harness-config-manager 0.1.0 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +422 -68
- package/builtin/hcm/README.md +23 -0
- package/builtin/hcm/context/10-hcm.md +14 -0
- package/builtin/hcm/hcm.yaml +16 -0
- package/builtin/hcm/skills/hcm-bundle-authoring/SKILL.md +119 -0
- package/builtin/hcm/skills/hcm-bundle-authoring/collections.md +168 -0
- package/builtin/hcm/skills/hcm-bundle-authoring/reference.md +222 -0
- package/builtin/hcm/skills/hcm-integration/SKILL.md +149 -0
- package/builtin/hcm/skills/hcm-integration/cli.md +139 -0
- package/builtin/hcm/skills/hcm-integration/examples.md +338 -0
- package/builtin/hcm/skills/hcm-integration/library.md +399 -0
- package/builtin/hcm/skills/hcm-integration/migrate.md +204 -0
- package/builtin/hcm/skills/hcm-integration/remote.md +204 -0
- package/builtin/hcm/skills/hcm-usage/SKILL.md +241 -0
- package/builtin/hcm/skills/hcm-usage/commands.md +76 -0
- package/dist/cli.js +61 -14
- package/dist/cli.js.map +1 -1
- package/dist/commands/export.d.ts +4 -2
- package/dist/commands/export.js +8 -9
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/import.js +10 -1
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/info.js +3 -3
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.js +2 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts +25 -1
- package/dist/commands/install.js +118 -9
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/list.d.ts +3 -1
- package/dist/commands/list.js +28 -5
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/registry.d.ts +25 -0
- package/dist/commands/registry.js +134 -20
- package/dist/commands/registry.js.map +1 -1
- package/dist/commands/update.d.ts +31 -6
- package/dist/commands/update.js +294 -108
- package/dist/commands/update.js.map +1 -1
- package/dist/core/builtin.d.ts +33 -0
- package/dist/core/builtin.js +37 -0
- package/dist/core/builtin.js.map +1 -0
- package/dist/core/bundle.d.ts +20 -1
- package/dist/core/bundle.js +77 -4
- package/dist/core/bundle.js.map +1 -1
- package/dist/core/collection-clash.d.ts +82 -0
- package/dist/core/collection-clash.js +186 -0
- package/dist/core/collection-clash.js.map +1 -0
- package/dist/core/collection.d.ts +37 -0
- package/dist/core/collection.js +113 -0
- package/dist/core/collection.js.map +1 -0
- package/dist/core/config.d.ts +2 -2
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/conflicts.d.ts +39 -5
- package/dist/core/conflicts.js +169 -32
- package/dist/core/conflicts.js.map +1 -1
- package/dist/core/deps.d.ts +1 -1
- package/dist/core/deps.js +8 -8
- package/dist/core/deps.js.map +1 -1
- package/dist/core/errors.d.ts +2 -2
- package/dist/core/errors.js +1 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/git-http.d.ts +111 -0
- package/dist/core/git-http.js +546 -0
- package/dist/core/git-http.js.map +1 -0
- package/dist/core/git.d.ts +63 -0
- package/dist/core/git.js +149 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/github.d.ts +8 -6
- package/dist/core/github.js +24 -2
- package/dist/core/github.js.map +1 -1
- package/dist/core/paths.d.ts +1 -1
- package/dist/core/paths.js +1 -1
- package/dist/core/paths.js.map +1 -1
- package/dist/core/planner.js +41 -15
- package/dist/core/planner.js.map +1 -1
- package/dist/core/refs.js +2 -1
- package/dist/core/refs.js.map +1 -1
- package/dist/core/registry.d.ts +58 -13
- package/dist/core/registry.js +221 -36
- package/dist/core/registry.js.map +1 -1
- package/dist/core/rename.d.ts +49 -10
- package/dist/core/rename.js +67 -10
- package/dist/core/rename.js.map +1 -1
- package/dist/core/store.d.ts +3 -4
- package/dist/core/store.js +1 -1
- package/dist/core/store.js.map +1 -1
- package/dist/core/tracking.d.ts +61 -0
- package/dist/core/tracking.js +106 -0
- package/dist/core/tracking.js.map +1 -0
- package/dist/core/types.d.ts +84 -3
- package/dist/core/types.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/targets/copilot-cli.d.ts +41 -0
- package/dist/targets/copilot-cli.js +181 -0
- package/dist/targets/copilot-cli.js.map +1 -0
- package/dist/targets/index.d.ts +2 -2
- package/dist/targets/index.js +11 -3
- package/dist/targets/index.js.map +1 -1
- package/docs/authoring-bundles.md +895 -828
- package/docs/shipping-bundles.md +181 -0
- package/package.json +6 -3
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Strategy: a bundle that users download separately
|
|
2
|
+
|
|
3
|
+
Use this strategy when users must get the bundle without the package. Examples:
|
|
4
|
+
|
|
5
|
+
- The user works in a different language, or does not install the package.
|
|
6
|
+
- The package must stay small, or it cannot contain extra files.
|
|
7
|
+
- The bundle changes more often than the package.
|
|
8
|
+
|
|
9
|
+
Keep the bundle in a folder of your repository, for example `hcm-bundle/`. Tag
|
|
10
|
+
each release. Read the shared rules in [the skill](./SKILL.md) first.
|
|
11
|
+
|
|
12
|
+
## Choose a download method
|
|
13
|
+
|
|
14
|
+
| Method | Downloads | Repository | Update |
|
|
15
|
+
| --- | --- | --- | --- |
|
|
16
|
+
| [A. hcm reads the repository](#a-hcm-reads-the-repository) | All files of one ref, without history | Any git host with an HTTPS clone URL. A private repository needs a token | Register the new tag, then `hcm update` |
|
|
17
|
+
| [B. Sparse partial clone](#b-sparse-partial-clone) | Only the bundle folder, without history | Any git host, with the git credentials of the user | `git fetch`, then `hcm update` |
|
|
18
|
+
| [C. Release archive](#c-release-archive) | Only the bundle, as one file | Any host that stores release files | Download and extract again, then `hcm update` |
|
|
19
|
+
|
|
20
|
+
Method A needs only hcm, and no git. Use it when the repository is small. If
|
|
21
|
+
the repository is large, use method B or C, or move the bundle to a small
|
|
22
|
+
repository of its own.
|
|
23
|
+
|
|
24
|
+
## A. hcm reads the repository
|
|
25
|
+
|
|
26
|
+
For a repository on GitHub:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
hcm registry add owner/repo/hcm-bundle#v1.2.0
|
|
30
|
+
hcm install my-lib -t claude-code
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- hcm downloads an archive of the ref `v1.2.0` from GitHub. The archive has all files of that ref, but no git history. hcm keeps only the `hcm-bundle` folder.
|
|
34
|
+
- hcm keeps the download in its cache, `~/.hcm/cache`.
|
|
35
|
+
- This short form works only for public repositories.
|
|
36
|
+
- The reference after `#` is a tag, a branch or a commit SHA. If a branch name contains `/`, use this short form, not a `/tree/` URL.
|
|
37
|
+
|
|
38
|
+
For a repository on another git host, give the HTTPS clone URL. Examples of
|
|
39
|
+
hosts are Azure DevOps, Bitbucket, GitLab and a self-hosted server:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
hcm registry add https://dev.azure.com/org/project/_git/repo#v1.2.0:hcm-bundle
|
|
43
|
+
hcm install my-lib -t claude-code
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- The form is `<clone-url>#<ref>:<folder>`. Without a ref, hcm reads the default branch: `<clone-url>#:hcm-bundle`.
|
|
47
|
+
- hcm uses the git protocol over HTTPS, and does not start git. It downloads the files of that ref, but no git history.
|
|
48
|
+
- An SSH URL does not work. Use the HTTPS clone URL.
|
|
49
|
+
- For a private repository, the user sets an access token in an environment variable: `HCM_GIT_TOKEN`, or `HCM_GIT_TOKEN_<HOST>` for one host, for example `HCM_GIT_TOKEN_DEV_AZURE_COM`. Do not put the token in the URL. hcm refuses a URL that contains a password.
|
|
50
|
+
- To read a private GitHub repository this way, write `git+` before the URL: `git+https://github.com/owner/repo.git#v1.2.0:hcm-bundle`.
|
|
51
|
+
|
|
52
|
+
To update to a new release, register the new tag. The entry keeps its id. Then
|
|
53
|
+
install the new version into each project:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
hcm registry add owner/repo/hcm-bundle#v1.3.0
|
|
57
|
+
hcm update my-lib
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
To follow a branch, register it: `hcm registry add owner/repo/hcm-bundle#main`.
|
|
61
|
+
Then each `hcm update my-lib` downloads the latest commit of the branch.
|
|
62
|
+
`hcm registry update my-lib` downloads it too, but does not change a project.
|
|
63
|
+
|
|
64
|
+
## B. Sparse partial clone
|
|
65
|
+
|
|
66
|
+
Git can download one folder of a repository. Use git when the repository is
|
|
67
|
+
large, or when the user has git credentials but no access token. Git uses the
|
|
68
|
+
credentials of the user, as for any clone.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
dir="$HOME/.local/share/my-lib/repo"
|
|
72
|
+
git clone --depth 1 --filter=blob:none --sparse --branch v1.2.0 https://github.com/owner/repo.git "$dir"
|
|
73
|
+
git -C "$dir" sparse-checkout set --no-cone 'hcm-bundle/'
|
|
74
|
+
hcm registry add "$dir/hcm-bundle"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- `--depth 1` downloads no history.
|
|
78
|
+
- `--filter=blob:none` downloads file contents only for the files that git writes to disk. If the server does not support the filter, git downloads all files of the commit. The result is the same.
|
|
79
|
+
- `--sparse` and `sparse-checkout set` write only the bundle folder to disk.
|
|
80
|
+
- Write the pattern without a `/` at the start. A `/` in the pattern already anchors it to the root of the repository. In Git Bash on Windows, a pattern that starts with `/` becomes a Windows path.
|
|
81
|
+
- If your Git does not know `--no-cone`, use `git -C "$dir" sparse-checkout set hcm-bundle`. This cone mode also writes the files at the root of the repository, but not the other folders.
|
|
82
|
+
- Register an absolute path, as above. hcm reads a relative path without `./` as a GitHub reference.
|
|
83
|
+
|
|
84
|
+
To update, get the new ref, then install it into each project. The folder stays
|
|
85
|
+
in the same place, so the registration does not change:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git -C "$dir" fetch --depth 1 origin v1.3.0 # a tag or a branch
|
|
89
|
+
git -C "$dir" reset --hard FETCH_HEAD
|
|
90
|
+
hcm update my-lib
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## C. Release archive
|
|
94
|
+
|
|
95
|
+
Attach the bundle to each release as one archive. In the release job:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
tar -czf my-lib-hcm-bundle.tar.gz -C hcm-bundle .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The user extracts the archive into a permanent folder, and registers that
|
|
102
|
+
folder:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
dir="$HOME/.local/share/my-lib/hcm-bundle"
|
|
106
|
+
rm -rf "$dir" && mkdir -p "$dir"
|
|
107
|
+
curl -fsSL https://github.com/owner/repo/releases/download/v1.2.0/my-lib-hcm-bundle.tar.gz | tar -xz -C "$dir"
|
|
108
|
+
hcm registry add "$dir"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```powershell
|
|
112
|
+
$dir = "$HOME\.my-lib\hcm-bundle"
|
|
113
|
+
Remove-Item -Recurse -Force $dir -ErrorAction SilentlyContinue
|
|
114
|
+
New-Item -ItemType Directory -Force $dir | Out-Null
|
|
115
|
+
$archive = Join-Path $env:TEMP 'my-lib-hcm-bundle.tar.gz'
|
|
116
|
+
Invoke-WebRequest https://github.com/owner/repo/releases/download/v1.2.0/my-lib-hcm-bundle.tar.gz -OutFile $archive
|
|
117
|
+
tar -xzf $archive -C $dir
|
|
118
|
+
hcm registry add $dir
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- Windows 10 and later include `tar`.
|
|
122
|
+
- For a private GitHub repository, download the file with `gh release download v1.2.0 --repo owner/repo --pattern my-lib-hcm-bundle.tar.gz`.
|
|
123
|
+
- Delete the old contents before you extract. Then the files that the new version deleted go too.
|
|
124
|
+
|
|
125
|
+
To update, run the same commands with the new version, then `hcm update my-lib`.
|
|
126
|
+
The folder stays in the same place, so the entry keeps its id.
|
|
127
|
+
|
|
128
|
+
Some git hosts can also make an archive of one folder of a repository, for
|
|
129
|
+
example GitLab with the `path` parameter of its archive API. See the API
|
|
130
|
+
documentation of the host.
|
|
131
|
+
|
|
132
|
+
## Pin the version in a project
|
|
133
|
+
|
|
134
|
+
A project can install a release with no registration, and follow it:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
hcm install owner/repo/hcm-bundle#v1.2.0 --track source -t claude-code --no-prompt
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
- hcm records the reference, with its tag, in `.hcm/state.json`. Commit that file with the installed files. Each checkout of the project then has the same release.
|
|
141
|
+
- `hcm update` reads the same tag again. A registered `my-lib` in another version does not replace it.
|
|
142
|
+
- To move the project to a new release, run `hcm update my-lib --from owner/repo/hcm-bundle#v1.3.0`. The installation follows the new tag from then on, and keeps its parameter values.
|
|
143
|
+
- Other projects of the user can pin other releases.
|
|
144
|
+
|
|
145
|
+
A team can also record the bundle version in a `bundles.txt` file. This
|
|
146
|
+
registers the bundle, so all projects of the user share one version. Put the
|
|
147
|
+
reference in the file and commit it:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
# bundles.txt
|
|
151
|
+
owner/repo/hcm-bundle#v1.2.0
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Each developer then runs `hcm import bundles.txt --install -t <harness> --no-prompt`.
|
|
155
|
+
To upgrade, change the tag in the file and run the command again. The file
|
|
156
|
+
accepts method A references. For methods B and C, give a script that does the
|
|
157
|
+
download and the registration.
|
|
158
|
+
|
|
159
|
+
## Write the instructions for your users
|
|
160
|
+
|
|
161
|
+
Put the install and update commands in the README of your package. Use the tag
|
|
162
|
+
of the release in each command. For method A:
|
|
163
|
+
|
|
164
|
+
````markdown
|
|
165
|
+
## Agent configuration (hcm)
|
|
166
|
+
|
|
167
|
+
This package comes with agent skills for hcm (harness-config-manager).
|
|
168
|
+
|
|
169
|
+
Install:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npm install -g harness-config-manager
|
|
173
|
+
hcm registry add owner/repo/hcm-bundle#v1.2.0
|
|
174
|
+
hcm install my-lib -t claude-code
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Update after an upgrade of my-lib:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
hcm registry add owner/repo/hcm-bundle#v<new-version>
|
|
181
|
+
hcm update my-lib
|
|
182
|
+
```
|
|
183
|
+
````
|
|
184
|
+
|
|
185
|
+
Update the tag in the README in the release step, together with the version of
|
|
186
|
+
the package and of the bundle.
|
|
187
|
+
|
|
188
|
+
If projects of your users pin different releases, document the per-project
|
|
189
|
+
commands of [Pin the version in a project](#pin-the-version-in-a-project)
|
|
190
|
+
instead:
|
|
191
|
+
|
|
192
|
+
````markdown
|
|
193
|
+
Install into one project, at one release:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
hcm install owner/repo/hcm-bundle#v1.2.0 --track source -t claude-code
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Move the project to a new release:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
hcm update my-lib --from owner/repo/hcm-bundle#v<new-version>
|
|
203
|
+
```
|
|
204
|
+
````
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Install, update and remove hcm bundles in a project or for the user, and check the result. Also decide if an installation follows the registry or its own source, for example a library bundle in .venv or node_modules, and repair an update whose source moved. Also manage the hcm registry. Use when the user asks to add skills, subagents, commands, rules or MCP servers with hcm, or to change what hcm installed. Also use it to register, group or unregister bundles, for example all bundles of one repository or named collection.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Use hcm
|
|
6
|
+
|
|
7
|
+
hcm installs bundles into agent harnesses. A bundle is a folder of subagents,
|
|
8
|
+
skills, commands, rules, context, MCP servers and settings. hcm writes each item
|
|
9
|
+
in the format of each harness, and it records a receipt for each write. The
|
|
10
|
+
receipts let hcm remove exactly what it wrote.
|
|
11
|
+
|
|
12
|
+
All commands and options are in [the command reference](./commands.md). For the
|
|
13
|
+
exact options of the installed version, run `hcm <command> --help`.
|
|
14
|
+
|
|
15
|
+
## Before you start
|
|
16
|
+
|
|
17
|
+
1. Run `hcm --version`. If the command is not found, tell the user to install hcm with `npm install -g harness-config-manager`.
|
|
18
|
+
2. Run `hcm targets`. The output shows the harnesses that this folder uses, and the files that two harnesses share.
|
|
19
|
+
3. Run `hcm list`. The output shows the bundles that you can install, with their ids. A `●` marks a bundle that is installed.
|
|
20
|
+
4. Run `hcm list --installed`. The output shows the bundles of this project. A `[source]` mark shows a bundle that `hcm update` reads from its own folder or repository, not from the registry.
|
|
21
|
+
|
|
22
|
+
The npm package name is `harness-config-manager`. The npm package `hcm` is a
|
|
23
|
+
different program.
|
|
24
|
+
|
|
25
|
+
## Rules for an agent
|
|
26
|
+
|
|
27
|
+
hcm asks questions only at an interactive terminal. An agent does not have one,
|
|
28
|
+
so hcm stops when it needs an answer. Give each answer on the command line:
|
|
29
|
+
|
|
30
|
+
- Always give `-t <harness...>`. Without it, hcm stops in a folder that more than one harness uses.
|
|
31
|
+
- Give `--no-prompt` to `hcm install`, `hcm update` and `hcm import`. Then hcm does not wait for input.
|
|
32
|
+
- Give each required parameter with `--param NAME=value`. To see the parameters of a bundle, run `hcm info <bundle>`.
|
|
33
|
+
- Give `--on-conflict skip` or `--on-conflict abort` when an item can already exist.
|
|
34
|
+
- Give `--on-conflict rename` when the user wants to keep both items. hcm then installs the bundle item with the bundle name as a suffix, and changes the references in the bundle to the new name.
|
|
35
|
+
- Do not use `--force` or `--on-conflict overwrite` unless the user tells you to. These options replace files that the user wrote or edited.
|
|
36
|
+
- Run each command with `--dry-run` first, and read the plan. If the plan changes files that hcm did not write, ask the user before you continue.
|
|
37
|
+
- Before you run `hcm registry remove --collection`, show the user the bundles of the collection. Continue only when the user agrees.
|
|
38
|
+
- If `hcm registry add` reports a collection name clash, ask the user to choose. Then give `--on-collection-clash join`, `rename` or `abort`.
|
|
39
|
+
|
|
40
|
+
## Install a bundle
|
|
41
|
+
|
|
42
|
+
1. Find the bundle with `hcm list`. To see its contents and the destination of each item, run `hcm info <bundle>`.
|
|
43
|
+
2. Preview the install: `hcm install <bundle> -t <harness> --no-prompt --dry-run`.
|
|
44
|
+
3. Install the bundle: `hcm install <bundle> -t <harness> --no-prompt`.
|
|
45
|
+
4. Check the result: `hcm status`.
|
|
46
|
+
|
|
47
|
+
A `<bundle>` is a registered name, a registered id, a local path, a GitHub
|
|
48
|
+
reference such as `owner/repo/path#v1.0.0`, or the HTTPS clone URL of a
|
|
49
|
+
repository on another git host. You can give more than one bundle and
|
|
50
|
+
more than one harness. Put the bundle names before `-t`, because `-t` takes all
|
|
51
|
+
the values after it:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
hcm install my-kit db-kit -t claude-code pi --no-prompt
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The default scope is `project`, which is the current folder. Give `-s user` to
|
|
58
|
+
install for all projects of the user.
|
|
59
|
+
|
|
60
|
+
To install part of a bundle, give `--flavor <name...>`. `hcm info <bundle>`
|
|
61
|
+
lists the flavors of a bundle.
|
|
62
|
+
|
|
63
|
+
## Register a bundle
|
|
64
|
+
|
|
65
|
+
Register a bundle to install it by name or id:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
hcm registry add ./my-kit # a local folder; hcm copies it
|
|
69
|
+
hcm registry add owner/repo/path#v1.0.0 # a folder in a GitHub repository, at a tag
|
|
70
|
+
hcm registry add https://dev.azure.com/org/project/_git/repo#v1.0.0:path # the same, on another git host
|
|
71
|
+
hcm registry add ./my-kit --dev # a folder that you edit; hcm reads it in place
|
|
72
|
+
hcm registry add ./agent-kits # a collection: hcm registers each bundle in it
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
hcm copies a registered bundle into its store. A change at the source has no
|
|
76
|
+
effect until `hcm update` or `hcm registry update`. A `--dev` bundle has no copy, so each install reads
|
|
77
|
+
the latest edits.
|
|
78
|
+
|
|
79
|
+
## Update and remove
|
|
80
|
+
|
|
81
|
+
| Task | Command |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| Get the latest version of the registered bundles from their sources, without a change to a project | `hcm registry update` |
|
|
84
|
+
| Install the new version of each bundle in this project | `hcm update -t <harness> --no-prompt` |
|
|
85
|
+
| Install the new version of one bundle | `hcm update <bundle> -t <harness> --no-prompt` |
|
|
86
|
+
| Install the new version from the recorded sources, with no change to the registry | `hcm update --no-registry -t <harness> --no-prompt` |
|
|
87
|
+
| Install a bundle that must follow its own folder, for example a library in `.venv/` | `hcm install <folder> --track source -t <harness> --no-prompt` |
|
|
88
|
+
| Point an installation at a new folder, for example after the `.venv/` moved | `hcm update <bundle> --from <folder> -t <harness> --no-prompt` |
|
|
89
|
+
| Make an installation follow the registry again | `hcm update <bundle> --track registry -t <harness> --no-prompt` |
|
|
90
|
+
| Remove a bundle, and the dependencies that no other bundle needs | `hcm uninstall <bundle> -t <harness>` |
|
|
91
|
+
| Unregister a bundle | `hcm registry remove <bundle>` |
|
|
92
|
+
| Unregister each bundle of a named collection, for example each bundle of one repository | `hcm registry remove --collection <name>`. See [Remove a named collection](#remove-a-named-collection). |
|
|
93
|
+
|
|
94
|
+
Each installation follows the registry or its source. `hcm update` reads the
|
|
95
|
+
next version from there:
|
|
96
|
+
|
|
97
|
+
- An installation made by name or id follows the registry.
|
|
98
|
+
- An installation made with `--track source` follows its folder or repository. `hcm update` does not read the registry for it. Libraries use this mode, because each project can pin another version.
|
|
99
|
+
- With no `--track`, an installation from a path follows the registry if a bundle with that name is registered. Else it follows the path.
|
|
100
|
+
- `hcm list --installed` marks a source installation `[source]`. It also shows the registered version when the two versions are different. Tell the user about a different version. Do not change the mode without the agreement of the user.
|
|
101
|
+
|
|
102
|
+
### A library that follows the environment of the project
|
|
103
|
+
|
|
104
|
+
Some libraries install their bundle from the environment of the project, for
|
|
105
|
+
example from `.venv/` or `node_modules/`. The library supplies the command, for
|
|
106
|
+
example `python -m my_library hcm install -t <harness>` or
|
|
107
|
+
`npx --no my-lib-hcm install -t <harness>`. Use that command, not
|
|
108
|
+
`hcm install <name>`. A registered bundle of the same name can have another
|
|
109
|
+
version than the library of the project.
|
|
110
|
+
|
|
111
|
+
After an upgrade of such a library, run `hcm update -t <harness> --no-prompt`.
|
|
112
|
+
|
|
113
|
+
### When an update fails
|
|
114
|
+
|
|
115
|
+
| hcm reports | Cause | Do this |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
| `Bundle directory no longer exists` | The source folder moved or is gone, for example after the `.venv/` was made again. | Run the `install` command of the library again. Or run `hcm update <bundle> --from <new-folder> -t <harness> --no-prompt`. |
|
|
118
|
+
| `now holds the bundle "<other>"` | The recorded folder now holds a different bundle. | Find the correct folder, then use `--from`. |
|
|
119
|
+
| `the registry has <bundle> v<x>, but the source has v<y>` | The project pins one version, and the registry has another. This is a warning, not an error. | Tell the user. Change nothing, unless the user asks. |
|
|
120
|
+
| `<bundle> is also registered, from <place>` | The bundle came from a path, and the registry has a bundle of that name from another place. `hcm update` reads the registered copy. | Ask the user which copy the project must follow. For the path, install again with `--track source`. |
|
|
121
|
+
|
|
122
|
+
hcm continues with the other bundles when one source fails, and exits with
|
|
123
|
+
code 1. Read all of the output.
|
|
124
|
+
|
|
125
|
+
`hcm update` and `hcm uninstall` do not change an item that somebody edited
|
|
126
|
+
after the install. hcm reports the item as `modified` and stops for that bundle.
|
|
127
|
+
Tell the user. Use `--force` only if the user agrees to lose the edit.
|
|
128
|
+
|
|
129
|
+
## Manage the registry
|
|
130
|
+
|
|
131
|
+
The registry is the list of bundles that the user can install by name or id.
|
|
132
|
+
There is one registry for each user, for all projects.
|
|
133
|
+
|
|
134
|
+
| Task | Command |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| See the registered bundles, with their ids, sources and collection names | `hcm registry list` |
|
|
137
|
+
| See the bundles of one named collection | `hcm registry list --collection <name>` |
|
|
138
|
+
| See the full data of each entry | `hcm registry list --json` |
|
|
139
|
+
| Register each bundle of a collection | `hcm registry add <collection>` |
|
|
140
|
+
| Give the bundles of a source a collection name | `hcm registry add <source> --collection <name>` |
|
|
141
|
+
| Read the registered bundles from their sources again | `hcm registry update` |
|
|
142
|
+
| Unregister bundles | `hcm registry remove <bundle...>` |
|
|
143
|
+
| Unregister each bundle of a named collection | `hcm registry remove --collection <name>` |
|
|
144
|
+
| Show the folder that holds the copies of the bundles | `hcm registry open --no-open` |
|
|
145
|
+
|
|
146
|
+
### Named collections
|
|
147
|
+
|
|
148
|
+
The registry records a collection name on each bundle of a named collection.
|
|
149
|
+
Usually, these are the bundles of one repository. The name comes from one of
|
|
150
|
+
these:
|
|
151
|
+
|
|
152
|
+
- The `collection` in the `hcm_manifest.yml` file of the collection. hcm reads it when you register the collection folder.
|
|
153
|
+
- The `--collection <name>` option of `hcm registry add`. It replaces the name of the collection manifest.
|
|
154
|
+
|
|
155
|
+
Rules:
|
|
156
|
+
|
|
157
|
+
- When you register a bundle again with no collection name, the bundle keeps its collection.
|
|
158
|
+
- `hcm registry update` does not change a collection name. To get a new name from the collection manifest, register the collection again.
|
|
159
|
+
- hcm ignores the case of collection names.
|
|
160
|
+
- `hcm export` does not record collection names. After `hcm import`, give the names again with `--collection`.
|
|
161
|
+
|
|
162
|
+
### Collection name clashes
|
|
163
|
+
|
|
164
|
+
A clash occurs when a registration asks for a collection name, and bundles of
|
|
165
|
+
a different source already have that name. hcm writes nothing until the clash
|
|
166
|
+
is resolved. The choices are:
|
|
167
|
+
|
|
168
|
+
| Choice | Result |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `join` | The new bundles go into the existing collection. One removal command then removes the bundles of both sources. |
|
|
171
|
+
| `rename` | The new bundles go into a collection with another name. The default is `<name>-2`. hcm records the rename, and does not ask again for the same source. |
|
|
172
|
+
| `abort` | hcm registers nothing. |
|
|
173
|
+
|
|
174
|
+
hcm asks only at a terminal. An agent has no terminal, so hcm stops with the
|
|
175
|
+
message `The collection name "<name>" is in use by ...`. Then do these steps:
|
|
176
|
+
|
|
177
|
+
1. Tell the user the name, and the source that already uses it.
|
|
178
|
+
2. Ask the user to choose `join`, `rename` or `abort`. Recommend `rename` when the two sources are not related.
|
|
179
|
+
3. Run the same command again with `--on-collection-clash <choice>`.
|
|
180
|
+
|
|
181
|
+
Do not give `--on-collection-clash join` without the consent of the user.
|
|
182
|
+
|
|
183
|
+
These cases are not clashes, and hcm does not ask:
|
|
184
|
+
|
|
185
|
+
- The source already has bundles in the collection.
|
|
186
|
+
- The sources differ only in the ref, for example `#v1.0.0` and `#v1.1.0`.
|
|
187
|
+
- One source is inside the other, for example a collection folder and one of its bundle folders.
|
|
188
|
+
- The only bundles with the name are bundles that the registration replaces.
|
|
189
|
+
|
|
190
|
+
### Remove a named collection
|
|
191
|
+
|
|
192
|
+
`hcm registry remove` changes only the registry. It does not remove the items
|
|
193
|
+
that a bundle installed in a project.
|
|
194
|
+
|
|
195
|
+
1. Run `hcm registry list --collection <name>`. Show the list to the user, and ask for confirmation.
|
|
196
|
+
2. If the user also wants the installed items removed, run `hcm list --installed` in each project.
|
|
197
|
+
3. For each project that has a bundle of the collection, run `hcm uninstall <bundle...> -t <harness>` there.
|
|
198
|
+
4. Run `hcm registry remove --collection <name>`.
|
|
199
|
+
5. Read the output. hcm warns when a bundle is still installed in this project or for the user. Tell the user about each warning.
|
|
200
|
+
|
|
201
|
+
To remove a named collection and other bundles in one command, give both:
|
|
202
|
+
`hcm registry remove 7 --collection <name>`.
|
|
203
|
+
|
|
204
|
+
### Name bundles that you registered before
|
|
205
|
+
|
|
206
|
+
Bundles of one source can be in the registry with no collection name. Give
|
|
207
|
+
them a name:
|
|
208
|
+
|
|
209
|
+
1. Run `hcm registry list --json`. Find the entries of the source. Note the `source` and the `dev` value of each entry.
|
|
210
|
+
2. If the source has an `hcm_manifest.yml` file with a `collection`, register the collection folder again: `hcm registry add <collection>`.
|
|
211
|
+
3. If not, give the name: `hcm registry add <collection> --collection <name>`.
|
|
212
|
+
4. For an entry with `"dev": true`, give `--dev` again. Without it, hcm replaces the entry with a copy.
|
|
213
|
+
5. If the entries are a mix of `--dev` entries and copies, register each `--dev` bundle from its own folder: `hcm registry add <bundle-folder> --dev --collection <name>`.
|
|
214
|
+
6. If hcm reports a clash, follow [Collection name clashes](#collection-name-clashes).
|
|
215
|
+
7. Run `hcm registry list --collection <name>`. Make sure that each bundle of the source is in the list.
|
|
216
|
+
|
|
217
|
+
A second registration keeps the id of each bundle. It does not change a
|
|
218
|
+
project. To add a manifest to the collection itself, use the
|
|
219
|
+
`hcm-bundle-authoring` skill.
|
|
220
|
+
|
|
221
|
+
## Repair the instruction file
|
|
222
|
+
|
|
223
|
+
The agent of a harness can rewrite `CLAUDE.md`, `AGENTS.md` or a similar file,
|
|
224
|
+
and remove the hcm sections. hcm keeps a copy of each section in
|
|
225
|
+
`.hcm/context/`.
|
|
226
|
+
|
|
227
|
+
- `hcm context` shows each section, and if the section is in its file.
|
|
228
|
+
- `hcm context append` writes back the missing sections. It does not change other text.
|
|
229
|
+
|
|
230
|
+
## Share a setup
|
|
231
|
+
|
|
232
|
+
- `hcm export` writes the installed bundles to `bundles.txt`.
|
|
233
|
+
- `hcm import bundles.txt --install -t <harness> --no-prompt` registers and installs them on another machine.
|
|
234
|
+
- `hcm params init` writes the parameter values of this project to `params.yaml`. Give that file back with `--params-file params.yaml`.
|
|
235
|
+
|
|
236
|
+
## The built-in bundle
|
|
237
|
+
|
|
238
|
+
The bundle `hcm`, with the id `0`, ships with hcm. It contains this skill. It is
|
|
239
|
+
always available, and you cannot unregister it. To add it to a project, run
|
|
240
|
+
`hcm install hcm -t <harness> --no-prompt`. After an upgrade of hcm, run
|
|
241
|
+
`hcm update hcm -t <harness> --no-prompt`.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# hcm command reference
|
|
2
|
+
|
|
3
|
+
Run `hcm <command> --help` for the options of the installed version.
|
|
4
|
+
|
|
5
|
+
## Options that most commands take
|
|
6
|
+
|
|
7
|
+
| Option | Meaning |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `-t, --target <harness...>` | The harnesses: `claude-code`, `copilot`, `copilot-cli`, `reasonix`, `opencode`, `pi`, or `all`. A unique prefix is also correct, for example `claude`. |
|
|
10
|
+
| `-s, --scope <scope>` | `project` (the current folder, the default) or `user` (the home folder of each harness). |
|
|
11
|
+
| `-f, --flavor <flavor...>` | Install the common part and only these parts of the bundle. `all` selects the full bundle. |
|
|
12
|
+
| `--param NAME=value` | A parameter value. You can give the option more than one time. `bundle:NAME=value` sets it for one bundle. `bundle@harness:NAME=value` sets it for one bundle in one harness. |
|
|
13
|
+
| `--params-file <file>` | Parameter values from a YAML or JSON file. |
|
|
14
|
+
| `--no-prompt` | Do not ask questions. Use the values on the command line, then the defaults. |
|
|
15
|
+
| `--dry-run` | Show the changes. Do not write. |
|
|
16
|
+
| `--on-conflict <policy>` | For an item that is already there and different: `prompt`, `skip`, `overwrite`, `rename` or `abort`. `rename` installs the item with the bundle name as a suffix, for example `audit-my-kit`. |
|
|
17
|
+
| `--force` | Overwrite conflicts, and remove items that somebody edited. |
|
|
18
|
+
|
|
19
|
+
`-t` and `-f` take all the values after them. Put bundle names before these
|
|
20
|
+
options.
|
|
21
|
+
|
|
22
|
+
## Install and remove
|
|
23
|
+
|
|
24
|
+
| Command | What it does |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `hcm install <bundle...>` | Install bundles, and the bundles that they require. Also `--no-deps`, `--refresh`, `--pi-subagents`. `--track registry\|source` sets where `hcm update` reads the next version. |
|
|
27
|
+
| `hcm update [<bundle...>\|all]` | Read each bundle again, from the registry or from its source. Install each new version where the old version is. No argument: the bundles of this project. `all`: these, and all registered bundles. `--reconfigure` asks for the parameters again. `--no-registry` reads the recorded sources this time, with no change to the registry. `--track registry\|source` changes the mode. `--from <path\|url>` reads a new source, and follows it from now on. |
|
|
28
|
+
| `hcm uninstall <bundle...>` | Remove exactly what hcm installed. Also `--cascade`, `--ignore-dependents`, `--keep-orphans`. |
|
|
29
|
+
|
|
30
|
+
## Inspect
|
|
31
|
+
|
|
32
|
+
| Command | What it does |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `hcm list` | The available bundles, with ids. `●` marks an installed bundle. `--descriptions`, `--json`. |
|
|
35
|
+
| `hcm list --installed` | The installed bundles. `--scope project\|user\|all`, `--json`. |
|
|
36
|
+
| `hcm info <bundle...>` | The contents of a bundle, its flavors and parameters, and the destination of each item in each harness. |
|
|
37
|
+
| `hcm status` | The harnesses of this folder, and if each installed item is present and not changed. |
|
|
38
|
+
| `hcm targets` | The supported harnesses, their paths, and the files that two harnesses share. |
|
|
39
|
+
| `hcm params [bundle...]` | The parameter values of each installation. |
|
|
40
|
+
| `hcm params init [bundle...]` | Write a parameters file to fill in. |
|
|
41
|
+
|
|
42
|
+
## Context sections
|
|
43
|
+
|
|
44
|
+
| Command | What it does |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `hcm context` | Each context section, and if it is in its file. |
|
|
47
|
+
| `hcm context append [bundle...]` | Write back the missing sections. |
|
|
48
|
+
| `hcm context override [bundle...]` | Clear the instruction file and write the sections again. This deletes text that hcm did not write. |
|
|
49
|
+
| `hcm context remove [bundle...]` | Remove the sections, and keep the cached copies. |
|
|
50
|
+
|
|
51
|
+
## Bundles and the registry
|
|
52
|
+
|
|
53
|
+
| Command | What it does |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `hcm init [dir]` | Make a new bundle from a template. |
|
|
56
|
+
| `hcm validate [dir]` | Check a bundle for common mistakes. |
|
|
57
|
+
| `hcm refs check -p <path>` | Report file references that point to no file. |
|
|
58
|
+
| `hcm refs fix -p <path>` | Repair broken references from a list of candidates. |
|
|
59
|
+
| `hcm registry add <source...>` | Register bundles from a path, `owner/repo`, a GitHub URL, or the HTTPS clone URL of any git host. `--dev` reads a local bundle in place. `-n, --name` sets a different name. `--collection <name>` gives the bundles a collection name. `--on-collection-clash join\|rename\|abort` resolves a name that another source uses. |
|
|
60
|
+
| `hcm registry update [bundle...]` | Read registered bundles from their sources again, and replace the stored copies. It does not change a project. No argument: all registered bundles. `--dry-run`. |
|
|
61
|
+
| `hcm registry remove [bundle...]` | Unregister bundles and delete their stored copies. `--collection <name>` removes each bundle of the named collection. |
|
|
62
|
+
| `hcm registry list` | The registered bundles, with ids and collection names. `--collection <name>` shows one collection. `--json`. |
|
|
63
|
+
| `hcm registry open [bundle]` | Show the folder of the store or of one bundle. `--no-open` only prints the path. |
|
|
64
|
+
| `hcm export [file]` | Write the installed bundles, or the registry with `--registry`, to `bundles.txt`. |
|
|
65
|
+
| `hcm import [file]` | Register the bundles in a bundles file. `--install` installs them too. |
|
|
66
|
+
| `hcm config` | Show the settings. `config set\|get\|unset` changes them. |
|
|
67
|
+
|
|
68
|
+
## Environment variables
|
|
69
|
+
|
|
70
|
+
| Variable | Effect |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `HCM_HOME` | The hcm home folder: config, registry, user state, cache and store. The default is `~/.hcm`. |
|
|
73
|
+
| `HCM_PARAM_<NAME>` | A parameter value. |
|
|
74
|
+
| `HCM_REQUIRE_TARGET` | When hcm requires `-t`: `auto`, `always` or `never`. |
|
|
75
|
+
| `HCM_CACHE_DIR`, `HCM_STORE_DIR` | Different folders for the download cache and the bundle store. |
|
|
76
|
+
| `HCM_GIT_TOKEN`, `HCM_GIT_TOKEN_<HOST>` | An access token for a private repository that hcm reads by its clone URL. `<HOST>` is the host name in upper case, with `_` for each other character: `HCM_GIT_TOKEN_DEV_AZURE_COM`. |
|