[codex] add Go module entrypoint#45
Conversation
Zero automated PR reviewVerdict: No blockers found Blockers
Validation
ScopeHead: This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR adds a Go module and CLI: a new ChangesGo CLI Module with Help and Version Support
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
internal/cli/app_test.go (1)
26-50: ⚡ Quick winAdd explicit coverage for the no-args help path (and optionally short flags).
Run([]string{})is a distinct branch and should be locked down in tests alongside the existing--help/--versioncases.Proposed test addition
func TestRunPrintsHelp(t *testing.T) { @@ } +func TestRunWithNoArgsPrintsHelp(t *testing.T) { + var stdout bytes.Buffer + var stderr bytes.Buffer + + exitCode := Run([]string{}, &stdout, &stderr) + if exitCode != 0 { + t.Fatalf("expected exit code 0, got %d", exitCode) + } + if output := stdout.String(); !strings.Contains(output, "Usage:") { + t.Fatalf("expected help output, got %q", output) + } + if stderr.Len() != 0 { + t.Fatalf("expected empty stderr, got %q", stderr.String()) + } +} + func TestRunRejectsUnknownCommand(t *testing.T) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/cli/app_test.go` around lines 26 - 50, Add a test covering the no-args help branch by calling Run([]string{}) (and optionally short flags like "-h" and "-v") and asserting the same expectations as TestRunPrintsHelp: exit code 0, stdout contains the help strings ("ZERO terminal coding agent", "Usage:", "zero [command]", "--version"), and stderr is empty; implement this either as a new TestRunNoArgsPrintsHelp or as subtests inside TestRunPrintsHelp and reuse the same assertions against Run to lock down the distinct branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Line 31: Replace the mutable GitHub Action reference "actions/setup-go@v5"
with the pinned commit SHA
"actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff" in the CI workflow;
update the single line containing uses: actions/setup-go@v5 (and any other
occurrences of that tag) so the workflow uses the fixed commit SHA for
supply-chain integrity.
In `@internal/cli/app.go`:
- Around line 23-27: The CLI currently ignores errors returned by
fmt.Fprintf/Fprintln in Run and printHelp, so update the Run and printHelp
functions to check each fmt.* call's (n, err) result and handle non-nil err by
returning an error (or non-zero exit) to the caller; specifically modify the
occurrences in Run (the version/default/unknown command branches that call
fmt.Fprintf to stdout/stderr) and the printHelp function (all
fmt.Fprintln/Fprint calls) to capture the error and immediately return it (or an
appropriate exit code) instead of discarding it so write failures are
propagated.
---
Nitpick comments:
In `@internal/cli/app_test.go`:
- Around line 26-50: Add a test covering the no-args help branch by calling
Run([]string{}) (and optionally short flags like "-h" and "-v") and asserting
the same expectations as TestRunPrintsHelp: exit code 0, stdout contains the
help strings ("ZERO terminal coding agent", "Usage:", "zero [command]",
"--version"), and stderr is empty; implement this either as a new
TestRunNoArgsPrintsHelp or as subtests inside TestRunPrintsHelp and reuse the
same assertions against Run to lock down the distinct branch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: bd6b73a5-05b2-4b87-910e-f0968042d4c1
📒 Files selected for processing (6)
.github/workflows/ci.yml.gitignorecmd/zero/main.gogo.modinternal/cli/app.gointernal/cli/app_test.go
gnanam1990
left a comment
There was a problem hiding this comment.
Thanks for the Go M0 entrypoint slice. The shape is good and I validated the important paths locally: go test ./..., go build ./cmd/zero, and git diff --check origin/main...HEAD all pass; GitHub checks are also green across macOS, Ubuntu, Windows, Performance Smoke, CodeRabbit, and Zero Review.
Requesting a small changes pass before approval:
internal/cli/app.go:Run/printHelpignorefmt.*write errors. Since the CLI accepts injected writers, failed stdout/stderr writes can still return success, especially for help/version paths. Please makeprintHelpreturn an error and map write failures to a non-zero exit..github/workflows/ci.yml:actions/setup-go@v5should be pinned or otherwise aligned with repo supply-chain policy now that this PR introduces the Go action.internal/cli/app_test.go: add explicit coverage for the no-args help branch withRun([]string{}); it is distinct from the--helpbranch and should stay locked down.
No larger blocker found beyond these small review items.
gnanam1990
left a comment
There was a problem hiding this comment.
Rereviewed the updated head 7aee97f. The requested changes are addressed:
- CLI write errors now return a non-zero exit.
- No-args, short-help, and write-failure branches are covered in tests.
actions/setup-gois pinned in CI.
Validated locally with go test ./..., go build ./cmd/zero, git diff --check origin/main...HEAD, bun run test after frozen install, bun run typecheck, bun run build, and bun run smoke:build. GitHub checks are green across macOS, Ubuntu, Windows, Performance Smoke, CodeRabbit, and Zero Review.
Approved.
Summary
cmd/zeroas the entrypoint.--help,--version, and unknown-command handling.go test ./...andgo build ./cmd/zeroacross the existing OS matrix..gitignoreso only root build artifacts/zeroand/zero.exeare ignored, allowingcmd/zeroto be tracked.Why
This starts the Go M0 foundation from the merged PRD direction without rewriting the current TypeScript/Bun app. The slice gives Anandan/Gnanam/Vasanth a concrete Go baseline to build on.
Validation
Local:
git diff --cached --checkpassed before commit.bun run typecheckpassed.bun test ./tests --timeout 15000passed: 277 tests.bun run buildpassed.bun run smoke:buildpassed.Blocked locally:
go test ./...andgo build ./cmd/zerocould not run becausegois not installed on this Windows machine.CI:
actions/setup-goand runs the Go validation commands on Ubuntu, macOS, and Windows.Summary by CodeRabbit
zerocommand-line tool with help (--help,-h) and version (--version,-v) output and proper unknown-command exit codes