Fix ULW component CLI direct subcommand dispatch#43
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb26359612
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { afterAll, beforeAll, describe, expect, it } from "vitest"; | ||
|
|
||
| const execFileAsync = promisify(execFile); | ||
| const repoRoot = resolve(import.meta.dirname, ".."); |
There was a problem hiding this comment.
Use a Node 20.0-compatible dirname fallback
On Node 20.0–20.10, which is still allowed by this package's engines: >=20.0.0 and the component AGENTS.md guidance, import.meta.dirname is not available, so this module throws during evaluation before the test can run. The existing tests use fileURLToPath(import.meta.url)/dirname(...); use that pattern here or raise the supported Node floor to a version that provides import.meta.dirname.
Useful? React with 👍 / 👎.
Problem Situation
omo ulw-loop status --jsoncan fail after the OMO wrapper strips theulw-loopprefix and invokes theomo-ulw-loopcomponent binary, because the component entrypoint rejects direct subcommands such asstatus.Reproduction Logs
RED:
npm test -- test/cli-entrypoint.test.tsfailed withAssertionError: expected '[omo] unknown command: status Usage:…' to contain '[ulw-loop] No ulw-loop plan found'.Approach
Keep the existing
ulw-loop <subcommand>andhook ...paths, but also dispatch known direct ULW subcommands toulwLoopCommand(argv). Add a regression test that buildsdist/cli.jsand invokesstatus --jsonthrough the component entrypoint.Why I Am Confident
The failing test reproduced the exact argv-shape bug before the fix; the same test passes after. Manual tmux QA ran direct
dist/cli.js create-goalsanddist/cli.js statuswith both commands exiting 0.Risks
Low. The change only affects known ULW subcommands at the component entrypoint;
hook ...,ulw-loop ..., and unknown-command behavior are preserved.User-Visible Behavior Changes
Users and wrapper scripts can invoke
omo ulw-loop status,omo ulw-loop create-goals, and other ULW subcommands without needing a duplicatedulw-loopargument.Verification
Fixes #42
This PR was debugged, implemented, and created with LazyCodex.
Tag: lazycodex-generated
Summary by cubic
Fix CLI dispatch so
omo ulw-loop <subcommand>works without repeatingulw-loop. Known ULW subcommands likestatusnow route directly via the component entrypoint.status,create-goals,complete-goals, etc.) directly toulwLoopCommand(argv).ulw-loop <subcommand>,hook ..., and unknown-command behavior.dist/cli.jsand verifiesstatus --jsonis handled as expected.Written for commit eb26359. Summary will update on new commits.