refactor: adds a left rail for the command preview in runfile#44
refactor: adds a left rail for the command preview in runfile#44nxtcoder17 merged 2 commits intomasterfrom
Conversation
Reviewer's GuideRefactors 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 railsequenceDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- In
Runfile.ymlthebuildtask defines an env varversionbut the shell command uses$VERSION, and the GitHub Action callsrun build ... version=$VERSION, so the case mismatch likely means$VERSIONis unset at build time; consider standardizing on a single env var name and case across the Runfile and workflow. - In
formatCommandPreview, a newlipglossstyle 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| 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 |
There was a problem hiding this comment.
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
$versionin the-ldflagsand rely on Runfile env injection, or - Rename the env key to
VERSIONand 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.
| 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 |
There was a problem hiding this comment.
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.
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:
Build:
Chores: