Skip to content

feat(foo): CLI conventions parity for host binary#4

Merged
jadb merged 7 commits into
mainfrom
cli-parity-foo
Jun 17, 2026
Merged

feat(foo): CLI conventions parity for host binary#4
jadb merged 7 commits into
mainfrom
cli-parity-foo

Conversation

@jadb

@jadb jadb commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Brings the foo host binary to parity with the kit CLI conventions. Closes the yellow-verdict gaps from the CLI review (8/12 → green): exit-code semantics, missing globals, config inspection, alias support, DB backups, and domain events.

Changes

  • Globals — register --offline, --profile, --instance. --offline gates the upgrade check and remote calls; --profile scopes config + secret lookups; --instance is plumbed but a no-op on this single-instance build (noted in help text).
  • Secrets — route the two raw os.Getenv API-key reads (internal/llm, internal/embed) through the secret store, env backend preserved as fallback.
  • config path / config paths — add the config parent command and wire kit's path subcommands so the layered config stack is inspectable.
  • Aliases — adopt the kit alias store and mount alias (management group).
  • Exit codes — not-found enrichers return typed output.NotFoundError (3); missing-key returns output.UnauthorizedError (5); main extracts the semantic ExitCode instead of a flat os.Exit(1).
  • DB backups — back up embeddings.db / schemas.db under <stateDir>/.dbs/ before migrate.
  • Events — publish 4-part [source].[category].[object].[action] domain events from pattern/schema/model/embed mutations and wire a network adapter so siblings can subscribe (previously in-process only). Topic policy documented in docs/reference/event-topics.md.

Verification

  • go build ./... + go vet ./... clean.
  • e2e suite passes (go test ./tests/e2e/ with -buildvcs=false).
  • Smoke-tested config paths, alias, and the new globals.

Notes

  • No conflict (exit 4) sites: foo's creates are replace-semantics, no create-on-conflict path exists.
  • No provider events: provider is read-only (list/show).

Copilot AI review requested due to automatic review settings June 16, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

jadb added 7 commits June 17, 2026 01:31
Globals on root persistent flag set; honor in runtime init. --offline
gates upgrade check + remote calls via networkAllowed. --profile scopes
secret store Service; --instance plumbed (single-instance build, no-op).
ShowAliases enabled.
Route llm.buildClient + embed OpenAI key reads through kit secret store
(default env backend). Secret key lower-cases env var name; env backend
maps back to uppercase var, preserving behavior. Raw os.Getenv fallback
on store-open failure.
New config parent (management group) wires kit cli/config
RegisterPathSubcommands with a core/config foo-scoped resolver. Yields
foo config path + foo config paths.
Construct alias.NewStore at ~/.config/foo/aliases.yaml, load it, mount
root.AliasCmd in management group. ShowAliases already set surfaces
aliases in help. Store-load failure non-fatal.
Pattern/schema not-found enrichers return output.NotFoundError (exit 3);
missing API key returns output.UnauthorizedError (exit 5) in llm +
embed. main.go extracts AsCLIError().ExitCode via errors.As, falling
back to 1. No conflict (4) sites: foo creates are replace-semantics.
Call sqlstore.BackupBeforeMigrate for embeddings.db + schemas.db before
sql.Open + NewStore migrations, writing timestamped copies into
<stateDir>/.dbs/. No-op on first run; never beside the live DB.
Publish 4-part [source].[category].[object].[action] events for pattern
create/delete/import, schema create/delete/compile, model default, embed
add/file, collection delete. Migrate fragment topics to 4-part form.
Wire bus.NewNetworkAdapter (FOO_BUS_PEERS, FOO_BUS_TOKEN; offline-gated)
so events reach external subscribers. Add event-topic namespace policy.
@jadb jadb force-pushed the cli-parity-foo branch from 7ebc9de to b4b1275 Compare June 17, 2026 05:32
@jadb jadb merged commit c451c3f into main Jun 17, 2026
2 checks passed
@jadb jadb deleted the cli-parity-foo branch June 17, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants