carlos / platform Public

cli: secrets for scripts: services --json, secrets set KEY - (#1056)

carlos services create and rotate take --json: stdout carries one JSON
object with the secret and nothing else; account resolution and write
failures go to stderr (a failed write exits non-zero and says to
rotate). carlos secrets set --app A KEY - reads the value from stdin
(refused on a terminal, capped at 64 KiB, one trailing newline
dropped), so it never appears in argv. secrets set refuses a value that
starts with its own key and = unless --literal. CI binary ceiling
raised to 70 MB (Paul). Astra R1 NOT READY, R2 READY, census approved;
copy by Luna.

Squashed from services-secret-scripts-1056 into main.
claude agent, operated by paul@keymail.dev ada520b6d27d1ac96c4131c97c895fc88f6d6975 parent ac9ee36
16 files changed, +967 −31
  • .amadan/ci.d/20-cross@5 +8 −2
  • appconfig_cli.go +113 −4
  • docs/site/cli.md +23 −0
  • docs/superpowers/notes/census-proposal-services-secret-scripts-1056.md +15 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-FIXES.md +10 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md +50 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R2.md +22 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056-FIXES.md +3 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056-R2.md +20 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056.md +16 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-services-secret-scripts-1056.tsv +6 −0
  • secrets_stdin_test.go +293 −0
  • services.go +113 −7
  • services_json_test.go +256 −0
  • testdata/clireg-golden.jsonl +18 −18

CI failed — run details

diff --git a/.amadan/ci.d/20-cross@5 b/.amadan/ci.d/20-cross@5
index b40d06de7..a9729511c 100755
--- a/.amadan/ci.d/20-cross@5
+++ b/.amadan/ci.d/20-cross@5
@@ -77,7 +77,13 @@ GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build ./...
# was 52,887,714 bytes, 112 KB under 53 MB, after ordinary growth with no SDK
# client in an interface. The ceiling is a tripwire for #275-style accidents,
# not a size budget: 64 MB leaves about 11 MB for ordinary growth and still
-# fails a repeat of #275 (about 14 MB on top of today's size). It is a
+# fails a repeat of #275 (about 14 MB on top of today's size). Raised to
+# 70 MB on 2026-11-14 (Paul, #1056): main was 63,897,762 bytes, 102 KB under
+# 64 MB, after ordinary growth since 10-27; the -dumpdep check found no SDK
+# client in an interface beyond the inherent S3, STS and the SDK's own
+# sign-in clients. Section alignment moves the size in 64 KiB steps, so a
+# 5 KB change crossed the line. 70 MB leaves about 6 MB and still fails a
+# repeat of #275. It is a
# ceiling and not an equality on purpose. If you are here because it fired, look for an SDK client stored in
# an interface, which html/template's method retention then drags in whole:
#
@@ -89,7 +95,7 @@ GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build ./...
# and STS stay whole whatever this repo does. Raise the number only for
# growth you meant, and say why in the commit.
if [ "$GOOS/$GOARCH" = "linux/arm64" ]; then
- max_bytes=64000000
+ max_bytes=70000000
size_dir=$(mktemp -d)
trap 'rm -rf "$size_dir"' EXIT
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-s -w" -o "$size_dir/carlos" .
diff --git a/appconfig_cli.go b/appconfig_cli.go
index 21339db3d..3719241ad 100644
--- a/appconfig_cli.go
+++ b/appconfig_cli.go
@@ -23,6 +23,7 @@ import (
"github.com/carlosframework/platform/internal/moves"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
+ "github.com/mattn/go-isatty"
)
// restartAnswer is what one config write can be said to have left behind
@@ -413,13 +414,66 @@ func unsetVars(ctx context.Context, s release.Store, acct, app, environment stri
}
// parseKV turns ["KEY=value", "KEY2=value2"] into a map, refusing anything
-// without an "=" or with an empty key. Shared by `env set` and `secrets set`.
+// without an "=" or with an empty key. `env set`'s parser; `secrets set`
+// adds its stdin form and its variable-name refusal (parseSecretsArgs). An
+// env value like FILTER=FILTER=active is plausible, so env set keeps it.
func parseKV(args []string) (map[string]string, error) {
+ return parseSecretsArgs(args, nil, false)
+}
+
+// secretsStdin is where `secrets set KEY -` reads its value, and whether
+// that is a terminal. A var so tests can stand a pipe in.
+var secretsStdin = func() (io.Reader, bool) {
+ return os.Stdin, stdinTerminal(os.Stdin.Fd(), isatty.IsTerminal, isatty.IsCygwinTerminal)
+}
+
+// stdinTerminal is go-isatty's answer, as `domains buy` uses, rather than
+// color.go's char-device test: /dev/null is a char device, and a script
+// running with stdin from it should get the empty-value refusal, not be
+// told it is at a terminal. A Cygwin or MSYS2 terminal on Windows is a
+// pipe to the console check, so it is asked separately (#1056 review R1):
+// reading there would sit waiting and echo a typed secret.
+func stdinTerminal(fd uintptr, console, cygwin func(uintptr) bool) bool {
+ return console(fd) || cygwin(fd)
+}
+
+// secretsStdinMaxBytes caps what `secrets set KEY -` reads. No per-value
+// limit exists for config values; the console takes 256 KiB per request
+// (configPutMaxBytes) and sealing grows a value by about 4/3, so 64 KiB of
+// plaintext is a generous single secret that still fits. Read as N+1 bytes
+// so a wrong file or an unending producer costs bounded memory.
+const secretsStdinMaxBytes = 64 << 10
+
+// parseSecretsArgs is parseKV plus `secrets set`'s stdin form (#1056): a
+// key followed by a lone "-" takes its value from stdin, read to EOF with
+// exactly one trailing newline (\n or \r\n) taken off, so the value never
+// sits in argv where a process list on a shared box shows it. Two separate
+// arguments, so it cannot collide with a real value: "KEY=-" still sets
+// "-". One such key per invocation, stdin read only after every argument
+// parsed, and never when stdin is a terminal, where nobody would know the
+// blinking cursor wants a secret. More than secretsStdinMaxBytes is refused
+// unread past the cap. stdin nil (env set) leaves the form unrecognised,
+// which is parseKV's old not-a-pair refusal. refuseNamed turns on
+// checkValueNotNamed for every value; `secrets set --literal` turns it off.
+//
+// An empty value is returned as such: checkNoEmptyValues refuses it with
+// the same words an empty KEY= gets.
+func parseSecretsArgs(args []string, stdin func() (io.Reader, bool), refuseNamed bool) (map[string]string, error) {
if len(args) == 0 {
return nil, fmt.Errorf("at least one KEY=value pair is required")
}
out := map[string]string{}
- for i, a := range args {
+ stdinKey := ""
+ for i := 0; i < len(args); i++ {
+ a := args[i]
+ if stdin != nil && a != "" && a != "-" && !strings.Contains(a, "=") && i+1 < len(args) && args[i+1] == "-" {
+ if stdinKey != "" {
+ return nil, fmt.Errorf(secretsCopyStdinTwice, stdinKey, a)
+ }
+ stdinKey = a
+ i++
+ continue
+ }
k, v, ok := strings.Cut(a, "=")
if !ok || k == "" {
// Named by position, never echoed: a mistyped `secrets set`
@@ -427,11 +481,64 @@ func parseKV(args []string) (map[string]string, error) {
// shell scrollback.
return nil, fmt.Errorf("argument %d is not a KEY=value pair", i+1)
}
+ if refuseNamed {
+ if err := checkValueNotNamed(k, v); err != nil {
+ return nil, err
+ }
+ }
out[k] = v
}
+ if stdinKey == "" {
+ return out, nil
+ }
+ r, terminal := stdin()
+ if terminal {
+ return nil, fmt.Errorf(secretsCopyStdinTerminal, stdinKey, stdinKey)
+ }
+ b, err := io.ReadAll(io.LimitReader(r, secretsStdinMaxBytes+1))
+ if err != nil {
+ // The read's own error, never what was read before it failed.
+ return nil, fmt.Errorf("%s: reading the value from stdin: %v", stdinKey, err)
+ }
+ if len(b) > secretsStdinMaxBytes {
+ return nil, fmt.Errorf(secretsCopyStdinTooLarge, stdinKey)
+ }
+ v := string(b)
+ if strings.HasSuffix(v, "\r\n") {
+ v = v[:len(v)-2]
+ } else if strings.HasSuffix(v, "\n") {
+ v = v[:len(v)-1]
+ }
+ if refuseNamed {
+ if err := checkValueNotNamed(stdinKey, v); err != nil {
+ return nil, err
+ }
+ }
+ out[stdinKey] = v
return out, nil
}
+// checkValueNotNamed refuses a value that starts with its own key and "=":
+// CARLOS_SERVICE_TOKEN=CARLOS_SERVICE_TOKEN=<secret> is the variable's whole
+// line pasted in as its value (#1056), and the app's every call then
+// answers 401 with nothing to say why. The key is named, the value never.
+func checkValueNotNamed(k, v string) error {
+ if strings.HasPrefix(v, k+"=") {
+ return fmt.Errorf(secretsCopyNamedValue, k, k)
+ }
+ return nil
+}
+
+// The words of #1056's refusals. The verb's own "secrets set:" prefix is
+// added at the call site. The first three passed Luna's copy pass; the
+// --literal clause and the size refusal (review R1) have not yet.
+const (
+ secretsCopyNamedValue = "%s: the value starts with %s=, so it includes the variable name: nothing stored. Give the value on its own, or add --literal if it really starts that way."
+ secretsCopyStdinTerminal = "%s: stdin is a terminal, so there is no value to read. Pipe the value in: ... | carlos secrets set --app <app> %s -"
+ secretsCopyStdinTwice = "%s and %s both read stdin: only one key can take its value from stdin."
+ secretsCopyStdinTooLarge = "%s: the input on stdin is larger than 64 KiB: nothing stored."
+)
+
func runEnvSet(args []string) {
fs := flag.NewFlagSet("env set", flag.ExitOnError)
messageFlags := addMutationMessageFlags(fs)
@@ -858,6 +965,7 @@ const secretsUsage = `usage: carlos secrets <command>
commands:
set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets
+ --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin
unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets
list --app <a> [--environment <name>] list a secret's key names only — never values
genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair
@@ -1009,11 +1117,12 @@ func runSecretsSet(args []string) {
environment := environmentFlag(fs, "named environment bundle to set in (omit for the default bundle)")
acctRaw, acctIDRaw, regPath, acctOf := accountFlagsWithRegistry(fs)
consoleFlag := consoleOption(fs, "console origin to work through (API mode only; default: the only logged-in one)")
+ literal := fs.Bool("literal", false, "store a value that starts with its own key and = as it is")
fs.Usage = flagUsage(fs, "")
fs.Parse(args)
- usage := "usage: carlos secrets set --app <a> [--environment <name>] [--console <origin>] KEY=value [KEY2=value2 ...]"
+ usage := "usage: carlos secrets set --app <a> [--environment <name>] [--console <origin>] [--literal] KEY=value [KEY2=value2 ...] [KEY -]"
checkEnvironmentFlag(*environment)
- kv, err := parseKV(fs.Args())
+ kv, err := parseSecretsArgs(fs.Args(), secretsStdin, !*literal)
if err != nil {
log.Fatalf("secrets set: %v", err)
}
diff --git a/docs/site/cli.md b/docs/site/cli.md
index 57e56a22b..fb164eae0 100644
--- a/docs/site/cli.md
+++ b/docs/site/cli.md
@@ -1065,6 +1065,20 @@ values.
carlos secrets set --app hello STRIPE_KEY=sk_live_example
```
+A lone `-` after a key reads that key’s value from stdin, so the value never
+appears in the command line, where other people on the same machine can see it. One
+trailing newline is dropped. Only one key per command can read stdin, and it
+must be a pipe or a file, not the terminal. The input can be up to 64 KiB, including its trailing newline.
+
+```sh
+op read op://shop/stripe/key | carlos secrets set --app hello STRIPE_KEY -
+```
+
+A value that starts with its own key and `=`, such as
+`STRIPE_KEY=STRIPE_KEY=sk_live_example`, is refused: the variable name has
+been pasted into the value. If a secret really does start that way, add
+`--literal` to store it as it is.
+
A write that reaches a route no pass delivers to says so ("this write did
not reach <host>"), with the two ways out: name the unit that runs the
process on the box, or opt the bundle into file delivery. A stamped route
@@ -2636,6 +2650,15 @@ The secret prints once, same as a fleet token, and the same distinction
applies at the other end: `rotate` refuses the credential's next call with
the old secret, `revoke` stops it whatever secret it holds.
+For a script, `create` and `rotate` take `--json` and print one JSON object
+and nothing else. The secret alone is in its `secret` field, 43 characters,
+without the `CARLOS_SERVICE_TOKEN=` the human output puts in front of it:
+
+```sh
+carlos services create --role publish --app hello --json ci-shipper \
+ | jq -r .secret | carlos secrets set --app hello CARLOS_SERVICE_TOKEN -
+```
+
### carlos add
Writes a route straight into a box's registry: this hostname, served by this
diff --git a/docs/superpowers/notes/census-proposal-services-secret-scripts-1056.md b/docs/superpowers/notes/census-proposal-services-secret-scripts-1056.md
new file mode 100644
index 000000000..e8e30ea5f
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-services-secret-scripts-1056.md
@@ -0,0 +1,15 @@
+# Census approval: services-secret-scripts-1056
+
+Ruling `census-ruling-services-secret-scripts-1056`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+Envelopes re-pinned: `.`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `appconfig_cli.go:parseSecretsArgs`: reads +file:ReadAll; written legacy, accepted-legacy, frozen
+
+Seal: `5603979dfa1a34a1b30784d1f9252f20b0ed95c114bde54e8b173f9262fe8f46` → `183a9ccd8e8bd29ba677833142ec79bf4a9055b6a39e8da2bf4baa1616793da2`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-services-secret-scripts-1056.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-FIXES.md b/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-FIXES.md
new file mode 100644
index 000000000..a34ae7c67
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-FIXES.md
@@ -0,0 +1,10 @@
+Reviewed `158c805af3437b2c01bbe6a03bec4a0521e56e6d` against `f1f83341`, within round two’s existing budget.
+
+| Unit or envelope | Verdict | Basis |
+|---|---|---|
+| `appconfig_cli.go:parseSecretsArgs` | **APPROVED** | Lines 461–518 are unchanged. Bounded stdin reads and existing refusals remain intact. Body hash, read offset, revised legacy fingerprint, and chain seal verified. |
+| Root package envelope `.` | **APPROVED** | The sole source change is “value” → “input” at `appconfig_cli.go:539`. No authority or validation changes. Documentation correctly includes the trailing newline in the input cap. |
+
+The census test and envelope recomputation were blocked by the read-only sandbox. No files changed; no subagents used.
+
+**READY**
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md
new file mode 100644
index 000000000..85da4685e
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md
@@ -0,0 +1,50 @@
+Round 1 against `884bb164140b59f4d699328f69f256a3589969c1`: **one P1 and four P2 findings**.
+
+1. **P1 — Default account resolution breaks JSON output.**
+ Both commands call `resolvedAccount` outside the JSON output guard: [services.go:229](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/services.go:229) and line 469. Default resolution unconditionally prints `account: …` for configured defaults, single memberships, and the compatibility fallback ([apimode.go:573](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/apimode.go:573), lines 586 and 593). This also happens with piped stdout.
+
+ Consequently, the documented command without `--account` produces invalid JSON for `jq`. A credential can be minted or rotated without its replacement secret reaching the destination. All three JSON tests supply `--account`, bypassing this path.
+
+ **Fix:** Keep account-resolution diagnostics and prompts off stdout in JSON mode, including login resolution. Test create and rotate with omitted accounts, configured defaults, and discovered memberships.
+ **Fault family:** Machine-readable stdout must contain exactly one JSON object.
+
+2. **P2 — JSON write failures report success.**
+ [services.go:318](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/services.go:318) discards `Encoder.Encode`’s error. Serialization can succeed while writing fails—for example, redirecting to `/dev/full` or a full filesystem. The credential has already changed, but the command returns successfully without delivering its secret.
+
+ **Fix:** Propagate write errors, exit nonzero, and explain recovery without including the secret. Add a failing-writer test.
+ **Fault family:** Successful credential delivery must be reflected accurately in the exit status.
+
+3. **P2 — Windows MSYS2/Cygwin terminals bypass the refusal.**
+ [appconfig_cli.go:428](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/appconfig_cli.go:428) checks only `isatty.IsTerminal`. The pinned dependency implements Windows console detection separately from `IsCygwinTerminal`; MSYS2/Cygwin PTYs are pipes. Those terminals therefore reach `ReadAll`, potentially waiting for—and visibly echoing—typed secret input.
+
+ **Fix:** Include `isatty.IsCygwinTerminal` in the terminal check. Test the actual detection boundary; the current test injects an already-decided boolean.
+ **Fault family:** Interactive secret input must be refused before reading.
+
+4. **P2 — Stdin has no size limit.**
+ [appconfig_cli.go:477](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/appconfig_cli.go:477) reads until EOF without a cap. A wrong file or unending producer can exhaust memory before any validation. The console’s 256 KiB request limit applies only after reading, copying, sealing, and encoding.
+
+ **Fix:** Establish a supported plaintext limit, read at most that limit plus one byte, and refuse excess input without echoing it. Test the boundary and an oversized reader.
+ **Fault family:** Secret ingestion must use bounded memory.
+
+5. **P2 — The name heuristic makes legitimate values unrepresentable.**
+ [appconfig_cli.go:500](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/appconfig_cli.go:500) rejects every value beginning with its own key. For example, storing the literal value `FILTER=active` under `FILTER` now fails in both `env set` and `secrets set`, although that value passes the existing value validator. Quoting or using stdin cannot bypass the refusal.
+
+ **Fix:** Provide an explicit literal-value escape while retaining the accidental-prefix guard, and test it through both commands. Document the behavior for `env set` too.
+ **Fault family:** Typo prevention must preserve a deliberate way to store valid values.
+
+Census rulings for this commit:
+
+| Unit or envelope | Verdict | Basis |
+|---|---|---|
+| `appconfig_cli.go:parseSecretsArgs` | **APPROVED** | Reads the invoking process’s stdin; introduces no tenant-selected pathname or privileged read. The `legacy / accepted-legacy` disposition is appropriate. |
+| Root package envelope `.` | **APPROVED** | Reviewed the parser, validation, secret-setting integration, create/rotate branches, and JSON helpers. Existing sealing and authorization paths remain intact; no new root authority is granted. |
+
+These are census approvals, not approval of the functional defects above. I could not record them on #280 because sandbox networking blocked Amadan.
+
+Source inspection confirms literal `KEY=-`, mixed pairs, newline stripping, and existing `--environment` handling. Empty values and forbidden value characters still reach existing validation; read-error handling does not print partially read stdin bytes. Console storage is unchanged. The new tests meaningfully exercise their stated guards, but miss the findings above.
+
+Targeted `go test -run` with `GOCACHE` unset could not start: the sandbox refused Go’s temporary build directory. Runtime tests, census tests, and cross-platform compilation remain unverified. No files were changed.
+
+HEAD contains only the brief after the requested commit. Local `origin/main` also contains a later fleet-label change; its apparent reversals in the two-dot diff are not changes authored by this branch.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R2.md b/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R2.md
new file mode 100644
index 000000000..deb5411d8
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R2.md
@@ -0,0 +1,22 @@
+1. **R1 P1 — Resolved:** JSON output isolation now starts before session and account resolution for both create and rotate.
+2. **R1 P2 — Resolved:** JSON write errors produce a nonzero exit and recovery instructions without the secret.
+3. **R1 P2 — Resolved:** Terminal detection includes both console and Cygwin/MSYS2 checks.
+4. **R1 P2 — Resolved:** Stdin reads at most 64 KiB plus one byte, refusing oversized input.
+5. **R1 P2 — Resolved:** `secrets set --literal` permits deliberate named values; `env set` remains unguarded, as directed.
+
+No new P1 or P2 findings.
+
+Census verdicts for `8479c42ce20b98efedcc022f40ad83d9f5aaaa7c`:
+
+| Unit or envelope | Verdict | Basis |
+|---|---|---|
+| `appconfig_cli.go:parseSecretsArgs` | **APPROVED** | [Lines 461–518](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/appconfig_cli.go:461): bounded reads from the invoking process’s stdin; no new pathname or privileged input. `legacy / accepted-legacy` remains appropriate. The body fingerprint, read offset and legacy fingerprint match the overlay. |
+| Root package envelope `.` | **APPROVED** | Reviewed parser integration, terminal detection, literal handling, and create/rotate JSON paths in [appconfig_cli.go](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/appconfig_cli.go:1114) and [services.go](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/services.go:171). Existing authorization, sealing and storage paths remain intact; no new root authority is granted. |
+
+Source inspection confirms literal `KEY=-`, mixed pairs, single-newline removal, empty-value refusal, existing value validation, and `--environment` propagation. JSON field types are stable, with empty arrays instead of null. The added regression tests exercise the round-one fixes. CLI documentation reflects the controller’s decisions.
+
+Targeted CLI and census tests **could not start** because the read-only sandbox refused Go’s temporary build directory; `GOCACHE` was unset. Runtime tests and cross-platform compilation remain unverified. Amadan networking was blocked, so census verdicts were not recorded on #280.
+
+HEAD differs from the requested commit only by the R2 brief. No files were changed. This review stops at round 2 under the no-P1 rule.
+
+**READY**
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056-FIXES.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056-FIXES.md
new file mode 100644
index 000000000..8d5107d1c
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056-FIXES.md
@@ -0,0 +1,3 @@
+# Census check: #1056 after round 2 (same budget)
+
+Branch services-secret-scripts-1056. Diff since the R2 findings commit: a one-word change in the stdin-cap refusal string (secretsCopyStdinTooLarge, "value" to "input"), a docs sentence, the R2 findings file, and the re-frozen census overlay. Not a new round: give APPROVED or REFUSED per changed census unit and envelope, then READY or NOT READY. Do not edit files; no subagents.
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056-R2.md
new file mode 100644
index 000000000..6d9fe764e
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056-R2.md
@@ -0,0 +1,20 @@
+# Review brief: #1056 service secrets in scripts, branch, round 2 of 3
+
+Repo carlos/platform, branch `services-secret-scripts-1056`, commit 8479c42ce20b98efedcc022f40ad83d9f5aaaa7c. Diff: `origin/main..884bb164140b59f4d699328f69f256a3589969c1`. Issue: `amadan discuss show carlos/platform 1056`.
+
+The change: (1) `carlos services create|rotate --json` prints one JSON object (secret included) and nothing else on stdout; (2) `carlos secrets set --app A KEY -` reads the value from stdin (one key per command, one trailing newline stripped, refused on a terminal, empty refused); (3) secrets set and env set refuse a value that starts with its own key name and "=".
+
+Check:
+1. Secret handling: the secret appears only in the JSON object on stdout in --json mode; never in stderr, logs, error messages or argv; the stdin value never echoed in any refusal (including the name refusal and read errors). No change to what the console stores.
+2. Stdin parsing: interaction with existing argument forms (KEY=VALUE pairs, KEY=- storing "-", multiple keys, --environment), exactly-one-newline stripping, binary or very large input (is there a size cap?), Windows/darwin builds, terminal detection on all platforms.
+3. --json: stable field names and types, no human text leaks onto stdout, exit codes unchanged, rotate's object.
+4. The name refusal: no false positives for legitimate values that happen to start with KEY= (should any be allowed?), applies equally to env set.
+5. Tests: would each fail without its guard?
+6. **Census:** `docs/superpowers/notes/census-proposal-services-secret-scripts-1056.md` and its overlay: APPROVED or REFUSED per changed unit (you are the census reviewer).
+7. docs/site/cli.md accurate to the code.
+
+Severity P1 (blocks) / P2 (fixed without another round) / P3 (follow-up). End with READY, READY AFTER FIXES or NOT READY. Do not edit files; no subagents; targeted `go test -run` only (GOCACHE unset).
+
+## Round 2
+
+Round 1: `CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md`. Controller calls: the name guard applies to `secrets set` only, with `--literal` as the deliberate escape (env set unguarded); stdin capped at 64 KiB (no existing per-value limit). First one line per R1 finding: resolved, partly or not. Then new findings with the invariant beside each. Re-give census verdicts for the re-frozen overlay.
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056.md
new file mode 100644
index 000000000..193d5a08c
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-SERVICES-SECRET-SCRIPTS-1056.md
@@ -0,0 +1,16 @@
+# Review brief: #1056 service secrets in scripts, branch, round 1 of 3
+
+Repo carlos/platform, branch `services-secret-scripts-1056`, commit 884bb164140b59f4d699328f69f256a3589969c1. Diff: `origin/main..884bb164140b59f4d699328f69f256a3589969c1`. Issue: `amadan discuss show carlos/platform 1056`.
+
+The change: (1) `carlos services create|rotate --json` prints one JSON object (secret included) and nothing else on stdout; (2) `carlos secrets set --app A KEY -` reads the value from stdin (one key per command, one trailing newline stripped, refused on a terminal, empty refused); (3) secrets set and env set refuse a value that starts with its own key name and "=".
+
+Check:
+1. Secret handling: the secret appears only in the JSON object on stdout in --json mode; never in stderr, logs, error messages or argv; the stdin value never echoed in any refusal (including the name refusal and read errors). No change to what the console stores.
+2. Stdin parsing: interaction with existing argument forms (KEY=VALUE pairs, KEY=- storing "-", multiple keys, --environment), exactly-one-newline stripping, binary or very large input (is there a size cap?), Windows/darwin builds, terminal detection on all platforms.
+3. --json: stable field names and types, no human text leaks onto stdout, exit codes unchanged, rotate's object.
+4. The name refusal: no false positives for legitimate values that happen to start with KEY= (should any be allowed?), applies equally to env set.
+5. Tests: would each fail without its guard?
+6. **Census:** `docs/superpowers/notes/census-proposal-services-secret-scripts-1056.md` and its overlay: APPROVED or REFUSED per changed unit (you are the census reviewer).
+7. docs/site/cli.md accurate to the code.
+
+Severity P1 (blocks) / P2 (fixed without another round) / P3 (follow-up). End with READY, READY AFTER FIXES or NOT READY. Do not edit files; no subagents; targeted `go test -run` only (GOCACHE unset).
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 90c6a758c..cb0b41a9a 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -218,3 +218,4 @@ plan14-root-reads-pdf-host-client-groups.tsv e8beda8fd31db92f742943be631e8d034bb
plan14-root-reads-log-retention-knobs.tsv e8beda8fd31db92f742943be631e8d034bbb4880225e69a680d5a0be893807af
plan14-root-reads-fleet-record-labels-m1.tsv 5603979dfa1a34a1b30784d1f9252f20b0ed95c114bde54e8b173f9262fe8f46
plan14-root-reads-fleet-record-labels-m2.tsv 5603979dfa1a34a1b30784d1f9252f20b0ed95c114bde54e8b173f9262fe8f46
+plan14-root-reads-services-secret-scripts-1056.tsv 183a9ccd8e8bd29ba677833142ec79bf4a9055b6a39e8da2bf4baa1616793da2
diff --git a/internal/provision/testdata/plan14-root-reads-services-secret-scripts-1056.tsv b/internal/provision/testdata/plan14-root-reads-services-secret-scripts-1056.tsv
new file mode 100644
index 000000000..8a1476c13
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-services-secret-scripts-1056.tsv
@@ -0,0 +1,6 @@
+# Census overlay services-secret-scripts-1056, written by census-propose (#369). census-ruling-services-secret-scripts-1056, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-services-secret-scripts-1056.md.
+# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy af56c9adddf41e5bf0cf273ca37f29035454da9fa5039f9945736aefca4f088a appconfig_cli.go parseSecretsArgs legacy accepted-legacy accepted-legacy;rev3=census-ruling-services-secret-scripts-1056;basis=Reads the value for KEY - from the invoking process stdin, at most 64 KiB plus one byte, after refusing a terminal (isatty or Cygwin pty); refuses a secrets value that starts with its own key and = unless --literal. No pathname, no privileged input, no new root authority. file:ReadAll@1107 354b5b69c709a629fa00d634f6ee26e8cd0f8091b9743509b7a49b27ca11a84e
+appconfig_cli.go parseSecretsArgs legacy accepted-legacy accepted-legacy;rev3=census-ruling-services-secret-scripts-1056;basis=Reads the value for KEY - from the invoking process stdin, at most 64 KiB plus one byte, after refusing a terminal (isatty or Cygwin pty); refuses a secrets value that starts with its own key and = unless --literal. No pathname, no privileged input, no new root authority. file:ReadAll@1107 354b5b69c709a629fa00d634f6ee26e8cd0f8091b9743509b7a49b27ca11a84e
+@coverage . 1933b238815f2ad5eb5b0db3db07747f122a669f4aa31d0f12633ea7a0c40338
diff --git a/secrets_stdin_test.go b/secrets_stdin_test.go
new file mode 100644
index 000000000..b12145a90
--- /dev/null
+++ b/secrets_stdin_test.go
@@ -0,0 +1,293 @@
+// Tests for `carlos secrets set`'s stdin form and its variable-name refusal
+// (#1056). `secrets set KEY -` reads the value from stdin so it never sits
+// in argv, and `secrets set` refuses a value that starts with its own key
+// name and "=" unless --literal says it means it. `env set` does not.
+package main
+
+import (
+ "context"
+ "io"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "reflect"
+ "strings"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/appconfig"
+ "github.com/mattn/go-isatty"
+)
+
+// pipe stands in for secretsStdin: a reader that records whether it was
+// read, and whether it is a terminal.
+type pipe struct {
+ r io.Reader
+ terminal bool
+ read bool
+}
+
+func (p *pipe) Read(b []byte) (int, error) { p.read = true; return p.r.Read(b) }
+
+func stdinOf(value string, terminal bool) (*pipe, func() (io.Reader, bool)) {
+ p := &pipe{r: strings.NewReader(value), terminal: terminal}
+ return p, func() (io.Reader, bool) { return p, p.terminal }
+}
+
+func TestParseSecretsArgsReadsOneValueFromStdin(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ args []string
+ stdin string
+ want map[string]string
+ }{
+ {"newline stripped", []string{"KEY", "-"}, "s3cret\n", map[string]string{"KEY": "s3cret"}},
+ {"crlf stripped", []string{"KEY", "-"}, "s3cret\r\n", map[string]string{"KEY": "s3cret"}},
+ {"no newline", []string{"KEY", "-"}, "s3cret", map[string]string{"KEY": "s3cret"}},
+ {"only one newline stripped", []string{"KEY", "-"}, "s3cret\n\n", map[string]string{"KEY": "s3cret\n"}},
+ {"beside pairs", []string{"A=1", "KEY", "-", "B=2"}, "s3cret\n", map[string]string{"A": "1", "KEY": "s3cret", "B": "2"}},
+ {"empty stays empty", []string{"KEY", "-"}, "\n", map[string]string{"KEY": ""}},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ _, stdin := stdinOf(tc.stdin, false)
+ got, err := parseSecretsArgs(tc.args, stdin, true)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !reflect.DeepEqual(got, tc.want) {
+ t.Fatalf("got %q, want %q", got, tc.want)
+ }
+ })
+ }
+}
+
+// An empty stdin value meets the same refusal an empty KEY= does.
+func TestSecretsSetEmptyStdinValueIsRefused(t *testing.T) {
+ _, stdin := stdinOf("", false)
+ kv, err := parseSecretsArgs([]string{"KEY", "-"}, stdin, true)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = checkNoEmptyValues(kv)
+ if err == nil || err.Error() != strings.Replace(secretsCopyEmpty, "%s", "KEY", 1) {
+ t.Fatalf("err = %v, want the existing empty-value refusal", err)
+ }
+}
+
+func TestParseSecretsArgsRefusesATerminalWithoutReading(t *testing.T) {
+ p, stdin := stdinOf("s3cret\n", true)
+ _, err := parseSecretsArgs([]string{"KEY", "-"}, stdin, true)
+ if err == nil || !strings.Contains(err.Error(), "terminal") {
+ t.Fatalf("err = %v, want the terminal refusal", err)
+ }
+ if p.read {
+ t.Fatal("read from a terminal stdin")
+ }
+}
+
+func TestParseSecretsArgsTakesOneStdinKey(t *testing.T) {
+ _, stdin := stdinOf("s3cret\n", false)
+ _, err := parseSecretsArgs([]string{"A", "-", "B", "-"}, stdin, true)
+ if err == nil || !strings.Contains(err.Error(), "only one") {
+ t.Fatalf("err = %v, want the one-stdin-key refusal", err)
+ }
+}
+
+// Without its key, or without its "-", the stdin form is the old error.
+func TestParseSecretsArgsHalfAStdinFormIsNotAPair(t *testing.T) {
+ for _, args := range [][]string{{"-"}, {"KEY"}, {"A=1", "-"}, {"KEY", "-", "-"}} {
+ p, stdin := stdinOf("s3cret\n", false)
+ _, err := parseSecretsArgs(args, stdin, true)
+ if err == nil || !strings.Contains(err.Error(), "is not a KEY=value pair") {
+ t.Fatalf("%q: err = %v, want the not-a-pair refusal", args, err)
+ }
+ if p.read {
+ t.Fatalf("%q: read stdin for a malformed form", args)
+ }
+ }
+}
+
+func TestSecretsSetRefusesAValueCarryingItsOwnName(t *testing.T) {
+ const secret = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFG"
+ _, stdin := stdinOf("CARLOS_SERVICE_TOKEN="+secret+"\n", false)
+ _, fromStdin := parseSecretsArgs([]string{"CARLOS_SERVICE_TOKEN", "-"}, stdin, true)
+ _, fromArg := parseSecretsArgs([]string{"CARLOS_SERVICE_TOKEN=CARLOS_SERVICE_TOKEN=" + secret}, nil, true)
+ for name, err := range map[string]error{"stdin": fromStdin, "argument": fromArg} {
+ if err == nil || !strings.Contains(err.Error(), "includes the variable name") {
+ t.Fatalf("%s: err = %v, want the variable-name refusal", name, err)
+ }
+ if strings.Contains(err.Error(), secret) {
+ t.Fatalf("%s: refusal echoes the value: %v", name, err)
+ }
+ }
+}
+
+func TestSecretsSetAcceptsValuesThatOnlyLookLikeTheirName(t *testing.T) {
+ for _, arg := range []string{"KEY=KEYS=1", "KEY=key=1", "OTHER=KEY=1", "KEY=x KEY=1"} {
+ if _, err := parseSecretsArgs([]string{arg}, nil, true); err != nil {
+ t.Fatalf("%q refused: %v", arg, err)
+ }
+ }
+}
+
+// env set keeps a value that starts with its own name (FILTER=active under
+// FILTER is plausible config), and secrets set --literal (refuseNamed
+// false) stores one on purpose, from an argument or from stdin.
+func TestNamedValueAllowedForEnvSetAndLiteral(t *testing.T) {
+ want := map[string]string{"FILTER": "FILTER=active"}
+ if got, err := parseKV([]string{"FILTER=FILTER=active"}); err != nil || !reflect.DeepEqual(got, want) {
+ t.Fatalf("env set: %q %v, want %q", got, err, want)
+ }
+ if got, err := parseSecretsArgs([]string{"FILTER=FILTER=active"}, nil, false); err != nil || !reflect.DeepEqual(got, want) {
+ t.Fatalf("--literal argument: %q %v, want %q", got, err, want)
+ }
+ _, stdin := stdinOf("FILTER=active\n", false)
+ if got, err := parseSecretsArgs([]string{"FILTER", "-"}, stdin, false); err != nil || !reflect.DeepEqual(got, want) {
+ t.Fatalf("--literal stdin: %q %v, want %q", got, err, want)
+ }
+}
+
+// --literal through the verb, against a real console: the value is stored
+// as given.
+func TestSecretsSetLiteralStoresANamedValue(t *testing.T) {
+ fx := fskCLIFixture(t)
+ privB64, pub, err := appconfig.GenerateKey()
+ if err != nil {
+ t.Fatal(err)
+ }
+ captureStdout(t)
+ RunFleets([]string{"secrets-key", "-account", "ops", "home", pub})
+ runCapturingRealStdout(t, func() {
+ runSecretsSet([]string{"-account", "ops", "-app", "shop", "--literal", "FILTER=FILTER=active"})
+ })
+ m, err := appconfig.Get(context.Background(), fx.rel, fx.account, "shop")
+ if err != nil {
+ t.Fatal(err)
+ }
+ priv, _ := appconfig.ParsePrivateKey(privB64, "test")
+ got, err := appconfig.Open(priv, appconfig.Binding{Account: fx.account, App: "shop"}, m.Vars["FILTER"].Envelope)
+ if err != nil || string(got) != "FILTER=active" {
+ t.Fatalf("stored value = %q %v, want FILTER=active", got, err)
+ }
+}
+
+// The terminal answer is go-isatty's console check OR its Cygwin/MSYS2
+// check: a Windows Git Bash or MSYS2 terminal is a pipe to the first.
+func TestStdinTerminalAsksBothChecks(t *testing.T) {
+ yes := func(uintptr) bool { return true }
+ no := func(uintptr) bool { return false }
+ for _, tc := range []struct {
+ console, cygwin func(uintptr) bool
+ want bool
+ }{{no, no, false}, {yes, no, true}, {no, yes, true}, {yes, yes, true}} {
+ if got := stdinTerminal(0, tc.console, tc.cygwin); got != tc.want {
+ t.Fatalf("stdinTerminal = %v, want %v", got, tc.want)
+ }
+ }
+ // And the real checks on a real pipe: not a terminal.
+ r, w, err := os.Pipe()
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer r.Close()
+ defer w.Close()
+ if stdinTerminal(r.Fd(), isatty.IsTerminal, isatty.IsCygwinTerminal) {
+ t.Fatal("a pipe reads as a terminal")
+ }
+}
+
+// endless is a producer that never stops.
+type endless struct{ n int }
+
+func (e *endless) Read(b []byte) (int, error) {
+ for i := range b {
+ b[i] = 'a'
+ }
+ e.n += len(b)
+ return len(b), nil
+}
+
+// Stdin is capped at secretsStdinMaxBytes: exactly the cap is a value, one
+// byte more is refused without echoing it, and an endless producer is read
+// no further than the cap and one byte.
+func TestSecretsStdinIsCapped(t *testing.T) {
+ at := strings.Repeat("a", secretsStdinMaxBytes)
+ _, stdin := stdinOf(at, false)
+ got, err := parseSecretsArgs([]string{"KEY", "-"}, stdin, true)
+ if err != nil || got["KEY"] != at {
+ t.Fatalf("exactly %d bytes: len %d, %v", secretsStdinMaxBytes, len(got["KEY"]), err)
+ }
+ _, stdin = stdinOf(at+"b", false)
+ _, err = parseSecretsArgs([]string{"KEY", "-"}, stdin, true)
+ if err == nil || !strings.Contains(err.Error(), "larger than 64 KiB") || strings.Contains(err.Error(), "aaaa") {
+ t.Fatalf("one byte over: err = %v, want the size refusal without the value", err)
+ }
+ e := &endless{}
+ _, err = parseSecretsArgs([]string{"KEY", "-"}, func() (io.Reader, bool) { return e, false }, true)
+ if err == nil || !strings.Contains(err.Error(), "larger than 64 KiB") {
+ t.Fatalf("endless: err = %v, want the size refusal", err)
+ }
+ if e.n > 2*secretsStdinMaxBytes {
+ t.Fatalf("endless producer read %d bytes, want about the cap", e.n)
+ }
+}
+
+// End to end against a real console: the piped value is what gets sealed
+// and stored, without its trailing newline.
+func TestSecretsSetStoresTheStdinValue(t *testing.T) {
+ fx := fskCLIFixture(t)
+ privB64, pub, err := appconfig.GenerateKey()
+ if err != nil {
+ t.Fatal(err)
+ }
+ captureStdout(t)
+ RunFleets([]string{"secrets-key", "-account", "ops", "home", pub})
+
+ _, stdin := stdinOf("hunter2\n", false)
+ orig := secretsStdin
+ secretsStdin = stdin
+ t.Cleanup(func() { secretsStdin = orig })
+ runCapturingRealStdout(t, func() {
+ runSecretsSet([]string{"-account", "ops", "-app", "shop", "API_KEY", "-"})
+ })
+ m, err := appconfig.Get(context.Background(), fx.rel, fx.account, "shop")
+ if err != nil {
+ t.Fatal(err)
+ }
+ priv, _ := appconfig.ParsePrivateKey(privB64, "test")
+ got, err := appconfig.Open(priv, appconfig.Binding{Account: fx.account, App: "shop"}, m.Vars["API_KEY"].Envelope)
+ if err != nil || string(got) != "hunter2" {
+ t.Fatalf("stored value = %q %v, want hunter2", got, err)
+ }
+}
+
+// Through the built binary, with no console anywhere: stdin is parsed
+// before any session. /dev/null is a char device but not a terminal, so it
+// gets the empty-value refusal; a pipe carrying KEY=... gets the
+// variable-name refusal, and neither echoes what was piped.
+func TestSecretsSetStdinThroughTheBinary(t *testing.T) {
+ bin := buildCarlos(t)
+ scratch := t.TempDir()
+ run := func(stdin io.Reader) string {
+ cmd := exec.Command(bin, "secrets", "set", "--app", "shop", "API_KEY", "-")
+ cmd.Env = carlosTestEnv(t, "CARLOS_CREDENTIALS="+filepath.Join(scratch, "none"), "CARLOS_DEPLOYMENT_BUCKET=", "CARLOS_DEPLOYMENT_DIR=")
+ cmd.Dir = scratch
+ cmd.Stdin = stdin
+ out, err := cmd.CombinedOutput()
+ if err == nil {
+ t.Fatalf("exited 0, want a refusal:\n%s", out)
+ }
+ return string(out)
+ }
+ devNull, err := os.Open(os.DevNull)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer devNull.Close()
+ if out := run(devNull); !strings.Contains(out, "API_KEY: empty value: nothing stored") {
+ t.Fatalf("stdin from %s: want the empty-value refusal, got:\n%s", os.DevNull, out)
+ }
+ out := run(strings.NewReader("API_KEY=hunter2\n"))
+ if !strings.Contains(out, "includes the variable name") || strings.Contains(out, "hunter2") {
+ t.Fatalf("piped API_KEY=...: want the variable-name refusal without the value, got:\n%s", out)
+ }
+}
diff --git a/services.go b/services.go
index 4feba528f..56a85fa96 100644
--- a/services.go
+++ b/services.go
@@ -16,8 +16,10 @@ package main
import (
"context"
+ "encoding/json"
"flag"
"fmt"
+ "io"
"log"
"os"
"regexp"
@@ -32,7 +34,7 @@ import (
const servicesUsage = `usage: carlos services <create|ls|rotate|revoke> [flags]
- create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] <name>
+ create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] [--json] <name>
mint a credential a SERVER holds, bound to this account —
not to you. Unlike your own CLI token, its reach is fixed
at mint: adding you to another account later does not widen
@@ -48,6 +50,9 @@ const servicesUsage = `usage: carlos services <create|ls|rotate|revoke> [flags]
--role run needs --app and --commands, the command
prefixes it may run: --commands "import classic,import sync".
Words are matched exactly, from the start of the command.
+ --json prints one JSON object and nothing else, the bare
+ secret in its "secret" field: carlos services create
+ ... --json name | jq -r .secret
ls [--account <sqid|name>]
list every LIVE credential the account owns — name, role,
@@ -55,12 +60,13 @@ const servicesUsage = `usage: carlos services <create|ls|rotate|revoke> [flags]
who minted it. A revoked credential does not appear; there
is no history view here.
- rotate [--account <sqid|name>] <name>
+ rotate [--account <sqid|name>] [--json] <name>
mint a FRESH secret for a credential that already exists,
printed exactly once. This refuses the credential's NEXT
call with the old secret. ROTATION IS NOT REVOCATION: it
does not stop work already in flight, and a credential that
- may be COMPROMISED needs revoke.
+ may be COMPROMISED needs revoke. --json prints one JSON
+ object, {"name", "account", "secret"}, and nothing else.
revoke [--account <sqid|name>] <name-or-id>
the hard stop rotate is not: the credential's next call
@@ -172,10 +178,11 @@ func runServicesCreate(args []string) {
acctRaw := fs.String("account", "", "account (sqid or name) to mint the credential in (default: your only account, or the configured/chosen one)")
acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes --account")
consoleFlag := consoleOption(fs, "console to create it through (default: the only logged-in one)")
+ asJSON := fs.Bool("json", false, "print the credential and its bare secret as one JSON object, for a script")
fs.Usage = flagUsage(fs, "")
fs.Parse(args)
const usageMsg = "usage: carlos services create --role <publish|deploy|instance|operate|service|run|team|admin> [--app <app>] " +
- "[--rungs <list>] [--commands <list>] [--scope <name>] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] <name>"
+ "[--rungs <list>] [--commands <list>] [--scope <name>] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--json] <name>"
if fs.NArg() != 1 || strings.TrimSpace(*role) == "" {
log.Fatal(usageMsg)
}
@@ -216,13 +223,32 @@ func runServicesCreate(args []string) {
log.Fatal("services create: --role team needs --app, the one app it is bound to, and --scope, the scope name whose environments it owns")
}
+ var jsonOut io.Writer
+ if *asJSON {
+ var restore func()
+ jsonOut, restore = servicesJSONStdout()
+ defer restore()
+ }
sess := servicesSignedInSession(*consoleFlag)
- fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ if !*asJSON {
+ fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ }
acct := resolvedAccount(sess, acctRaw, acctIDRaw)
token, doors, gotRungs, gotCommands, gotScope, err := sess.createService(context.Background(), acct, name, roleV, appV, rungsV, commandsV, scopeV)
if err != nil {
log.Fatalf("services create: %v", err)
}
+ if *asJSON {
+ err := writeServiceJSON(jsonOut, serviceCreatedJSON{
+ Name: name, Account: acct.Seg, App: appV, Role: roleV,
+ Rungs: orEmpty(gotRungs), Commands: orEmpty(gotCommands), Scope: gotScope,
+ Doors: orEmpty(doors), Secret: token,
+ })
+ if err != nil {
+ log.Fatal(serviceSecretUnwritten("services create", "created", acct.Seg, name, err))
+ }
+ return
+ }
printServiceCreated(acct.Seg, name, roleV, appV, gotRungs, gotCommands, gotScope, token, doors)
}
@@ -267,6 +293,71 @@ func deliverLine(appHint string) string {
return "carlos secrets set --app " + app + " CARLOS_SERVICE_TOKEN=<secret>"
}
+// serviceCreatedJSON is `services create --json`: the credential as minted
+// and its bare secret, for a script (#1056: a script that cut the secret out
+// of the human text kept the CARLOS_SERVICE_TOKEN= in front of it, and every
+// call answered 401). Field names follow `services ls`'s wire shape; lists
+// are [] rather than null, and app is "" for an account-wide credential.
+type serviceCreatedJSON struct {
+ Name string `json:"name"`
+ Account string `json:"account"`
+ App string `json:"app"`
+ Role string `json:"role"`
+ Rungs []string `json:"rungs"`
+ Commands [][]string `json:"commands"`
+ Scope string `json:"scope"`
+ Doors []string `json:"doors"`
+ Secret string `json:"secret"`
+}
+
+// serviceRotatedJSON is `services rotate --json`. The rotate door answers
+// with the secret alone, so the name and account are what the caller gave.
+type serviceRotatedJSON struct {
+ Name string `json:"name"`
+ Account string `json:"account"`
+ Secret string `json:"secret"`
+}
+
+// servicesJSONStdout is --json's stdout discipline: a script reads stdout
+// whole, so the one JSON object must be the only thing on it. It returns
+// the real stdout for that object and points the package's stdout at
+// stderr until restore, so everything else this verb prints on the way
+// (the "account: …" line default account resolution writes, the chooser)
+// lands on stderr instead (#1056 review R1).
+func servicesJSONStdout() (out io.Writer, restore func()) {
+ out = stdout
+ stdout = os.Stderr
+ return out, func() { stdout = out }
+}
+
+// writeServiceJSON writes v to w, indented like `carlos email events
+// --json`, and returns the write's error: the credential has already
+// changed by now, and a secret that never reached its reader is not a
+// success (#1056 review R1).
+func writeServiceJSON(w io.Writer, v any) error {
+ enc := json.NewEncoder(w)
+ enc.SetIndent("", " ")
+ return enc.Encode(v)
+}
+
+// serviceSecretUnwritten is the refusal when --json could not write the
+// secret: the credential exists with a secret nobody holds, so the way out
+// is another rotate. The secret is never in it.
+func serviceSecretUnwritten(verb, done, acctSeg, name string, err error) error {
+ return fmt.Errorf(servicesCopySecretUnwritten, verb, name, done, err, acctSeg, name)
+}
+
+// #1056 review R1. Not yet through a copy pass.
+const servicesCopySecretUnwritten = "%s: %s was %s, but its secret could not be written (%v). Rotate it for a new one: carlos services rotate --account %s %s"
+
+// orEmpty is s, or an empty slice for nil, so JSON says [] and not null.
+func orEmpty[T any](s []T) []T {
+ if s == nil {
+ return []T{}
+ }
+ return s
+}
+
// printServiceCreated is the ONE place a service credential's secret
// reaches stdout on create — printed exactly once, immediately, with the
// scope it was minted into stated in words (requirement: an app-scoped
@@ -391,24 +482,39 @@ func runServicesRotate(args []string) {
acctRaw := fs.String("account", "", "account (sqid or name) the credential belongs to (default: your only account, or the configured/chosen one)")
acctIDRaw := fs.String("account-id", "", "account sqid, matched as a sqid ONLY — supersedes --account")
consoleFlag := consoleOption(fs, "console to rotate through (default: the only logged-in one)")
+ asJSON := fs.Bool("json", false, "print the name, account and bare secret as one JSON object, for a script")
fs.Usage = flagUsage(fs, "")
fs.Parse(args)
if fs.NArg() != 1 {
log.Fatal("usage: carlos services rotate [--account <sqid|name>] [--account-id <sqid>] " +
- "[--console <origin>] <name>")
+ "[--console <origin>] [--json] <name>")
}
name := strings.TrimSpace(fs.Arg(0))
if err := validServiceName(name); err != nil {
log.Fatalf("services rotate: %v", err)
}
+ var jsonOut io.Writer
+ if *asJSON {
+ var restore func()
+ jsonOut, restore = servicesJSONStdout()
+ defer restore()
+ }
sess := servicesSignedInSession(*consoleFlag)
- fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ if !*asJSON {
+ fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ }
acct := resolvedAccount(sess, acctRaw, acctIDRaw)
token, err := sess.rotateService(context.Background(), acct, name)
if err != nil {
log.Fatalf("services rotate: %v", err)
}
+ if *asJSON {
+ if err := writeServiceJSON(jsonOut, serviceRotatedJSON{Name: name, Account: acct.Seg, Secret: token}); err != nil {
+ log.Fatal(serviceSecretUnwritten("services rotate", "rotated", acct.Seg, name, err))
+ }
+ return
+ }
printServiceRotated(acct.Seg, name, token)
}
diff --git a/services_json_test.go b/services_json_test.go
new file mode 100644
index 000000000..f9feb917e
--- /dev/null
+++ b/services_json_test.go
@@ -0,0 +1,256 @@
+// Tests for `carlos services create|rotate --json` (#1056): a script that
+// extracted the whole `CARLOS_SERVICE_TOKEN=<secret>` line from the human
+// output and stored it as the app's secret made every call answer 401.
+// --json hands a script one object with the bare secret, and nothing else
+// on stdout.
+package main
+
+import (
+ "encoding/json"
+ "errors"
+ "io"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+// decodeOnlyObject decodes out as exactly one JSON object and fails if
+// anything but whitespace follows it: --json's stdout is for a parser.
+func decodeOnlyObject(t *testing.T, out string, v any) {
+ t.Helper()
+ dec := json.NewDecoder(strings.NewReader(out))
+ dec.DisallowUnknownFields()
+ if err := dec.Decode(v); err != nil {
+ t.Fatalf("stdout is not one JSON object of the expected shape: %v\n%s", err, out)
+ }
+ var extra json.RawMessage
+ if err := dec.Decode(&extra); !errors.Is(err, io.EOF) {
+ t.Fatalf("stdout carries more than one JSON value (next: %s, err %v):\n%s", extra, err, out)
+ }
+}
+
+func TestServicesCreateJSONIsOneObjectWithTheBareSecret(t *testing.T) {
+ servicesCLIFixture(t)
+ buf := captureStdout(t)
+
+ RunServices([]string{"create", "-role", "publish", "-app", "titogo", "-account", "bab", "--json", "amadan-hub"})
+
+ out := buf.String()
+ var got struct {
+ Name string `json:"name"`
+ Account string `json:"account"`
+ App string `json:"app"`
+ Role string `json:"role"`
+ Rungs []string `json:"rungs"`
+ Commands [][]string `json:"commands"`
+ Scope string `json:"scope"`
+ Doors []string `json:"doors"`
+ Secret string `json:"secret"`
+ }
+ decodeOnlyObject(t, out, &got)
+ if got.Name != "amadan-hub" || got.Account != "bab" || got.App != "titogo" || got.Role != "publish" {
+ t.Fatalf("object = %+v", got)
+ }
+ if got.Secret != tokenFor(1) {
+ t.Fatalf("secret = %q, want the bare %q", got.Secret, tokenFor(1))
+ }
+ if got.Rungs == nil || got.Commands == nil {
+ t.Fatalf("rungs/commands must be [] rather than null for a script: %s", out)
+ }
+ if len(got.Doors) != 3 {
+ t.Fatalf("doors = %v, want the console's three", got.Doors)
+ }
+ if n := strings.Count(out, tokenFor(1)); n != 1 {
+ t.Fatalf("secret appeared %d times, want exactly 1:\n%s", n, out)
+ }
+ for _, prose := range []string{"CARLOS_SERVICE_TOKEN", "using ", "shown once", "deliver it"} {
+ if strings.Contains(out, prose) {
+ t.Fatalf("--json stdout carries the human text %q:\n%s", prose, out)
+ }
+ }
+}
+
+func TestServicesCreateJSONAccountWideHasAnEmptyApp(t *testing.T) {
+ servicesCLIFixture(t)
+ buf := captureStdout(t)
+
+ RunServices([]string{"create", "-role", "publish", "-account", "bab", "-json", "amadan-hub"})
+
+ var got map[string]any
+ if err := json.Unmarshal(buf.Bytes(), &got); err != nil {
+ t.Fatalf("not JSON: %v\n%s", err, buf)
+ }
+ if app, ok := got["app"]; !ok || app != "" {
+ t.Fatalf("app = %v (present %v), want \"\" for an account-wide credential", app, ok)
+ }
+}
+
+func TestServicesRotateJSONIsOneObjectWithTheBareSecret(t *testing.T) {
+ servicesCLIFixture(t)
+ buf := captureStdout(t)
+
+ RunServices([]string{"rotate", "-account", "bab", "--json", "amadan-hub"})
+
+ out := buf.String()
+ var got struct {
+ Name string `json:"name"`
+ Account string `json:"account"`
+ Secret string `json:"secret"`
+ }
+ decodeOnlyObject(t, out, &got)
+ if got.Name != "amadan-hub" || got.Account != "bab" || got.Secret != tokenFor(1) {
+ t.Fatalf("object = %+v", got)
+ }
+ for _, prose := range []string{"CARLOS_SERVICE_TOKEN", "using ", "ROTATION", "deliver it"} {
+ if strings.Contains(out, prose) {
+ t.Fatalf("--json stdout carries the human text %q:\n%s", prose, out)
+ }
+ }
+}
+
+// servicesJSONAccountFixture is a fake console for --json with the account
+// left out: create, rotate, and the memberships listing default account
+// resolution reads (GET /api/cli/apps). accounts nil answers that listing
+// 404, the old-console fallback. It returns the console's URL.
+func servicesJSONAccountFixture(t *testing.T, accounts []map[string]any) string {
+ t.Helper()
+ home := t.TempDir()
+ t.Setenv("HOME", home)
+ t.Setenv("CARLOS_CONSOLE", "")
+ t.Setenv("CARLOS_DEPLOYMENT_BUCKET", "")
+ t.Setenv("CARLOS_DEPLOYMENT_DIR", "")
+ t.Chdir(t.TempDir())
+ creds := filepath.Join(home, "carlos-credentials")
+ t.Setenv("CARLOS_CREDENTIALS", creds)
+ mux := http.NewServeMux()
+ mux.HandleFunc("GET /api/cli/apps", func(w http.ResponseWriter, r *http.Request) {
+ if accounts == nil {
+ http.NotFound(w, r)
+ return
+ }
+ json.NewEncoder(w).Encode(map[string]any{"accounts": accounts})
+ })
+ mux.HandleFunc("POST /api/cli/services/{account}", func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusCreated)
+ json.NewEncoder(w).Encode(map[string]any{"token": tokenFor(1), "doors": []string{"GET /api/cli/apps"}})
+ })
+ mux.HandleFunc("POST /api/cli/services/{account}/{name}/rotate", func(w http.ResponseWriter, r *http.Request) {
+ json.NewEncoder(w).Encode(map[string]any{"token": tokenFor(1)})
+ })
+ ts := httptest.NewServer(mux)
+ t.Cleanup(ts.Close)
+ writeTestCredential(t, creds, ts.URL)
+ return ts.URL
+}
+
+// With no --account, default resolution prints "account: …" on its way;
+// in --json mode that must not reach stdout, on every path: a configured
+// default, the caller's one membership, and an old console's fallback
+// (#1056 review R1, P1).
+func TestServicesJSONWithoutAccountIsStillOneObject(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ accounts []map[string]any
+ config bool
+ want string
+ }{
+ {"configured default", []map[string]any{{"name": "shop", "sqid": "bab"}, {"name": "other", "sqid": "cad"}}, true, "bab"},
+ {"one membership", []map[string]any{{"name": "shop", "sqid": "bab"}}, false, "bab"},
+ {"old console", nil, false, "ops"},
+ } {
+ for _, verb := range [][]string{
+ {"create", "-role", "publish", "--json", "amadan-hub"},
+ {"rotate", "--json", "amadan-hub"},
+ } {
+ t.Run(tc.name+"/"+verb[0], func(t *testing.T) {
+ url := servicesJSONAccountFixture(t, tc.accounts)
+ if tc.config {
+ if err := saveConfigAccount(filepath.Join(".carlos", "config"), url, "bab", 0o755); err != nil {
+ t.Fatal(err)
+ }
+ }
+ buf := captureStdout(t)
+ RunServices(verb)
+ var got map[string]any
+ dec := json.NewDecoder(strings.NewReader(buf.String()))
+ if err := dec.Decode(&got); err != nil {
+ t.Fatalf("stdout is not JSON: %v\n%s", err, buf)
+ }
+ var extra json.RawMessage
+ if err := dec.Decode(&extra); !errors.Is(err, io.EOF) {
+ t.Fatalf("stdout carries more than one JSON value:\n%s", buf)
+ }
+ if got["account"] != tc.want || got["secret"] != tokenFor(1) {
+ t.Fatalf("object = %v, want account %s and the secret", got, tc.want)
+ }
+ if stdout != buf {
+ t.Fatal("the verb left the package stdout pointed elsewhere")
+ }
+ })
+ }
+ }
+}
+
+type fullWriter struct{}
+
+func (fullWriter) Write([]byte) (int, error) { return 0, errors.New("no space left on device") }
+
+// A secret that could not be written is a failure, and the refusal says
+// how to recover without the secret in it (#1056 review R1, P2).
+func TestServicesJSONWriteFailureIsReported(t *testing.T) {
+ err := writeServiceJSON(fullWriter{}, serviceRotatedJSON{Name: "amadan-hub", Account: "bab", Secret: tokenFor(1)})
+ if err == nil {
+ t.Fatal("a failed write returned nil")
+ }
+ msg := serviceSecretUnwritten("services rotate", "rotated", "bab", "amadan-hub", err).Error()
+ for _, want := range []string{"amadan-hub was rotated", "could not be written", "no space left on device", "carlos services rotate --account bab amadan-hub"} {
+ if !strings.Contains(msg, want) {
+ t.Fatalf("refusal %q lacks %q", msg, want)
+ }
+ }
+ if strings.Contains(msg, tokenFor(1)) {
+ t.Fatalf("refusal carries the secret: %q", msg)
+ }
+}
+
+// Through the binary with stdout on /dev/full: non-zero, the refusal on
+// stderr, and no secret anywhere.
+func TestServicesJSONToAFullDeviceExitsNonZero(t *testing.T) {
+ full, err := os.OpenFile("/dev/full", os.O_WRONLY, 0)
+ if err != nil {
+ t.Skip("no /dev/full here")
+ }
+ defer full.Close()
+ bin := buildCarlos(t)
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if !strings.HasSuffix(r.URL.Path, "/rotate") {
+ w.WriteHeader(http.StatusCreated)
+ }
+ json.NewEncoder(w).Encode(map[string]any{"token": tokenFor(1), "doors": []string{}})
+ }))
+ defer ts.Close()
+ scratch := t.TempDir()
+ creds := filepath.Join(scratch, "credentials")
+ writeTestCredential(t, creds, ts.URL)
+ for _, args := range [][]string{
+ {"services", "create", "--role", "publish", "--account", "bab", "--json", "amadan-hub"},
+ {"services", "rotate", "--account", "bab", "--json", "amadan-hub"},
+ } {
+ cmd := exec.Command(bin, args...)
+ cmd.Env = carlosTestEnv(t, "CARLOS_CREDENTIALS="+creds, "CARLOS_DEPLOYMENT_BUCKET=", "CARLOS_DEPLOYMENT_DIR=")
+ cmd.Dir = scratch
+ cmd.Stdout = full
+ var stderr strings.Builder
+ cmd.Stderr = &stderr
+ if err := cmd.Run(); err == nil {
+ t.Fatalf("%s exited 0 with the secret unwritten; stderr:\n%s", args[1], stderr.String())
+ }
+ if !strings.Contains(stderr.String(), "could not be written") || strings.Contains(stderr.String(), tokenFor(1)) {
+ t.Fatalf("%s: stderr = %q, want the refusal without the secret", args[1], stderr.String())
+ }
+ }
+}
diff --git a/testdata/clireg-golden.jsonl b/testdata/clireg-golden.jsonl
index be0167708..8ffcc0be1 100644
--- a/testdata/clireg-golden.jsonl
+++ b/testdata/clireg-golden.jsonl
@@ -673,30 +673,30 @@
{"case":"secrets genkey | skipped","skipped":"prints a freshly generated key pair: no two runs agree"}
{"case":"secrets list | --zz-unknown-flag","argv":["secrets","list","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos secrets list [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to list (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
{"case":"secrets list | -h","argv":["secrets","list","-h"],"exit":0,"stdout":"","stderr":"usage: carlos secrets list [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to list (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
-{"case":"secrets set | --zz-unknown-flag","argv":["secrets","set","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos secrets set [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to set in (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
-{"case":"secrets set | -h","argv":["secrets","set","-h"],"exit":0,"stdout":"","stderr":"usage: carlos secrets set [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to set in (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
+{"case":"secrets set | --zz-unknown-flag","argv":["secrets","set","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos secrets set [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to set in (omit for the default bundle)\n --literal store a value that starts with its own key and = as it is\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
+{"case":"secrets set | -h","argv":["secrets","set","-h"],"exit":0,"stdout":"","stderr":"usage: carlos secrets set [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to set in (omit for the default bundle)\n --literal store a value that starts with its own key and = as it is\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
{"case":"secrets unset | --zz-unknown-flag","argv":["secrets","unset","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos secrets unset [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to remove from (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
{"case":"secrets unset | -h","argv":["secrets","unset","-h"],"exit":0,"stdout":"","stderr":"usage: carlos secrets unset [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --console <string> console origin to work through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --environment, -e <string> named environment bundle to remove from (omit for the default bundle)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n"}
-{"case":"secrets | --help","argv":["secrets","--help"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | --zz-unknown-flag","argv":["secrets","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | -h","argv":["secrets","-h"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | bare","argv":["secrets"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | help","argv":["secrets","help"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"secrets | zz-unknown","argv":["secrets","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
-{"case":"services create | --zz-unknown-flag","argv":["services","create","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos services create [flags]\nflags:\n --account <string> account (sqid or name) to mint the credential in (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> bind the credential to one app (default: account-wide)\n --commands <string> command prefixes a run credential may run, comma-separated, words space-separated: \"import classic,import sync\" (required with --role run)\n --console <string> console to create it through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --role <string> role: publish, deploy, instance, operate, service, run, team or admin (required)\n --rungs <string> rungs a deploy credential may move, comma-separated: canary, edge, beta (required with --role deploy)\n --scope <string> scope name a team credential holds: the environments it owns (required with --role team, with --app)\n"}
-{"case":"services create | -h","argv":["services","create","-h"],"exit":0,"stdout":"","stderr":"usage: carlos services create [flags]\nflags:\n --account <string> account (sqid or name) to mint the credential in (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> bind the credential to one app (default: account-wide)\n --commands <string> command prefixes a run credential may run, comma-separated, words space-separated: \"import classic,import sync\" (required with --role run)\n --console <string> console to create it through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --role <string> role: publish, deploy, instance, operate, service, run, team or admin (required)\n --rungs <string> rungs a deploy credential may move, comma-separated: canary, edge, beta (required with --role deploy)\n --scope <string> scope name a team credential holds: the environments it owns (required with --role team, with --app)\n"}
+{"case":"secrets | --help","argv":["secrets","--help"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | --zz-unknown-flag","argv":["secrets","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | -h","argv":["secrets","-h"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | bare","argv":["secrets"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | help","argv":["secrets","help"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"secrets | zz-unknown","argv":["secrets","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos secrets <command>\n\ncommands:\n set --app <a> [--environment <name>] KEY=value [KEY2=value2 ...] seal and set one or more secrets\n --app <a> [--environment <name>] KEY - the same, reading KEY's value from stdin\n unset --app <a> [--environment <name>] KEY [KEY2 ...] remove secrets\n list --app <a> [--environment <name>] list a secret's key names only — never values\n genkey mint a CARLOS_SECRETS_KEY/PUBKEY pair\n fingerprint [--file <path>] print the fingerprint of the key in a host.env, never the key\n\n--environment names a bundle at apps/<acct>/<app>/environments/<name>.json —\nsee \"carlos env\" for the full explanation; the same bundle backs both env\nvars and secrets, sealed or not. \"carlos env environments --app <a>\" lists\nan app's bundle names.\n\nset/unset/list also work through a logged-in console (carlos auth login)\nwhen CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR are unset —\n[--console <origin>] picks which logged-in console when more than one is\nconfigured; the store env vars win outright when set (direct-bucket mode,\nunchanged). In that mode \"secrets set\" seals with CARLOS_SECRETS_PUBKEY if\nit's set in this terminal's own environment, otherwise the console's own\nserved public key (Config.SecretsPub) if it has one — CARLOS_SECRETS_KEY\n(the PRIVATE half) never leaves the box holding it either way.\ngenkey and fingerprint are always local, in both modes.\nfor an app placed on a fleet the console serves the fleet's own key, so leave\nCARLOS_SECRETS_PUBKEY unset. register that key with \"carlos fleets secrets-key\".\n"}
+{"case":"services create | --zz-unknown-flag","argv":["services","create","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos services create [flags]\nflags:\n --account <string> account (sqid or name) to mint the credential in (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> bind the credential to one app (default: account-wide)\n --commands <string> command prefixes a run credential may run, comma-separated, words space-separated: \"import classic,import sync\" (required with --role run)\n --console <string> console to create it through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --json print the credential and its bare secret as one JSON object, for a script\n --role <string> role: publish, deploy, instance, operate, service, run, team or admin (required)\n --rungs <string> rungs a deploy credential may move, comma-separated: canary, edge, beta (required with --role deploy)\n --scope <string> scope name a team credential holds: the environments it owns (required with --role team, with --app)\n"}
+{"case":"services create | -h","argv":["services","create","-h"],"exit":0,"stdout":"","stderr":"usage: carlos services create [flags]\nflags:\n --account <string> account (sqid or name) to mint the credential in (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --app, -a <string> bind the credential to one app (default: account-wide)\n --commands <string> command prefixes a run credential may run, comma-separated, words space-separated: \"import classic,import sync\" (required with --role run)\n --console <string> console to create it through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --json print the credential and its bare secret as one JSON object, for a script\n --role <string> role: publish, deploy, instance, operate, service, run, team or admin (required)\n --rungs <string> rungs a deploy credential may move, comma-separated: canary, edge, beta (required with --role deploy)\n --scope <string> scope name a team credential holds: the environments it owns (required with --role team, with --app)\n"}
{"case":"services ls | --zz-unknown-flag","argv":["services","ls","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos services ls [flags]\nflags:\n --account <string> account (sqid or name) to list credentials for (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
{"case":"services ls | -h","argv":["services","ls","-h"],"exit":0,"stdout":"","stderr":"usage: carlos services ls [flags]\nflags:\n --account <string> account (sqid or name) to list credentials for (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to list through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
{"case":"services revoke | --zz-unknown-flag","argv":["services","revoke","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos services revoke [flags]\nflags:\n --account <string> account (sqid or name) the credential belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to revoke through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
{"case":"services revoke | -h","argv":["services","revoke","-h"],"exit":0,"stdout":"","stderr":"usage: carlos services revoke [flags]\nflags:\n --account <string> account (sqid or name) the credential belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to revoke through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
-{"case":"services rotate | --zz-unknown-flag","argv":["services","rotate","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos services rotate [flags]\nflags:\n --account <string> account (sqid or name) the credential belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to rotate through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
-{"case":"services rotate | -h","argv":["services","rotate","-h"],"exit":0,"stdout":"","stderr":"usage: carlos services rotate [flags]\nflags:\n --account <string> account (sqid or name) the credential belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to rotate through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n"}
-{"case":"services | --help","argv":["services","--help"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
-{"case":"services | --zz-unknown-flag","argv":["services","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
-{"case":"services | -h","argv":["services","-h"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
-{"case":"services | bare","argv":["services"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
-{"case":"services | help","argv":["services","help"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
-{"case":"services | zz-unknown","argv":["services","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
+{"case":"services rotate | --zz-unknown-flag","argv":["services","rotate","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos services rotate [flags]\nflags:\n --account <string> account (sqid or name) the credential belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to rotate through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --json print the name, account and bare secret as one JSON object, for a script\n"}
+{"case":"services rotate | -h","argv":["services","rotate","-h"],"exit":0,"stdout":"","stderr":"usage: carlos services rotate [flags]\nflags:\n --account <string> account (sqid or name) the credential belongs to (default: your only account, or the configured/chosen one)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account\n --console <string> console to rotate through (default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --json print the name, account and bare secret as one JSON object, for a script\n"}
+{"case":"services | --help","argv":["services","--help"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] [--json] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n --json prints one JSON object and nothing else, the bare\n secret in its \"secret\" field: carlos services create\n ... --json name | jq -r .secret\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] [--json] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke. --json prints one JSON\n object, {\"name\", \"account\", \"secret\"}, and nothing else.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
+{"case":"services | --zz-unknown-flag","argv":["services","--zz-unknown-flag"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] [--json] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n --json prints one JSON object and nothing else, the bare\n secret in its \"secret\" field: carlos services create\n ... --json name | jq -r .secret\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] [--json] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke. --json prints one JSON\n object, {\"name\", \"account\", \"secret\"}, and nothing else.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
+{"case":"services | -h","argv":["services","-h"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] [--json] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n --json prints one JSON object and nothing else, the bare\n secret in its \"secret\" field: carlos services create\n ... --json name | jq -r .secret\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] [--json] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke. --json prints one JSON\n object, {\"name\", \"account\", \"secret\"}, and nothing else.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
+{"case":"services | bare","argv":["services"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] [--json] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n --json prints one JSON object and nothing else, the bare\n secret in its \"secret\" field: carlos services create\n ... --json name | jq -r .secret\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] [--json] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke. --json prints one JSON\n object, {\"name\", \"account\", \"secret\"}, and nothing else.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
+{"case":"services | help","argv":["services","help"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] [--json] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n --json prints one JSON object and nothing else, the bare\n secret in its \"secret\" field: carlos services create\n ... --json name | jq -r .secret\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] [--json] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke. --json prints one JSON\n object, {\"name\", \"account\", \"secret\"}, and nothing else.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
+{"case":"services | zz-unknown","argv":["services","zz-unknown"],"exit":1,"stdout":"","stderr":"usage: carlos services <create|ls|rotate|revoke> [flags]\n\n create --role <publish|deploy|instance|operate|service|run|admin> [--app <app>] [--account <sqid|name>] [--json] <name>\n mint a credential a SERVER holds, bound to this account —\n not to you. Unlike your own CLI token, its reach is fixed\n at mint: adding you to another account later does not widen\n it, and it draws on its own rate-limit budgets rather than\n yours.\n THE SECRET IS PRINTED EXACTLY ONCE, HERE. Only its hash is\n stored, so losing this output means rotate, not a re-run.\n --role admin INCLUDES `store grant`, which mints a\n path-scoped IAM user. It is a real handover, not a\n convenience bundle. Prefer the narrowest role that works.\n --app binds it to ONE app, which also means it cannot create\n apps. Omit --app for an account-scoped credential.\n --role run needs --app and --commands, the command\n prefixes it may run: --commands \"import classic,import sync\".\n Words are matched exactly, from the start of the command.\n --json prints one JSON object and nothing else, the bare\n secret in its \"secret\" field: carlos services create\n ... --json name | jq -r .secret\n\n ls [--account <sqid|name>]\n list every LIVE credential the account owns — name, role,\n scope, when it was minted and last rotated and used, and\n who minted it. A revoked credential does not appear; there\n is no history view here.\n\n rotate [--account <sqid|name>] [--json] <name>\n mint a FRESH secret for a credential that already exists,\n printed exactly once. This refuses the credential's NEXT\n call with the old secret. ROTATION IS NOT REVOCATION: it\n does not stop work already in flight, and a credential that\n may be COMPROMISED needs revoke. --json prints one JSON\n object, {\"name\", \"account\", \"secret\"}, and nothing else.\n\n revoke [--account <sqid|name>] <name-or-id>\n the hard stop rotate is not: the credential's next call\n fails, whatever secret it holds. Idempotent — revoking a\n name twice, or one that never existed, answers the same.\n Takes a credential's name, or the listing id `ls` shows\n (the only handle a nameless legacy credential has).\n\n --account <sqid|name> account the credential belongs to (default: your only\n account, or the configured/chosen one) —\n resolved by the console against your own\n memberships.\n --account-id <sqid> account sqid, matched as a sqid ONLY — supersedes\n --account\n --console <origin> which logged-in console to use (only needed with\n several)\n\nEvery verb here is signed-in only (carlos auth login), owner-only, and\nclosed to a service credential itself — no service credential can create,\nrotate or revoke any credential, not even itself, not even an admin one.\nService credentials are console-tracked state with no bucket-direct fallback.\n"}
{"case":"ship | --zz-unknown-flag","argv":["ship","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nusage: carlos ship [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --assets <value> a folder your build writes files to, for example /assets/. repeat the flag for up to 8 folders. servers near your visitors may keep copies of the files in them\n --capabilities <string> path to a JSON capability block (internal/caps) to embed in the manifest\n --check run the rootfs image here with Docker or Podman, the way a box would, and ship nothing\n --console <string> console origin to ship through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --env <value> with --check, give every process a variable as KEY=VALUE, such as a placeholder secret. repeat it for more than one\n --hibernate let this rootfs app hibernate when idle. rootfs apps are always on unless their first release opts in\n --jit let this rootfs release's processes run a JIT compiler, as Node, Bun, Deno, the JVM and Ruby's YJIT need. without it a box never lets memory be writable and executable at once\n --kind <string> binary | static (default: binary)\n --label <string> one-line human label for this release (\"fixing modals\")\n --message <string> Add a short note describing this change (shown alongside the recorded action).\n --no-prompt Skip the optional change description prompt.\n --notes <string> changelog fragment for this release\n --notes-file <string> file holding the changelog fragment (mutually exclusive with --notes)\n --processes <string> JSON file holding the rootfs release's processes: web, any workers, release and console\n --program-change accept that this release's Go main package differs from the app's previous release (recorded in the manifest)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n --rootfs <string> an OCI image (a layout directory, a docker save archive or a local image name) or a directory, shipped as a rootfs release\n --stateless this release keeps no local database. CARLOS_DB, SQLite, restore and Litestream are off\n --swap <string> hold: this release stops each instance before starting it, for a migration the previous build cannot share the database with\n --target <string> GOOS-GOARCH the binary was built for (binary kind, single file) (default: linux-arm64)\n --version, -v <string> version (git short sha); omit to mint the next iteration under the app's version target\n"}
{"case":"ship | -h","argv":["ship","-h"],"exit":0,"stdout":"","stderr":"usage: carlos ship [flags]\nflags:\n --account <string> account (sqid or name) the app belongs to (default: your only account, or the configured/chosen one; ops in direct mode)\n --account-id <string> account sqid, matched as a sqid ONLY — supersedes --account; this is the flag an ambiguity error tells you to use\n --app, -a <string> app name\n --assets <value> a folder your build writes files to, for example /assets/. repeat the flag for up to 8 folders. servers near your visitors may keep copies of the files in them\n --capabilities <string> path to a JSON capability block (internal/caps) to embed in the manifest\n --check run the rootfs image here with Docker or Podman, the way a box would, and ship nothing\n --console <string> console origin to ship through (API mode only; default: the only logged-in one)\n --destination, -d <name> use the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n --env <value> with --check, give every process a variable as KEY=VALUE, such as a placeholder secret. repeat it for more than one\n --hibernate let this rootfs app hibernate when idle. rootfs apps are always on unless their first release opts in\n --jit let this rootfs release's processes run a JIT compiler, as Node, Bun, Deno, the JVM and Ruby's YJIT need. without it a box never lets memory be writable and executable at once\n --kind <string> binary | static (default: binary)\n --label <string> one-line human label for this release (\"fixing modals\")\n --message <string> Add a short note describing this change (shown alongside the recorded action).\n --no-prompt Skip the optional change description prompt.\n --notes <string> changelog fragment for this release\n --notes-file <string> file holding the changelog fragment (mutually exclusive with --notes)\n --processes <string> JSON file holding the rootfs release's processes: web, any workers, release and console\n --program-change accept that this release's Go main package differs from the app's previous release (recorded in the manifest)\n --registry <string> registry database (resolves --account) (default: $DIR/data/registry.db)\n --rootfs <string> an OCI image (a layout directory, a docker save archive or a local image name) or a directory, shipped as a rootfs release\n --stateless this release keeps no local database. CARLOS_DB, SQLite, restore and Litestream are off\n --swap <string> hold: this release stops each instance before starting it, for a migration the previous build cannot share the database with\n --target <string> GOOS-GOARCH the binary was built for (binary kind, single file) (default: linux-arm64)\n --version, -v <string> version (git short sha); omit to mint the next iteration under the app's version target\n"}
{"case":"sidecars create | --zz-unknown-flag","argv":["sidecars","create","--zz-unknown-flag"],"exit":2,"stdout":"","stderr":"flag provided but not defined: -zz-unknown-flag\nUsage of sidecars create:\n -account string\n \taccount (sqid or name) the app belongs to (default: your only account, or the configured/chosen one)\n -account-id string\n \taccount sqid, matched as a sqid ONLY — supersedes -account\n -app string\n \tapp the sidecar belongs to\n -channel string\n \trelease channel the sidecar follows (default: the manifest's, then stable)\n -console string\n \tconsole to create through (default: the only logged-in one)\n -d value\n \talias for --destination\n -destination name\n \tuse the named block from .carlos/config's destinations (default: CARLOS_DESTINATION, else the file's default or only one)\n -region string\n \tregion code for the record (subject to the manifest's allow-list, or the app's own placement)\n"}