Skip to content

Add secrets list and rm to the CLI - #38

Open
dantheuber wants to merge 5 commits into
mainfrom
freight/feature-secrets-list-rm
Open

dantheuber wants to merge 5 commits into
mainfrom
freight/feature-secrets-list-rm

Conversation

@dantheuber

@dantheuber dantheuber commented Sep 21, 2026

Copy link
Copy Markdown
Member

This branch assembles the listed issues for review.

Issues in this consist

Closes #37

What & why

Completes the write-only millwright secrets command group by adding list and rm, mirroring the existing repo list / repo remove shape. Operators can now enumerate stored secret names and delete individual parameters from the CLI instead of going through SSM directly.

Changes

  • secrets list [--scope <scope>] [--all-scopes] — prints secret names only (sorted); values are never fetched or decrypted. --all-scopes walks the whole secrets/ prefix, printing <scope> <name> lines, and doesn't require an origin remote.
  • secrets rm <name> [--scope <scope>] — deletes one parameter, reports the removed path, and exits 1 via CommandError when nothing was deleted.
  • Shared pre-check (isSecretNameSegment) and scope resolution (defaulting from the cwd origin remote, same as secrets set) factored into helpers in secrets.ts; set keeps its promptSecret dependency while list/rm use the narrower SecretsScopeDeps.
  • New secretFromParameterName inverse in millwright-state's ssm-paths.ts, used by list to invert parameter names the same way repo list does. Recursive listing under secrets/acme/ is filtered to the exact scope so acme/api secrets don't leak into a listing of scope acme.
  • Docs updated: README secrets section, the "Secrets not resolving" troubleshooting step in docs/operations.md, and the CLI surface note in okf-bundle/interfaces/cli.md.

Review notes

  • Worth double-checking the --all-scopes prefix walk and the scope-filtering logic in secretFromParameterName against nested scope names.
  • Version bumped to 0.8.0 (minor) — new backward-compatible CLI functionality, no breaking changes.
  • Full test suite green: 108 files / 1136 tests passing; typecheck clean across all workspaces.

cb-jeeves and others added 4 commits September 21, 2026 01:03
Complete the write-only `millwright secrets` group with `list` and `rm`,
following the shape of `repo list` / `repo remove`.

- `secrets list [--scope <scope>] [--all-scopes]` prints secret names only,
  sorted; values are never fetched or printed (the listing never asks SSM to
  decrypt and ignores the returned ciphertext). `--all-scopes` walks the whole
  `secrets/` prefix and prints `<scope>  <name>` lines, and does not need an
  origin remote.
- `secrets rm <name> [--scope <scope>]` deletes one parameter, reports the
  path removed, and throws a CommandError (exit 1) when nothing was deleted.
- Both pre-check the name with `isSecretNameSegment` before discovery and
  default the scope from the cwd `origin` remote exactly like `secrets set`;
  the shared pre-check and scope resolution are factored into helpers in
  secrets.ts. `set` keeps its `promptSecret` dep; list/rm take the narrower
  `SecretsScopeDeps`.
- New `secretFromParameterName` inverse in millwright-state ssm-paths.ts so
  `list` inverts parameter names the same way `repo list` does; a recursive
  listing of `secrets/acme/` is filtered to the exact scope so `acme/api`
  secrets do not leak into a listing of scope `acme`.
- Docs: README secrets section, the "Secrets not resolving" step 1 in
  docs/operations.md now answers "is it written?" with `secrets list`, and
  the CLI surface note in okf-bundle/interfaces/cli.md.

Files: packages/millwright-cli/src/{secrets,cli,index}.ts,
packages/millwright-state/src/{ssm-paths,index}.ts, tests in
packages/millwright-cli/test/{secrets,cli}.test.ts and
packages/millwright-state/test/ssm-paths.test.ts.
@cb-jeeves
cb-jeeves marked this pull request as ready for review September 21, 2026 01:18
@cb-jeeves cb-jeeves added the Jeeves-Review Jeeves: request a skeptical review of this issue label Sep 21, 2026

@cb-jeeves cb-jeeves left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds secrets list and secrets rm on top of the existing secrets set, with a secretFromParameterName inverse in millwright-state to turn parameter names back into scope + name. The shape matches repo list / repo remove, the listing never asks SSM to decrypt, and rm fails with a useful message when nothing was deleted. This is close to mergeable; three suggestions below, none blocking.

The submit pass ran on claude-opus-5 after its primary model failed.

The correctness pass ran on claude-opus-5 after its primary model failed; maintainability pass ran on claude-opus-5 after its primary model failed; ux-dx pass ran on claude-opus-5 after its primary model failed.

Comment thread packages/millwright-cli/src/cli.ts Outdated
Comment thread packages/millwright-cli/test/secrets.test.ts
Comment thread packages/millwright-cli/src/secrets.ts Outdated
…tering

- secrets list: --all-scopes now conflicts with --scope instead of silently
  dropping it, so a stale --scope cannot widen the listing by accident
- alias SecretsListEntry to SecretParameterParts so the row type tracks the
  inverse in millwright-state
- add tests for the nested-scope case the scope filter exists for, and for
  the option conflict
@cb-jeeves

Copy link
Copy Markdown
Contributor

Responded to review round 1, pushed 64b35f9:

  • Addressed --all-scopes silently discarding --scope: the option is now declared with Option.conflicts('scope'), so the combined invocation fails with commander's conflict error. The suggested .conflicts() call is an Option method, not a Command one, so the fix uses addOption. Added a parse test for the rejection.
  • Addressed the untested scope filter: added tests storing acme/DEPLOY_KEY and acme/api/NPM_TOKEN, checking that scope: 'acme' returns only DEPLOY_KEY and that --all-scopes lists both under their own scopes.
  • Addressed the duplicated row type: SecretsListEntry is now an alias of SecretParameterParts from millwright-state; the CLI export name is unchanged.

npm run typecheck and npm test pass (1139 tests).

@cb-jeeves cb-jeeves left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three findings from round 1 are addressed in 64b35f9: --all-scopes now conflicts with --scope, the nested-scope filter has tests on both sides, and SecretsListEntry aliases SecretParameterParts.

The submit pass ran on claude-opus-5 after its primary model failed.

The correctness pass ran on claude-opus-5 after its primary model failed; maintainability pass ran on claude-opus-5 after its primary model failed; ux-dx pass ran on claude-opus-5 after its primary model failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Jeeves-Review Jeeves: request a skeptical review of this issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add secrets list and secrets rm to the CLI

2 participants