harness-config-manager 0.1.0 → 0.1.4

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