Skip to content

CLI: dataset release --version X.Y.Z reaches the release command - #1653

Closed
bruAristimunha wants to merge 1 commit into
nemarOrg:feature/issue-1671-epic-bru-upload-fixesfrom
bruAristimunha:fix/issue-1493-release-version-flag
Closed

bruAristimunha wants to merge 1 commit into
nemarOrg:feature/issue-1671-epic-bru-upload-fixesfrom
bruAristimunha:fix/issue-1493-release-version-flag

Conversation

@bruAristimunha

@bruAristimunha bruAristimunha commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

#1493: the root program's -v, --version (src/index.ts) is recognised anywhere on the command line, so nemar dataset release <id> --version 2.0.0, the form the release help documents, printed the CLI version and exited 0, and a scripted release (-y) silently did nothing. The = form already worked.

Change

  • bindShadowedOptionValues(program, argv) runs before parseAsync. For the subcommand named on the line, a value-taking option whose flag an ancestor also declares is joined to its value (--version 2.0.0 → --version=2.0.0).
  • Left unchanged: global flags anywhere (no enablePositionalOptions), a bare --version, values that start with -, anything after --, and boolean collisions such as -v/--verbose (Subcommand -v/--verbose shadowed by root -v (version) and global --verbose #1220 stays open).

Closes #1493

Testing

  • test/release-version-flag.test.ts (new, 6 tests), including an entry-point test that runs the real CLI: on main it prints the CLI version and exits 0; on this branch it reaches the release command.

  • Files that import the changed modules (src/index.ts pulls in most of the CLI), on current dev: CLI 18 files, 751 pass, 19 skip, 1 fail; backend 25 files, 1027 pass, 0 fail. The one failure is neurobagel-node-deploy.unit.test.ts "the symlink swap is one rename" (10 s timeout on this laptop); this branch does not touch that file and it fails the same way on main.

  • bun run typecheck, biome check on the changed files.

  • CI api-test and integration-dev fail on this PR because it comes from a fork: both call the dev API with the TEST_*_API_KEY secrets, which GitHub does not pass to fork pull requests, so the authenticated cases fail and the unauthenticated ones pass. lint, unit-pure and e2e-sandbox run normally.

The root program's '-v, --version' is recognised anywhere on the command
line, so 'nemar dataset release <id> --version 2.0.0' -- the form the
release help documents -- printed the CLI version and exited 0, and a
scripted release (-y) silently did nothing. The '=' form already worked
because the root option is boolean.

Before parsing, bindShadowedOptionValues joins a value-taking option of the
addressed subcommand to its value when an ancestor command declares the
same flag ('--version 2.0.0' -> '--version=2.0.0'). Global flags keep
working anywhere (no enablePositionalOptions); a bare '--version', values
that look like flags, anything after '--', and boolean collisions (nemarOrg#1220)
are left alone.
@neuromechanist
neuromechanist changed the base branch from dev to feature/issue-1671-epic-bru-upload-fixes October 7, 2026 22:06
@neuromechanist

Copy link
Copy Markdown
Contributor

Thank you for this fix, and for the entry-point test that ran the real CLI. It is merged into the integration branch for epic #1671 as PR #1673, with your commit kept (4a647d0 on that branch, authored by you). The review added commits on top, so this PR is closed in favor of that one.

What the review added: a shadowed option given with no value, or an empty one, is now a usage error instead of the root printing the CLI version (and an empty --version "" no longer falls back to --type or a prompt in the release handler); a shadowed flag typed before the subcommand is a usage error; help wins over a missing value; the regression test now runs in the unit tier and builds the real command tree with an invariant over every command; and admin recover is left untouched.

The epic merges into dev as a unit once 0.10.15 has shipped. The full review record is on #1673.

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.

2 participants