feat(cli): address team vaults as <project> <env> (#109)

`teams push|pull|grant` took a single `<vault>` name, so a team holding
more than one project had to encode both halves by hand and hope
everyone spelled it the same way. They now take `<project> <env>` and
join them into the `project/env` vault name.

The split lives entirely in the CLI — vaultName()/splitVaultName() are
the only things that know about it, and the server still stores one
opaque vault name — so there's no migration. Both halves reject a "/"
so the join stays unambiguous and the split is a true inverse.

`teams vaults` now breaks the name back into project/env columns,
falling back to the raw name for vaults created before the convention.
Those legacy vaults are no longer addressable (their names don't
contain a slash), so resolveVaultId() lists what the team actually has
instead of just saying "not found" — better than silently retargeting a
push, which in a secrets tool would write to the wrong vault.

Note push/pull carry two different "env"s: the `<env>` positional is
the environment half of the address, `--env` is the local .env path.
Verified commander keeps them separate.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-07-30 11:39:22 -07:00 • committed by GitHub
parent 7c9796ae51
commit ca182bc057
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 130 additions and 23 deletions

View file

@ -601,29 +601,32 @@ teams
teams
.command("grant")
.argument("<slug>", "Team slug")
.argument("<vault>", "Vault name")
.argument("<project>", "Project name")
.argument("<env>", "Environment name (prod, staging, …)")
.argument("<email>", "Teammate email to grant vault access")
.option("--format <format>", "table, json, or markdown", "table")
.description("Grant a member decryption access to a vault (re-wraps the vault key to their key).")
.action((slug, vault, email, options) => teamsGrantAction(slug, vault, email, options.format as OutputFormat));
.action((slug, project, env, email, options) => teamsGrantAction(slug, project, env, email, options.format as OutputFormat));
teams
.command("push")
.argument("<slug>", "Team slug")
.argument("<vault>", "Vault name")
.argument("<project>", "Project name")
.argument("<env>", "Environment name (prod, staging, …)")
.option("--env <path>", "Source .env file", ".env")
.option("--format <format>", "table, json, or markdown", "table")
.description("Encrypt and push a local .env into a team vault.")
.action((slug, vault, options) => teamsPushAction(slug, vault, { env: options.env, format: options.format as OutputFormat }));
.description("Encrypt and push a local .env into a team vault (<project>/<env>).")
.action((slug, project, env, options) => teamsPushAction(slug, project, env, { env: options.env, format: options.format as OutputFormat }));
teams
.command("pull")
.argument("<slug>", "Team slug")
.argument("<vault>", "Vault name")
.argument("<project>", "Project name")
.argument("<env>", "Environment name (prod, staging, …)")
.option("--env <path>", "Destination .env file", ".env")
.option("--format <format>", "table, json, or markdown", "table")
.description("Pull a team vault and decrypt it into a local .env.")
.action((slug, vault, options) => teamsPullAction(slug, vault, { env: options.env, format: options.format as OutputFormat }));
.description("Pull a team vault (<project>/<env>) and decrypt it into a local .env.")
.action((slug, project, env, options) => teamsPullAction(slug, project, env, { env: options.env, format: options.format as OutputFormat }));
const accounts = program.command("accounts").description("Manage connected social and email accounts.");