harness-config-manager 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +1547 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +584 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/config.d.ts +7 -0
- package/dist/commands/config.js +49 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/context.d.ts +24 -0
- package/dist/commands/context.js +329 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/export.d.ts +19 -0
- package/dist/commands/export.js +116 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/import.d.ts +33 -0
- package/dist/commands/import.js +81 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/info.d.ts +19 -0
- package/dist/commands/info.js +235 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.js +116 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +119 -0
- package/dist/commands/install.js +533 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/list.d.ts +9 -0
- package/dist/commands/list.js +102 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/params.d.ts +58 -0
- package/dist/commands/params.js +366 -0
- package/dist/commands/params.js.map +1 -0
- package/dist/commands/refs.d.ts +60 -0
- package/dist/commands/refs.js +329 -0
- package/dist/commands/refs.js.map +1 -0
- package/dist/commands/registry.d.ts +18 -0
- package/dist/commands/registry.js +173 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/status.d.ts +10 -0
- package/dist/commands/status.js +83 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/targets.d.ts +8 -0
- package/dist/commands/targets.js +61 -0
- package/dist/commands/targets.js.map +1 -0
- package/dist/commands/uninstall.d.ts +71 -0
- package/dist/commands/uninstall.js +322 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +66 -0
- package/dist/commands/update.js +384 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -0
- package/dist/commands/validate.js +38 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/core/bundle.d.ts +49 -0
- package/dist/core/bundle.js +326 -0
- package/dist/core/bundle.js.map +1 -0
- package/dist/core/config.d.ts +65 -0
- package/dist/core/config.js +112 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/conflicts.d.ts +67 -0
- package/dist/core/conflicts.js +300 -0
- package/dist/core/conflicts.js.map +1 -0
- package/dist/core/context.d.ts +139 -0
- package/dist/core/context.js +432 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/deps.d.ts +62 -0
- package/dist/core/deps.js +339 -0
- package/dist/core/deps.js.map +1 -0
- package/dist/core/errors.d.ts +21 -0
- package/dist/core/errors.js +26 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/executor.d.ts +9 -0
- package/dist/core/executor.js +139 -0
- package/dist/core/executor.js.map +1 -0
- package/dist/core/flavors.d.ts +128 -0
- package/dist/core/flavors.js +386 -0
- package/dist/core/flavors.js.map +1 -0
- package/dist/core/frontmatter.d.ts +6 -0
- package/dist/core/frontmatter.js +20 -0
- package/dist/core/frontmatter.js.map +1 -0
- package/dist/core/fsx.d.ts +40 -0
- package/dist/core/fsx.js +180 -0
- package/dist/core/fsx.js.map +1 -0
- package/dist/core/github.d.ts +37 -0
- package/dist/core/github.js +157 -0
- package/dist/core/github.js.map +1 -0
- package/dist/core/harnesses.d.ts +142 -0
- package/dist/core/harnesses.js +215 -0
- package/dist/core/harnesses.js.map +1 -0
- package/dist/core/hash.d.ts +12 -0
- package/dist/core/hash.js +34 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/logger.d.ts +16 -0
- package/dist/core/logger.js +36 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/overlap.d.ts +79 -0
- package/dist/core/overlap.js +155 -0
- package/dist/core/overlap.js.map +1 -0
- package/dist/core/parameters.d.ts +249 -0
- package/dist/core/parameters.js +944 -0
- package/dist/core/parameters.js.map +1 -0
- package/dist/core/paths.d.ts +20 -0
- package/dist/core/paths.js +35 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/planner.d.ts +36 -0
- package/dist/core/planner.js +364 -0
- package/dist/core/planner.js.map +1 -0
- package/dist/core/prompt.d.ts +52 -0
- package/dist/core/prompt.js +197 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/refmap.d.ts +91 -0
- package/dist/core/refmap.js +331 -0
- package/dist/core/refmap.js.map +1 -0
- package/dist/core/refs.d.ts +297 -0
- package/dist/core/refs.js +801 -0
- package/dist/core/refs.js.map +1 -0
- package/dist/core/registry.d.ts +119 -0
- package/dist/core/registry.js +363 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/rename.d.ts +36 -0
- package/dist/core/rename.js +74 -0
- package/dist/core/rename.js.map +1 -0
- package/dist/core/rollback.d.ts +38 -0
- package/dist/core/rollback.js +226 -0
- package/dist/core/rollback.js.map +1 -0
- package/dist/core/semver.d.ts +56 -0
- package/dist/core/semver.js +214 -0
- package/dist/core/semver.js.map +1 -0
- package/dist/core/state.d.ts +99 -0
- package/dist/core/state.js +196 -0
- package/dist/core/state.js.map +1 -0
- package/dist/core/store.d.ts +30 -0
- package/dist/core/store.js +54 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/types.d.ts +515 -0
- package/dist/core/types.js +49 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/merge/blocks.d.ts +48 -0
- package/dist/merge/blocks.js +0 -0
- package/dist/merge/blocks.js.map +1 -0
- package/dist/merge/json-merge.d.ts +66 -0
- package/dist/merge/json-merge.js +176 -0
- package/dist/merge/json-merge.js.map +1 -0
- package/dist/merge/toml.d.ts +48 -0
- package/dist/merge/toml.js +118 -0
- package/dist/merge/toml.js.map +1 -0
- package/dist/targets/claude-code.d.ts +11 -0
- package/dist/targets/claude-code.js +94 -0
- package/dist/targets/claude-code.js.map +1 -0
- package/dist/targets/copilot.d.ts +13 -0
- package/dist/targets/copilot.js +126 -0
- package/dist/targets/copilot.js.map +1 -0
- package/dist/targets/index.d.ts +20 -0
- package/dist/targets/index.js +60 -0
- package/dist/targets/index.js.map +1 -0
- package/dist/targets/opencode.d.ts +32 -0
- package/dist/targets/opencode.js +172 -0
- package/dist/targets/opencode.js.map +1 -0
- package/dist/targets/pi.d.ts +42 -0
- package/dist/targets/pi.js +134 -0
- package/dist/targets/pi.js.map +1 -0
- package/dist/targets/reasonix.d.ts +27 -0
- package/dist/targets/reasonix.js +192 -0
- package/dist/targets/reasonix.js.map +1 -0
- package/dist/targets/shared.d.ts +33 -0
- package/dist/targets/shared.js +109 -0
- package/dist/targets/shared.js.map +1 -0
- package/dist/targets/types.d.ts +40 -0
- package/dist/targets/types.js +17 -0
- package/dist/targets/types.js.map +1 -0
- package/docs/authoring-bundles.md +828 -0
- package/package.json +74 -0
package/README.md
ADDED
|
@@ -0,0 +1,1547 @@
|
|
|
1
|
+
# harness-config-manager (`hcm`)
|
|
2
|
+
|
|
3
|
+
Define your subagents, skills, commands, rules and MCP servers **once**, then install
|
|
4
|
+
them into whichever agent harness you happen to be using — and remove them again
|
|
5
|
+
cleanly, even when several bundles share the same config file.
|
|
6
|
+
|
|
7
|
+
Supported targets:
|
|
8
|
+
|
|
9
|
+
| Target | Docs |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Claude Code | <https://code.claude.com/docs/en/claude-directory> |
|
|
12
|
+
| GitHub Copilot | <https://awesome-copilot.github.com/learning-hub/copilot-configuration-basics/> |
|
|
13
|
+
| Reasonix | <https://github.com/esengine/DeepSeek-Reasonix/blob/main-v2/docs/GUIDE.md> |
|
|
14
|
+
| OpenCode | <https://opencode.ai/docs/config/> |
|
|
15
|
+
| Pi | <https://pi.dev/docs/latest/quickstart> |
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Requires Node 20 or newer.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g harness-config-manager # puts `hcm` on your PATH
|
|
23
|
+
hcm --version
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To try it without installing anything:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx harness-config-manager list
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Note the package name is the full `harness-config-manager`, not `hcm`. `npx`
|
|
33
|
+
resolves the *package* name, and `hcm` on npm is an unrelated package. Once
|
|
34
|
+
installed, the command itself is `hcm`.
|
|
35
|
+
|
|
36
|
+
### From source
|
|
37
|
+
|
|
38
|
+
For working on hcm itself. `make setup` checks your Node version first and
|
|
39
|
+
tells you what to do if it is too old.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
make setup # install dependencies, build, run the checks
|
|
43
|
+
make link # puts `hcm` on your PATH
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or without make: `npm ci && npm run build && npm link`.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
hcm init my-kit # scaffold a bundle
|
|
52
|
+
hcm registry add ./my-kit # make it installable by name or id
|
|
53
|
+
hcm list # what can I install?
|
|
54
|
+
hcm info my-kit # where would everything land?
|
|
55
|
+
hcm install my-kit --dry-run # check before writing
|
|
56
|
+
hcm install my-kit # install into every supported target
|
|
57
|
+
hcm install my-kit -t claude pi # ...or just the harnesses you mean
|
|
58
|
+
hcm install 1 2 3 -t reasonix # several bundles in one go
|
|
59
|
+
hcm list --installed # what is installed here?
|
|
60
|
+
hcm status # is it all still intact?
|
|
61
|
+
hcm update # re-read the sources, reinstall everything here
|
|
62
|
+
hcm context append # put back context an agent overwrote
|
|
63
|
+
hcm uninstall my-kit # remove exactly what was installed
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Bundles and harnesses are both lists — `hcm install 1 2 3 -t reasonix pi` — and
|
|
67
|
+
in a folder used by more than one harness the commands that write ask which one
|
|
68
|
+
you mean. See [One folder, several harnesses](#one-folder-several-harnesses).
|
|
69
|
+
|
|
70
|
+
Every registered bundle also gets a one-character id, so the above is usually
|
|
71
|
+
`hcm install 1`, `hcm update 1`. If you are *writing* the bundle, register it
|
|
72
|
+
with `hcm registry add ./my-kit --dev` and your edits apply straight away.
|
|
73
|
+
|
|
74
|
+
## Bundle layout
|
|
75
|
+
|
|
76
|
+
A bundle is a directory with a manifest and conventionally-named subdirectories.
|
|
77
|
+
There is no resource list to maintain — the layout *is* the schema.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
my-kit/
|
|
81
|
+
├── hcm.yaml # name, version, description, tags, targets
|
|
82
|
+
├── subagents/code-reviewer.md # delegated worker with its own prompt
|
|
83
|
+
├── skills/dependency-audit/ # SKILL.md plus supporting files
|
|
84
|
+
│ ├── SKILL.md
|
|
85
|
+
│ └── checklist.md
|
|
86
|
+
├── commands/review-pr.md # slash command / prompt
|
|
87
|
+
├── rules/typescript.md # path-scoped instructions
|
|
88
|
+
├── context/10-conventions.md # always-loaded instructions, one section per file
|
|
89
|
+
├── context/20-pull-requests.md # concatenated in filename order
|
|
90
|
+
├── mcp/filesystem.json # one file per MCP server
|
|
91
|
+
├── settings/settings.json # settings fragment, deep-merged
|
|
92
|
+
└── assets/ # copied verbatim
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`hcm.yaml`:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
name: my-kit
|
|
99
|
+
version: 1.0.0
|
|
100
|
+
description: What this bundle is for
|
|
101
|
+
tags: [review, typescript]
|
|
102
|
+
# Omit "targets" to support all of them.
|
|
103
|
+
targets: [claude-code, copilot, reasonix, opencode, pi]
|
|
104
|
+
# Bundles this one needs; installed first. See "Dependencies" below.
|
|
105
|
+
dependencies:
|
|
106
|
+
- jira-board@^1.2.0
|
|
107
|
+
# Subsets it can be installed as. See "Flavors" below.
|
|
108
|
+
flavors:
|
|
109
|
+
python: Python tooling
|
|
110
|
+
# Values filled into its files at install time. See "Parameters" below.
|
|
111
|
+
parameters:
|
|
112
|
+
AGENT_NAME:
|
|
113
|
+
default: Claude
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Where things land
|
|
117
|
+
|
|
118
|
+
`hcm` writes one canonical resource into each harness's own convention, rewriting
|
|
119
|
+
frontmatter to match. Project scope is the current directory; user scope is the
|
|
120
|
+
harness's home directory (`hcm targets` prints the exact paths on your machine).
|
|
121
|
+
|
|
122
|
+
| Kind | Claude Code | GitHub Copilot | Reasonix |
|
|
123
|
+
| --- | --- | --- | --- |
|
|
124
|
+
| subagent | `.claude/agents/<n>.md` | `.github/agents/<n>.agent.md` | `.reasonix/skills/<n>/SKILL.md` |
|
|
125
|
+
| skill | `.claude/skills/<n>/` | `.github/skills/<n>/` | `.reasonix/skills/<n>/` |
|
|
126
|
+
| command | `.claude/commands/<n>.md` | `.github/prompts/<n>.prompt.md` | `.reasonix/commands/<n>.md` |
|
|
127
|
+
| rule | `.claude/rules/<n>.md` | `.github/instructions/<n>.instructions.md` | `REASONIX.md` |
|
|
128
|
+
| context | `CLAUDE.md` | `.github/copilot-instructions.md` | `REASONIX.md` |
|
|
129
|
+
| mcp | `.mcp.json` → `mcpServers.<n>` | `.vscode/mcp.json` → `servers.<n>` | `reasonix.toml` → `[[plugins]]` |
|
|
130
|
+
| settings | `.claude/settings.json` | `.github/copilot/settings.json` | `reasonix.toml` |
|
|
131
|
+
|
|
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` |
|
|
141
|
+
|
|
142
|
+
Frontmatter is translated per target. A rule written once as:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
appliesTo: ["**/*.ts", "**/*.tsx"]
|
|
146
|
+
```
|
|
147
|
+
|
|
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.
|
|
153
|
+
|
|
154
|
+
Note the deliberate asymmetry: bundles say **subagent**, but each harness keeps
|
|
155
|
+
its own word — and its own filing system — for the same thing. Claude Code,
|
|
156
|
+
Copilot and OpenCode each have an `agents/` directory; Reasonix and Pi have
|
|
157
|
+
none, because there a subagent *is* a skill — on Reasonix marked `runAs:
|
|
158
|
+
subagent` and `invocation: manual` so it is only invoked by name, on Pi invoked
|
|
159
|
+
as `/skill:<name>`. `hcm` translates; you only learn one vocabulary.
|
|
160
|
+
|
|
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.
|
|
163
|
+
|
|
164
|
+
### What each target does with the edges
|
|
165
|
+
|
|
166
|
+
Every target has a home for every kind, but the fit is not always exact:
|
|
167
|
+
|
|
168
|
+
- **OpenCode gates subagent tools through a `permission` object** keyed by its
|
|
169
|
+
own categories (`edit`, `bash`, `read`, …) rather than a list of tool names,
|
|
170
|
+
so a canonical `tools:` allowlist has no faithful translation and is dropped
|
|
171
|
+
from the written agent file. Set it in OpenCode's own config if you need it.
|
|
172
|
+
- **Pi has neither sub-agents nor a built-in MCP client** — both are extension
|
|
173
|
+
territory there — but both kinds still install, on the conventions those
|
|
174
|
+
extensions build on. A subagent becomes a skill (Agent Skills frontmatter is
|
|
175
|
+
just `name` and `description`, so `tools` and `model` are dropped, and with no
|
|
176
|
+
delegation the prompt runs in the main context rather than its own). MCP
|
|
177
|
+
servers go to the same `.mcp.json`, in the same `mcpServers` shape, that
|
|
178
|
+
Claude Code uses — inert until an MCP extension is installed, correct once it
|
|
179
|
+
is. If you *have* installed the sub-agent extension, say so — see
|
|
180
|
+
[`--pi-subagents`](#pi-subagents) below.
|
|
181
|
+
- **OpenCode has no glob-scoped rule format**, but it does read extra
|
|
182
|
+
instruction files listed in `instructions`. So a rule becomes a file *and* one
|
|
183
|
+
entry appended to that array — appended, never replaced, so several bundles
|
|
184
|
+
can each list their own rules in the same config and each remove only its own
|
|
185
|
+
on uninstall.
|
|
186
|
+
|
|
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).
|
|
189
|
+
Installing one bundle into both harnesses writes the shared item once, and both
|
|
190
|
+
installations claim it — so uninstalling from either leaves the other working,
|
|
191
|
+
and the item goes when the second one does. See
|
|
192
|
+
[Shared items](#shared-items-written-once-claimed-by-everyone-who-needs-them)
|
|
193
|
+
and [One folder, several harnesses](#one-folder-several-harnesses).
|
|
194
|
+
|
|
195
|
+
Everything outside those two files is per-target and unaffected.
|
|
196
|
+
|
|
197
|
+
### pi-subagents
|
|
198
|
+
|
|
199
|
+
Pi's sub-agent support is an extension,
|
|
200
|
+
[`pi-subagents`](https://github.com/nicobailon/pi-subagents), and it scans a
|
|
201
|
+
directory stock Pi knows nothing about. `hcm` cannot tell whether you have
|
|
202
|
+
installed it, so tell it:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
hcm install my-kit -t pi --pi-subagents
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
| | Without | With `--pi-subagents` |
|
|
209
|
+
| --- | --- | --- |
|
|
210
|
+
| project | `.pi/skills/<n>/SKILL.md` | `.pi/agents/<n>.md` |
|
|
211
|
+
| user | `~/.pi/agent/skills/<n>/SKILL.md` | `~/.pi/agent/agents/<n>.md` |
|
|
212
|
+
| frontmatter | `name`, `description` | `name`, `description`, `tools`, `model` |
|
|
213
|
+
| invoked as | `/skill:<n>`, in the main context | `subagent({ agent: "<n>" })`, in a child session |
|
|
214
|
+
|
|
215
|
+
The extension has fields for `tools` and `model`, so a subagent that would have
|
|
216
|
+
had them dropped keeps them. It also ends the shared namespace: a subagent and a
|
|
217
|
+
skill of the same name are two files in two directories rather than one
|
|
218
|
+
collision, though `hcm validate` still flags the pair because Reasonix keeps it.
|
|
219
|
+
|
|
220
|
+
`tools` is passed through as written. `hcm` translates the shape of frontmatter,
|
|
221
|
+
never the tool names inside it — and `pi-subagents` treats the list as a strict
|
|
222
|
+
allowlist over its own vocabulary (`read`, `grep`, `bash`, `mcp:<server>`), so a
|
|
223
|
+
list written for Claude Code will not match there. See
|
|
224
|
+
[authoring bundles](docs/authoring-bundles.md#subagents--subagentsnamemd).
|
|
225
|
+
|
|
226
|
+
**The flag is recorded with the installation**, so `hcm update` reinstalls into
|
|
227
|
+
the same place without being told again — say it once. Passing it to `hcm update`
|
|
228
|
+
overrides what was recorded, which is how you migrate an existing install after
|
|
229
|
+
adding the extension:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
hcm update my-kit --pi-subagents # moves the subagent, removing the old skill
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`hcm install` accepts it too, but a plain install does not clean up: it writes
|
|
236
|
+
the new location and leaves the old file behind, so it warns and points you at
|
|
237
|
+
`hcm update`. The flag also works on `hcm info` (to preview the layout) and on
|
|
238
|
+
`hcm import --install`.
|
|
239
|
+
|
|
240
|
+
## One folder, several harnesses
|
|
241
|
+
|
|
242
|
+
A project directory is not one harness's. The same checkout can hold `.claude/`,
|
|
243
|
+
`.reasonix/` and `.pi/`, because the person working in it uses all three. `hcm`
|
|
244
|
+
has always recorded installations per harness — an installation is keyed
|
|
245
|
+
`bundle@target@scope`, and `.hcm/state.json` holds one record, with its own
|
|
246
|
+
receipts, for each — so installing the same bundle into three harnesses gives
|
|
247
|
+
three independent installations that uninstall independently:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
hcm install my-kit -t claude-code
|
|
251
|
+
hcm install my-kit -t reasonix -t pi
|
|
252
|
+
hcm list --installed
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
project scope
|
|
257
|
+
● my-kit v1.0.0 → claude-code · 9 item(s) · 2026-08-13
|
|
258
|
+
● my-kit v1.0.0 → reasonix · 7 item(s) · 2026-08-13
|
|
259
|
+
● my-kit v1.0.0 → pi · 8 item(s) · 2026-08-13
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
`hcm targets` shows which harnesses this folder is actually used by, and `hcm
|
|
263
|
+
status` leads with the same list — both read it from the harnesses' own
|
|
264
|
+
directories, so a harness you set up yourself counts whether or not `hcm` has
|
|
265
|
+
ever installed into it. Ambiguous files do not count as evidence: finding
|
|
266
|
+
`AGENTS.md` says nothing about *which* harness put it there.
|
|
267
|
+
|
|
268
|
+
### Several at a time
|
|
269
|
+
|
|
270
|
+
Both halves of a command are lists. Name as many bundles as you like, and as
|
|
271
|
+
many harnesses:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
hcm install 1 2 3 --target reasonix pi # three bundles, two harnesses
|
|
275
|
+
hcm install my-kit db-kit -t claude # names and ids mix freely
|
|
276
|
+
hcm uninstall alpha beta -t pi
|
|
277
|
+
hcm update 1 3 -t reasonix
|
|
278
|
+
hcm info my-kit db-kit
|
|
279
|
+
hcm registry add ./my-kit ./db-kit
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
A harness can be named by its id, by an alias, or by **any unambiguous prefix**
|
|
283
|
+
— `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
|
|
285
|
+
installs into it once.
|
|
286
|
+
|
|
287
|
+
**Bundles come before `--target`.** The option is variadic, so it takes every
|
|
288
|
+
value after it — `hcm install --target pi 1 2 3` reads `1 2 3` as harness names
|
|
289
|
+
and says so:
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
✖ Unknown target "1"
|
|
293
|
+
Known targets: claude-code, copilot, reasonix, opencode, pi, or "all".
|
|
294
|
+
If that was meant to be a bundle, note that bundle names come before
|
|
295
|
+
--target, which takes every value after it.
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Several bundles is one operation, not a loop.** They are resolved into a
|
|
299
|
+
single dependency graph, so a bundle two of them require is worked out once and
|
|
300
|
+
installed once, a version clash between them is an error naming both rather
|
|
301
|
+
than whichever ran last, and a conflict question is asked once for the whole
|
|
302
|
+
run. The same goes coming out: `hcm uninstall shared alpha` removes a bundle
|
|
303
|
+
together with the one depending on it, which naming either alone would refuse.
|
|
304
|
+
|
|
305
|
+
**A bad name stops the run before anything is written.** Every reference is
|
|
306
|
+
resolved up front, so `hcm install 1 2 nosuchkit` installs neither 1 nor 2 —
|
|
307
|
+
there is no half-applied list to unpick.
|
|
308
|
+
|
|
309
|
+
### Saying which harness you mean
|
|
310
|
+
|
|
311
|
+
`hcm install my-kit` without `-t` is not a complete instruction — it does not
|
|
312
|
+
say into which harness. At a terminal, it asks, with the harnesses this folder
|
|
313
|
+
is already set up for ticked:
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
Which harness(es) should this install into?
|
|
317
|
+
[x] 1) Claude Code -- already set up in this folder
|
|
318
|
+
[ ] 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]:
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Answer with numbers or names, separated by spaces or commas, `all` for every
|
|
326
|
+
one, or press enter to take what is ticked. What comes ticked is what hcm has
|
|
327
|
+
installed here before — the ledger in `.hcm/` — and before there is one, the
|
|
328
|
+
harnesses whose own directories are lying around. Only the harnesses the bundle
|
|
329
|
+
supports are on the menu: a manifest with `targets: [claude-code, pi]` offers
|
|
330
|
+
two lines, not five.
|
|
331
|
+
|
|
332
|
+
`-t` skips the question, and so does `--no-prompt`. Without a terminal to ask —
|
|
333
|
+
a script, a CI run — an operation that would span more than one harness in a
|
|
334
|
+
folder set up for more than one is refused rather than guessed at:
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
✖ This folder is set up for more than one harness (Claude Code, Reasonix and Pi),
|
|
338
|
+
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
|
|
340
|
+
Name one or more: hcm install my-kit -t claude-code
|
|
341
|
+
Or every harness: hcm install my-kit -t all
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
`install`, `uninstall`, `update` and the three writing `hcm context` subcommands
|
|
345
|
+
all refuse it, and `-t all` is the explicit form of the old blanket default.
|
|
346
|
+
|
|
347
|
+
**It only asks when there is something to ask.** The question needs both a
|
|
348
|
+
multi-harness folder *and* an operation spanning more than one of them, so
|
|
349
|
+
plenty of commands never see it: `hcm uninstall my-kit` when the bundle only
|
|
350
|
+
ever went into Claude Code, a bundle whose manifest declares one target, a
|
|
351
|
+
folder with one harness in it. In a single-harness folder a blanket install is
|
|
352
|
+
merely wide, so it says so and carries on rather than refusing.
|
|
353
|
+
|
|
354
|
+
Set [`requireTarget`](#settings) to `always` to be asked everywhere, or to
|
|
355
|
+
`never` for the behaviour `hcm` had before it looked.
|
|
356
|
+
|
|
357
|
+
### When harnesses share a file
|
|
358
|
+
|
|
359
|
+
Uninstalling for one harness cannot always take something away from it, and
|
|
360
|
+
this is the reason:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
hcm install my-kit -t claude-code -t pi
|
|
364
|
+
hcm uninstall my-kit -t pi
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
```
|
|
368
|
+
removed .pi/skills/code-reviewer/SKILL.md
|
|
369
|
+
held .mcp.json → mcpServers.filesystem (still required by my-kit)
|
|
370
|
+
! .mcp.json is shared with Claude Code: 1 item(s) were left in place,
|
|
371
|
+
so Pi still reads them from this file
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
Nothing has gone wrong. Claude Code still claims that server, so the entry stays
|
|
375
|
+
in `.mcp.json` — and Pi reads the same `.mcp.json`, so Pi still has the server
|
|
376
|
+
it was just uninstalled from. One file cannot be two, so `hcm` says so rather
|
|
377
|
+
than letting you find out later. It goes the other way too: install an MCP
|
|
378
|
+
server for Claude Code alone in a folder where Pi is set up, and Pi gets it.
|
|
379
|
+
|
|
380
|
+
The same warning appears on the way in, on `hcm context` (one block in
|
|
381
|
+
`AGENTS.md` serves OpenCode and Pi alike), and in `hcm info`, which lists the
|
|
382
|
+
landing places two targets share before you install anything. `hcm targets`
|
|
383
|
+
lists them for the harnesses in the current folder:
|
|
384
|
+
|
|
385
|
+
```
|
|
386
|
+
Shared between the harnesses in this folder
|
|
387
|
+
.mcp.json Claude Code (mcp) · Pi (mcp)
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Which files these are is worked out from the target adapters themselves rather
|
|
391
|
+
than from a list kept by hand, so adding a harness that writes `AGENTS.md`
|
|
392
|
+
extends the warnings without anything else changing.
|
|
393
|
+
|
|
394
|
+
## Dependencies: bundles that build on other bundles
|
|
395
|
+
|
|
396
|
+
One bundle explaining how your team's JIRA board works is worth writing once and
|
|
397
|
+
requiring from the half-dozen bundles that assume it. A manifest says so:
|
|
398
|
+
|
|
399
|
+
```yaml
|
|
400
|
+
name: sprint-kit
|
|
401
|
+
version: 1.0.0
|
|
402
|
+
dependencies:
|
|
403
|
+
- jira-board@^1.2.0 # a name and a range
|
|
404
|
+
- team-conventions # any version will do
|
|
405
|
+
- name: db-kit # ...or the long form, with a source
|
|
406
|
+
version: ">=2.1 <3"
|
|
407
|
+
source: acme/agent-kits/db-kit
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Installing `sprint-kit` installs `jira-board` first:
|
|
411
|
+
|
|
412
|
+
```
|
|
413
|
+
Resolved 1 required bundle(s):
|
|
414
|
+
sprint-kit v1.0.0
|
|
415
|
+
└─ jira-board v1.4.2 (registered)
|
|
416
|
+
|
|
417
|
+
jira-board v1.4.2 (…/jira-board) (required by sprint-kit)
|
|
418
|
+
+ .claude/skills/jira-board/SKILL.md
|
|
419
|
+
+ .claude/agents/triager.md
|
|
420
|
+
|
|
421
|
+
sprint-kit v1.0.0 (…/sprint-kit)
|
|
422
|
+
= .claude/skills/jira-board/SKILL.md (already installed by another bundle -- shared, not copied again)
|
|
423
|
+
+ .claude/agents/planner.md
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**Where a dependency is looked for**, in order: bundles already in this run, the
|
|
427
|
+
registry, a sibling folder in the same collection, and the `source` the
|
|
428
|
+
dependency itself names. So a monorepo of bundles resolves with nothing
|
|
429
|
+
registered and no network, and a published bundle can point at where its
|
|
430
|
+
dependency lives. A `source` written as a path (`../shared/jira-board`) is read
|
|
431
|
+
against the manifest that declares it, so it means the same thing whichever
|
|
432
|
+
directory `hcm` is run from; a bare `owner/repo/path` is GitHub.
|
|
433
|
+
`hcm validate` tries the same lookup and tells you when it fails — which is the
|
|
434
|
+
moment to add a `source`, since what resolves on your machine because you
|
|
435
|
+
registered it resolves nowhere else.
|
|
436
|
+
|
|
437
|
+
**Versions** are the usual subset: `1.2.3`, `^1.2.3`, `~1.2.3`, `>=1.2.3`,
|
|
438
|
+
`1.2.x`, `*`, joined with a space for *and* and `||` for *or*. One version of a
|
|
439
|
+
bundle exists per scope — there is only one `.claude/agents/` — so two
|
|
440
|
+
dependents that cannot agree is an error naming both, not a silent choice:
|
|
441
|
+
|
|
442
|
+
```
|
|
443
|
+
✖ "jira-board" v1.4.2 does not satisfy ^2.0.0 (required by report-kit)
|
|
444
|
+
Only one version of a bundle can be installed in a scope, and sprint-kit
|
|
445
|
+
wants ^1.0.0, report-kit wants ^2.0.0.
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Cycles are refused, naming the loop. A dependency goes only into the harnesses
|
|
449
|
+
the bundles needing it went into, whatever else it happens to support.
|
|
450
|
+
|
|
451
|
+
**Coming back out.** A bundle pulled in as a dependency is marked as such
|
|
452
|
+
(`[dependency]` in `hcm list --installed`) and leaves when the last bundle
|
|
453
|
+
needing it does:
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
hcm uninstall sprint-kit # takes jira-board too, if nothing else needs it
|
|
457
|
+
hcm uninstall sprint-kit --keep-orphans
|
|
458
|
+
hcm uninstall jira-board # refused: sprint-kit still requires it
|
|
459
|
+
hcm uninstall jira-board sprint-kit # …or name both, and neither is left behind
|
|
460
|
+
hcm uninstall jira-board --cascade # …remove sprint-kit as well
|
|
461
|
+
hcm uninstall jira-board --ignore-dependents # …or leave it installed without it
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Installing a dependency by name makes it yours: it is no longer automatic, and
|
|
465
|
+
survives whatever pulled it in. `hcm install --no-deps` skips resolution
|
|
466
|
+
entirely, and says what it skipped.
|
|
467
|
+
|
|
468
|
+
`hcm update` installs dependencies a new version has gained, and leaves ones
|
|
469
|
+
that are already there alone — updating one bundle should not quietly update
|
|
470
|
+
another. Use `hcm update all` for that.
|
|
471
|
+
|
|
472
|
+
## Flavors: installing part of a bundle
|
|
473
|
+
|
|
474
|
+
A coding kit that covers Python and C# is one bundle — the review command, the
|
|
475
|
+
house conventions, the PR checklist are the same either way — but half of what it
|
|
476
|
+
ships is only useful in one language. Splitting it into two kits duplicates the
|
|
477
|
+
common half; shipping it whole puts C# subagents in front of people who write
|
|
478
|
+
Python. A **flavor** names the half:
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
hcm install coding-kit --flavor python
|
|
482
|
+
hcm install coding-kit --flavor python csharp # both
|
|
483
|
+
hcm install coding-kit # all of it, as always
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
Two rules, and everything else follows from them:
|
|
487
|
+
|
|
488
|
+
1. **A resource in no flavor is *common*** and installs whatever you ask for.
|
|
489
|
+
This is why a bundle that has never heard of flavors installs in full.
|
|
490
|
+
2. **A resource in at least one flavor** installs only when one of its flavors
|
|
491
|
+
was asked for. Asking for none asks for all of them.
|
|
492
|
+
|
|
493
|
+
**A markdown resource joins a flavor in its own frontmatter**, which is where the
|
|
494
|
+
fact belongs — next to the thing it is a fact about:
|
|
495
|
+
|
|
496
|
+
```markdown
|
|
497
|
+
---
|
|
498
|
+
description: Runs pytest, reads the failures, and reports the shortest path to green.
|
|
499
|
+
flavors: [python]
|
|
500
|
+
---
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**The manifest joins the rest by path**, since `mcp/`, `settings/` and `assets/`
|
|
504
|
+
have no frontmatter to write in. A pattern naming a directory takes everything
|
|
505
|
+
under it:
|
|
506
|
+
|
|
507
|
+
```yaml
|
|
508
|
+
flavors:
|
|
509
|
+
python:
|
|
510
|
+
description: Python typing, linting and test tooling
|
|
511
|
+
includes:
|
|
512
|
+
- rules/python.md
|
|
513
|
+
- mcp/pyright.json
|
|
514
|
+
- assets/python # …and everything inside it
|
|
515
|
+
csharp:
|
|
516
|
+
description: C# analyzers and conventions
|
|
517
|
+
includes: [rules/csharp.md]
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
Both mechanisms feed one list, so a kit can use whichever suits each resource.
|
|
521
|
+
Declaring flavors in the manifest is optional — leave it out and the flavors are
|
|
522
|
+
whatever the resources named for themselves, which is the shortest way to write
|
|
523
|
+
an all-markdown kit. Declare them and the list becomes the authority: `hcm
|
|
524
|
+
validate` reports a resource claiming a flavor that is not on it, a pattern that
|
|
525
|
+
matches nothing, and a flavor nothing belongs to.
|
|
526
|
+
|
|
527
|
+
**What the parts are is printed where you would look for it** — `hcm registry
|
|
528
|
+
list`, `hcm list`, and in full by `hcm info`, which names every member and marks
|
|
529
|
+
the flavor you are previewing:
|
|
530
|
+
|
|
531
|
+
```
|
|
532
|
+
$ hcm info coding-kit --flavor python
|
|
533
|
+
Flavors
|
|
534
|
+
● python 5 resource(s) — Python typing, linting and test tooling
|
|
535
|
+
mcp/pyright.json
|
|
536
|
+
rules/python.md
|
|
537
|
+
skills/pytest-runner
|
|
538
|
+
subagents/python-typer.md
|
|
539
|
+
assets/python/lint.sh
|
|
540
|
+
○ csharp 2 resource(s) — C# analyzers and conventions
|
|
541
|
+
rules/csharp.md
|
|
542
|
+
subagents/csharp-analyzer.md
|
|
543
|
+
5 resource(s) belong to no flavor and install whatever you ask for.
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
**Nothing downstream knows a flavor exists.** A narrowed install is one that
|
|
547
|
+
*plans* less, so its receipts claim exactly what it wrote — and uninstall,
|
|
548
|
+
`hcm status` and rollback need no special case. The choice is recorded with the
|
|
549
|
+
installation, so `hcm update` puts the same subset back without being told:
|
|
550
|
+
|
|
551
|
+
```bash
|
|
552
|
+
hcm update coding-kit # the flavors it was installed with
|
|
553
|
+
hcm update coding-kit --flavor csharp # switch: the Python half is removed, not orphaned
|
|
554
|
+
hcm update coding-kit --flavor all # widen back to the whole bundle
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
`all` is reserved as a flavor name for exactly that reason: with the flag
|
|
558
|
+
omitted meaning "whatever was recorded", widening again needs something to say.
|
|
559
|
+
|
|
560
|
+
**A misspelled flavor is refused**, because the alternative is installing the
|
|
561
|
+
common part and silently dropping the half you asked for:
|
|
562
|
+
|
|
563
|
+
```
|
|
564
|
+
✖ "coding-kit" has no flavor "pyhton"
|
|
565
|
+
It offers: python, csharp
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
**Naming several bundles with one `--flavor` needs all of them to define it.**
|
|
569
|
+
One flag cannot mean the Python part of one kit and the whole of another, and
|
|
570
|
+
choosing either reading for you would be a guess:
|
|
571
|
+
|
|
572
|
+
```
|
|
573
|
+
✖ --flavor python does not apply to "db-kit"
|
|
574
|
+
Installing several bundles at once with --flavor needs every one of them to
|
|
575
|
+
define the flavor. Install them one at a time to give each its own.
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
**A dependency needs no exception.** It inherits the run's flavors, and a bundle
|
|
579
|
+
with no flavors is entirely common — so one that has never heard of `python`
|
|
580
|
+
arrives whole, and one that happens to share the flavor is narrowed the same way
|
|
581
|
+
its dependent was. `hcm install` says which happened.
|
|
582
|
+
|
|
583
|
+
## Parameters: values filled in at install time
|
|
584
|
+
|
|
585
|
+
A bundle is written once and installed into many projects, and some of what it
|
|
586
|
+
says is different in each of them — the agent's name, the team that owns the
|
|
587
|
+
code, the ticket prefix. Writing those into the bundle means one bundle per
|
|
588
|
+
project; leaving them out means the instructions are vague. A **parameter** is
|
|
589
|
+
the third option: the bundle names the hole, the install fills it.
|
|
590
|
+
|
|
591
|
+
```yaml
|
|
592
|
+
# hcm.yaml
|
|
593
|
+
parameters:
|
|
594
|
+
AGENT_NAME:
|
|
595
|
+
description: What the agent should call itself
|
|
596
|
+
default: Claude
|
|
597
|
+
TEAM:
|
|
598
|
+
description: The team that owns this project
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
```markdown
|
|
602
|
+
<!-- context/10-identity.md -->
|
|
603
|
+
You are a coding agent called <%AGENT_NAME%>, working for the <%TEAM%> team.
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
```bash
|
|
607
|
+
hcm install my-kit --param TEAM=Platform --param AGENT_NAME=Ada
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
and the `CLAUDE.md` block reads *You are a coding agent called Ada, working for
|
|
611
|
+
the Platform team.*
|
|
612
|
+
|
|
613
|
+
Placeholders are filled in wherever the text of an installed item can hold one:
|
|
614
|
+
markdown bodies and their frontmatter, context sections, a skill's `SKILL.md`
|
|
615
|
+
**and** the files beside it, the string values inside MCP and settings
|
|
616
|
+
fragments, and any asset that is text. Never in a *path* — where a file lands is
|
|
617
|
+
a fact about the bundle, not about one install.
|
|
618
|
+
|
|
619
|
+
Substitution happens on the **plan**, after references are remapped and before
|
|
620
|
+
anything is compared against disk. So the hashes, the receipts, `--dry-run`,
|
|
621
|
+
`hcm info` and the cached context sections all describe the text that will
|
|
622
|
+
really be there — and rollback stays exact, because what was claimed is what was
|
|
623
|
+
written.
|
|
624
|
+
|
|
625
|
+
### Three kinds of parameter
|
|
626
|
+
|
|
627
|
+
| Declaration | Asked for |
|
|
628
|
+
| --- | --- |
|
|
629
|
+
| neither `flavors` nor `targets` | **global** — every install |
|
|
630
|
+
| `flavors: [python]` | when that flavor is installed (or no `--flavor` at all) |
|
|
631
|
+
| `targets: [claude-code]` | when installing into that harness |
|
|
632
|
+
|
|
633
|
+
Narrowing changes what is **asked**, not what is **substituted**. A parameter
|
|
634
|
+
scoped to Claude Code still has a default, and a file every harness gets that
|
|
635
|
+
mentions it reads as that default in the others — so narrowing never puts a hole
|
|
636
|
+
in a common file. Only a narrowed parameter with *no default* can, and
|
|
637
|
+
`hcm validate` reports exactly that.
|
|
638
|
+
|
|
639
|
+
A harness-scoped parameter is asked once per harness rather than once per
|
|
640
|
+
bundle, which is how one name takes a different value in each:
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
hcm install my-kit -t claude-code copilot \
|
|
644
|
+
--param my-kit@claude-code:AGENT_NAME=Ada \
|
|
645
|
+
--param my-kit@copilot:AGENT_NAME=Cop
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Four ways to answer
|
|
649
|
+
|
|
650
|
+
```bash
|
|
651
|
+
hcm install my-kit --param TEAM=Platform # a flag
|
|
652
|
+
hcm install my-kit --params-file team.yaml # a file, committable
|
|
653
|
+
HCM_PARAM_TEAM=Platform hcm install my-kit # the environment, for CI
|
|
654
|
+
hcm install my-kit # answering when asked
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Checked in that order, then this run's earlier answers, then what a previous
|
|
658
|
+
install recorded — and only when all of those are silent is anybody asked. So a
|
|
659
|
+
scripted run never blocks, an interactive one never repeats itself, and nothing
|
|
660
|
+
changes an answer behind your back. With no terminal and nothing supplied, a
|
|
661
|
+
required parameter stops the run rather than installing something half-written;
|
|
662
|
+
`--no-prompt` asks for that behaviour deliberately.
|
|
663
|
+
|
|
664
|
+
A parameters file scopes the same three ways the flag does:
|
|
665
|
+
|
|
666
|
+
```yaml
|
|
667
|
+
# team.yaml
|
|
668
|
+
TEAM: Platform # any bundle that asks for it
|
|
669
|
+
bundles:
|
|
670
|
+
my-kit:
|
|
671
|
+
AGENT_NAME: Ada # this bundle
|
|
672
|
+
targets:
|
|
673
|
+
copilot:
|
|
674
|
+
AGENT_NAME: Cop # this bundle, in Copilot
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
You do not have to write it by hand. `hcm params init` asks the bundles what
|
|
678
|
+
they want and writes the file for you to fill in:
|
|
679
|
+
|
|
680
|
+
```bash
|
|
681
|
+
hcm params init my-kit # writes params.yaml
|
|
682
|
+
$EDITOR params.yaml # fill in the blanks
|
|
683
|
+
hcm install my-kit --params-file params.yaml
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
Every question appears with what it is for, whether it has to be answered, and
|
|
687
|
+
what it will accept — with the answer already filled in wherever hcm can work
|
|
688
|
+
one out, so only the genuinely unknown values are left blank:
|
|
689
|
+
|
|
690
|
+
```yaml
|
|
691
|
+
bundles:
|
|
692
|
+
my-kit:
|
|
693
|
+
# What the agent should call itself
|
|
694
|
+
AGENT_NAME: Claude
|
|
695
|
+
# The team that owns this project
|
|
696
|
+
# REQUIRED — no default
|
|
697
|
+
TEAM:
|
|
698
|
+
# Token for the reporting service
|
|
699
|
+
# secret — never recorded, so it must be given every time
|
|
700
|
+
API_TOKEN:
|
|
701
|
+
targets:
|
|
702
|
+
claude-code:
|
|
703
|
+
# The model this project prefers
|
|
704
|
+
CLAUDE_MODEL: sonnet
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
A blank key means *not said* — hcm falls back to the default or asks, exactly as
|
|
708
|
+
if the key were absent, so a half-finished file is never a broken one. Write
|
|
709
|
+
`KEY: ""` to mean the value really is empty.
|
|
710
|
+
|
|
711
|
+
Name no bundles and it writes down what this project is **already** installed
|
|
712
|
+
as, values and all:
|
|
713
|
+
|
|
714
|
+
```bash
|
|
715
|
+
hcm params init # prefilled from the installation ledger
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
That file, committed or handed to a colleague, reproduces the setup on a fresh
|
|
719
|
+
checkout — with the exception of anything declared `secret`, which was never
|
|
720
|
+
recorded and is left blank on purpose.
|
|
721
|
+
|
|
722
|
+
### Remembered for `hcm update`
|
|
723
|
+
|
|
724
|
+
The values are recorded with the installation, so the next version is rendered
|
|
725
|
+
with the same ones without being told again — an update that silently renamed
|
|
726
|
+
the agent would be worse than no update at all.
|
|
727
|
+
|
|
728
|
+
```bash
|
|
729
|
+
hcm params # what each installation holds
|
|
730
|
+
hcm update my-kit # new version, same values
|
|
731
|
+
hcm update my-kit --param AGENT_NAME=Grace # change one, keep the rest
|
|
732
|
+
hcm update my-kit --reconfigure # ask for all of them again
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
A parameter declared `secret: true` is used but never written to the ledger —
|
|
736
|
+
project scope keeps that in `.hcm/state.json`, a file people commit. The trade
|
|
737
|
+
is that an update has to be given it again.
|
|
738
|
+
|
|
739
|
+
## Shared items: written once, claimed by everyone who needs them
|
|
740
|
+
|
|
741
|
+
Two bundles will often want the very same thing: a dependency's skill that its
|
|
742
|
+
dependents also ship, an MCP server two kits both wrap, a permission both ask
|
|
743
|
+
for. That is not a collision.
|
|
744
|
+
|
|
745
|
+
**An item hcm has already installed, identical to what this bundle would write,
|
|
746
|
+
is *shared*.** Nothing is written a second time — no second copy, not even a
|
|
747
|
+
rewritten file — and the new installation claims it alongside the existing one.
|
|
748
|
+
Uninstalling reports the item as `held` and leaves it:
|
|
749
|
+
|
|
750
|
+
```
|
|
751
|
+
removed .claude/agents/planner.md
|
|
752
|
+
held .claude/skills/jira-board/SKILL.md (still required by jira-board)
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
The last claim to go takes the item with it. There is no counter to drift out of
|
|
756
|
+
step: the claims *are* the install ledger, so what is holding an item is worked
|
|
757
|
+
out from the same records `hcm list --installed` prints.
|
|
758
|
+
|
|
759
|
+
This works item by item, so two bundles asking for one permission each plus one
|
|
760
|
+
in common end up with three entries in the allow-list, and removing either
|
|
761
|
+
leaves the other's two. It works across harnesses, since the claim is keyed by
|
|
762
|
+
where the item actually is — which is what makes `.mcp.json` and `AGENTS.md`
|
|
763
|
+
safe to share between Claude Code, OpenCode and Pi. And it works only for hcm's
|
|
764
|
+
own claims: an entry *you* wrote is claimed by nobody, so it is adopted and
|
|
765
|
+
outlives every bundle that happened to want it.
|
|
766
|
+
|
|
767
|
+
Three outcomes, then, when something is already there:
|
|
768
|
+
|
|
769
|
+
| What is there | Outcome | On uninstall |
|
|
770
|
+
| --- | --- | --- |
|
|
771
|
+
| Nothing | written | removed |
|
|
772
|
+
| The same item, claimed by another bundle | **shared** — not written again | `held` until the last claimant goes |
|
|
773
|
+
| The same item, claimed by nobody | **adopted** — not written, not owned | `kept`, always |
|
|
774
|
+
| A different item | a conflict — you are asked | — |
|
|
775
|
+
|
|
776
|
+
## Context: sections that survive being overwritten
|
|
777
|
+
|
|
778
|
+
`CLAUDE.md`, `AGENTS.md` and `REASONIX.md` are the one place hcm writes that the
|
|
779
|
+
harness's own agent also writes. Ask it to record what it has learned about the
|
|
780
|
+
project and it may rewrite the file from scratch — taking the marker blocks, and
|
|
781
|
+
the instructions inside them, with it.
|
|
782
|
+
|
|
783
|
+
A receipt cannot help here: it records *where* a section was, not what it said.
|
|
784
|
+
So every install also drops a copy of each context section under `.hcm`:
|
|
785
|
+
|
|
786
|
+
```
|
|
787
|
+
.hcm/
|
|
788
|
+
├── state.json # the install ledger
|
|
789
|
+
├── context.json # each section, its order, and where it goes
|
|
790
|
+
└── context/
|
|
791
|
+
└── ts-review-kit/
|
|
792
|
+
├── 10-conventions.md
|
|
793
|
+
└── 20-pull-requests.md
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
Split `context/` into several short files and each becomes its own section —
|
|
797
|
+
its own marker block, restorable on its own. Filename order is section order,
|
|
798
|
+
which is what the numeric prefixes are for.
|
|
799
|
+
|
|
800
|
+
```bash
|
|
801
|
+
hcm context # what is tracked, and is it still in place?
|
|
802
|
+
hcm context append # put back whatever has gone missing
|
|
803
|
+
hcm context override # clear the file, rewrite it from the sections
|
|
804
|
+
hcm context remove # take the sections out again
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
Every subcommand takes bundle names or ids — `hcm context append 1 my-kit` — and
|
|
808
|
+
acts on all of them when you name none. `-t` narrows to one harness, `-s` to a
|
|
809
|
+
scope, and `--dry-run` shows the change without making it.
|
|
810
|
+
|
|
811
|
+
**`append` is the everyday one.** It looks at each tracked section and writes
|
|
812
|
+
back only what is absent, leaving the rest of the file — including anything the
|
|
813
|
+
agent wrote — exactly where it is. Two things it deliberately does not touch:
|
|
814
|
+
|
|
815
|
+
- A section still inside its markers is left alone even if the text has been
|
|
816
|
+
edited, on the same principle as everywhere else in `hcm`. `--force` writes
|
|
817
|
+
every section from the cache instead, which is how you undo such an edit.
|
|
818
|
+
- A section whose text survived the rewrite *without* its markers is reported as
|
|
819
|
+
`unmarked` and not appended, because appending would say the same thing twice.
|
|
820
|
+
`hcm context list` shows these; re-wrapping one means deleting the loose copy
|
|
821
|
+
and running `append` again.
|
|
822
|
+
|
|
823
|
+
**`override` is the reset.** It discards everything hcm did not write and lays
|
|
824
|
+
the sections down in order. Blocks belonging to other bundles — or to rules,
|
|
825
|
+
which share `AGENTS.md` on Pi and `REASONIX.md` on Reasonix — are kept and moved
|
|
826
|
+
below, since they have receipts of their own. Because it does destroy
|
|
827
|
+
hand-written text, it says how many lines that is and asks first; `--force`
|
|
828
|
+
answers yes, and with no terminal it refuses rather than guessing.
|
|
829
|
+
|
|
830
|
+
**`remove` takes the sections out** and keeps the cached copies, so `append` can
|
|
831
|
+
put them back. Uninstalling the bundle is what forgets them for good.
|
|
832
|
+
|
|
833
|
+
Throughout, the install receipts are kept in step: after `hcm context remove`,
|
|
834
|
+
`hcm status` does not report the blocks as damage, and after `append` it counts
|
|
835
|
+
them as present again.
|
|
836
|
+
|
|
837
|
+
## References: written once, repointed on the way in
|
|
838
|
+
|
|
839
|
+
A bundle's files talk about each other. A `SKILL.md` says to work through
|
|
840
|
+
`checklist.md`; a command points at the skill; an MCP server's args name a
|
|
841
|
+
script under `assets/`. Installation takes that layout apart and files each
|
|
842
|
+
piece under a different harness's conventions — so a path written against the
|
|
843
|
+
bundle is wrong in every target, and wrong differently in each.
|
|
844
|
+
|
|
845
|
+
So write references **against the bundle's own layout**, from its root:
|
|
846
|
+
|
|
847
|
+
```markdown
|
|
848
|
+
Follow the checklist at `skills/dependency-audit/checklist.md`.
|
|
849
|
+
See [the reviewer](subagents/code-reviewer.md) for the tone to use.
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
and `hcm` rewrites them as it installs, to wherever those files actually went:
|
|
853
|
+
|
|
854
|
+
| Written in the bundle | Claude Code | Reasonix |
|
|
855
|
+
| --- | --- | --- |
|
|
856
|
+
| `subagents/code-reviewer.md` | `.claude/agents/code-reviewer.md` | `.reasonix/skills/code-reviewer/SKILL.md` |
|
|
857
|
+
| `skills/audit/checklist.md` | `.claude/skills/audit/checklist.md` | `.reasonix/skills/audit/checklist.md` |
|
|
858
|
+
| `context/conventions.md` | `CLAUDE.md` | `REASONIX.md` |
|
|
859
|
+
| `assets/run.sh` | `.claude/assets/run.sh` | `.reasonix/assets/run.sh` |
|
|
860
|
+
|
|
861
|
+
What comes out is always **relative to the file doing the referring**:
|
|
862
|
+
|
|
863
|
+
```
|
|
864
|
+
.claude/skills/audit/SKILL.md → checklist.md (same directory)
|
|
865
|
+
.claude/commands/review.md → ../skills/audit/checklist.md
|
|
866
|
+
.claude/skills/audit/SKILL.md → ../../agents/code-reviewer.md
|
|
867
|
+
CLAUDE.md → .claude/skills/audit/checklist.md
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
One rule, not two. A reference means the same thing to whoever reads the file it
|
|
871
|
+
is written in, wherever that file ended up — the last line only looks like a
|
|
872
|
+
rooted path because a context section lands at the scope root and has nothing to
|
|
873
|
+
climb out of. It is why the same reference reads identically at project and user
|
|
874
|
+
scope, even though the layouts differ: from `prompts/review.md` to
|
|
875
|
+
`skills/audit/checklist.md` is `../skills/audit/checklist.md` either way.
|
|
876
|
+
|
|
877
|
+
Both readings are accepted going in, bundle root first, so `checklist.md` next
|
|
878
|
+
to a `SKILL.md` keeps working and nothing written before this needs changing.
|
|
879
|
+
Markdown links, images, link definitions, inline code and `@paths` are all
|
|
880
|
+
rewritten, in resource files *and* in context blocks, and so are whole string
|
|
881
|
+
values in MCP and settings fragments — `"args": ["assets/run.sh"]` is repointed,
|
|
882
|
+
while `"args": ["-c", "echo hi"]` is left alone.
|
|
883
|
+
|
|
884
|
+
Nothing is guessed. A reference is rewritten only when it names a file the
|
|
885
|
+
bundle ships *and* this target installs. One naming a file the target drops is
|
|
886
|
+
left exactly as written and reported as a warning; one pointing outside the
|
|
887
|
+
bundle — a URL, a path in the user's project — is never touched. `hcm info`
|
|
888
|
+
prints the rewrites per target before you install anything, and `hcm install
|
|
889
|
+
--verbose` prints them as it goes.
|
|
890
|
+
|
|
891
|
+
> **One thing to watch in config values.** The rule holds wherever a path is
|
|
892
|
+
> resolved against the file containing it, which is how the harnesses read the
|
|
893
|
+
> markdown they load. A path inside a *config value* — an MCP server's `args`,
|
|
894
|
+
> a hook command in `settings.json` — is resolved by the harness, usually
|
|
895
|
+
> against the project root rather than against the config file. Where the config
|
|
896
|
+
> sits at the scope root (`.mcp.json`, `opencode.json`, `reasonix.toml`) the two
|
|
897
|
+
> agree and there is nothing to think about. Where it does not, they diverge:
|
|
898
|
+
> Copilot's `.vscode/mcp.json` gets `../.github/assets/run.sh`, which is the
|
|
899
|
+
> correct path *from that file* and not what a client launched in the project
|
|
900
|
+
> root will open. Keep executable paths out of bundle-relative references, or
|
|
901
|
+
> check `hcm info` before shipping.
|
|
902
|
+
|
|
903
|
+
### Finding the ones that point at nothing
|
|
904
|
+
|
|
905
|
+
```bash
|
|
906
|
+
hcm refs check --path ./bundles # report broken references
|
|
907
|
+
hcm refs fix --path ./bundles # repair them, by picking from a list
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
`check` reads every markdown file and config under the path — one bundle or a
|
|
911
|
+
whole collection — resolves each reference both ways, and reports what resolves
|
|
912
|
+
neither way, with the files it probably meant:
|
|
913
|
+
|
|
914
|
+
```
|
|
915
|
+
ts-review-kit/README.md · 14 file(s) · 9 reference(s) · 1 bundle(s)
|
|
916
|
+
scope: links, wikilinks and explicitly relative paths
|
|
917
|
+
|
|
918
|
+
ts-review-kit/README.md
|
|
919
|
+
✖ line 11 context/conventions.md (link)
|
|
920
|
+
→ context/10-conventions.md
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
The `scope` line is the important one, and [What counts as a
|
|
924
|
+
reference](#what-counts-as-a-reference) is what it means.
|
|
925
|
+
|
|
926
|
+
`fix` puts the same thing in a JSON file, one entry per broken reference, each
|
|
927
|
+
with the candidates ranked best first:
|
|
928
|
+
|
|
929
|
+
```json
|
|
930
|
+
{
|
|
931
|
+
"ts-review-kit/README.md": {
|
|
932
|
+
"original_ref": "context/conventions.md",
|
|
933
|
+
"new": ["context/10-conventions.md", "context/20-pull-requests.md"]
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
Delete the wrong ones. **Leave exactly one entry in each `new` list**, save, and
|
|
939
|
+
close the editor — every entry down to one choice is applied, and every entry
|
|
940
|
+
still holding two or more is reported and left alone, so an unfinished pass
|
|
941
|
+
cannot write something nobody picked. Entries are keyed by the file the
|
|
942
|
+
reference is in; a file that broke several gets `#2`, `#3` suffixes, and
|
|
943
|
+
`original_ref` is what actually identifies the reference.
|
|
944
|
+
|
|
945
|
+
`$VISUAL` or `$EDITOR` decides the editor; GUI editors known to fork get
|
|
946
|
+
`--wait` added, or the round trip would apply the file before you touched it.
|
|
947
|
+
Two flags split it up when that is not what you want:
|
|
948
|
+
|
|
949
|
+
```bash
|
|
950
|
+
hcm refs fix --path ./bundles --write # save hcm-refs.json here, stop
|
|
951
|
+
hcm refs fix --path ./bundles --write fixes.json # ...under a name of your choosing
|
|
952
|
+
hcm refs fix --path ./bundles --file fixes.json # apply one you edited earlier
|
|
953
|
+
hcm refs fix --path ./bundles --file fixes.json --dry-run
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
Suggestions come from the files under the scanned path — the same bundle first,
|
|
957
|
+
then sibling bundles and dependencies in the same folder. A suggestion from
|
|
958
|
+
another bundle is marked, and never outranks one from the bundle doing the
|
|
959
|
+
referring: it may not be installed alongside it, and it cannot be remapped if it
|
|
960
|
+
is not.
|
|
961
|
+
|
|
962
|
+
### What counts as a reference
|
|
963
|
+
|
|
964
|
+
A bundle's prose is full of filenames it is not referring to:
|
|
965
|
+
|
|
966
|
+
```markdown
|
|
967
|
+
A file will be created named `report.txt`.
|
|
968
|
+
Identify the manifest (`package.json`) and read `tsconfig.json`.
|
|
969
|
+
The run log lands in `logs/scaffold.txt`.
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
Every one of those sentences is complete and true, and not one of them points at
|
|
973
|
+
a file the bundle ships. A checker that flags them is wrong about the bundle and
|
|
974
|
+
trains you to skim its output — so a reference has to be **written as one**, in
|
|
975
|
+
one of two ways:
|
|
976
|
+
|
|
977
|
+
| | |
|
|
978
|
+
| --- | --- |
|
|
979
|
+
| **Declared** | the syntax says its target is a path: `[text](path)`, ``, a `[id]:` definition, a `[[wikilink]]`, an `@path` mention |
|
|
980
|
+
| **Relative** | written with an explicit `./` or `../`, anywhere — inline code, a config value, a link target |
|
|
981
|
+
|
|
982
|
+
Everything else is left alone. `` `checklist.md` `` is a name; `` `./checklist.md` ``
|
|
983
|
+
is a reference, and the `./` is you saying so. When you mean a file the bundle
|
|
984
|
+
ships, write the prefix.
|
|
985
|
+
|
|
986
|
+
Beyond that, and at every scope:
|
|
987
|
+
|
|
988
|
+
- **Fenced code blocks are skipped** — they are examples and shell sessions.
|
|
989
|
+
- **URLs, anchors, absolute paths, `~/…` and `${VAR}` paths** are somebody
|
|
990
|
+
else's to resolve.
|
|
991
|
+
- **Paths rooted at a hidden directory** — `.claude/agents/x.md`,
|
|
992
|
+
`.vscode/mcp.json` — describe where something lands *after* installation.
|
|
993
|
+
Bundles ship no hidden directories, so these are documentation, not references.
|
|
994
|
+
- **Well-known project filenames** (`package.json`, `tsconfig.json`, `go.mod`,
|
|
995
|
+
lockfiles…) mentioned without a path.
|
|
996
|
+
|
|
997
|
+
#### Wikilinks
|
|
998
|
+
|
|
999
|
+
`[[release-checklist]]` resolves the way wiki tools resolve one — by **name**,
|
|
1000
|
+
against any file in the same bundle, wherever it sits. The `|alias` and
|
|
1001
|
+
`#heading` are not part of the name, and a missing extension is guessed
|
|
1002
|
+
(`.md`, `.markdown`, `.mdx`). A fix for a broken wikilink is offered as a
|
|
1003
|
+
wikilink, not as a path.
|
|
1004
|
+
|
|
1005
|
+
Wikilinks are checked but **not** rewritten at install time: a name survives
|
|
1006
|
+
being moved, and turning one into a relative path would break it.
|
|
1007
|
+
|
|
1008
|
+
#### Moving the line
|
|
1009
|
+
|
|
1010
|
+
```bash
|
|
1011
|
+
hcm refs check --path ./bundles --links # links and wikilinks only
|
|
1012
|
+
hcm refs check --path ./bundles --all-paths # ...plus every implicit path
|
|
1013
|
+
hcm refs check --path ./bundles --strict # ...plus bare names matching nothing
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
`--links` is the narrow pass, for when you care about a document's links and
|
|
1017
|
+
nothing else — it reads no config values at all. `--all-paths` is the wide one,
|
|
1018
|
+
and it is how this used to behave by default: bare filenames and implicit paths
|
|
1019
|
+
come back, with a bare name reported only when something similar exists to offer
|
|
1020
|
+
as a fix. `--strict` implies `--all-paths` and drops that last condition.
|
|
1021
|
+
|
|
1022
|
+
`fix` takes the same three flags, and needs the ones `check` was run with — it
|
|
1023
|
+
re-scans before applying, and a narrower scope would not find the references the
|
|
1024
|
+
fix file was written for.
|
|
1025
|
+
|
|
1026
|
+
## How rollback stays exact
|
|
1027
|
+
|
|
1028
|
+
The hard part is that bundles share files. Two bundles both write into
|
|
1029
|
+
`.mcp.json`; a third appends to `settings.json`; you hand-edit `CLAUDE.md`. A
|
|
1030
|
+
line-based or diff-based record would break the moment anything is reordered or
|
|
1031
|
+
reformatted.
|
|
1032
|
+
|
|
1033
|
+
So `hcm` never records line numbers. Every write leaves a **receipt** expressed in
|
|
1034
|
+
terms the file format itself understands:
|
|
1035
|
+
|
|
1036
|
+
- **JSON** — a structural path plus a SHA-256 of the value written, e.g.
|
|
1037
|
+
`mcpServers.filesystem = <hash>`. On uninstall the pointer is resolved in the
|
|
1038
|
+
file *as it is now*; the item is removed only if it still hashes to what we
|
|
1039
|
+
wrote. Hashes are computed over canonicalised JSON with sorted keys, so
|
|
1040
|
+
reformatting and key reordering are invisible.
|
|
1041
|
+
- **JSON arrays** (permission allow-lists) — each appended item is recorded by
|
|
1042
|
+
its own hash and removed by value, so position never matters and items other
|
|
1043
|
+
bundles contributed are left alone.
|
|
1044
|
+
- **Markdown and TOML** — a comment-delimited marker block, so removal is an
|
|
1045
|
+
exact excision no matter what moved around it:
|
|
1046
|
+
|
|
1047
|
+
```markdown
|
|
1048
|
+
<!-- hcm:begin my-kit/conventions -->
|
|
1049
|
+
...
|
|
1050
|
+
<!-- hcm:end my-kit/conventions -->
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
TOML uses `# hcm:begin ...`. Because TOML files carry comments people care
|
|
1054
|
+
about, `hcm` never parses-and-restringifies them — it only appends and excises
|
|
1055
|
+
marked blocks, leaving the rest of the file byte-for-byte intact.
|
|
1056
|
+
|
|
1057
|
+
Consequences worth knowing:
|
|
1058
|
+
|
|
1059
|
+
- **Files you already had are never deleted.** A pre-existing `CLAUDE.md` keeps
|
|
1060
|
+
its content; only the marked block goes. A file that ends up empty is removed.
|
|
1061
|
+
- **Hand edits are respected.** If an item no longer matches its receipt,
|
|
1062
|
+
uninstall reports it as `modified` and leaves it in place. The installation
|
|
1063
|
+
record is kept so you can retry with `--force`.
|
|
1064
|
+
- **Overwrites are reversible.** When installing replaces an existing value, the
|
|
1065
|
+
old value is stored in the receipt and restored on uninstall.
|
|
1066
|
+
- **Items you already had are adopted, not claimed.** If a server, file or key
|
|
1067
|
+
is already exactly what the bundle would write, `hcm` records that the bundle
|
|
1068
|
+
uses it but does not take ownership — uninstall leaves it exactly where it is.
|
|
1069
|
+
- **Items another bundle installed are shared, not duplicated.** The same item
|
|
1070
|
+
wanted by two bundles is written once and claimed by both; the last uninstall
|
|
1071
|
+
is the one that removes it. See
|
|
1072
|
+
[Shared items](#shared-items-written-once-claimed-by-everyone-who-needs-them).
|
|
1073
|
+
- **Everything else is asked about before writing.** See below.
|
|
1074
|
+
|
|
1075
|
+
## When something is already there
|
|
1076
|
+
|
|
1077
|
+
Installing into a real project usually means landing next to configuration
|
|
1078
|
+
somebody else — you, a teammate, another tool — already wrote. `hcm` decides
|
|
1079
|
+
what to do *before* it writes anything, and the answer depends on what it finds.
|
|
1080
|
+
|
|
1081
|
+
**Already identical → adopted.** An MCP server in `.mcp.json` whose definition
|
|
1082
|
+
matches the bundle's byte for byte is left untouched: the file is not rewritten,
|
|
1083
|
+
not even reformatted, and the receipt records that the item was there first.
|
|
1084
|
+
`hcm status` counts it as adopted, `hcm uninstall` reports it as `kept` and
|
|
1085
|
+
leaves it behind, and a second bundle can adopt the same item without colliding.
|
|
1086
|
+
|
|
1087
|
+
**Already installed by another bundle, identically → shared.** Same
|
|
1088
|
+
write-nothing outcome, different bookkeeping: this bundle claims the item too,
|
|
1089
|
+
and it survives until the last claimant is uninstalled. See
|
|
1090
|
+
[Shared items](#shared-items-written-once-claimed-by-everyone-who-needs-them).
|
|
1091
|
+
|
|
1092
|
+
**Different → your call, one question per resource.** With a terminal attached,
|
|
1093
|
+
`hcm` asks. A skill is a dozen files but one question, because you mean one
|
|
1094
|
+
thing by all of them:
|
|
1095
|
+
|
|
1096
|
+
```
|
|
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
|
|
1103
|
+
4) abort -- stop; write nothing at all
|
|
1104
|
+
```
|
|
1105
|
+
|
|
1106
|
+
- **skip** — the existing item stays and the rest of the bundle installs as
|
|
1107
|
+
normal. For a settings fragment only the colliding keys are dropped, since its
|
|
1108
|
+
keys are independent; for everything else the whole resource is, because half
|
|
1109
|
+
a skill on disk is worse than none.
|
|
1110
|
+
- **replace / overwrite** — the bundle's version wins. The old value is kept in
|
|
1111
|
+
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.
|
|
1122
|
+
- **abort** — stops the whole run with nothing written.
|
|
1123
|
+
|
|
1124
|
+
Answers are remembered per bundle for the length of the run: a bundle installed
|
|
1125
|
+
into three harnesses asks each question once.
|
|
1126
|
+
|
|
1127
|
+
**No terminal?** Then there is nobody to ask, and `hcm` fails with the conflicts
|
|
1128
|
+
listed rather than guessing — the behaviour scripts and CI already relied on.
|
|
1129
|
+
Decide up front instead:
|
|
1130
|
+
|
|
1131
|
+
```bash
|
|
1132
|
+
hcm install my-kit --on-conflict skip # keep whatever is already there
|
|
1133
|
+
hcm install my-kit --on-conflict overwrite # same as --force
|
|
1134
|
+
hcm install my-kit --on-conflict abort # the default: fail and list them
|
|
1135
|
+
hcm install my-kit --on-conflict prompt # ask even where hcm would not have
|
|
1136
|
+
```
|
|
1137
|
+
|
|
1138
|
+
## Commands
|
|
1139
|
+
|
|
1140
|
+
| Command | What it does |
|
|
1141
|
+
| --- | --- |
|
|
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` |
|
|
1144
|
+
| `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` |
|
|
1146
|
+
| `hcm list --installed` | Installed bundles. `--scope project\|user\|all`, `--json` |
|
|
1147
|
+
| `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
|
+
| `hcm params [list] [bundle...]` | The parameter values each installation was rendered with. `-t`, `-s`, `--json` |
|
|
1149
|
+
| `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` |
|
|
1150
|
+
| `hcm status` | Which harnesses this folder uses, then whether installed items are still present and unmodified |
|
|
1151
|
+
| `hcm context [list]` | Tracked context sections, and whether each is still in its file. `--json` |
|
|
1152
|
+
| `hcm context append [bundle...]` | Add back the sections that have gone missing. `-t`, `-s`, `--dry-run`, `--force` |
|
|
1153
|
+
| `hcm context override [bundle...]` | Clear the file and rewrite it from the cached sections. `-t`, `-s`, `--dry-run`, `--force` |
|
|
1154
|
+
| `hcm context remove [bundle...]` | Take the sections out, keeping the cached copies. `-t`, `-s`, `--dry-run` |
|
|
1155
|
+
| `hcm refs check` | Report file references that point at nothing. `-p/--path`, `--links`, `--all-paths`, `--strict`, `--json` |
|
|
1156
|
+
| `hcm refs fix` | Repair them by picking from a ranked list. `-p/--path`, `--write [file]`, `--file <path>`, `--links`, `--all-paths`, `--strict`, `--dry-run` |
|
|
1157
|
+
| `hcm validate [dir]` | Check a bundle for common mistakes |
|
|
1158
|
+
| `hcm init [dir]` | Scaffold a new bundle |
|
|
1159
|
+
| `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 |
|
|
1162
|
+
| `hcm registry open [bundle]` | Print — and open — where registered bundles are stored |
|
|
1163
|
+
| `hcm registry list` | List registered bundles with their ids |
|
|
1164
|
+
| `hcm export [file]` | Write installed (or `--registry`) bundles to `bundles.txt` |
|
|
1165
|
+
| `hcm import [file]` | Register everything a bundles file lists; `--install` to install too, `-f/--flavor`, `--param`, `--params-file`, `--on-conflict` |
|
|
1166
|
+
| `hcm config` | Show settings; `config set\|get\|unset` to change them |
|
|
1167
|
+
|
|
1168
|
+
`-t/--target` takes one or more harnesses — by id, alias or unambiguous prefix
|
|
1169
|
+
(`-t claude pi`) — or `all` for every one of them. In a folder used by several
|
|
1170
|
+
harnesses it stops being optional; see
|
|
1171
|
+
[One folder, several harnesses](#one-folder-several-harnesses) and
|
|
1172
|
+
[Several at a time](#several-at-a-time).
|
|
1173
|
+
|
|
1174
|
+
`-f/--flavor` takes one or more of the bundle's own flavors, or `all` for the
|
|
1175
|
+
whole bundle; omitted, `hcm install` takes all of it and `hcm update` keeps
|
|
1176
|
+
whatever was recorded. See [Flavors](#flavors-installing-part-of-a-bundle). Like
|
|
1177
|
+
`--target` it is variadic, so bundle names come first:
|
|
1178
|
+
`hcm install my-kit --flavor python`, never the other way round.
|
|
1179
|
+
|
|
1180
|
+
`--param` takes one `NAME=value` at a time and may be repeated, optionally
|
|
1181
|
+
scoped to a bundle (`my-kit:NAME=value`) or to a bundle in one harness
|
|
1182
|
+
(`my-kit@copilot:NAME=value`). Unlike `--target` and `--flavor` it is not
|
|
1183
|
+
variadic, so it never swallows the bundle names after it. See
|
|
1184
|
+
[Parameters](#parameters-values-filled-in-at-install-time).
|
|
1185
|
+
|
|
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
|
|
1188
|
+
`hcm install acme/kits/review#v2` all work, the last two without registering
|
|
1189
|
+
first.
|
|
1190
|
+
|
|
1191
|
+
### Short ids
|
|
1192
|
+
|
|
1193
|
+
Every registered bundle gets a one-character handle — `1`, `2`, … `a`, `b` —
|
|
1194
|
+
usable anywhere a name is:
|
|
1195
|
+
|
|
1196
|
+
```bash
|
|
1197
|
+
hcm registry list # 1 ts-review-kit v1.0.0
|
|
1198
|
+
hcm install 1 # …instead of typing the name
|
|
1199
|
+
hcm install 1 2 3 -t pi # several at once
|
|
1200
|
+
hcm update 1
|
|
1201
|
+
hcm registry remove 1
|
|
1202
|
+
```
|
|
1203
|
+
|
|
1204
|
+
Ids are assigned on registration and stay put; re-registering a bundle keeps
|
|
1205
|
+
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
|
|
1207
|
+
install receipts always record names and sources, so nothing that travels
|
|
1208
|
+
between machines depends on them.
|
|
1209
|
+
|
|
1210
|
+
### Scopes
|
|
1211
|
+
|
|
1212
|
+
- `--scope project` (default) — writes into the current directory; state in
|
|
1213
|
+
`.hcm/state.json` and cached context in `.hcm/context/`, both of which you can
|
|
1214
|
+
commit so the team shares them.
|
|
1215
|
+
- `--scope user` — writes into the harness's home directory; state in
|
|
1216
|
+
`~/.hcm/state.json`.
|
|
1217
|
+
|
|
1218
|
+
### GitHub sources
|
|
1219
|
+
|
|
1220
|
+
Paste whatever GitHub gave you — the address bar, the clone box, or the short
|
|
1221
|
+
form. All of these work anywhere a bundle is accepted (`registry add`, `install`,
|
|
1222
|
+
`info`):
|
|
1223
|
+
|
|
1224
|
+
```bash
|
|
1225
|
+
# shorthand
|
|
1226
|
+
hcm registry add owner/repo # default branch
|
|
1227
|
+
hcm registry add owner/repo#v1.2.0 # tag, branch or SHA
|
|
1228
|
+
hcm registry add owner/repo/bundles/my-kit # subdirectory of a monorepo
|
|
1229
|
+
|
|
1230
|
+
# copied from the browser
|
|
1231
|
+
hcm registry add https://github.com/owner/repo
|
|
1232
|
+
hcm registry add https://github.com/owner/repo?tab=readme-ov-file
|
|
1233
|
+
hcm registry add https://github.com/owner/repo/tree/main/bundles/my-kit
|
|
1234
|
+
hcm registry add https://github.com/owner/repo/blob/main/bundles/my-kit/hcm.yaml
|
|
1235
|
+
|
|
1236
|
+
# copied from the clone box
|
|
1237
|
+
hcm registry add https://github.com/owner/repo.git
|
|
1238
|
+
hcm registry add git@github.com:owner/repo.git
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1241
|
+
Query strings and GitHub's own `#readme` / `#L42` anchors are ignored. A `/blob/`
|
|
1242
|
+
URL points at a file, so the bundle is taken to be the directory containing it —
|
|
1243
|
+
linking straight at a bundle's `hcm.yaml` does the right thing. Any other
|
|
1244
|
+
fragment is treated as a ref, so `.../repo#v1.2.0` works.
|
|
1245
|
+
|
|
1246
|
+
One ambiguity is unavoidable: in `/tree/feature/login/bundles/kit`, GitHub itself
|
|
1247
|
+
can't tell the branch `feature/login` from a branch `feature` containing
|
|
1248
|
+
`login/bundles/kit` without asking the server. `hcm` takes the first segment as
|
|
1249
|
+
the ref, so for a branch name containing a slash use the shorthand instead:
|
|
1250
|
+
`owner/repo/bundles/kit#feature/login`.
|
|
1251
|
+
|
|
1252
|
+
Tarballs are cached under `~/.hcm/cache`; `--refresh` re-downloads. See
|
|
1253
|
+
[Settings](#settings) to put the cache somewhere else.
|
|
1254
|
+
|
|
1255
|
+
### The store: where registered bundles live
|
|
1256
|
+
|
|
1257
|
+
Registering **copies** the bundle into one central directory, `~/.hcm/store`,
|
|
1258
|
+
with a folder per entry:
|
|
1259
|
+
|
|
1260
|
+
```bash
|
|
1261
|
+
hcm registry open # prints the path, and opens it in your file manager
|
|
1262
|
+
hcm registry open 1 # just that bundle's folder
|
|
1263
|
+
hcm registry open --no-open # print only
|
|
1264
|
+
```
|
|
1265
|
+
|
|
1266
|
+
```
|
|
1267
|
+
~/.hcm/store/
|
|
1268
|
+
├── 1-ts-review-kit/
|
|
1269
|
+
└── 2-db-kit/
|
|
1270
|
+
```
|
|
1271
|
+
|
|
1272
|
+
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.
|
|
1276
|
+
|
|
1277
|
+
### Authoring: `registry add --dev`
|
|
1278
|
+
|
|
1279
|
+
While you are writing a bundle, a snapshot is exactly wrong — you want the edit
|
|
1280
|
+
you just made. `--dev` registers a local bundle *in place*:
|
|
1281
|
+
|
|
1282
|
+
```bash
|
|
1283
|
+
hcm registry add ./my-kit --dev
|
|
1284
|
+
# edit my-kit/subagents/reviewer.md
|
|
1285
|
+
hcm install my-kit # picks up the edit; nothing to refresh
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1288
|
+
Dev entries are marked `[dev]` in `hcm list`, are read from your directory every
|
|
1289
|
+
time, and never have a copy in the store — so `hcm registry remove` unregisters
|
|
1290
|
+
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
|
|
1292
|
+
`hcm update` in between. A registered *snapshot* is the other way round — `hcm
|
|
1293
|
+
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
|
|
1295
|
+
is nothing to edit in place. Clone the repo and register the clone.
|
|
1296
|
+
|
|
1297
|
+
### Updating
|
|
1298
|
+
|
|
1299
|
+
`hcm update` re-reads a bundle from its source and puts the new version wherever
|
|
1300
|
+
the old one already was — every target and scope the ledger knows about:
|
|
1301
|
+
|
|
1302
|
+
```bash
|
|
1303
|
+
hcm update # every bundle installed here — the usual one
|
|
1304
|
+
hcm update my-kit # or: hcm update 1
|
|
1305
|
+
hcm update 1 3 db-kit # several, in registry order however you type them
|
|
1306
|
+
hcm update all # every REGISTERED bundle, installed here or not
|
|
1307
|
+
hcm update 1 --dry-run # show the swap without doing it
|
|
1308
|
+
hcm update 1 -t claude-code -s project
|
|
1309
|
+
```
|
|
1310
|
+
|
|
1311
|
+
**With no argument it updates what this project actually has**, read from the
|
|
1312
|
+
installation ledger — including bundles that arrived automatically as
|
|
1313
|
+
dependencies. `all` is the wider one: it refreshes every bundle in the registry,
|
|
1314
|
+
which for a bundle installed nowhere is a fetch that changes nothing here.
|
|
1315
|
+
`-s/--scope` and `-t/--target` narrow the ledger it reads, so `hcm update -s
|
|
1316
|
+
project` means "everything in this project" and leaves your user-scope
|
|
1317
|
+
installations alone.
|
|
1318
|
+
|
|
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.
|
|
1322
|
+
|
|
1323
|
+
It is a rollback followed by an install, not a write-over-the-top, because a new
|
|
1324
|
+
version is defined as much by what it *removed*: a subagent deleted upstream has
|
|
1325
|
+
to disappear from the harness too. Items you hand-edited since installing still
|
|
1326
|
+
block, and `--force` still overrides — an update never silently discards your
|
|
1327
|
+
changes. The block is all-or-nothing per installation, which is where it differs
|
|
1328
|
+
from `hcm uninstall`: an update that cannot remove everything removes nothing,
|
|
1329
|
+
leaves that harness exactly as it is, and carries on to the others, because it
|
|
1330
|
+
would not install the new version over a half-removed old one. Anything the new
|
|
1331
|
+
version now collides with is put to you the same way `hcm install` does, and
|
|
1332
|
+
`--on-conflict` works here too.
|
|
1333
|
+
|
|
1334
|
+
Bundles that are registered but not installed anywhere just get their stored
|
|
1335
|
+
copy refreshed.
|
|
1336
|
+
|
|
1337
|
+
### Removing
|
|
1338
|
+
|
|
1339
|
+
```bash
|
|
1340
|
+
hcm registry remove 1 # or by name; several at once is fine
|
|
1341
|
+
```
|
|
1342
|
+
|
|
1343
|
+
That unregisters the bundle and deletes its copy from the store. Anything it
|
|
1344
|
+
installed stays where it is — removal tells you so, and `hcm uninstall` still
|
|
1345
|
+
works afterwards, because uninstall replays receipts and never needs the bundle
|
|
1346
|
+
files.
|
|
1347
|
+
|
|
1348
|
+
### Collections: many bundles in one place
|
|
1349
|
+
|
|
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:
|
|
1353
|
+
|
|
1354
|
+
```
|
|
1355
|
+
agent-kits/
|
|
1356
|
+
├── review-kit/
|
|
1357
|
+
│ └── hcm.yaml
|
|
1358
|
+
├── db-kit/
|
|
1359
|
+
│ └── hcm.yaml
|
|
1360
|
+
└── docs/ ← no manifest, ignored
|
|
1361
|
+
```
|
|
1362
|
+
|
|
1363
|
+
Point any command at the collection and it acts on every bundle inside:
|
|
1364
|
+
|
|
1365
|
+
```bash
|
|
1366
|
+
hcm registry add ./agent-kits # registers review-kit and db-kit separately
|
|
1367
|
+
hcm registry add acme/agent-kits # same, straight from GitHub
|
|
1368
|
+
hcm install ./agent-kits # installs both
|
|
1369
|
+
hcm info acme/agent-kits # describes both
|
|
1370
|
+
```
|
|
1371
|
+
|
|
1372
|
+
Each is registered, installed and tracked under its own name, so
|
|
1373
|
+
`hcm uninstall review-kit` removes only that one. To work with a single bundle
|
|
1374
|
+
out of a collection, name its subdirectory: `hcm install acme/agent-kits/db-kit`.
|
|
1375
|
+
|
|
1376
|
+
Only one level is searched. A bundle that happens to contain a nested `hcm.yaml`
|
|
1377
|
+
is still one bundle, not a collection.
|
|
1378
|
+
|
|
1379
|
+
### Settings
|
|
1380
|
+
|
|
1381
|
+
`hcm config` shows every setting, its effective value, and where that value came
|
|
1382
|
+
from:
|
|
1383
|
+
|
|
1384
|
+
```bash
|
|
1385
|
+
hcm config # list everything
|
|
1386
|
+
hcm config get cacheDir
|
|
1387
|
+
hcm config set cacheDir /srv/shared/hcm # a path all your projects share
|
|
1388
|
+
hcm config unset cacheDir # back to the default
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
| Setting | Default | Meaning |
|
|
1392
|
+
| --- | --- | --- |
|
|
1393
|
+
| `cacheDir` | `~/.hcm/cache` | Where bundles downloaded from GitHub are stored |
|
|
1394
|
+
| `storeDir` | `~/.hcm/store` | Where registered bundles themselves are kept |
|
|
1395
|
+
| `requireTarget` | `auto` | When a writing command insists on `-t`: `auto` in [multi-harness folders](#one-folder-several-harnesses), `always`, or `never` |
|
|
1396
|
+
|
|
1397
|
+
Precedence is environment variable, then `config.json`, then the default:
|
|
1398
|
+
|
|
1399
|
+
| Variable | Overrides |
|
|
1400
|
+
| --- | --- |
|
|
1401
|
+
| `HCM_CACHE_DIR` | `cacheDir` |
|
|
1402
|
+
| `HCM_STORE_DIR` | `storeDir` |
|
|
1403
|
+
| `HCM_REQUIRE_TARGET` | `requireTarget` |
|
|
1404
|
+
| `HCM_HOME` | The whole `~/.hcm` directory — config, registry, user state, cache and store |
|
|
1405
|
+
| `HCM_CONFIG` | The path of `config.json` itself |
|
|
1406
|
+
|
|
1407
|
+
The cache is shared, so a bundle downloaded once installs into as many projects
|
|
1408
|
+
as you like without re-fetching. Pointing `cacheDir` at a shared or synced
|
|
1409
|
+
directory lets several machines reuse the same downloads. Changing it does not
|
|
1410
|
+
move existing downloads; they are simply re-fetched on next use.
|
|
1411
|
+
|
|
1412
|
+
`storeDir` moves the registered bundles themselves. Changing it does not move
|
|
1413
|
+
what is already there; entries whose folder has gone missing are re-fetched from
|
|
1414
|
+
their source on next use, so a relocated store repopulates itself. A bundle
|
|
1415
|
+
registered with `--dev` is never in the store at all — it is read from your
|
|
1416
|
+
working directory.
|
|
1417
|
+
|
|
1418
|
+
### Sharing a setup: `bundles.txt`
|
|
1419
|
+
|
|
1420
|
+
`hcm export` writes the bundles you have as a plain list, one reference per
|
|
1421
|
+
line, that `hcm import` can replay on another machine:
|
|
1422
|
+
|
|
1423
|
+
```bash
|
|
1424
|
+
hcm export # what is installed here -> bundles.txt
|
|
1425
|
+
hcm export --registry # everything this machine knows about
|
|
1426
|
+
hcm export --scope user # user-scope installs only
|
|
1427
|
+
hcm export --stdout # print instead of writing
|
|
1428
|
+
```
|
|
1429
|
+
|
|
1430
|
+
```
|
|
1431
|
+
# hcm bundles file
|
|
1432
|
+
# generated 2026-08-06T14:48:27.117Z
|
|
1433
|
+
# source: installed bundles (project scope)
|
|
1434
|
+
#
|
|
1435
|
+
# Recreate this setup with: hcm import bundles.txt --install
|
|
1436
|
+
|
|
1437
|
+
# review-kit v2.0.0 -> claude-code, copilot
|
|
1438
|
+
acme/kits/bundles/review#v2.0.0
|
|
1439
|
+
```
|
|
1440
|
+
|
|
1441
|
+
Then elsewhere:
|
|
1442
|
+
|
|
1443
|
+
```bash
|
|
1444
|
+
hcm import bundles.txt # register everything listed
|
|
1445
|
+
hcm import bundles.txt --install # register and install, honouring -t/-s
|
|
1446
|
+
```
|
|
1447
|
+
|
|
1448
|
+
Commit `bundles.txt` and a new machine reproduces the setup in one command.
|
|
1449
|
+
Notes are comments, so the file stays a simple list of references — a line may
|
|
1450
|
+
be any form `hcm install` accepts, including a collection, which expands to
|
|
1451
|
+
every bundle inside it.
|
|
1452
|
+
|
|
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:
|
|
1455
|
+
|
|
1456
|
+
```
|
|
1457
|
+
! Skipped 1 local bundle(s), which cannot be fetched elsewhere:
|
|
1458
|
+
local-kit (C:\work\local-kit)
|
|
1459
|
+
```
|
|
1460
|
+
|
|
1461
|
+
Push a bundle to GitHub and re-register it if you want it to travel. An import
|
|
1462
|
+
where some entries fail registers everything it can, reports the rest, and exits
|
|
1463
|
+
non-zero.
|
|
1464
|
+
|
|
1465
|
+
## Layout of this repo
|
|
1466
|
+
|
|
1467
|
+
```
|
|
1468
|
+
src/
|
|
1469
|
+
├── cli.ts # command wiring
|
|
1470
|
+
├── commands/ # one file per command
|
|
1471
|
+
├── core/ # bundle loading, planning, executing, rollback, state
|
|
1472
|
+
│ # state.ts -- receipts and the claims that refcount them
|
|
1473
|
+
│ # deps.ts + semver.ts -- the dependency graph
|
|
1474
|
+
│ # registry.ts + store.ts -- ids and the bundle snapshots
|
|
1475
|
+
│ # context.ts -- the cached instruction sections
|
|
1476
|
+
│ # harnesses.ts -- which harnesses a folder uses, and
|
|
1477
|
+
│ # the gate that makes multi-harness commands explicit
|
|
1478
|
+
│ # overlap.ts -- the files two harnesses both read
|
|
1479
|
+
│ # refs.ts -- finding file references, and what they meant
|
|
1480
|
+
│ # refmap.ts -- repointing them at the installed layout
|
|
1481
|
+
├── merge/ # json-merge.ts, blocks.ts, toml.ts -- the receipt machinery
|
|
1482
|
+
└── targets/ # one adapter per harness
|
|
1483
|
+
bundles/ts-review-kit/ # sample bundle exercising every resource kind
|
|
1484
|
+
tests/
|
|
1485
|
+
├── *.test.ts # the unit layer: pure functions, plans, refusals,
|
|
1486
|
+
│ # registry ids, and anything whose assertion is not
|
|
1487
|
+
│ # "the project looks like this"
|
|
1488
|
+
├── cases/ # the readable layer: one folder per behaviour, each
|
|
1489
|
+
│ # with inputs/, outputs/ and a README walkthrough you
|
|
1490
|
+
│ # can check by hand -- see its README
|
|
1491
|
+
├── case-runner.test.ts # discovers those folders; never edited to add one
|
|
1492
|
+
├── run-case.ts # runs one, with no test framework in the call stack
|
|
1493
|
+
└── fixtures/ # shared bundles the unit tests build on -- see its README
|
|
1494
|
+
```
|
|
1495
|
+
|
|
1496
|
+
## Development
|
|
1497
|
+
|
|
1498
|
+
`make help` lists every target. The ones you'll use:
|
|
1499
|
+
|
|
1500
|
+
| Target | What it does |
|
|
1501
|
+
| --- | --- |
|
|
1502
|
+
| `make setup` | Install dependencies, build, and run the checks |
|
|
1503
|
+
| `make check` | Typecheck plus tests — run before committing |
|
|
1504
|
+
| `make audit` | Report known vulnerabilities in dependencies |
|
|
1505
|
+
| `make dev ARGS="targets"` | Run the CLI from source, no build step |
|
|
1506
|
+
| `make run ARGS="list"` | Build, then run the built CLI |
|
|
1507
|
+
| `make test-watch` | Tests in watch mode |
|
|
1508
|
+
| `make test-cases` | Just the readable case folders |
|
|
1509
|
+
| `make test-case CASE=pi-every-kind` | One case |
|
|
1510
|
+
| `make debug-case CASE=pi-every-kind` | One case, no test framework in the call stack |
|
|
1511
|
+
| `make bless` | Regenerate case baselines — read the diff before committing |
|
|
1512
|
+
| `make link` / `make unlink` | Add or remove `hcm` on your PATH |
|
|
1513
|
+
| `make demo` | Show where the sample bundle would install |
|
|
1514
|
+
| `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 |
|
|
1517
|
+
| `make clean` | Remove `dist/` and tarballs |
|
|
1518
|
+
| `make distclean` | Also remove `node_modules/` |
|
|
1519
|
+
| `make reinstall` | `distclean` followed by `setup` |
|
|
1520
|
+
|
|
1521
|
+
Every recipe is a single shell-agnostic command, because make on Windows may
|
|
1522
|
+
hand recipes to either `sh` or `cmd.exe`. If you add one, avoid shell builtins
|
|
1523
|
+
and pipes — `node -e` handles file operations portably.
|
|
1524
|
+
|
|
1525
|
+
### The two test layers
|
|
1526
|
+
|
|
1527
|
+
`tests/*.test.ts` is the unit layer, and most of the suite. `tests/cases/` is a
|
|
1528
|
+
small readable layer on top: one folder per behaviour, each holding the bundle
|
|
1529
|
+
that goes in, the project tree that has to come out, and a `README.md` that
|
|
1530
|
+
walks you from one to the other in steps you can check by hand. Adding a case is
|
|
1531
|
+
adding a folder — the runner discovers them.
|
|
1532
|
+
|
|
1533
|
+
Start there if you are new to the codebase. Pick a case, read its README, then:
|
|
1534
|
+
|
|
1535
|
+
```bash
|
|
1536
|
+
make debug-case CASE=claude-code-every-kind
|
|
1537
|
+
```
|
|
1538
|
+
|
|
1539
|
+
which runs it with a clean call stack, so a breakpoint anywhere in `src/` is
|
|
1540
|
+
three frames from the top. `tests/cases/README.md` explains the format.
|
|
1541
|
+
|
|
1542
|
+
Adding a harness means writing one file in `src/targets/` — a `scopeRoot`, the
|
|
1543
|
+
`markers` that mean "this harness is set up here", a list of supported kinds,
|
|
1544
|
+
and a function mapping each resource to writes. The receipt and rollback
|
|
1545
|
+
machinery is shared, and so is the overlap detection: if the new harness writes
|
|
1546
|
+
a file an existing one also reads, that is worked out from the mapping function
|
|
1547
|
+
rather than declared.
|