@hashicorp/kits 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +51 -683
  2. package/dist/adapters/claude-code/detection.d.ts +1 -1
  3. package/dist/adapters/claude-code/detection.d.ts.map +1 -1
  4. package/dist/adapters/claude-code/detection.js +3 -2
  5. package/dist/adapters/claude-code/detection.js.map +1 -1
  6. package/dist/adapters/claude-code/index.d.ts +1 -1
  7. package/dist/adapters/claude-code/index.d.ts.map +1 -1
  8. package/dist/adapters/claude-code/index.js +3 -1
  9. package/dist/adapters/claude-code/index.js.map +1 -1
  10. package/dist/adapters/claude-code/installer.d.ts.map +1 -1
  11. package/dist/adapters/claude-code/installer.js +5 -9
  12. package/dist/adapters/claude-code/installer.js.map +1 -1
  13. package/dist/adapters/gemini-cli/detection.d.ts +1 -1
  14. package/dist/adapters/gemini-cli/detection.d.ts.map +1 -1
  15. package/dist/adapters/gemini-cli/detection.js +3 -2
  16. package/dist/adapters/gemini-cli/detection.js.map +1 -1
  17. package/dist/adapters/gemini-cli/index.d.ts +1 -1
  18. package/dist/adapters/gemini-cli/index.d.ts.map +1 -1
  19. package/dist/adapters/gemini-cli/index.js +3 -1
  20. package/dist/adapters/gemini-cli/index.js.map +1 -1
  21. package/dist/adapters/gemini-cli/installer.d.ts.map +1 -1
  22. package/dist/adapters/gemini-cli/installer.js +5 -9
  23. package/dist/adapters/gemini-cli/installer.js.map +1 -1
  24. package/dist/adapters/github-copilot/detection.d.ts +1 -1
  25. package/dist/adapters/github-copilot/detection.d.ts.map +1 -1
  26. package/dist/adapters/github-copilot/detection.js +3 -2
  27. package/dist/adapters/github-copilot/detection.js.map +1 -1
  28. package/dist/adapters/github-copilot/index.d.ts +1 -1
  29. package/dist/adapters/github-copilot/index.d.ts.map +1 -1
  30. package/dist/adapters/github-copilot/index.js +2 -1
  31. package/dist/adapters/github-copilot/index.js.map +1 -1
  32. package/dist/adapters/github-copilot/installer.d.ts.map +1 -1
  33. package/dist/adapters/github-copilot/installer.js +6 -3
  34. package/dist/adapters/github-copilot/installer.js.map +1 -1
  35. package/dist/adapters/opencode/detection.d.ts.map +1 -1
  36. package/dist/adapters/opencode/detection.js +3 -2
  37. package/dist/adapters/opencode/detection.js.map +1 -1
  38. package/dist/adapters/opencode/index.d.ts.map +1 -1
  39. package/dist/adapters/opencode/index.js +43 -20
  40. package/dist/adapters/opencode/index.js.map +1 -1
  41. package/dist/adapters/opencode/installer.d.ts.map +1 -1
  42. package/dist/adapters/opencode/installer.js +38 -18
  43. package/dist/adapters/opencode/installer.js.map +1 -1
  44. package/dist/adapters/types.d.ts +8 -0
  45. package/dist/adapters/types.d.ts.map +1 -1
  46. package/dist/adapters/types.js.map +1 -1
  47. package/dist/cli/index.js +1 -1
  48. package/dist/cli/index.js.map +1 -1
  49. package/dist/cli/install.d.ts.map +1 -1
  50. package/dist/cli/install.js +238 -176
  51. package/dist/cli/install.js.map +1 -1
  52. package/dist/cli/list.d.ts.map +1 -1
  53. package/dist/cli/list.js +18 -10
  54. package/dist/cli/list.js.map +1 -1
  55. package/dist/cli/uninstall.d.ts.map +1 -1
  56. package/dist/cli/uninstall.js +93 -88
  57. package/dist/cli/uninstall.js.map +1 -1
  58. package/dist/cli/upgrade.d.ts.map +1 -1
  59. package/dist/cli/upgrade.js +180 -31
  60. package/dist/cli/upgrade.js.map +1 -1
  61. package/dist/core/debug.d.ts +1 -1
  62. package/dist/core/debug.js +2 -2
  63. package/dist/core/debug.js.map +1 -1
  64. package/dist/core/hook-arguments.d.ts +4 -0
  65. package/dist/core/hook-arguments.d.ts.map +1 -0
  66. package/dist/core/hook-arguments.js +56 -0
  67. package/dist/core/hook-arguments.js.map +1 -0
  68. package/dist/core/hook-instance.d.ts +2 -2
  69. package/dist/core/hook-instance.d.ts.map +1 -1
  70. package/dist/core/hook-instance.js +7 -11
  71. package/dist/core/hook-instance.js.map +1 -1
  72. package/dist/core/hook-store.d.ts +5 -0
  73. package/dist/core/hook-store.d.ts.map +1 -0
  74. package/dist/core/hook-store.js +6 -0
  75. package/dist/core/hook-store.js.map +1 -0
  76. package/dist/core/types.d.ts +11 -7
  77. package/dist/core/types.d.ts.map +1 -1
  78. package/dist/core/upgrade-executor.d.ts +3 -1
  79. package/dist/core/upgrade-executor.d.ts.map +1 -1
  80. package/dist/core/upgrade-executor.js +292 -25
  81. package/dist/core/upgrade-executor.js.map +1 -1
  82. package/dist/index.d.ts +1 -1
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +1 -1
  85. package/dist/index.js.map +1 -1
  86. package/dist/lockfile/index.d.ts +5 -5
  87. package/dist/lockfile/index.d.ts.map +1 -1
  88. package/dist/lockfile/index.js +35 -57
  89. package/dist/lockfile/index.js.map +1 -1
  90. package/dist/lockfile/read.js +1 -1
  91. package/dist/lockfile/read.js.map +1 -1
  92. package/dist/lockfile/types.d.ts +39 -39
  93. package/dist/lockfile/types.d.ts.map +1 -1
  94. package/dist/lockfile/types.js +1 -1
  95. package/dist/lockfile/types.js.map +1 -1
  96. package/dist/lockfile/upgrade-check.d.ts.map +1 -1
  97. package/dist/lockfile/upgrade-check.js +16 -19
  98. package/dist/lockfile/upgrade-check.js.map +1 -1
  99. package/dist/tui/types.d.ts +2 -0
  100. package/dist/tui/types.d.ts.map +1 -1
  101. package/dist/tui/upgrade-select.d.ts.map +1 -1
  102. package/dist/tui/upgrade-select.js +92 -14
  103. package/dist/tui/upgrade-select.js.map +1 -1
  104. package/package.json +1 -1
  105. package/schemas/hook-binding.schema.json +10 -11
  106. package/schemas/hook-program.schema.json +39 -7
  107. package/schemas/kits-lock.schema.json +161 -105
package/README.md CHANGED
@@ -5,356 +5,38 @@ Install AI agent kits into your favorite coding assistants.
5
5
  ## Table of Contents
6
6
 
7
7
  - [Overview](#overview)
8
- - [Installation](#installation)
9
8
  - [Quick Start](#quick-start)
10
- - [Commands](#commands)
11
- - [Install](#install)
12
- - [Manifest-driven installs (kits.json)](#manifest-driven-installs-kitsjson)
13
- - [Uninstall](#uninstall)
14
- - [Upgrade](#upgrade)
15
- - [Validate](#validate)
16
- - [List](#list)
17
- - [Info](#info)
18
9
  - [Supported Harnesses](#supported-harnesses)
19
- - [Installation Scopes](#installation-scopes)
20
- - [Global Scope (`--global`)](#global-scope---global)
21
- - [Project Scope (`--project`)](#project-scope---project)
22
- - [Scope Limitations](#scope-limitations)
23
- - [Source Formats](#source-formats)
24
- - [Primitive Resolution](#primitive-resolution)
25
- - [File vs Configuration Primitives](#file-vs-configuration-primitives)
10
+ - [Install Scopes (Global vs Project)](#install-scopes-global-vs-project)
26
11
  - [Kits Manifest + Lock](#kits-manifest--lock)
27
- - [Exit Codes](#exit-codes)
28
- - [Environment Variables](#environment-variables)
29
- - [Configuration](#configuration)
30
- - [Kit Repository Structure](#kit-repository-structure)
31
- - [Kit Definition (kit.json)](#kit-definition-kitjson)
32
- - [Primitive Formats](#primitive-formats)
33
- - [Model Templates](#model-templates)
12
+ - [Documentation Index](#documentation-index)
13
+ - [CLI Commands (Summary)](#cli-commands-summary)
14
+ - [Configuration and Formats](#configuration-and-formats)
34
15
  - [Development](#development)
35
- - [Prerequisites](#prerequisites)
36
- - [Setup](#setup)
37
- - [Testing Local Changes](#testing-local-changes)
38
- - [Integration Tests (Devcontainer)](#integration-tests-devcontainer)
39
- - [Project Structure](#project-structure)
40
16
  - [Troubleshooting](#troubleshooting)
41
- - [Common Issues](#common-issues)
42
- - [Debug Mode](#debug-mode)
43
17
  - [License](#license)
44
18
 
45
19
  ## Overview
46
20
 
47
- The Kit Installer is a CLI tool that discovers, validates, and installs AI agent kits from kit repositories into various AI coding assistant harnesses. It supports multiple harnesses including Claude Code, Codex, Gemini CLI, GitHub Copilot, and OpenCode.
48
-
49
- ## Installation
50
-
51
- ```bash
52
- # Run directly with npx (recommended)
53
- npx @hashicorp/kits install example-org/kits
54
-
55
- # Or install globally
56
- npm install -g @hashicorp/kits
57
- kits install example-org/kits
58
- ```
59
-
60
- To validate kit repositories, use the built-in validate command:
61
-
62
- ```bash
63
- npx @hashicorp/kits validate ./agent-kits
64
- npx @hashicorp/kits validate --commands example-org/kits
65
- ```
21
+ The Kit Installer is a CLI that discovers, validates, and installs AI agent kits into supported harnesses (Claude Code, Codex, Gemini CLI, GitHub Copilot, OpenCode). It supports local or remote kit repositories, manifest-driven installs, and scoped installation (global or project).
66
22
 
67
23
  ## Quick Start
68
24
 
69
25
  ```bash
70
- # Interactive installation - guides you through selection
26
+ # Interactive install (prompts for scope + selection)
71
27
  npx @hashicorp/kits install example-org/kits
72
28
 
73
- # Install to global scope (user-level, available in all projects)
29
+ # Non-interactive global install
74
30
  npx @hashicorp/kits install example-org/kits --global -y
75
31
 
76
- # Install to project scope (current directory only)
32
+ # Project-scope install (current repo)
77
33
  npx @hashicorp/kits install example-org/kits --project -y
78
34
 
79
- # Install specific kit to specific harness
80
- npx @hashicorp/kits install example-org/kits \
81
- -a claude-code \
82
- -k terraform-development \
83
- --global
84
-
85
- # List available kits without installing
35
+ # List kits without installing
86
36
  npx @hashicorp/kits install example-org/kits -l
87
37
 
88
- # Check what would be installed (dry run)
89
- npx @hashicorp/kits install example-org/kits --global --dry-run
90
- ```
91
-
92
- ## Commands
93
-
94
- ### Install
95
-
96
- Installs kits from a source repository or a manifest directory.
97
-
98
- ```bash
99
- kits install <source> [options]
100
- ```
101
-
102
- **Options:**
103
-
104
- | Flag | Description |
105
- |------|-------------|
106
- | `-a, --agent <name...>` | Target specific harness(es) |
107
- | `-k, --kit <name...>` | Install specific kit(s) |
108
- | `-g, --global` | Use global scope (user-level, available in all projects) |
109
- | `-p, --project` | Use project scope (current directory only) |
110
- | `--alias <name>` | Install a single kit using an alternate instance name |
111
- | `-e, --env <KEY=VALUE>` | Set environment variable for MCP servers (repeatable; nonsensitive only) |
112
- | `--mcp-instance <KIT:NAME=VALUE>` | Override MCP instance name (repeatable; KIT is the kit instance name) |
113
- | `-l, --list` | List available kits without installing |
114
- | `-y, --yes` | Non-interactive mode, accept defaults |
115
- | `--ci` | Require a matching kits-lock.json when installing from kits.json |
116
- | `--ignore-lock` | Ignore kits-lock.json and resolve directly from kits.json |
117
- | `--overwrite` | Overwrite existing kit instances when names collide |
118
- | `--dry-run` | Show what would be installed |
119
- | `--json` | Output results as JSON |
120
- | `-v, --verbose` | Enable verbose logging |
121
- | `--debug` | Enable debug logging to `~/.config/agent-kit/debug.log` |
122
-
123
- **Note:** In non-interactive mode (`-y`), one of `--global` or `--project` is required unless installing from `kits.json` (which defines scope).
124
-
125
- **Examples:**
126
-
127
- ```bash
128
- # Interactive installation (prompts for scope selection)
129
- npx @hashicorp/kits install example-org/kits
130
-
131
- # Install to global scope (user-level)
132
- npx @hashicorp/kits install example-org/kits --global -y
133
-
134
- # Install to project scope (current directory)
135
- npx @hashicorp/kits install example-org/kits --project -y
136
-
137
- # Install to Claude Code only at global scope
138
- npx @hashicorp/kits install example-org/kits -a claude-code --global
139
-
140
- # Install specific kits at project scope
141
- npx @hashicorp/kits install example-org/kits \
142
- -k terraform-development \
143
- -k vault-operations \
144
- --project
145
-
146
- # Install a kit with an alias (instance name)
147
- npx @hashicorp/kits install example-org/kits \
148
- -k terraform-development \
149
- --alias terraform-dev \
150
- --project
151
-
152
- # Override MCP instance name for a specific kit
153
- npx @hashicorp/kits install example-org/kits \
154
- -k terraform-development \
155
- --mcp-instance terraform-development:terraform=terraform-prod \
156
- --global
157
-
158
- # Non-interactive with all options
159
- npx @hashicorp/kits install example-org/kits \
160
- -a claude-code \
161
- -k terraform-development \
162
- --global \
163
- -y
164
-
165
- # Install from local directory (for development)
166
- npx @hashicorp/kits install ./my-kits -a claude-code --project
167
-
168
- # Install from a kits.json manifest in the current repo
169
- npx @hashicorp/kits install .
170
- ```
171
-
172
- #### Manifest-driven installs (kits.json)
173
-
174
- If `<source>` points at a directory or a `kits.json` file, the installer will
175
- look for a manifest and use it as the installation intent:
176
-
177
- 1. `<source>/.agents/kits.json`
178
- 2. `<source>/kits.json`
179
- 3. `<source>` itself if it is `kits.json`
180
-
181
- The manifest determines scope, sources, and optional harness selection. When
182
- `kits.json` is present, the installer writes a corresponding `kits-lock.json`
183
- and records a hash of the manifest to keep the two in sync.
184
-
185
- Example manifest (`.agents/kits.json`):
186
-
187
- ```json
188
- {
189
- "schemaVersion": "1.0.0",
190
- "scope": "project",
191
- "sources": [
192
- { "source": "example-org/kits", "kits": ["terraform-development"] }
193
- ],
194
- "harnesses": ["claude-code"]
195
- }
196
- ```
197
-
198
- Install using that manifest:
199
-
200
- ```bash
201
- npx @hashicorp/kits install .
202
- ```
203
-
204
- ### Uninstall
205
-
206
- Removes installed kit instances.
207
-
208
- ```bash
209
- kits uninstall <kit-name> [options]
210
- ```
211
-
212
- **Options:**
213
-
214
- | Flag | Description |
215
- |------|-------------|
216
- | `-a, --agent <name...>` | Target specific harness(es) |
217
- | `-g, --global` | Use global scope |
218
- | `-p, --project` | Use project scope |
219
- | `--alias <name>` | Target a specific kit instance name (installAs) |
220
- | `--all` | Uninstall all instances that match the kit name |
221
- | `-y, --yes` | Non-interactive mode |
222
- | `--lock-only` | Uninstall using kits-lock.json only (do not modify kits.json) |
223
- | `--dry-run` | Show what would be uninstalled |
224
- | `--json` | Output results as JSON |
225
-
226
- **Note:** In non-interactive mode (`-y`), one of `--global` or `--project` is required.
227
-
228
- **Examples:**
229
-
230
- ```bash
231
- # Interactive uninstall (prompts for scope selection)
232
- npx @hashicorp/kits uninstall terraform-development
233
-
234
- # Uninstall from global scope
235
- npx @hashicorp/kits uninstall terraform-development --global -y
236
-
237
- # Uninstall from project scope
238
- npx @hashicorp/kits uninstall terraform-development --project -y
239
-
240
- # Uninstall a specific kit instance (alias)
241
- npx @hashicorp/kits uninstall terraform-development --alias terraform-dev --project -y
242
-
243
- # Uninstall from specific harness at global scope
244
- npx @hashicorp/kits uninstall terraform-development -a claude-code --global -y
245
- ```
246
-
247
- ### Upgrade
248
-
249
- Checks for and applies primitive updates.
250
-
251
- ```bash
252
- kits upgrade [options]
253
- ```
254
-
255
- **Options:**
256
-
257
- | Flag | Description |
258
- |------|-------------|
259
- | `-s, --source <source>` | Kit repository source (defaults to lockfile sources) |
260
- | `-a, --agent <name...>` | Target specific harness(es) |
261
- | `-k, --kit <name...>` | Upgrade specific kit(s) by canonical name |
262
- | `--alias <name>` | Upgrade a specific kit instance name |
263
- | `--all` | Upgrade all kit instances for the selected kit(s) |
264
- | `-g, --global` | Use global scope (required) |
265
- | `-p, --project` | Use project scope (required) |
266
- | `-c, --check` | Check for updates without installing |
267
- | `-y, --yes` | Non-interactive mode |
268
- | `--dry-run` | Alias for `--check` |
269
- | `--save` | Update kits.json source refs to match upgraded lockfile |
270
- | `--json` | Output results as JSON |
271
-
272
- **Note:** Unlike install, upgrade always requires `--global` or `--project` (no TUI prompt).
273
-
274
- **Examples:**
275
-
276
- ```bash
277
- # Check for available upgrades at global scope
278
- npx @hashicorp/kits upgrade --check --global
279
-
280
- # Check for available upgrades at project scope
281
- npx @hashicorp/kits upgrade --check --project
282
-
283
- # Interactive upgrade at global scope
284
- npx @hashicorp/kits upgrade -s example-org/kits --global
285
-
286
- # Upgrade all automatically at project scope
287
- npx @hashicorp/kits upgrade -s example-org/kits --project -y
288
-
289
- # Upgrade specific kit at global scope
290
- npx @hashicorp/kits upgrade \
291
- -s example-org/kits \
292
- -k terraform-development \
293
- --global
294
-
295
- # Upgrade a specific kit instance
296
- npx @hashicorp/kits upgrade \
297
- --alias terraform-dev \
298
- --global \
299
- --check
300
- ```
301
-
302
- ### Validate
303
-
304
- Validate primitive files in a kit repository. Validators accept either a local path or GitHub shorthand (`org/repo[@ref]`).
305
-
306
- ```bash
307
- # Validate an entire repository (all types)
38
+ # Validate a repository
308
39
  npx @hashicorp/kits validate ./agent-kits
309
-
310
- # Validate commands in a GitHub repo
311
- npx @hashicorp/kits validate --commands example-org/kits
312
-
313
- # Validate skills at a specific ref
314
- npx @hashicorp/kits validate --skills example-org/kits@v1.2.3
315
-
316
- # Validate hook programs in a local path
317
- npx @hashicorp/kits validate --hooks ./agent-kits
318
-
319
- # Validate MCP configs in a local path
320
- npx @hashicorp/kits validate --mcp ./agent-kits
321
-
322
- # Validate kit definitions and kits-registry.json registry
323
- npx @hashicorp/kits validate --kits ./agent-kits
324
- ```
325
-
326
- If you install the package globally, the validate command is available directly:
327
-
328
- ```bash
329
- npm install -g @hashicorp/kits
330
- kits validate example-org/kits
331
- kits validate --skills example-org/kits@v1.2.3
332
- kits validate --subagents example-org/kits
333
- kits validate --hooks ./agent-kits
334
- kits validate --mcp ./agent-kits
335
- kits validate --kits ./agent-kits
336
- ```
337
-
338
- ### List
339
-
340
- Lists detected harnesses or installed kits.
341
-
342
- ```bash
343
- kits list harnesses # Show detected AI harnesses
344
- kits list kits # Show installed kits (both scopes)
345
- kits list kits --global # Show global scope only
346
- kits list kits --project # Show project scope only
347
- ```
348
-
349
- When listing kits, results are grouped by scope. Use `--global` or `--project` to filter to a specific scope.
350
-
351
- ### Info
352
-
353
- Shows information about a kit repository or specific kit.
354
-
355
- ```bash
356
- kits info <source> [options]
357
- kits info <source> -k <kit-name> # Specific kit info
358
40
  ```
359
41
 
360
42
  ## Supported Harnesses
@@ -364,397 +46,83 @@ kits info <source> -k <kit-name> # Specific kit info
364
46
  | Claude Code | Yes | Yes | Yes | Yes | Yes |
365
47
  | Codex | Yes | Yes | No | Yes | No |
366
48
  | Gemini CLI | Yes | Experimental | Experimental | Yes | Yes |
367
- | GitHub Copilot | Partial | Yes | Yes | Yes | Limited |
49
+ | GitHub Copilot | Project only | Yes | Yes | Yes | Limited (project only) |
368
50
  | OpenCode | Yes | Yes | Yes | Yes | Yes |
369
51
 
370
- ## Installation Scopes
52
+ ## Install Scopes (Global vs Project)
371
53
 
372
54
  Kits can be installed at two scopes:
373
55
 
374
- ### Global Scope (`--global`)
375
-
376
- Installs to user-level harness directories, making primitives available across all projects.
377
-
378
- | Harness | Primitives Directory | Config Location |
379
- |---------|---------------------|-----------------|
380
- | Claude Code | `~/.claude/commands/`, `~/.claude/skills/`, `~/.claude/agents/` | `~/.claude/settings.json`, `~/.claude.json` |
381
- | Codex | `~/.codex/prompts/`, `~/.codex/skills/` | `~/.codex/config.toml` |
382
- | Gemini CLI | `~/.gemini/commands/`, `~/.gemini/skills/` | `~/.gemini/settings.json` |
383
- | GitHub Copilot | `~/.copilot/prompts/`, `~/.copilot/skills/`, `~/.copilot/agents/` | `~/.copilot/config.json` |
384
- | OpenCode | `~/.config/opencode/commands/`, `~/.config/opencode/skills/`, `~/.config/opencode/agents/` | `~/.config/opencode/opencode.json` |
385
-
386
- ### Project Scope (`--project`)
387
-
388
- Installs to repository-level harness directories, making primitives available only within that project. Project-scope installations can be committed to version control for team sharing.
389
-
390
- | Harness | Primitives Directory | Config Location |
391
- |---------|---------------------|-----------------|
392
- | Claude Code | `.claude/commands/`, `.claude/skills/`, `.claude/agents/` | `.claude/settings.json`, `.mcp.json` |
393
- | Codex | `.codex/skills/` | `.codex/config.toml` |
394
- | Gemini CLI | `.gemini/commands/`, `.gemini/skills/` | `.gemini/settings.json` |
395
- | GitHub Copilot | `.github/skills/`, `.github/agents/` | `.vscode/mcp.json` |
396
- | OpenCode | `.opencode/commands/`, `.opencode/skills/`, `.opencode/agents/` | `opencode.json` |
397
-
398
- ### Scope Limitations
399
-
400
- Not all primitive types are available at project scope for all harnesses:
401
-
402
- | Harness | Commands | Skills | Subagents | MCP | Hooks |
403
- |---------|----------|--------|-----------|-----|-------|
404
- | Claude Code | Global + Project | Global + Project | Global + Project | Global + Project | Global + Project |
405
- | Codex | **Global only** | Global + Project | N/A | **Global only** | N/A |
406
- | Gemini CLI | Global + Project | Global + Project | Global + Project | Global + Project | Global + Project |
407
- | GitHub Copilot | Global + Project | Global + Project | Global + Project | Global + Project | Limited |
408
- | OpenCode | Global + Project | Global + Project | Global + Project | Global + Project | Global + Project |
409
-
410
- When a kit requires primitives that cannot be installed at project scope for a given harness, the installer will report this as a compatibility issue and suggest using `--global` instead.
411
-
412
- ## Source Formats
413
-
414
- The installer supports multiple source formats:
415
-
416
- ```bash
417
- # GitHub shorthand (org/repo)
418
- example-org/kits
419
-
420
- # GitHub with specific version/branch
421
- example-org/kits@v1.0.0
422
- example-org/kits@main
423
-
424
- # Local path (for development)
425
- ./my-kits
426
- /absolute/path/to/kits
427
- ~/path/to/kits
428
- ```
429
-
430
- ## Primitive Resolution
431
-
432
- Kits can reference primitives from a shared primitives library using version specs:
433
-
434
- ```json
435
- {
436
- "primitives": {
437
- "commands": [
438
- { "ref": "tf-plan@^1.0.0" },
439
- { "ref": "tf-apply@~1.1.0" },
440
- { "ref": "tf-validate@latest" }
441
- ]
442
- }
443
- }
444
- ```
56
+ - **Global** (`--global`): user-level installs (e.g., `~/.claude/`), available across projects.
57
+ - **Project** (`--project`): repo-level installs (e.g., `.claude/`), scoped to the current project.
445
58
 
446
- The installer resolves these references at install time:
447
- - **SemVer ranges** (`^1.0.0`, `~1.2.0`): Resolved to highest matching version
448
- - **Exact versions** (`1.2.3`): Must match exactly
449
- - **`latest` keyword**: Resolved to highest available version
59
+ **Scope limitations:** Some harnesses limit which primitives are supported at project scope. For example, Codex commands and MCP are global-only, and GitHub Copilot hooks are project-only.
450
60
 
451
- When multiple kits reference the same primitive, the installer deduplicates and selects the highest compatible version.
61
+ Hook programs are stored in the kit hook store:
62
+ - Global scope: `~/.agents/hooks/`
63
+ - Project scope: `.agents/hooks/`
452
64
 
453
- ## File vs Configuration Primitives
454
-
455
- Primitives install in two different ways, and the installer treats them differently:
456
-
457
- **File-based primitives** are copied into harness-specific directories. These include
458
- commands, skills, subagents, and hook programs. The harness discovers them by scanning
459
- its filesystem paths, so installs/uninstalls are direct file operations.
460
-
461
- **Configuration-based primitives** are merged into harness configuration files. These
462
- include MCP server definitions and hook bindings. The installer updates config files
463
- and tracks instance hashes in `kits-lock.json` so it can safely upgrade or remove
464
- entries later without clobbering unrelated settings.
65
+ Harness configs reference these hook program paths.
465
66
 
466
67
  ## Kits Manifest + Lock
467
68
 
468
- The installer reads declarative kits manifests (`kits.json`) and records resolved installs in lockfiles (`kits-lock.json`).
469
-
470
- Manifests are scope-specific:
471
-
472
- | Scope | Manifest Location |
473
- |-------|-------------------|
474
- | Global | `~/.agents/kits.json` |
475
- | Project | `.agents/kits.json` |
476
-
477
- Lockfiles are scope-specific:
478
-
479
- | Scope | Lockfile Location |
480
- |-------|------------------|
481
- | Global | `~/.agents/kits-lock.json` |
482
- | Project | `.agents/kits-lock.json` |
483
-
484
- This enables:
485
- - Uninstallation of kits
486
- - Upgrade checking for primitives
487
- - Conflict detection
488
- - Scope isolation (global and project installations are tracked separately)
489
-
490
- Behavior notes:
491
- - When `kits.json` exists and its hash matches the lockfile metadata, the
492
- lockfile is the authoritative source of resolved versions.
493
- - `--ci` requires a matching lockfile and fails fast if out of sync.
494
- - `--ignore-lock` ignores `kits-lock.json` and resolves directly from `kits.json`.
495
- - `uninstall`/`upgrade` will fail if `kits.json` exists but is out of sync with
496
- the lockfile (use `install` to reconcile, or `uninstall --lock-only`).
497
-
498
- ## Exit Codes
499
-
500
- | Code | Meaning |
501
- |------|---------|
502
- | 0 | Success |
503
- | 1 | Installation failed |
504
- | 2 | Invalid arguments |
505
- | 3 | Source not found or invalid |
506
- | 4 | No harnesses detected |
507
- | 5 | Kit not found |
508
- | 6 | Kit incompatible with all selected harnesses |
509
- | 7 | Primitive reference resolution failed |
510
- | 8 | Manifest read/write error |
511
- | 9 | No upgrades available |
512
- | 10 | User cancelled |
513
- | 11 | Scope required (non-interactive mode without `--global` or `--project`) |
514
- | 12 | Required env var missing |
515
- | 13 | Sensitive env var provided via `--env` |
516
- | 14 | Lockfile out of sync with kits.json |
517
-
518
- ## Environment Variables
69
+ Manifest-driven installs use `kits.json` to declare intent and `kits-lock.json` to record resolved versions.
519
70
 
520
- | Variable | Description |
521
- |----------|-------------|
522
- | `HTTP_PROXY` / `HTTPS_PROXY` | Proxy configuration for network requests |
71
+ | Scope | Manifest | Lockfile |
72
+ |-------|----------|----------|
73
+ | Global | `~/.agents/kits.json` | `~/.agents/kits-lock.json` |
74
+ | Project | `.agents/kits.json` | `.agents/kits-lock.json` |
523
75
 
524
- ## Configuration
76
+ The lockfile is the source of truth when its hash matches the manifest. It also records shared instance registries (`mcpInstances`, `hookInstances`).
525
77
 
526
- ### Kit Repository Structure
78
+ ## Documentation Index
527
79
 
528
- A kit repository should have:
80
+ More comprehensive docs live under `docs/`:
529
81
 
530
- ```
531
- my-kits/
532
- ├── kits-registry.json # Kits registry (optional, enables multiple kits)
533
- ├── primitives-registry.json # Shared primitives registry (optional)
534
- ├── primitives/ # Shared primitive definitions
535
- │ ├── commands/
536
- │ ├── skills/
537
- │ └── ...
538
- └── kits/ # Individual kit directories
539
- ├── terraform-development/
540
- │ ├── kit.json # Kit definition
541
- │ └── primitives/ # Kit-specific primitives
542
- └── vault-operations/
543
- ├── kit.json
544
- └── primitives/
545
- ```
546
-
547
- For single-kit repositories, place `kit.json` at the root.
548
-
549
- ### Kit Definition (kit.json)
550
-
551
- ```json
552
- {
553
- "schemaVersion": "1.0.0",
554
- "name": "terraform-development",
555
- "version": "1.0.0",
556
- "description": "Terraform development capabilities",
557
- "products": ["terraform"],
558
- "requires": {
559
- "primitives": ["commands", "skills"]
560
- },
561
- "primitives": {
562
- "commands": [
563
- { "ref": "tf-plan@^1.0.0" },
564
- { "name": "custom-cmd", "entrypoint": "./primitives/commands/custom-cmd.md" }
565
- ],
566
- "skills": [
567
- { "name": "generate-hcl", "entrypoint": "./primitives/skills/generate-hcl" }
568
- ]
569
- }
570
- }
571
- ```
572
-
573
- ### Primitive Formats
574
-
575
- **Commands** (Markdown):
576
- ```markdown
577
- # Command Name
82
+ - CLI usage and options: [docs/cli](./docs/cli/README.md)
83
+ - Manifests + lockfiles: [docs/manifests-lockfiles](./docs/manifests-lockfiles/README.md)
84
+ - Primitives and resolution: [docs/primitives](./docs/primitives/README.md)
85
+ - Hook programs and bindings: [docs/hooks](./docs/hooks/README.md)
86
+ - Harness support + paths: [docs/harnesses](./docs/harnesses/README.md)
87
+ - Validation and schemas: [docs/validation](./docs/validation/README.md)
88
+ - Development + testing: [docs/development](./docs/development/README.md)
89
+ - Troubleshooting: [docs/troubleshooting](./docs/troubleshooting/README.md)
578
90
 
579
- Description of what the command does.
91
+ ## CLI Commands (Summary)
580
92
 
581
- ## Usage
582
-
583
- Instructions for using the command.
584
-
585
- ## Examples
586
-
587
- Example usage scenarios.
588
- ```
589
-
590
- **Skills** (Directory with SKILL.md):
591
- ```
592
- my-skill/
593
- ├── SKILL.md # Main skill definition
594
- └── assets/ # Optional supporting files
595
- └── template.hcl
596
- ```
597
-
598
- **Subagents** (Markdown with YAML frontmatter):
599
- ```markdown
600
- ---
601
- name: security-advisor
602
- description: Reviews Terraform configs for security issues
603
- model: "{{model:power}}"
604
- allowedTools:
605
- - "{{tool:read}}"
606
- - "{{tool:shell}}"
607
- disallowedTools: "{{tool:write}}"
608
- skills:
609
- - generate-hcl
610
- hooks:
611
- - ref: "pre-apply-validation@^1.0.0"
612
- binding:
613
- event: "tool.before"
614
- matcher:
615
- tools:
616
- - shell
617
- ---
618
-
619
- # security-advisor
620
-
621
- <agent_role>
622
- You are a security-focused Terraform advisor...
623
- </agent_role>
93
+ ```bash
94
+ kits install <source> [options]
95
+ kits uninstall <kit-name> [options]
96
+ kits upgrade [options]
97
+ kits validate <path> [--commands|--skills|--subagents|--hooks|--mcp|--kits]
98
+ kits list harnesses|kits
99
+ kits info <source> [-k kit-name]
624
100
  ```
625
101
 
626
- Skill and subagent frontmatter `hooks` are supported by Claude Code only; other harnesses drop them during transformation.
102
+ ## Configuration and Formats
627
103
 
628
- ### Model Templates
104
+ - Kit repositories can be single-kit or multi-kit with registries.
105
+ - Primitives may be shared or inline; versioned shared primitives live under `primitives/`.
106
+ - Tool templates (`{{tool:...}}`) and model templates (`{{model:...}}`) are resolved by adapters.
629
107
 
630
- Skills and subagents can reference canonical model tiers in frontmatter:
631
-
632
- ```yaml
633
- model: "{{model:fast}}"
634
- ```
635
-
636
- Supported tiers: `fast`, `standard`, `power`, `auto`, `inherit`. Adapters map these to harness-specific model IDs (or omit the field if unsupported).
108
+ See [docs/primitives](./docs/primitives/README.md) for detailed formats and examples.
637
109
 
638
110
  ## Development
639
111
 
640
- ### Prerequisites
641
-
642
- - Node.js >= 18.0.0
643
- - npm >= 8.0.0
644
-
645
- ### Setup
646
-
647
112
  ```bash
648
- # Install dependencies
649
113
  npm install
650
-
651
- # Build
652
114
  npm run build
653
-
654
- # Run tests
655
- npm test
656
-
657
- # Run tests with coverage
658
- npm test -- --coverage
659
-
660
- # Type check
661
115
  npm run typecheck
662
-
663
- # Lint
664
116
  npm run lint
665
- ```
666
-
667
- ### Testing Local Changes
668
-
669
- ```bash
670
- # Build and link locally
671
- npm run build
672
- npm link
673
-
674
- # Test with local kit repository
675
- kits install ./path/to/local/kits
676
-
677
- # Or use directly without linking
678
- node bin/kits.js install ./path/to/local/kits
679
- ```
680
-
681
- ### Integration Tests (Devcontainer)
682
-
683
- The integration suite runs the real CLI against the local `test-kits/` repository using non-interactive JSON output. It is intended to run inside the devcontainer so harness CLIs are available and filesystem isolation is preserved.
684
-
685
- ```bash
117
+ npm test
686
118
  npm run test:integration
687
119
  ```
688
120
 
689
- Integration tests are organized by intent under `tests/integration/`:
690
- - `cli/` for CLI command behavior
691
- - `primitives/` for primitive-specific scenarios
692
- - `harnesses/` for harness-specific scenarios
693
- - `scopes/` for scope-specific scenarios
694
- - `validators/` for validator binaries (using `test-kits/fixtures/invalid/`)
695
-
696
- ### Project Structure
697
-
698
- ```
699
- kits/
700
- ├── src/
701
- │ ├── cli/ # CLI commands (install, uninstall, upgrade, etc.)
702
- │ ├── tui/ # Terminal UI components
703
- │ ├── adapters/ # Harness adapters (claude-code, codex, etc.)
704
- │ ├── discovery/ # Kit discovery and source fetching
705
- │ ├── resolution/ # Primitive reference resolution
706
- │ ├── manifest/ # kits.json intent
707
- │ ├── lockfile/ # kits-lock.json tracking
708
- │ └── core/ # Core types and utilities
709
- ├── tests/ # Test files
710
- ├── schemas/ # JSON schemas
711
- └── bin/ # CLI entrypoint
712
- ```
121
+ Integration tests require the devcontainer. See [docs/development](./docs/development/README.md).
713
122
 
714
123
  ## Troubleshooting
715
124
 
716
- ### Common Issues
717
-
718
- **"No harnesses detected"**
719
- - Ensure at least one supported AI assistant is installed
720
- - Check that configuration files exist in expected locations
721
-
722
- **"Permission denied" errors**
723
- - Check file permissions on harness configuration directories
724
- - Ensure the AI assistant is not running during installation
725
-
726
- **"Source not found"**
727
- - Verify the source path or GitHub repository exists
728
- - Check network connectivity for remote sources
729
-
730
- **"Kit incompatible"**
731
- - The kit requires primitives not supported by the selected harness
732
- - Choose a compatible harness or different kit
733
-
734
- **"Scope required" (exit code 11)**
735
- - Non-interactive mode (`-y`) requires explicit scope selection
736
- - Add `--global` for user-level installation or `--project` for current directory
737
- - Example: `npx @hashicorp/kits install ... --global -y`
738
-
739
- **"Scope incompatible" for Codex**
740
- - Codex commands and MCP servers are global-only
741
- - Use `--global` to install kits requiring these primitives to Codex
742
- - Or install to other harnesses that support project scope
743
-
744
- **"Lockfile out of sync" (exit code 14)**
745
- - A `kits.json` exists but the lockfile hash does not match
746
- - Run `kits install <source>` to reconcile
747
- - Or use `kits uninstall --lock-only` to bypass manifest updates
748
-
749
- ### Debug Mode
750
-
751
- Enable debug logging for detailed output:
752
-
753
- ```bash
754
- npx @hashicorp/kits install example-org/kits --debug
755
- ```
756
-
757
- Logs are written to `~/.config/agent-kit/debug.log`.
125
+ Common issues and fixes are documented in [docs/troubleshooting](./docs/troubleshooting/README.md).
758
126
 
759
127
  ## License
760
128