feat(foo): CLI conventions parity for host binary#4
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings the
foohost 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
--offline,--profile,--instance.--offlinegates the upgrade check and remote calls;--profilescopes config + secret lookups;--instanceis plumbed but a no-op on this single-instance build (noted in help text).os.GetenvAPI-key reads (internal/llm,internal/embed) through the secret store, env backend preserved as fallback.config path/config paths— add theconfigparent command and wire kit's path subcommands so the layered config stack is inspectable.alias(management group).output.NotFoundError(3); missing-key returnsoutput.UnauthorizedError(5);mainextracts the semanticExitCodeinstead of a flatos.Exit(1).embeddings.db/schemas.dbunder<stateDir>/.dbs/before migrate.[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 indocs/reference/event-topics.md.Verification
go build ./...+go vet ./...clean.go test ./tests/e2e/with-buildvcs=false).config paths,alias, and the new globals.Notes
provideris read-only (list/show).