harness-config-manager 0.1.0 → 0.1.5

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 (109) hide show
  1. package/README.md +427 -70
  2. package/builtin/hcm/README.md +23 -0
  3. package/builtin/hcm/context/10-hcm.md +14 -0
  4. package/builtin/hcm/hcm.yaml +16 -0
  5. package/builtin/hcm/skills/hcm-bundle-authoring/SKILL.md +119 -0
  6. package/builtin/hcm/skills/hcm-bundle-authoring/collections.md +168 -0
  7. package/builtin/hcm/skills/hcm-bundle-authoring/reference.md +222 -0
  8. package/builtin/hcm/skills/hcm-integration/SKILL.md +149 -0
  9. package/builtin/hcm/skills/hcm-integration/cli.md +139 -0
  10. package/builtin/hcm/skills/hcm-integration/examples.md +338 -0
  11. package/builtin/hcm/skills/hcm-integration/library.md +399 -0
  12. package/builtin/hcm/skills/hcm-integration/migrate.md +204 -0
  13. package/builtin/hcm/skills/hcm-integration/remote.md +204 -0
  14. package/builtin/hcm/skills/hcm-usage/SKILL.md +241 -0
  15. package/builtin/hcm/skills/hcm-usage/commands.md +78 -0
  16. package/dist/cli.js +72 -17
  17. package/dist/cli.js.map +1 -1
  18. package/dist/commands/export.d.ts +4 -2
  19. package/dist/commands/export.js +8 -9
  20. package/dist/commands/export.js.map +1 -1
  21. package/dist/commands/import.js +10 -1
  22. package/dist/commands/import.js.map +1 -1
  23. package/dist/commands/info.js +3 -3
  24. package/dist/commands/info.js.map +1 -1
  25. package/dist/commands/init.js +2 -1
  26. package/dist/commands/init.js.map +1 -1
  27. package/dist/commands/install.d.ts +25 -1
  28. package/dist/commands/install.js +118 -9
  29. package/dist/commands/install.js.map +1 -1
  30. package/dist/commands/list.d.ts +45 -1
  31. package/dist/commands/list.js +278 -33
  32. package/dist/commands/list.js.map +1 -1
  33. package/dist/commands/registry.d.ts +25 -0
  34. package/dist/commands/registry.js +134 -20
  35. package/dist/commands/registry.js.map +1 -1
  36. package/dist/commands/update.d.ts +31 -6
  37. package/dist/commands/update.js +294 -108
  38. package/dist/commands/update.js.map +1 -1
  39. package/dist/core/analysis.d.ts +51 -0
  40. package/dist/core/analysis.js +90 -0
  41. package/dist/core/analysis.js.map +1 -0
  42. package/dist/core/builtin.d.ts +33 -0
  43. package/dist/core/builtin.js +37 -0
  44. package/dist/core/builtin.js.map +1 -0
  45. package/dist/core/bundle.d.ts +20 -1
  46. package/dist/core/bundle.js +77 -4
  47. package/dist/core/bundle.js.map +1 -1
  48. package/dist/core/collection-clash.d.ts +82 -0
  49. package/dist/core/collection-clash.js +186 -0
  50. package/dist/core/collection-clash.js.map +1 -0
  51. package/dist/core/collection.d.ts +37 -0
  52. package/dist/core/collection.js +113 -0
  53. package/dist/core/collection.js.map +1 -0
  54. package/dist/core/config.d.ts +2 -2
  55. package/dist/core/config.js +1 -1
  56. package/dist/core/config.js.map +1 -1
  57. package/dist/core/conflicts.d.ts +39 -5
  58. package/dist/core/conflicts.js +169 -32
  59. package/dist/core/conflicts.js.map +1 -1
  60. package/dist/core/deps.d.ts +1 -1
  61. package/dist/core/deps.js +8 -8
  62. package/dist/core/deps.js.map +1 -1
  63. package/dist/core/errors.d.ts +2 -2
  64. package/dist/core/errors.js +1 -1
  65. package/dist/core/errors.js.map +1 -1
  66. package/dist/core/executor.js +9 -1
  67. package/dist/core/executor.js.map +1 -1
  68. package/dist/core/git-http.d.ts +111 -0
  69. package/dist/core/git-http.js +546 -0
  70. package/dist/core/git-http.js.map +1 -0
  71. package/dist/core/git.d.ts +63 -0
  72. package/dist/core/git.js +149 -0
  73. package/dist/core/git.js.map +1 -0
  74. package/dist/core/github.d.ts +8 -6
  75. package/dist/core/github.js +24 -2
  76. package/dist/core/github.js.map +1 -1
  77. package/dist/core/paths.d.ts +1 -1
  78. package/dist/core/paths.js +1 -1
  79. package/dist/core/paths.js.map +1 -1
  80. package/dist/core/planner.js +41 -15
  81. package/dist/core/planner.js.map +1 -1
  82. package/dist/core/refs.js +2 -1
  83. package/dist/core/refs.js.map +1 -1
  84. package/dist/core/registry.d.ts +58 -13
  85. package/dist/core/registry.js +221 -36
  86. package/dist/core/registry.js.map +1 -1
  87. package/dist/core/rename.d.ts +49 -10
  88. package/dist/core/rename.js +67 -10
  89. package/dist/core/rename.js.map +1 -1
  90. package/dist/core/store.d.ts +3 -4
  91. package/dist/core/store.js +1 -1
  92. package/dist/core/store.js.map +1 -1
  93. package/dist/core/tracking.d.ts +61 -0
  94. package/dist/core/tracking.js +106 -0
  95. package/dist/core/tracking.js.map +1 -0
  96. package/dist/core/types.d.ts +106 -7
  97. package/dist/core/types.js.map +1 -1
  98. package/dist/index.d.ts +3 -2
  99. package/dist/index.js +3 -2
  100. package/dist/index.js.map +1 -1
  101. package/dist/targets/copilot-cli.d.ts +41 -0
  102. package/dist/targets/copilot-cli.js +181 -0
  103. package/dist/targets/copilot-cli.js.map +1 -0
  104. package/dist/targets/index.d.ts +2 -2
  105. package/dist/targets/index.js +11 -3
  106. package/dist/targets/index.js.map +1 -1
  107. package/docs/authoring-bundles.md +895 -828
  108. package/docs/shipping-bundles.md +181 -0
  109. package/package.json +6 -3
package/README.md CHANGED
@@ -10,6 +10,7 @@ Supported targets:
10
10
  | --- | --- |
11
11
  | Claude Code | <https://code.claude.com/docs/en/claude-directory> |
12
12
  | GitHub Copilot | <https://awesome-copilot.github.com/learning-hub/copilot-configuration-basics/> |
13
+ | GitHub Copilot CLI | <https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/overview> |
13
14
  | Reasonix | <https://github.com/esengine/DeepSeek-Reasonix/blob/main-v2/docs/GUIDE.md> |
14
15
  | OpenCode | <https://opencode.ai/docs/config/> |
15
16
  | Pi | <https://pi.dev/docs/latest/quickstart> |
@@ -33,6 +34,10 @@ Note the package name is the full `harness-config-manager`, not `hcm`. `npx`
33
34
  resolves the *package* name, and `hcm` on npm is an unrelated package. Once
34
35
  installed, the command itself is `hcm`.
35
36
 
37
+ Each installation includes the built-in `hcm` bundle. It gives an agent the
38
+ skills to use hcm, to write bundles, and to connect a CLI tool to hcm. See
39
+ [The built-in `hcm` bundle](#the-built-in-hcm-bundle).
40
+
36
41
  ### From source
37
42
 
38
43
  For working on hcm itself. `make setup` checks your Node version first and
@@ -48,6 +53,7 @@ Or without make: `npm ci && npm run build && npm link`.
48
53
  ## Quick start
49
54
 
50
55
  ```bash
56
+ hcm install hcm -t claude # give your agent the hcm skills (built in)
51
57
  hcm init my-kit # scaffold a bundle
52
58
  hcm registry add ./my-kit # make it installable by name or id
53
59
  hcm list # what can I install?
@@ -57,6 +63,7 @@ hcm install my-kit # install into every supported target
57
63
  hcm install my-kit -t claude pi # ...or just the harnesses you mean
58
64
  hcm install 1 2 3 -t reasonix # several bundles in one go
59
65
  hcm list --installed # what is installed here?
66
+ hcm list --analysis # which bundle brought which file?
60
67
  hcm status # is it all still intact?
61
68
  hcm update # re-read the sources, reinstall everything here
62
69
  hcm context append # put back context an agent overwrote
@@ -71,6 +78,74 @@ Every registered bundle also gets a one-character id, so the above is usually
71
78
  `hcm install 1`, `hcm update 1`. If you are *writing* the bundle, register it
72
79
  with `hcm registry add ./my-kit --dev` and your edits apply straight away.
73
80
 
81
+ ## The built-in `hcm` bundle
82
+
83
+ The hcm package contains one bundle, `hcm`, with the id `0`. You do not
84
+ register it. `hcm list` shows it with the mark `[built-in]`.
85
+
86
+ | Resource | Flavor | Use |
87
+ | --- | --- | --- |
88
+ | `context/10-hcm.md` | common | Tells the agent that hcm manages the agent configuration of the project. |
89
+ | `skills/hcm-usage/` | common | Find, install, update and remove bundles. Manage the registry, and the named collections in it. |
90
+ | `skills/hcm-bundle-authoring/` | `authoring` | Write, check and publish a bundle or a collection of bundles. Add a collection manifest to an existing collection. |
91
+ | `skills/hcm-integration/` | `integration` | Ship a bundle with a CLI tool (`my-cli hcm init`), with a library (`python -m my_library hcm install`, `npx --no my-lib-hcm install`), or as a separate download. Upgrade an older integration, and move the projects of its users. |
92
+
93
+ To add hcm support to a project, install the bundle there:
94
+
95
+ ```bash
96
+ hcm install hcm -t claude-code # all of it
97
+ hcm install hcm -t claude-code --flavor authoring # only the common part and the authoring skill
98
+ hcm install hcm -t claude-code -s user # for all projects of this user
99
+ ```
100
+
101
+ hcm reads this bundle from its own package. It does not copy the bundle into
102
+ the store, and it does not write it to `registry.json`. Thus the bundle always
103
+ has the version of the hcm that runs. After you upgrade hcm, run `hcm update` in
104
+ each project that has the bundle.
105
+
106
+ The id `0` is reserved for this bundle. hcm never gives it to a registered
107
+ bundle, and `hcm install 0` always means the built-in bundle. If a registry file
108
+ gives `0` to a registered bundle, hcm gives that bundle a new id when it reads
109
+ the file. A registered bundle cannot have the name `0`.
110
+
111
+ The name `hcm` is reserved too. `hcm registry add` refuses a different bundle with
112
+ that name, unless you give it a different name with `--name`. `hcm registry
113
+ remove hcm` also fails: to remove the bundle from a project, use `hcm uninstall
114
+ hcm`. `hcm export` writes the bundle as `hcm`, and `hcm import` installs it with
115
+ no registration. Another bundle can require it in `dependencies`.
116
+
117
+ The source is [`builtin/hcm/`](builtin/hcm/). `npm version` copies the package
118
+ version into its `hcm.yaml`, through `scripts/sync-builtin-version.mjs`.
119
+
120
+ ## Ship a bundle with your software
121
+
122
+ A CLI tool, an app or a library can ship agent configuration as an hcm bundle.
123
+ There are three strategies:
124
+
125
+ ```bash
126
+ my-cli hcm init # a CLI tool: its subcommand registers the bundle
127
+ python -m my_library hcm install -t claude-code # a library: installs the bundle of the project's environment
128
+ npx --no my-lib-hcm install -t claude-code
129
+ hcm registry add owner/repo/hcm-bundle#v1.2.0 # any software: download only the bundle folder
130
+ ```
131
+
132
+ After the registration, `hcm install my-cli -t claude` installs the bundle like
133
+ any other. A library installs its bundle straight into the project, from the
134
+ virtual environment or `node_modules/`, and does not change the registry. Then
135
+ `hcm update` reads that environment again after each upgrade. See
136
+ [Follow the registry or the source](#follow-the-registry-or-the-source). A
137
+ `--dev` option registers the working copy in place, so that `hcm update` in
138
+ each test project picks up each edit.
139
+
140
+ [Shipping a bundle with your software](docs/shipping-bundles.md) describes the
141
+ strategies. The `hcm-integration` skill of the built-in bundle contains the same
142
+ procedures, with code for Node.js, Python and Go. Install it, and an agent can
143
+ write the integration for you:
144
+
145
+ ```bash
146
+ hcm install hcm -t claude-code --flavor integration authoring
147
+ ```
148
+
74
149
  ## Bundle layout
75
150
 
76
151
  A bundle is a directory with a manifest and conventionally-named subdirectories.
@@ -100,7 +175,7 @@ version: 1.0.0
100
175
  description: What this bundle is for
101
176
  tags: [review, typescript]
102
177
  # Omit "targets" to support all of them.
103
- targets: [claude-code, copilot, reasonix, opencode, pi]
178
+ targets: [claude-code, copilot, copilot-cli, reasonix, opencode, pi]
104
179
  # Bundles this one needs; installed first. See "Dependencies" below.
105
180
  dependencies:
106
181
  - jira-board@^1.2.0
@@ -129,15 +204,23 @@ harness's home directory (`hcm targets` prints the exact paths on your machine).
129
204
  | mcp | `.mcp.json` → `mcpServers.<n>` | `.vscode/mcp.json` → `servers.<n>` | `reasonix.toml` → `[[plugins]]` |
130
205
  | settings | `.claude/settings.json` | `.github/copilot/settings.json` | `reasonix.toml` |
131
206
 
132
- | Kind | OpenCode | Pi |
133
- | --- | --- | --- |
134
- | subagent | `.opencode/agents/<n>.md` | `.pi/skills/<n>/SKILL.md`, or `.pi/agents/<n>.md` with `--pi-subagents` |
135
- | skill | `.opencode/skills/<n>/` | `.pi/skills/<n>/` |
136
- | command | `.opencode/commands/<n>.md` | `.pi/prompts/<n>.md` |
137
- | rule | `.opencode/rules/<n>.md` + `opencode.json` → `instructions[]` | `AGENTS.md` |
138
- | context | `AGENTS.md` | `AGENTS.md` |
139
- | mcp | `opencode.json` → `mcp.<n>` | `.mcp.json` → `mcpServers.<n>` |
140
- | settings | `opencode.json` | `.pi/settings.json` |
207
+ | Kind | GitHub Copilot CLI | OpenCode | Pi |
208
+ | --- | --- | --- | --- |
209
+ | subagent | `.github/agents/<n>.agent.md` | `.opencode/agents/<n>.md` | `.pi/skills/<n>/SKILL.md`, or `.pi/agents/<n>.md` with `--pi-subagents` |
210
+ | skill | `.github/skills/<n>/` | `.opencode/skills/<n>/` | `.pi/skills/<n>/` |
211
+ | command | `.github/skills/<n>/SKILL.md` | `.opencode/commands/<n>.md` | `.pi/prompts/<n>.md` |
212
+ | rule | `.github/instructions/<n>.instructions.md` | `.opencode/rules/<n>.md` + `opencode.json` → `instructions[]` | `AGENTS.md` |
213
+ | context | `.github/copilot-instructions.md` | `AGENTS.md` | `AGENTS.md` |
214
+ | mcp | `.github/mcp.json` → `mcpServers.<n>` | `opencode.json` → `mcp.<n>` | `.mcp.json` → `mcpServers.<n>` |
215
+ | settings | `.github/copilot/settings.json` | `opencode.json` | `.pi/settings.json` |
216
+
217
+ `copilot` is Copilot in the IDE; `copilot-cli` is
218
+ [Copilot CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli). They read
219
+ five of the same repository files and part company on the sixth — see
220
+ [the edges](#what-each-target-does-with-the-edges) below. At user scope the CLI
221
+ writes into `$COPILOT_HOME`, else `~/.copilot`, without the `.github` prefix and
222
+ with its own filenames: `mcp-config.json`, `settings.json`,
223
+ `copilot-instructions.md`.
141
224
 
142
225
  Frontmatter is translated per target. A rule written once as:
143
226
 
@@ -145,11 +228,11 @@ Frontmatter is translated per target. A rule written once as:
145
228
  appliesTo: ["**/*.ts", "**/*.tsx"]
146
229
  ```
147
230
 
148
- becomes `paths: [...]` for Claude Code, `applyTo: '**/*.ts, **/*.tsx'` for
149
- Copilot, and — since Reasonix, OpenCode and Pi have no glob-scoped rule format —
150
- a line of prose above the rule text. Subagent `tools` become a comma-separated
151
- string for Claude Code, a YAML list for Copilot, and `allowed-tools` for
152
- Reasonix.
231
+ becomes `paths: [...]` for Claude Code, `applyTo: '**/*.ts, **/*.tsx'` for both
232
+ Copilots, and — since Reasonix, OpenCode and Pi have no glob-scoped rule format
233
+ — a line of prose above the rule text. Subagent `tools` become a
234
+ comma-separated string for Claude Code, a YAML list for either Copilot, and
235
+ `allowed-tools` for Reasonix.
153
236
 
154
237
  Note the deliberate asymmetry: bundles say **subagent**, but each harness keeps
155
238
  its own word — and its own filing system — for the same thing. Claude Code,
@@ -158,8 +241,9 @@ none, because there a subagent *is* a skill — on Reasonix marked `runAs:
158
241
  subagent` and `invocation: manual` so it is only invoked by name, on Pi invoked
159
242
  as `/skill:<name>`. `hcm` translates; you only learn one vocabulary.
160
243
 
161
- One consequence: on Reasonix and Pi a subagent and a skill share one namespace.
162
- Give them distinct names — `hcm validate` flags a bundle that does not.
244
+ One consequence: on Reasonix and Pi a subagent and a skill share one namespace,
245
+ and on Copilot CLI a *command* and a skill do. Give them distinct names — `hcm
246
+ validate` flags a bundle that does not.
163
247
 
164
248
  ### What each target does with the edges
165
249
 
@@ -178,21 +262,38 @@ Every target has a home for every kind, but the fit is not always exact:
178
262
  Claude Code uses — inert until an MCP extension is installed, correct once it
179
263
  is. If you *have* installed the sub-agent extension, say so — see
180
264
  [`--pi-subagents`](#pi-subagents) below.
265
+ - **Copilot CLI has no commands directory outside a plugin.**
266
+ `.github/prompts/*.prompt.md` is an IDE feature the CLI does not read, and the
267
+ CLI's own slash commands ship inside
268
+ [plugins](https://docs.github.com/en/copilot/concepts/agents/about-plugins),
269
+ under `com.github.copilot/commands/` — a package format, not a place to
270
+ install one file into. So a command is filed as a skill, which the CLI loads
271
+ and invokes by name. `argumentHint` has no field there and is dropped;
272
+ `allowedTools` survives as `allowed-tools`.
181
273
  - **OpenCode has no glob-scoped rule format**, but it does read extra
182
274
  instruction files listed in `instructions`. So a rule becomes a file *and* one
183
275
  entry appended to that array — appended, never replaced, so several bundles
184
276
  can each list their own rules in the same config and each remove only its own
185
277
  on uninstall.
186
278
 
187
- Finally, two files are genuinely shared between harnesses rather than owned by
188
- one: **`.mcp.json`** (Claude Code and Pi) and **`AGENTS.md`** (OpenCode and Pi).
279
+ Finally, some files are genuinely shared between harnesses rather than owned by
280
+ one: **`.mcp.json`** (Claude Code and Pi), **`AGENTS.md`** (OpenCode and Pi),
281
+ and the five repository files **both Copilots read** — `.github/agents/`,
282
+ `.github/skills/`, `.github/instructions/`, `.github/copilot-instructions.md`
283
+ and `.github/copilot/settings.json`. That last group is the widest overlap hcm
284
+ has, and it is a fact about GitHub's layout rather than something to fix: the
285
+ CLI and the IDE genuinely read the same repository. What they do not share is
286
+ where the servers are declared — `.github/mcp.json` for the CLI,
287
+ `.vscode/mcp.json` for the IDE — which is why they are two harnesses.
288
+
189
289
  Installing one bundle into both harnesses writes the shared item once, and both
190
290
  installations claim it — so uninstalling from either leaves the other working,
191
291
  and the item goes when the second one does. See
192
292
  [Shared items](#shared-items-written-once-claimed-by-everyone-who-needs-them)
193
293
  and [One folder, several harnesses](#one-folder-several-harnesses).
194
294
 
195
- Everything outside those two files is per-target and unaffected.
295
+ Everything outside those files is per-target and unaffected. `hcm targets`
296
+ prints the overlaps that apply to the folder you are standing in.
196
297
 
197
298
  ### pi-subagents
198
299
 
@@ -281,16 +382,20 @@ hcm registry add ./my-kit ./db-kit
281
382
 
282
383
  A harness can be named by its id, by an alias, or by **any unambiguous prefix**
283
384
  — `claude`, `cc`, `reason`, `op`, `oc` all work, and `-t c` is an error naming
284
- both Claude Code and Copilot rather than a guess. Naming the same harness twice
385
+ Claude Code and both Copilots rather than a guess. Naming the same harness twice
285
386
  installs into it once.
286
387
 
388
+ The two Copilots are the one pair a prefix will not separate, so each has its
389
+ own spellings: `copilot`, `gh` and `github-copilot` are the IDE; `copilot-cli`,
390
+ `gh-cli`, `ghcli` and `copilotcli` are the CLI.
391
+
287
392
  **Bundles come before `--target`.** The option is variadic, so it takes every
288
393
  value after it — `hcm install --target pi 1 2 3` reads `1 2 3` as harness names
289
394
  and says so:
290
395
 
291
396
  ```
292
397
  ✖ Unknown target "1"
293
- Known targets: claude-code, copilot, reasonix, opencode, pi, or "all".
398
+ Known targets: claude-code, copilot, copilot-cli, reasonix, opencode, pi, or "all".
294
399
  If that was meant to be a bundle, note that bundle names come before
295
400
  --target, which takes every value after it.
296
401
  ```
@@ -316,10 +421,11 @@ is already set up for ticked:
316
421
  Which harness(es) should this install into?
317
422
  [x] 1) Claude Code -- already set up in this folder
318
423
  [ ] 2) GitHub Copilot
319
- [ ] 3) Reasonix
320
- [ ] 4) OpenCode
321
- [x] 5) Pi -- already set up in this folder
322
- ? choose 1-5, or "all" [1,5]:
424
+ [ ] 3) GitHub Copilot CLI
425
+ [ ] 4) Reasonix
426
+ [ ] 5) OpenCode
427
+ [x] 6) Pi -- already set up in this folder
428
+ ? choose 1-6, or "all" [1,6]:
323
429
  ```
324
430
 
325
431
  Answer with numbers or names, separated by spaces or commas, `all` for every
@@ -327,7 +433,7 @@ one, or press enter to take what is ticked. What comes ticked is what hcm has
327
433
  installed here before — the ledger in `.hcm/` — and before there is one, the
328
434
  harnesses whose own directories are lying around. Only the harnesses the bundle
329
435
  supports are on the menu: a manifest with `targets: [claude-code, pi]` offers
330
- two lines, not five.
436
+ two lines, not six.
331
437
 
332
438
  `-t` skips the question, and so does `--no-prompt`. Without a terminal to ask —
333
439
  a script, a CI run — an operation that would span more than one harness in a
@@ -336,7 +442,7 @@ folder set up for more than one is refused rather than guessed at:
336
442
  ```
337
443
  ✖ This folder is set up for more than one harness (Claude Code, Reasonix and Pi),
338
444
  so "hcm install my-kit" needs to be told which one to act on
339
- It would otherwise affect: claude-code, copilot, reasonix, opencode, pi
445
+ It would otherwise affect: claude-code, copilot, copilot-cli, reasonix, opencode, pi
340
446
  Name one or more: hcm install my-kit -t claude-code
341
447
  Or every harness: hcm install my-kit -t all
342
448
  ```
@@ -1094,31 +1200,53 @@ and it survives until the last claimant is uninstalled. See
1094
1200
  thing by all of them:
1095
1201
 
1096
1202
  ```
1097
- ! mcp "light-plan" conflicts with what is already installed:
1098
- .mcp.json mcpServers.light-plan already set to a different value
1099
- How should hcm handle mcp "light-plan"?
1100
- *1) skip -- keep the existing one, install nothing
1101
- 2) replace -- overwrite it with the bundle version
1102
- 3) rename -- install under another name and update this bundle's instructions
1203
+ ! skill "audit" from bundle "my-kit" conflicts with bundle "team-kit":
1204
+ .claude/skills/audit/SKILL.md file is owned by bundle "team-kit"
1205
+ How should hcm handle skill "audit" from bundle "my-kit"?
1206
+ *1) skip -- keep what is there now (bundle "team-kit"), install nothing
1207
+ 2) replace -- overwrite it with the version from "my-kit"
1208
+ 3) rename -- install as "audit-my-kit" or another name; update the instructions in "my-kit"
1103
1209
  4) abort -- stop; write nothing at all
1104
1210
  ```
1105
1211
 
1212
+ Each conflict names the two sides. The first is the bundle that hcm installs.
1213
+ The second is one of these:
1214
+
1215
+ - `bundle "<name>"`: another bundle installed the item.
1216
+ - `content that no bundle installed`: a person or another tool wrote the item.
1217
+ - `an edited copy of its earlier install`: the same bundle installed the item,
1218
+ and somebody changed it after the install.
1219
+
1220
+ The same names show in the result line, for example
1221
+ `rename skill "audit" (clashed with bundle "team-kit"; installed as "audit-my-kit")`,
1222
+ and in the error when hcm stops.
1223
+
1106
1224
  - **skip** — the existing item stays and the rest of the bundle installs as
1107
1225
  normal. For a settings fragment only the colliding keys are dropped, since its
1108
1226
  keys are independent; for everything else the whole resource is, because half
1109
1227
  a skill on disk is worse than none.
1110
1228
  - **replace / overwrite** — the bundle's version wins. The old value is kept in
1111
1229
  the receipt and restored when you uninstall.
1112
- - **rename** — offered for MCP servers, which are addressed by name. The server
1113
- installs under the name you give, *and* every mention of the old name in the
1114
- rest of the bundle — `mcp__old__tool` prefixes and the bare name in skills,
1115
- subagents, commands and context — is rewritten to match, so the instructions
1116
- still point at a server that exists. The number of rewritten mentions is
1117
- reported; the substitution is textual, so check that count if the old name is
1118
- also an ordinary word. Names glued to other name characters (`light-plan` in
1119
- `light-plan-legacy`) are left alone, and the server's own `command` is never
1120
- rewritten. A rename decided for one harness is applied to the others in the
1121
- same run, so the server has one name everywhere.
1230
+ - **rename** — offered for skills, subagents, commands, rules, assets and MCP
1231
+ servers. Context sections and settings keys have no name to change, so hcm
1232
+ does not offer it for them. The suggested name is the old name with the bundle
1233
+ name as a suffix: `audit` from `my-kit` becomes `audit-my-kit`. If that name
1234
+ is also taken, hcm adds a number: `audit-my-kit-2`. An asset keeps its
1235
+ directory and extension: `scripts/lint.sh` becomes `scripts/lint-my-kit.sh`.
1236
+ Press Enter to accept the suggestion, or type a different name.
1237
+
1238
+ hcm also changes the mentions of the old name in the rest of the bundle, so
1239
+ that the instructions point at the new name. These mentions are
1240
+ `mcp__old__tool` prefixes, paths such as `skills/audit/checklist.md`, slash
1241
+ commands such as `/audit`, and the bare name. A one-word name such as `audit`
1242
+ is also an ordinary word, so hcm changes it only after `/`, `@` or a backtick.
1243
+ hcm does not change a name that is part of a longer name (`light-plan` in
1244
+ `light-plan-legacy`), or the `command` of an MCP server. hcm reports the
1245
+ number of changed mentions. The change is textual, so examine that number.
1246
+
1247
+ A rename for one harness applies to the other harnesses in the same run, so
1248
+ the item has one name in all of them. hcm records the rename with the
1249
+ installation, so `hcm update` installs the new version under the same name.
1122
1250
  - **abort** — stops the whole run with nothing written.
1123
1251
 
1124
1252
  Answers are remembered per bundle for the length of the run: a bundle installed
@@ -1131,6 +1259,7 @@ Decide up front instead:
1131
1259
  ```bash
1132
1260
  hcm install my-kit --on-conflict skip # keep whatever is already there
1133
1261
  hcm install my-kit --on-conflict overwrite # same as --force
1262
+ hcm install my-kit --on-conflict rename # keep both: add the bundle name as a suffix
1134
1263
  hcm install my-kit --on-conflict abort # the default: fail and list them
1135
1264
  hcm install my-kit --on-conflict prompt # ask even where hcm would not have
1136
1265
  ```
@@ -1139,11 +1268,13 @@ hcm install my-kit --on-conflict prompt # ask even where hcm would not have
1139
1268
 
1140
1269
  | Command | What it does |
1141
1270
  | --- | --- |
1142
- | `hcm install <bundle...>` | Install, with whatever it requires. `-t/--target`, `-f/--flavor`, `-s/--scope`, `--param`, `--params-file`, `--no-prompt`, `--dry-run`, `--force`, `--on-conflict`, `--refresh`, `--no-deps`, `--pi-subagents` |
1143
- | `hcm update [<bundle...>\|all]` | Re-read bundles and reinstall them in place. No argument: everything installed here; `all`: everything registered. `-t`, `-f`, `-s`, `--param`, `--params-file`, `--reconfigure`, `--no-prompt`, `--dry-run`, `--force`, `--on-conflict`, `--pi-subagents` |
1271
+ | `hcm install <bundle...>` | Install, with whatever it requires. `-t/--target`, `-f/--flavor`, `-s/--scope`, `--param`, `--params-file`, `--no-prompt`, `--dry-run`, `--force`, `--on-conflict`, `--refresh`, `--no-deps`, `--pi-subagents`, `--track registry\|source` |
1272
+ | `hcm update [<bundle...>\|all]` | Re-read bundles from the registry or from their sources, and reinstall them in place. No argument: everything installed here; `all`: that, and everything registered. `-t`, `-f`, `-s`, `--param`, `--params-file`, `--reconfigure`, `--no-prompt`, `--dry-run`, `--force`, `--on-conflict`, `--pi-subagents`, `--track registry\|source`, `--from <source>`, `--no-registry` |
1144
1273
  | `hcm uninstall <bundle...>` | Remove exactly what was installed. `-t`, `-s`, `--dry-run`, `--force`, `--cascade`, `--ignore-dependents`, `--keep-orphans` |
1145
- | `hcm list` | Registered bundles (`●` = installed somewhere). `--descriptions`, `--json` |
1274
+ | `hcm list` | Registered bundles with their ids and their status in this project (`●` = installed here). A "Local bundles" section shows the bundles that this project installed from its own dependencies, not from the registry. `-v/--verbose` (sources, flavors, parameters), `--descriptions`, `--json` |
1146
1275
  | `hcm list --installed` | Installed bundles. `--scope project\|user\|all`, `--json` |
1276
+ | `hcm list -a/--analysis` | Each installed bundle, its items, and the files and file entries of each item. Marks an entry that another bundle also claims. `--scope project\|user\|all`, `--json` |
1277
+ | `hcm list ... -o/--output <file>` | Write any `hcm list` output to a file, without colors |
1147
1278
  | `hcm info <bundle...>` | Contents, its flavors and parameters, plus where every item would land in each target. `-f/--flavor`, `--param`, `--params-file`, `--pi-subagents` |
1148
1279
  | `hcm params [list] [bundle...]` | The parameter values each installation was rendered with. `-t`, `-s`, `--json` |
1149
1280
  | `hcm params init [bundle...]` | Write a parameters file to fill in and pass back with `--params-file`. Omit the bundles for everything installed here. `-t`, `-f`, `-s`, `-o/--output`, `--stdout`, `--force` |
@@ -1157,10 +1288,11 @@ hcm install my-kit --on-conflict prompt # ask even where hcm would not have
1157
1288
  | `hcm validate [dir]` | Check a bundle for common mistakes |
1158
1289
  | `hcm init [dir]` | Scaffold a new bundle |
1159
1290
  | `hcm targets` | Supported harnesses, their paths, which are set up here, and the files they share |
1160
- | `hcm registry add <source...>` | Register bundles by path, `owner/repo`, or GitHub URL. `--dev`, `-n/--name` (one source only) |
1161
- | `hcm registry remove <bundle...>` | Unregister and delete the stored copy |
1291
+ | `hcm registry add <source...>` | Register bundles by path, `owner/repo`, GitHub URL, or the HTTPS clone URL of any git host. `--dev`, `-n/--name` (one source only), `--collection <name>`, `--on-collection-clash prompt\|join\|rename\|abort` |
1292
+ | `hcm registry update [bundle...]` | Read registered bundles from their sources again, and replace the stored copies. No argument: all of them. `--dry-run` |
1293
+ | `hcm registry remove [bundle...]` | Unregister and delete the stored copy. `--collection <name>` removes each bundle of that [named collection](#named-collections-remove-a-group-in-one-step) |
1162
1294
  | `hcm registry open [bundle]` | Print — and open — where registered bundles are stored |
1163
- | `hcm registry list` | List registered bundles with their ids |
1295
+ | `hcm registry list` | List registered bundles with their ids. `--collection <name>` lists only that collection. `--json` |
1164
1296
  | `hcm export [file]` | Write installed (or `--registry`) bundles to `bundles.txt` |
1165
1297
  | `hcm import [file]` | Register everything a bundles file lists; `--install` to install too, `-f/--flavor`, `--param`, `--params-file`, `--on-conflict` |
1166
1298
  | `hcm config` | Show settings; `config set\|get\|unset` to change them |
@@ -1183,8 +1315,9 @@ scoped to a bundle (`my-kit:NAME=value`) or to a bundle in one harness
1183
1315
  variadic, so it never swallows the bundle names after it. See
1184
1316
  [Parameters](#parameters-values-filled-in-at-install-time).
1185
1317
 
1186
- `<bundle>` accepts a registered **name or id**, a local path, or a GitHub
1187
- reference — so `hcm install 3`, `hcm install ./my-kit` and
1318
+ `<bundle>` accepts a registered **name or id**, a local path, a GitHub
1319
+ reference, or the [clone URL of any git host](#other-git-hosts-azure-devops-bitbucket-gitlab)
1320
+ — so `hcm install 3`, `hcm install ./my-kit` and
1188
1321
  `hcm install acme/kits/review#v2` all work, the last two without registering
1189
1322
  first.
1190
1323
 
@@ -1203,7 +1336,8 @@ hcm registry remove 1
1203
1336
 
1204
1337
  Ids are assigned on registration and stay put; re-registering a bundle keeps
1205
1338
  its id, and an id freed by `registry remove` is handed to the next bundle
1206
- registered. They are a local convenience, not an identity: `bundles.txt` and
1339
+ registered. The id `0` is reserved for [the built-in `hcm`
1340
+ bundle](#the-built-in-hcm-bundle), so registered ids start at `1`. They are a local convenience, not an identity: `bundles.txt` and
1207
1341
  install receipts always record names and sources, so nothing that travels
1208
1342
  between machines depends on them.
1209
1343
 
@@ -1252,6 +1386,60 @@ the ref, so for a branch name containing a slash use the shorthand instead:
1252
1386
  Tarballs are cached under `~/.hcm/cache`; `--refresh` re-downloads. See
1253
1387
  [Settings](#settings) to put the cache somewhere else.
1254
1388
 
1389
+ ### Other git hosts: Azure DevOps, Bitbucket, GitLab
1390
+
1391
+ `hcm` reads a bundle from any git host that has an HTTPS clone URL: Azure
1392
+ DevOps, Bitbucket, GitLab, Gitea or a self-hosted server. Give the URL that you
1393
+ give to `git clone`:
1394
+
1395
+ ```bash
1396
+ hcm registry add https://dev.azure.com/org/project/_git/repo
1397
+ hcm registry add https://bitbucket.org/workspace/repo.git
1398
+ hcm registry add https://gitlab.com/group/subgroup/repo.git
1399
+ hcm registry add https://git.example.com/team/repo.git
1400
+ ```
1401
+
1402
+ `hcm` does not start `git`, so the machine does not need git. It uses the git
1403
+ protocol over HTTPS, and downloads the files of one commit without the history.
1404
+
1405
+ To select a ref, a folder, or both, add `#<ref>:<folder>` to the URL. This is
1406
+ the form of `git show <ref>:<path>`:
1407
+
1408
+ ```bash
1409
+ hcm registry add https://bitbucket.org/workspace/repo.git#v1.2.0 # a tag, a branch or a full commit id
1410
+ hcm registry add https://bitbucket.org/workspace/repo.git#main:bundles # a folder of a branch
1411
+ hcm registry add https://bitbucket.org/workspace/repo.git#:bundles/my-kit # a folder of the default branch
1412
+ ```
1413
+
1414
+ - Without a ref, `hcm` reads the default branch.
1415
+ - A branch is not a fixed version. `hcm registry update` downloads its latest commit.
1416
+ - `hcm` also reads the browser URL of an Azure DevOps folder, with its `path` and `version` parameters.
1417
+ - To read a GitHub repository with the git protocol, write `git+` before the URL: `git+https://github.com/owner/repo.git`. Use this form for a private GitHub repository.
1418
+ - An SSH URL works only for github.com. For each other host, use the HTTPS clone URL.
1419
+ - `hcm` does not write symbolic links or submodules.
1420
+
1421
+ #### Private repositories
1422
+
1423
+ Put an access token in an environment variable. `hcm` sends the token as the
1424
+ password of HTTP Basic authentication.
1425
+
1426
+ | Variable | Meaning |
1427
+ | --- | --- |
1428
+ | `HCM_GIT_TOKEN_<HOST>` | The token for one host. Write the host name in upper case, with `_` for each character that is not a letter or a digit: `HCM_GIT_TOKEN_DEV_AZURE_COM` |
1429
+ | `HCM_GIT_TOKEN` | The token for each host that has no variable of its own |
1430
+ | `HCM_GIT_USERNAME` | The user name, for a host that needs one. A user name in the URL has priority |
1431
+
1432
+ ```bash
1433
+ export HCM_GIT_TOKEN_DEV_AZURE_COM=<token> # PowerShell: $env:HCM_GIT_TOKEN_DEV_AZURE_COM = '<token>'
1434
+ hcm registry add https://dev.azure.com/org/project/_git/repo
1435
+ ```
1436
+
1437
+ - The token needs only read access to the code.
1438
+ - Do not put the token in the URL. `hcm` records the URL in its registry, so it refuses a URL that contains a password.
1439
+ - Use `HCM_GIT_TOKEN_<HOST>` when you use more than one host. Then each host gets only its own token.
1440
+ - Azure DevOps, GitHub and GitLab accept a token with any user name.
1441
+ - For a Bitbucket access token, `hcm` sends the user name `x-token-auth`. For a Bitbucket app password, keep your user name in the URL: `https://<user>@bitbucket.org/workspace/repo.git`.
1442
+
1255
1443
  ### The store: where registered bundles live
1256
1444
 
1257
1445
  Registering **copies** the bundle into one central directory, `~/.hcm/store`,
@@ -1270,9 +1458,9 @@ hcm registry open --no-open # print only
1270
1458
  ```
1271
1459
 
1272
1460
  So a registered bundle is a **snapshot**. Installing it today and again next
1273
- month installs the same thing both times, whether it came from a GitHub ref that
1274
- has since moved or a working directory you have been editing. `hcm update` is
1275
- what goes back to the source; nothing else does.
1461
+ month installs the same thing both times, whether it came from a remote ref that
1462
+ has since moved or a working directory you have been editing. `hcm update` and
1463
+ `hcm registry update` are what go back to the source; nothing else does.
1276
1464
 
1277
1465
  ### Authoring: `registry add --dev`
1278
1466
 
@@ -1288,10 +1476,10 @@ hcm install my-kit # picks up the edit; nothing to refresh
1288
1476
  Dev entries are marked `[dev]` in `hcm list`, are read from your directory every
1289
1477
  time, and never have a copy in the store — so `hcm registry remove` unregisters
1290
1478
  them without touching your files. The listings read them live too: add a flavor
1291
- or a parameter to `my-kit/hcm.yaml` and `hcm list` says so at once, with no
1479
+ or a parameter to `my-kit/hcm.yaml` and `hcm list --verbose` says so at once, with no
1292
1480
  `hcm update` in between. A registered *snapshot* is the other way round — `hcm
1293
1481
  list` describes the copy in the store, which is what an install would write,
1294
- until `hcm update` moves it. `--dev` is refused for GitHub sources: there
1482
+ until `hcm update` moves it. `--dev` is refused for remote sources: there
1295
1483
  is nothing to edit in place. Clone the repo and register the clone.
1296
1484
 
1297
1485
  ### Updating
@@ -1316,9 +1504,26 @@ which for a bundle installed nowhere is a fetch that changes nothing here.
1316
1504
  project` means "everything in this project" and leaves your user-scope
1317
1505
  installations alone.
1318
1506
 
1319
- Anything installed here that is *not* registered — a bundle installed straight
1320
- from a path — is named and skipped, because there is nowhere to re-read it from.
1321
- Register its source and it joins the next run.
1507
+ Each installation follows the **registry** or its **source**. The next section
1508
+ tells how hcm decides. A bundle installed from a path that nobody registered
1509
+ follows its source, so `hcm update` reads that path again.
1510
+
1511
+ **`hcm registry update` does only the first half.** It reads registered bundles
1512
+ from their sources again and replaces the stored copies. It does not change a
1513
+ project:
1514
+
1515
+ ```bash
1516
+ hcm registry update # every registered bundle
1517
+ hcm registry update my-kit 3 # only these bundles
1518
+ hcm registry update --dry-run # show the versions, and change nothing
1519
+ ```
1520
+
1521
+ Use it to get the latest version of the bundles of a remote repository. Then run
1522
+ `hcm update` in each project that has them.
1523
+
1524
+ - `hcm` downloads a repository one time, also when it holds many registered bundles.
1525
+ - If one source fails, `hcm` reports it, updates the other bundles, and exits with code 1.
1526
+ - A bundle that is new in the repository is not registered. Run `hcm registry add <url>` again to register it.
1322
1527
 
1323
1528
  It is a rollback followed by an install, not a write-over-the-top, because a new
1324
1529
  version is defined as much by what it *removed*: a subagent deleted upstream has
@@ -1334,6 +1539,61 @@ version now collides with is put to you the same way `hcm install` does, and
1334
1539
  Bundles that are registered but not installed anywhere just get their stored
1335
1540
  copy refreshed.
1336
1541
 
1542
+ ### Follow the registry or the source
1543
+
1544
+ Software that ships a bundle is installed in one of two ways, and each way needs
1545
+ a different update path:
1546
+
1547
+ | The software | Example | One version for | The installation follows |
1548
+ | --- | --- | --- | --- |
1549
+ | A tool that the machine has one time | a CLI, an MCP server, an app | each machine | the **registry** |
1550
+ | A library that each project installs | a Python package in `.venv/`, an npm package in `node_modules/` | each project | its **source** |
1551
+
1552
+ **Registry.** The tool registers its bundle one time (`my-cli hcm init`). Each
1553
+ project installs it by name. After an upgrade of the tool, use one of these:
1554
+
1555
+ ```bash
1556
+ npm update -g my-cli
1557
+ hcm registry update # read the new bundle into the registry
1558
+ hcm update # in each project: install it there
1559
+ # or, in one project, without a change to the registry:
1560
+ hcm update --no-registry # read each bundle from the source that this project recorded
1561
+ ```
1562
+
1563
+ **Source.** Two projects can pin two versions of one library, so one registry
1564
+ entry cannot serve both. Install the bundle from the environment of the project,
1565
+ with `--track source`. The library can supply a command that does this, for
1566
+ example `python -m my_library hcm install`:
1567
+
1568
+ ```bash
1569
+ hcm install .venv/lib/python3.12/site-packages/my_library/hcm_bundle --track source -t claude-code
1570
+ pip install -U my_library
1571
+ hcm update # reads the .venv again; the registry is not read
1572
+ ```
1573
+
1574
+ How hcm decides which one an installation follows:
1575
+
1576
+ 1. `--track registry` or `--track source` on `hcm install` or `hcm update` sets the mode. hcm records it in `.hcm/state.json`, and a later install or update keeps it.
1577
+ 2. If no mode is recorded, the installation follows the registry when a bundle with its name is registered. Else it follows its source.
1578
+
1579
+ | Command | Effect |
1580
+ | --- | --- |
1581
+ | `hcm install <name\|id>` | Follows the registry. |
1582
+ | `hcm install <path\|url>` | Follows the registry if a bundle with that name is registered, else the source. hcm warns when the registered bundle comes from a different place. |
1583
+ | `hcm install <bundle> --track source` | Follows its source. A registered name is read from its origin, not from the store. |
1584
+ | `hcm update --no-registry` | Reads each installation from its recorded source, this time only. The registry does not change. |
1585
+ | `hcm update <bundle> --track registry` | Starts to follow the registry again, and installs the registered version. |
1586
+ | `hcm update <bundle> --track source` | Starts to follow the recorded source. |
1587
+ | `hcm update <bundle> --from <path\|url>` | Reads the bundle from a new source, and follows it from now on. Use it when the environment moved. |
1588
+
1589
+ Rules:
1590
+
1591
+ - An update of a source installation does not read or write the registry. `hcm update my-lib` keeps the pinned version also when `my-lib` is registered.
1592
+ - When the source and the registry have different versions of a bundle, `hcm install` and `hcm update` warn. `hcm list --installed` marks the installation `[source]`, and shows the registered version.
1593
+ - A local source inside the project, for example in `.venv/` or `node_modules/`, is also recorded as a path relative to the project. A teammate's checkout of the project then reads its own environment.
1594
+ - If the source is gone, `hcm update` reports it, updates the other bundles, and exits with code 1. To point the installation at the new place, use `--from`.
1595
+ - The built-in `hcm` bundle always has the version of the hcm that runs. It cannot follow a source.
1596
+
1337
1597
  ### Removing
1338
1598
 
1339
1599
  ```bash
@@ -1347,9 +1607,9 @@ files.
1347
1607
 
1348
1608
  ### Collections: many bundles in one place
1349
1609
 
1350
- A directory — local or a GitHub repo — can hold several bundles side by side.
1351
- Anything whose immediate subdirectories each contain an `hcm.yaml` is treated as
1352
- a collection:
1610
+ A directory — local, a GitHub repo, or a repo on any other git host — can hold
1611
+ several bundles side by side. Anything whose immediate subdirectories each
1612
+ contain an `hcm.yaml` is treated as a collection:
1353
1613
 
1354
1614
  ```
1355
1615
  agent-kits/
@@ -1365,6 +1625,7 @@ Point any command at the collection and it acts on every bundle inside:
1365
1625
  ```bash
1366
1626
  hcm registry add ./agent-kits # registers review-kit and db-kit separately
1367
1627
  hcm registry add acme/agent-kits # same, straight from GitHub
1628
+ hcm registry add https://dev.azure.com/acme/platform/_git/agent-kits # same, from Azure DevOps
1368
1629
  hcm install ./agent-kits # installs both
1369
1630
  hcm info acme/agent-kits # describes both
1370
1631
  ```
@@ -1376,6 +1637,98 @@ out of a collection, name its subdirectory: `hcm install acme/agent-kits/db-kit`
1376
1637
  Only one level is searched. A bundle that happens to contain a nested `hcm.yaml`
1377
1638
  is still one bundle, not a collection.
1378
1639
 
1640
+ #### The collection manifest: `hcm_manifest.yml`
1641
+
1642
+ A collection can have a collection manifest in its root folder. The file name is
1643
+ `hcm_manifest.yml`, `hcm_manifest.yaml` or `hcm_manifest.json`. All fields are
1644
+ optional:
1645
+
1646
+ ```yaml
1647
+ # agent-kits/hcm_manifest.yml
1648
+ collection: agent-kits # the collection name that each bundle gets in the registry
1649
+ bundles: # the bundle folders, relative to this file
1650
+ - review-kit
1651
+ - bundles/db-kit # a deeper folder is permitted
1652
+ ```
1653
+
1654
+ - `collection` sets the [collection name](#named-collections-remove-a-group-in-one-step)
1655
+ of each bundle that `hcm registry add` registers from the collection.
1656
+ - `bundles` replaces the search of the direct subfolders. hcm reads only the
1657
+ folders in the list, in the list order. Each folder must contain an
1658
+ `hcm.yaml`. A path must stay inside the collection folder.
1659
+ - Without `bundles`, hcm searches the direct subfolders, as for a collection
1660
+ without a manifest.
1661
+
1662
+ A folder is one bundle or one collection. hcm refuses a folder that contains
1663
+ `hcm.yaml` and `hcm_manifest.yml` together.
1664
+
1665
+ #### Named collections: remove a group in one step
1666
+
1667
+ The registry records the collection name of each bundle. Use it to remove all
1668
+ the bundles of one collection with one command:
1669
+
1670
+ ```bash
1671
+ hcm registry add ./agent-kits # the name from hcm_manifest.yml
1672
+ hcm registry add acme/agent-kits --collection acme # or give the name yourself
1673
+ hcm registry list --collection agent-kits # show the bundles of the collection
1674
+ hcm registry remove --collection agent-kits # unregister all of them
1675
+ ```
1676
+
1677
+ - `--collection` on `hcm registry add` replaces the name of the collection
1678
+ manifest. It also works for a single bundle.
1679
+ - When you register a bundle again with no collection name, the bundle keeps
1680
+ its collection. Thus `hcm registry add ./agent-kits/review-kit --dev` keeps
1681
+ `review-kit` in the `agent-kits` collection.
1682
+ - hcm reads the collection manifest only when you register the collection
1683
+ folder. A bundle that you register from its own folder gets no collection
1684
+ name from the manifest.
1685
+ - hcm ignores the case of collection names. A name uses letters, digits, dots,
1686
+ dashes and underscores.
1687
+ - `hcm registry remove --collection` does not uninstall. If a bundle of the
1688
+ collection is installed, the command tells you where. Use `hcm uninstall` to
1689
+ remove the items.
1690
+ - `hcm export` writes one source for each bundle, and not the collection name.
1691
+ Thus the bundles that `hcm import` registers from an exported file have no
1692
+ collection name.
1693
+
1694
+ #### When two sources use the same collection name
1695
+
1696
+ One collection name must mean one group, or `hcm registry remove --collection`
1697
+ removes more than you expect. A registration that asks for a name that bundles
1698
+ of a different source already use is a *clash*:
1699
+
1700
+ ```
1701
+ ! The collection name "agent-kits" is in use by bundles review-kit, db-kit from acme/agent-kits.
1702
+ What do you want to do with the bundles from ./my-kits?
1703
+ 1) join -- put them in "agent-kits" too; removing the collection then removes both groups
1704
+ *2) rename -- put them in a collection with another name, for example "agent-kits-2"
1705
+ 3) abort -- register nothing
1706
+ ? choose 1-3 [2]:
1707
+ ```
1708
+
1709
+ - **join** puts the new bundles in the existing collection.
1710
+ - **rename** asks for another name. Press Enter to accept the suggestion. hcm
1711
+ records the rename. A later registration of the same source gets the same
1712
+ name, with no question.
1713
+ - **abort** registers nothing.
1714
+
1715
+ hcm asks before it writes anything. Without a terminal, hcm stops, registers
1716
+ nothing, and tells you to choose with `--on-collection-clash`:
1717
+
1718
+ ```bash
1719
+ hcm registry add ./my-kits --on-collection-clash rename # or join, or abort
1720
+ ```
1721
+
1722
+ These cases are not clashes:
1723
+
1724
+ - The source already has bundles in the collection, because it joined before.
1725
+ - The sources differ only in the ref, for example `acme/kits#v1` and `acme/kits#v2`.
1726
+ - One source is inside the other, for example `./kits` and `./kits/review-kit`.
1727
+ - The only bundles with the name are bundles that this registration replaces.
1728
+ An example is a collection that moved to a new folder.
1729
+
1730
+ `hcm import --no-prompt` never asks. A clash fails that line of the file.
1731
+
1379
1732
  ### Settings
1380
1733
 
1381
1734
  `hcm config` shows every setting, its effective value, and where that value came
@@ -1390,7 +1743,7 @@ hcm config unset cacheDir # back to the default
1390
1743
 
1391
1744
  | Setting | Default | Meaning |
1392
1745
  | --- | --- | --- |
1393
- | `cacheDir` | `~/.hcm/cache` | Where bundles downloaded from GitHub are stored |
1746
+ | `cacheDir` | `~/.hcm/cache` | Where bundles downloaded from GitHub and other git hosts are stored |
1394
1747
  | `storeDir` | `~/.hcm/store` | Where registered bundles themselves are kept |
1395
1748
  | `requireTarget` | `auto` | When a writing command insists on `-t`: `auto` in [multi-harness folders](#one-folder-several-harnesses), `always`, or `never` |
1396
1749
 
@@ -1450,15 +1803,16 @@ Notes are comments, so the file stays a simple list of references — a line may
1450
1803
  be any form `hcm install` accepts, including a collection, which expands to
1451
1804
  every bundle inside it.
1452
1805
 
1453
- **Only GitHub-backed bundles are exported.** A local path means nothing on
1454
- another computer, so those are listed as skipped rather than written out:
1806
+ **Only bundles with a remote source are exported** — GitHub, or the clone URL of
1807
+ another git host. A local path means nothing on another computer, so those are
1808
+ listed as skipped rather than written out:
1455
1809
 
1456
1810
  ```
1457
1811
  ! Skipped 1 local bundle(s), which cannot be fetched elsewhere:
1458
1812
  local-kit (C:\work\local-kit)
1459
1813
  ```
1460
1814
 
1461
- Push a bundle to GitHub and re-register it if you want it to travel. An import
1815
+ Push a bundle to a git host and re-register it if you want it to travel. An import
1462
1816
  where some entries fail registers everything it can, reports the rest, and exits
1463
1817
  non-zero.
1464
1818
 
@@ -1480,7 +1834,9 @@ src/
1480
1834
  │ # refmap.ts -- repointing them at the installed layout
1481
1835
  ├── merge/ # json-merge.ts, blocks.ts, toml.ts -- the receipt machinery
1482
1836
  └── targets/ # one adapter per harness
1837
+ builtin/hcm/ # the built-in bundle, shipped in the npm package
1483
1838
  bundles/ts-review-kit/ # sample bundle exercising every resource kind
1839
+ scripts/ # sync-builtin-version.mjs, run by "npm version"
1484
1840
  tests/
1485
1841
  ├── *.test.ts # the unit layer: pure functions, plans, refusals,
1486
1842
  │ # registry ids, and anything whose assertion is not
@@ -1512,8 +1868,9 @@ tests/
1512
1868
  | `make link` / `make unlink` | Add or remove `hcm` on your PATH |
1513
1869
  | `make demo` | Show where the sample bundle would install |
1514
1870
  | `make pack` | Build a publishable tarball |
1515
- | `make publish` | Run checks and publish to npm |
1516
- | `make version-patch\|minor\|major` | Bump the version and tag it |
1871
+ | `make publish` | Bump the patch, commit, tag and push; GitHub Actions publishes to npm |
1872
+ | `make publish-local CONFIRM=yes` | Check, build and publish to npm from this machine |
1873
+ | `make version-minor\|major` | Start the next minor or major version; `make publish` releases it |
1517
1874
  | `make clean` | Remove `dist/` and tarballs |
1518
1875
  | `make distclean` | Also remove `node_modules/` |
1519
1876
  | `make reinstall` | `distclean` followed by `setup` |