feat(cli): add inventory subcommand to enumerate KB-known AI artifacts#51
Merged
jonathansantilli merged 1 commit intomainfrom Apr 21, 2026
Merged
feat(cli): add inventory subcommand to enumerate KB-known AI artifacts#51jonathansantilli merged 1 commit intomainfrom
jonathansantilli merged 1 commit intomainfrom
Conversation
`codegate inventory` walks every tool entry in the knowledge base, resolves
each `config_paths` and `skill_paths` pattern against `$HOME` (user scope)
or the workspace root(s) (project scope), and emits the result as either a
human table or machine-readable JSON.
Motivation: downstream tooling (IDE extensions, CI agents, dashboards) was
maintaining its own hard-coded lists of "places to look for AI skills"
because the KB wasn't queryable. Exposing it as a first-class subcommand
makes that parallel list unnecessary and keeps every consumer in sync when
the KB adds a new tool or layout.
### Usage
```
codegate inventory [options]
--scope <user|project|all> scope filter (default: all)
--kind <skills|configs|all> artifact kind filter (default: all)
--only-existing filter to paths that exist on disk
--workspace <path> project-scope root (repeatable; defaults to cwd)
--format <text|json> output format (default: text)
```
Example consumer call:
```
codegate inventory --kind skills --scope user --only-existing --format json
```
Returns one entry per resolved skill file across every KB-registered tool
(`.claude/skills/*/SKILL.md`, `.codex/skills/**/*.md`, `.opencode/skills/`,
`.cline/skills/`, `.gemini/skills/`, `.roo/skills/`, etc.), with `tool`,
`type`, `scope`, `path`, `exists`, and `risk_surface` on each item.
### JSON output shape
```json
{
"kb_version": "1.0.0",
"tools": [{"name": "claude-code", "version_range": ">=1.0.0"}, ...],
"items": [
{
"tool": "claude-code",
"kind": "skill",
"type": "anthropic_skill",
"scope": "user",
"pattern": ".claude/skills/*/SKILL.md",
"path": "/Users/alice/.claude/skills/foo/SKILL.md",
"exists": true,
"risk_surface": ["prompt_injection", "unicode_backdoor",
"command_exec", "mcp_config"],
"resolved_against": "/Users/alice"
},
...
]
}
```
### Implementation notes
- Reuses `loadKnowledgeBase()` from `layer1-discovery/knowledge-base`; no
duplication of KB parsing.
- Wildcard expansion (`*`, `**`, `?`) implemented inline in the command
file rather than reaching into `scan.ts`'s private helpers — keeps the
command self-contained and avoids widening `scan.ts`'s export surface.
- Refuses to follow symlinks during wildcard expansion (parity with the
existing scanner).
- Deterministic ordering (tool → kind → scope → path) so output is stable
across runs on the same machine.
- Depth- and count-limited walks (`MAX_WILDCARD_DEPTH = 8`,
`MAX_WILDCARD_MATCHES = 2000`) to keep it bounded on large homedirs.
### Tests
- `tests/commands/inventory-command.test.ts` — 8 unit tests covering
filters, scope resolution, `--only-existing`, wildcard expansion against
a seeded temp `$HOME`, empty-workspace edge case, ordering.
- `tests/cli/inventory-command.test.ts` — 3 integration tests via
`createCli()` + `parseAsync()`: JSON output, `--only-existing --kind
skills` end-to-end, text-format rendering.
Full test suite: 694/694 pass; typecheck clean; prettier applied.
github-actions Bot
pushed a commit
that referenced
this pull request
Apr 21, 2026
# [0.14.0](v0.13.0...v0.14.0) (2026-04-21) ### Features * **cli:** add `inventory` subcommand to enumerate KB-known AI artifacts ([#51](#51)) ([620b112](620b112))
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.
Summary
New
codegate-ai inventorysubcommand that walks every tool entry in the knowledge base, resolvesconfig_pathsandskill_pathsagainst\$HOME/ workspace root(s), and emits the result as either a human table or machine-readable JSON.Why
Downstream tooling (IDE extensions, CI agents, dashboards) has been maintaining its own hard-coded lists of "places to look for AI skills / configs" because the KB wasn't queryable. Every time the KB adds a new tool or a new path (like this week's Anthropic Skills entry in #49), those downstream lists silently go stale.
This exposes the KB as structured data so every consumer can read it instead of duplicating it.
Usage
```
codegate inventory [options]
--scope <user|project|all> scope filter (default: all)
--kind <skills|configs|all> artifact kind filter (default: all)
--only-existing filter to paths that exist on disk
--workspace project-scope root (repeatable; defaults to cwd)
--format <text|json> output format (default: text)
```
Example output (JSON)
```json
{
"kb_version": "1.0.0",
"tools": [{ "name": "claude-code", "version_range": ">=1.0.0" }, …],
"items": [
{
"tool": "claude-code",
"kind": "skill",
"type": "anthropic_skill",
"scope": "user",
"pattern": ".claude/skills/*/SKILL.md",
"path": "/Users/alice/.claude/skills/foo/SKILL.md",
"exists": true,
"risk_surface": ["prompt_injection", "unicode_backdoor", "command_exec", "mcp_config"],
"resolved_against": "/Users/alice"
},
…
]
}
```
Consumer use cases
Implementation notes
Tests
Test plan
Follow-up (separate PRs)