Repository navigation
[local-name-the-cli-flag-in-worker-read-command] Name the CLI flag in worker read-command validation errors - #848
Merged
danii1 merged 1 commit intoDec 4, 2026
Conversation
… the CLI flag in worker read-command validation errors
Contributor
Author
Artifacts & verificationRun: 1718 · Commit: Verification reportProduced by Show artifactAuto-review summaryProduced by Show artifact |
Contributor
Author
|
🤖 Auto-merge: merged (squash) at The merge-safety review judged it safe: Behavior-only change to CLI error message wording in dashboard-read-cli.ts (flag names instead of API param names, plus a --help hint). It touches no flags, config, auth, dependencies, CI or other always-human categories. It comes with new unit tests and updated e2e assertions that exercise the changed path. |
danii1
deleted the
feature/local-name-the-cli-flag-in-worker-read-command
branch
December 4, 2026 12:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Task local-name-the-cli-flag-in-worker-read-command: Name the CLI flag in worker read-command validation errors
devintern workerread commands printed the dashboard handler's 400 message as-is. Those messages name API query params (limit,taskKey,automationId), not the flags the user typed (--lines,--task-key,--automation). They also lacked the--helphint that argument-parse errors get. Nowworker logs --lines 3000prints❌ --lines must be between 1 and 1000plus the hint.What changed
packages/code/src/lib/worker/dashboard-read-cli.ts:runs,stats,prs,logs) now keeps its flag→param mapping as a named constant, exposed as an optionalflagParamsfield on the spec. The same constant still feedsqueryParams.flagNamedMessage(message, flagParams)rewrites a leading<param>to--<flag>. It leaves the message alone if the first word is not a mapped param, such asrun id must be an integer.runWorkerReadCommand, aninvalid_argumentsfailure now goes through that rewrite and adds the--helphint. The code and exit code 1 are unchanged.packages/code/tests/worker-dashboard-read-cli.test.ts: new tests for the four examples plusruns --limitandprs --state, a directflagNamedMessagetest (includingtaskKey→--task-keyandautomationId→--automation), and a check thathandleLogsstill returnslimit must be between 1 and 1000.packages/e2e/tests/local/worker-read-commands.test.ts: three assertions now expect--windowand--level.Scope
Included: the human stderr message and hint for 400s from read commands.
Excluded: API handlers and their messages, API response bodies, MCP read tools,
JSON_ERROR_KEYS, and any new validation.Tradeoffs
The rewrite only matches a message that starts with the param name. This covers every current message, but a future handler message that starts differently would stay unrewritten. That is safe, because the old text is shown. The mapping constants add a few lines. They avoid keeping a second reverse map that could drift.
Blast Radius
readWorkerDocumentis unchanged, so/api/*and thedevintern mcpread tools are unaffected. The rewrite only runs in therunWorkerReadCommandCLI output.limit must be…would now see--limit must be…. I found only the e2e assertions, which I updated.--jsonoutput for the list commands is unchanged. The--helphint now appears on stderr for these 400s in both text and--jsonmode. I only ranstats --jsonin the e2e, which asserts stderr withtoContain.Verification
bun run test tests/worker-dashboard-read-cli.test.tsinpackages/code: 24 pass.bun run test tests/mcp-server.test.tsinpackages/code: 14 pass.bun run testinpackages/code: 6524 pass, 7 skip, 0 fail.bun run format,bun run lintandbun run typecheckshowed no errors in the output I saw. I only looked at the tail of that output.worker-read-commands.test.tsfirst failed because it runs the builtdist, which was stale. Afterbun run buildinpackages/codeit passes.dashboard-access.test.tsanddashboard-inbox.test.tsinpackages/e2e/tests/localalso matched mymust be…grep, but I did not run them or check what they assert.🤖 Opened by DevIntern from local-name-the-cli-flag-in-worker-read-command