feat(cli): add JSON output for extension inventory and provenance#100
Open
Adams521 wants to merge 2 commits into
Open
feat(cli): add JSON output for extension inventory and provenance#100Adams521 wants to merge 2 commits into
Adams521 wants to merge 2 commits into
Conversation
4f9544a to
4ec34f2
Compare
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.
Why
HarnessKit already tracks rich extension inventory, source, and install metadata internally, but the CLI currently exposes this information primarily through human-readable output.
That makes it harder for terminal-first users, headless/server workflows, local scripts, debugging, and issue triage to inspect what HarnessKit already knows about installed extensions.
This PR adds machine-readable JSON output for the existing
hk listandhk info <name>commands. It is intentionally limited to the current CLI semantics:hk list --jsonmirrors the existing grouped/deduped list table.hk info <name> --jsonmirrors the existing first-name-match detail view.This gives users and maintainers a script-friendly way to inspect existing inventory/provenance data without introducing a new inventory model or update system.
Summary
--jsonoutput forhk list.--jsonoutput forhk info <name>.schema_version: 1.hk list --jsonlimited to grouped table fields.hk info <name> --json.Details
hk list --jsonmirrors the current grouped/deduped table semantics and exposes only table-level fields:namekindagentspacktrust_scoreenabledstatusIt intentionally does not expose instance-level fields such as
id,source_path,source,install_meta,update_eligible,update_reason,remote_revision,checked_at,check_error, or nested instances.hk info <name> --jsonmirrors the current first-name-match behavior and exposes detailed metadata for the selected extension, including existing source and static install metadata fields.Update eligibility is static and derived from the existing
service::is_update_eligiblerule. This PR does not perform update checks, call remotes, or expose cached update status.Non-goals
This PR does not:
check-updatesgit ls-remoteImplementation notes
crates/hk-cli/src/main.rs.Extension.hk list agents --jsonremains unsupported and returns a stable error:--json is only supported for extension list output, not list agentsValidation
Automated:
cargo fmt --check --package hk-clicargo test -p hk-cli(17 tests passed)cargo test --workspace(hk-cli 17, hk-core 532, hk-core integration 8, hk-desktop 2, hk-web 3, hk-web integration 6)npm test(32 files / 249 tests passed)git diff --checkcrates/hk-cli/src/main.rsManual smoke:
cargo run -p hk-cli -- listcargo run -p hk-cli -- list --jsoncargo run -p hk-cli -- list --kind skill --jsoncargo run -p hk-cli -- list --agent codex --jsoncargo run -p hk-cli -- list agentscargo run -p hk-cli -- list agents --json(returned the expected unsupported error)cargo run -p hk-cli -- list --helpcargo run -p hk-cli -- info --helpIf local extensions were available:
cargo run -p hk-cli -- info <existing-extension-name>cargo run -p hk-cli -- info <existing-extension-name> --jsonRisk and mitigation
--jsonis passed.