Maintainer fixups for PR #4419 folded into one commit on top of the
contributor branch.
Security (blocker): metrics consent and endpoint are resolved from the
user-global config only (config.MetricsDisabledByUserConfig /
UserMetricsEndpoint). A project/BEADS_DIR config — highest viper precedence —
can no longer re-enable metrics or redirect the endpoint for a user who ran
`bd metrics off`.
First-run notice (major): the consent notice runs after the config-derived
json/quiet rebind and command classification, and is suppressed in
JSON/quiet/hook-json, BD_GIT_HOOK, hook/codex-hook/completion/shell-init/
version/prime, the metrics command, `init --stealth`, and the root
`bd --version` / `bd -V` probe, so it can never corrupt machine-readable or
hook/protocol output.
One cli_command event per invocation (major): delegating commands no longer
double-count. `bd ready --gated` and `bd mol wisp <proto>` record only their
own event by delegating to non-emitting cores (runMolReadyGatedCore /
runWispCreateCore), matching the existing runTodoListCore/runListCore pattern;
cardinality regression tests cover both aliases.
config get/show honor user-global metrics state (major): `bd config get
metrics.*` and `bd config show` report the user-global value (via
config.GetUserYamlConfig) that actually governs runtime behavior, with the
user-global path as the location, instead of a project value that has no
runtime effect.
Metrics cleanup on os.Exit paths (major): CheckReadonly and the reachable
pre-run gates (no-DB, fresh-clone, schema-skew, remote-migrate-gate, identity
mismatch) call the shared metrics.CloseAndFlush before exiting, so events
queued earlier in the run are still written and scheduled for upload instead
of stranded until the next clean exit. main()'s post-command tail uses the
same helper. `bd q` now creates its event before the readonly guard and labels
the readonly operation "q".
Telemetry coverage (major): recompute-blocked converted to RunE + HandleError
and emits a cli_command event; `metrics on/off/example` and `version` emit
cli_command events.
Consistency / minor cleanups: added SilenceUsage/SilenceErrors to the
ADO/GitHub/GitLab/Notion push/pull commands to match the jira/linear siblings
in the same file; corrected the inverted env-override "saved config" status
text; preserved 0600 when unsetting user-global config keys.
Pre-review CI repair (earlier in this commit): lint, stealth-init
cleanliness, proxied-server error handling, and regenerated CLI docs.
Tests: user-global opt-out vs project override at the config readers, runtime
resolvers, and `config get`; first-run notice suppression across
hook/protocol/json/quiet/stealth/root-version contexts; event cardinality for
the todo/ready-gated/wisp aliases; and CloseAndFlush persistence.
Original contributor commits preserved.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>