Skip to content

refactor: adds a left rail for the command preview in runfile#44

Merged
nxtcoder17 merged 2 commits intomasterfrom
fix/ci
May 4, 2026
Merged

refactor: adds a left rail for the command preview in runfile#44
nxtcoder17 merged 2 commits intomasterfrom
fix/ci

Conversation

@nxtcoder17
Copy link
Copy Markdown
Owner

@nxtcoder17 nxtcoder17 commented May 4, 2026

Summary by Sourcery

Update build and release workflows to use Nix-based builds and versioned multi-arch binaries, and add a left-rail visual treatment to command previews in the runfile UI.

Enhancements:

  • Update Runfile tasks to produce versioned, architecture-specific binaries, add a dev build task with file watching, and refine command preview formatting with a styled left rail in the UI.

Build:

  • Adjust GitHub release workflow to integrate the nixy action and build versioned multi-arch Go binaries without the previous Cachix setup.

Chores:

  • Introduce nixy build configuration for runfile with defined build outputs and comment out shell initialization hooks.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 4, 2026

Reviewer's Guide

Refactors how binaries are built and versioned via Runfile and nixy integration, adjusts the GitHub release workflow to use a nixy-based build path and consistent versioning, and updates the runfile command preview to render with a left-side rail for multi-line commands.

Sequence diagram for updated command preview rendering with left rail

sequenceDiagram
  actor User
  participant RunfileCLI
  participant TaskResolver
  participant LogWriter
  participant printCommand
  participant formatCommandPreview
  participant Lipgloss

  User->>RunfileCLI: run task
  RunfileCLI->>TaskResolver: resolve and execute task
  TaskResolver->>printCommand: printCommand(writer, prefix, lang, cmd)
  printCommand->>LogWriter: prepare highlighted cmd
  printCommand->>formatCommandPreview: formatCommandPreview(hlCmd, prefix)
  formatCommandPreview->>formatCommandPreview: split cmd into lines
  formatCommandPreview->>formatCommandPreview: compute indent from prefixDisplayWidth
  formatCommandPreview->>Lipgloss: NewStyle Foreground Faint Render(rail_symbol)
  Lipgloss-->>formatCommandPreview: colored_rail
  formatCommandPreview->>formatCommandPreview: prepend prefix and rail to first line
  formatCommandPreview->>formatCommandPreview: prepend indent and rail to other lines
  formatCommandPreview-->>printCommand: formatted_multiline_preview
  printCommand->>LogWriter: write preview with left rail
  LogWriter-->>User: display multi_line preview with left side rail
Loading

File-Level Changes

Change Details Files
Refactor GitHub release workflow to use nixy action and consistent GOOS/GOARCH/version handling for multi-arch builds.
  • Add nxtcoder17/nixy GitHub Action to the release workflow and comment out the previous nix/nix-cachix setup.
  • Introduce a VERSION environment variable combining metadata version and commit slug for builds.
  • Normalize the GOOS/GOARCH build loop, including clearer logging and simplified go build invocations with consistent output naming and ldflags.
.github/workflows/release.yml
Introduce nixy configuration for building the runfile binary across platforms and wiring it into the build pipeline.
  • Define a nixy builds.runfile command that echoes VERSION and runs the Runfile build task for multiple GOOS/GOARCH combinations.
  • Declare explicit output paths for each platform-specific binary produced by the nixy build.
  • Comment out previous onShellEnter shell environment configuration that manipulated PATH and profile sourcing.
nixy.yml
Restructure Runfile tasks to support parameterized builds, version injection, and a dev/watch flow based on the main build task.
  • Extend the build task to derive GOOS/GOARCH via go env and require a version parameter, using it in ldflags to set main.Version and naming the output binary with GOOS/GOARCH suffix.
  • Refactor build:dev to become a watch-enabled wrapper around the build task, setting version=nightly instead of duplicating the build command.
  • Keep other tasks (e.g., example) unchanged, maintaining compatibility.
Runfile.yml
Update command preview formatting to add a visually distinct left rail for multi-line commands.
  • Rename padString to formatCommandPreview and update printCommand to use it for rendering the preview.
  • Compute an indented rail string using lipgloss styling and inject it between the prefix and the command text for the first line and all subsequent lines.
  • Ensure multi-line command previews align with the prefix width while rendering a faint colored rail character for readability.
pkg/runfile/resolver/task.go

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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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

@nxtcoder17 nxtcoder17 merged commit d4dccef into master May 4, 2026
2 checks passed
Copy link
Copy Markdown

@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 - I've found 2 issues, and left some high level feedback:

  • In Runfile.yml the build task defines an env var version but the shell command uses $VERSION, and the GitHub Action calls run build ... version=$VERSION, so the case mismatch likely means $VERSION is unset at build time; consider standardizing on a single env var name and case across the Runfile and workflow.
  • In formatCommandPreview, a new lipgloss style is created on every call; you could define the rail style once (e.g., as a package-level variable) to avoid repeated allocations in hot paths.
  • The workflow now uses nxtcoder17/nixy@feat/github-action, which is a feature branch ref; consider pinning this to a stable tag or commit SHA to avoid unexpected changes in the release pipeline.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `Runfile.yml` the `build` task defines an env var `version` but the shell command uses `$VERSION`, and the GitHub Action calls `run build ... version=$VERSION`, so the case mismatch likely means `$VERSION` is unset at build time; consider standardizing on a single env var name and case across the Runfile and workflow.
- In `formatCommandPreview`, a new `lipgloss` style is created on every call; you could define the rail style once (e.g., as a package-level variable) to avoid repeated allocations in hot paths.
- The workflow now uses `nxtcoder17/nixy@feat/github-action`, which is a feature branch ref; consider pinning this to a stable tag or commit SHA to avoid unexpected changes in the release pipeline.

## Individual Comments

### Comment 1
<location path="Runfile.yml" line_range="14-23" />
<code_context>
-              binary=bin/run-$GOOS-$GOARCH
-              time go build -o $binary -ldflags="-s -w -X main.Version=${{ steps.meta.outputs.version }}-${{steps.meta.outputs.short_sha}}" -tags urfave_cli_no_docs ./cmd/run
+              echo "🚧 building binary for os=$GOOS arch=$GOARCH"
+              go build -o bin/run-${GOOS}-${GOARCH} -ldflags="-s -w -X main.Version=$VERSION" -tags urfave_cli_no_docs ./cmd/run
             done
           done
</code_context>
<issue_to_address>
**issue (bug_risk):** Mismatch between `version` env key and use of `$VERSION` in the build command likely results in an empty version string.

`version` is defined in the task env (lowercase), but the `go build` command uses `$VERSION` (uppercase). Unless something else exports `VERSION`, `main.Version` will be empty.

To align them, either:
- Use `$version` in the `-ldflags` and rely on Runfile env injection, or
- Rename the env key to `VERSION` and keep using `$VERSION`.

The same issue applies to `build:dev`, where `version: "nightly"` is set but `$VERSION` is referenced, so the nightly marker may never be applied.
</issue_to_address>

### Comment 2
<location path="nixy.yml" line_range="12-17" />
<code_context>
+builds:
+  runfile:
+    command: |+
+      echo "VERSION: $VERSION"

-onShellEnter: |+
-  export PATH="/workspace/bin:$PATH"
-  source $HOME/.profile
+      run build GOOS=linux GOARCH=amd64 version=$VERSION
+      run build GOOS=linux GOARCH=arm64 version=$VERSION
+      run build GOOS=darwin GOARCH=amd64 version=$VERSION
+      run build GOOS=darwin GOARCH=arm64 version=$VERSION
+
+    paths:
</code_context>
<issue_to_address>
**issue (bug_risk):** VERSION env usage here may not be wired correctly into the Runfile `build` task.

The `build` task defines `version` as an env key but still uses `$VERSION` in `go build`. Unless something else exports `VERSION` and maps `version``VERSION`, the value from `nixy.yml` may never reach `main.Version`. After aligning on either `version` or `VERSION` in `Runfile.yml`, please verify that the pipeline still passes the correct value through and that `main.Version` matches what `nixy` and CI set.
</issue_to_address>

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.

Comment thread Runfile.yml
Comment on lines +14 to +23
go build -o bin/run-${GOOS}-${GOARCH} -ldflags="-s -w -X main.Version=$VERSION" -tags urfave_cli_no_docs ./cmd/run
echo "DONE"

build:dev:
watch:
enabled: true
dirs:
- .
cmd:
- |+
echo "building ..."
go build -o bin/run-nightly -ldflags="-s -w" -tags urfave_cli_no_docs ./cmd/run
echo "DONE"
- run: build
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Mismatch between version env key and use of $VERSION in the build command likely results in an empty version string.

version is defined in the task env (lowercase), but the go build command uses $VERSION (uppercase). Unless something else exports VERSION, main.Version will be empty.

To align them, either:

  • Use $version in the -ldflags and rely on Runfile env injection, or
  • Rename the env key to VERSION and keep using $VERSION.

The same issue applies to build:dev, where version: "nightly" is set but $VERSION is referenced, so the nightly marker may never be applied.

Comment thread nixy.yml
Comment on lines +12 to +17
echo "VERSION: $VERSION"

onShellEnter: |+
export PATH="/workspace/bin:$PATH"
source $HOME/.profile
run build GOOS=linux GOARCH=amd64 version=$VERSION
run build GOOS=linux GOARCH=arm64 version=$VERSION
run build GOOS=darwin GOARCH=amd64 version=$VERSION
run build GOOS=darwin GOARCH=arm64 version=$VERSION
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): VERSION env usage here may not be wired correctly into the Runfile build task.

The build task defines version as an env key but still uses $VERSION in go build. Unless something else exports VERSION and maps versionVERSION, the value from nixy.yml may never reach main.Version. After aligning on either version or VERSION in Runfile.yml, please verify that the pipeline still passes the correct value through and that main.Version matches what nixy and CI set.

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