Skip to content

Conversation

@nxtcoder17
Copy link
Owner

@nxtcoder17 nxtcoder17 commented Oct 6, 2024

closes #4

Summary by Sourcery

Refactor the task execution system to support parallel execution, watch mode, and modular task definitions. Enhance error handling and logging, and update the build and CI configurations to support new features. Improve documentation and add tests to ensure reliability.

New Features:

  • Introduce support for running tasks in parallel and in different working directories.
  • Add the ability to run tasks with watch mode and validate environment variables with default values.
  • Implement a new logging system using the slog package for enhanced logging capabilities.
  • Add support for including one runfile into another, allowing for modular task definitions.

Bug Fixes:

  • Fix error handling for task not found and command execution failures by introducing a structured error message system.

Enhancements:

  • Refactor the task execution logic to use a more modular and extensible approach with the introduction of new types and functions.
  • Improve environment variable handling by supporting dotenv files and dynamic environment variables through shell execution.

Build:

  • Update the go.mod file to include new dependencies such as godotenv and slim-sprig for enhanced functionality.

CI:

  • Add a new GitHub Actions workflow for building and releasing binaries for different platforms and architectures.

Documentation:

  • Update the README to reflect new features such as running tasks in parallel and with watch mode.
  • Add new documentation files to explain the requirements for a run target and the includes feature.

Tests:

  • Add comprehensive tests for the task parser and dotenv file parsing to ensure robustness and correctness.

@nxtcoder17 nxtcoder17 self-assigned this Oct 6, 2024
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 6, 2024

Reviewer's Guide by Sourcery

This pull request implements significant changes to the runfile package, including improved error handling, task parsing, and execution. It also adds support for includes, requirements, and environment variable handling. The changes aim to enhance the functionality and flexibility of the runfile system.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Refactored and enhanced the runfile package
  • Implemented a new Context type for better context handling
  • Added support for task requirements and preconditions
  • Improved environment variable handling and validation
  • Implemented support for including other runfiles
  • Enhanced error handling with custom error types
  • Added support for parallel task execution
pkg/runfile/run.go
pkg/runfile/parser.go
pkg/runfile/task-parser.go
pkg/runfile/context.go
pkg/runfile/runfile.go
pkg/runfile/task.go
pkg/runfile/errors/message.go
pkg/runfile/errors/known-errors.go
Updated main command implementation
  • Added support for parallel and watch mode execution
  • Implemented debug mode and improved logging
  • Enhanced runfile locating logic
cmd/run/main.go
Added new utility packages
  • Implemented a custom logging package
  • Added helper functions for common operations
pkg/logging/logger.go
pkg/functions/helpers.go
pkg/functions/maps.go
Added GitHub Actions workflow for releases
  • Implemented multi-platform binary building
  • Added steps for creating GitHub releases
.github/workflows/release.yml
Updated project configuration and documentation
  • Updated go.mod with new dependencies
  • Added example Runfile
  • Created documentation for new features
go.mod
examples/Runfile.yml
docs/requirements-for-a-run-target.md
docs/includes.md
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nxtcoder17 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider simplifying the task parsing logic to improve maintainability. The current implementation in task-parser.go is quite complex and may be difficult to extend in the future.
  • Enhance test coverage, particularly for the new features like parallel execution and watch mode. This will help ensure reliability as the project grows.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟡 Documentation: 1 issue found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Repository owner deleted a comment from sourcery-ai bot Oct 6, 2024
Repository owner deleted a comment from sourcery-ai bot Oct 6, 2024
Repository owner deleted a comment from sourcery-ai bot Oct 6, 2024
Repository owner deleted a comment from sourcery-ai bot Oct 6, 2024
Repository owner deleted a comment from sourcery-ai bot Oct 6, 2024
@nxtcoder17 nxtcoder17 merged commit 06b1e4a into master Oct 6, 2024
@nxtcoder17 nxtcoder17 deleted the fix/error-messages branch October 6, 2024 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant