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,23 @@
|
|
|
1
|
+
# hcm (built-in bundle)
|
|
2
|
+
|
|
3
|
+
This bundle ships inside the hcm package. Every hcm installation has it, with
|
|
4
|
+
the name `hcm` and the id `0`. You do not register it, and you cannot remove it
|
|
5
|
+
from the registry.
|
|
6
|
+
|
|
7
|
+
| Resource | Flavor | Use |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `context/10-hcm.md` | common | Tells the agent that hcm manages the agent configuration of the project. |
|
|
10
|
+
| `skills/hcm-usage/` | common | Find, install, update and remove bundles. Manage the registry, and the named collections in it. |
|
|
11
|
+
| `skills/hcm-bundle-authoring/` | `authoring` | Write, check and publish a bundle or a collection of bundles. Add a collection manifest to an existing collection. |
|
|
12
|
+
| `skills/hcm-integration/` | `integration` | Ship a bundle with a CLI tool (`my-cli hcm init`), with a library (`python -m my_library hcm install`, `npx --no my-lib-hcm install`), or as a separate download. Upgrade an older integration, and move the projects of its users. |
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
hcm install hcm -t claude-code # all of it
|
|
18
|
+
hcm install hcm -t claude-code --flavor authoring # the common part and the authoring skill
|
|
19
|
+
hcm install hcm -t claude-code -s user # for all projects of this user
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
hcm reads this bundle from the package. After you upgrade hcm, run
|
|
23
|
+
`hcm update hcm` in each project that has it.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## hcm
|
|
2
|
+
|
|
3
|
+
hcm (harness-config-manager) manages the agent configuration of this project.
|
|
4
|
+
hcm writes subagents, skills, commands, rules, MCP servers and settings into the
|
|
5
|
+
harness folders, for example `.claude/`, `.github/` and `.pi/`.
|
|
6
|
+
|
|
7
|
+
- Do not edit a file that hcm installed. Change the bundle that supplies it, then run `hcm update <bundle>`.
|
|
8
|
+
- An edit to an installed file stops `hcm update` and `hcm uninstall` for that bundle.
|
|
9
|
+
- Some bundles come from a dependency of this project, for example from `.venv/` or `node_modules/`. `hcm list --installed` marks them `[source]`. After an upgrade of the dependency, run `hcm update`.
|
|
10
|
+
- To see the files that hcm installed, and the files that changed after the install, run `hcm status`.
|
|
11
|
+
- hcm keeps its sections of this file between `hcm:begin` and `hcm:end` comments. Keep these comments when you edit this file.
|
|
12
|
+
- If an hcm section is missing from this file, run `hcm context append`.
|
|
13
|
+
- Do not edit the `.hcm/` folder. It holds the install ledger.
|
|
14
|
+
- For a task about hcm, use the `hcm-usage`, `hcm-bundle-authoring` or `hcm-integration` skill.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: hcm
|
|
2
|
+
version: 0.1.4
|
|
3
|
+
description: Skills and instructions for agents that install hcm bundles, write hcm bundles, or connect a CLI tool or a library to hcm.
|
|
4
|
+
author: harness-config-manager
|
|
5
|
+
homepage: https://github.com/fleskovar/harness_config_manager
|
|
6
|
+
tags:
|
|
7
|
+
- hcm
|
|
8
|
+
- bundles
|
|
9
|
+
- authoring
|
|
10
|
+
# This bundle ships inside the hcm package, so its version is the package
|
|
11
|
+
# version. "npm version" updates this line through scripts/sync-builtin-version.mjs.
|
|
12
|
+
flavors:
|
|
13
|
+
authoring:
|
|
14
|
+
description: The skill to write, check and publish an hcm bundle
|
|
15
|
+
integration:
|
|
16
|
+
description: The skill to ship a bundle with a CLI tool, with a library, or as a separate download, and to upgrade an older integration
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Write, check and publish an hcm bundle of subagents, skills, commands, rules, context, MCP servers and settings. Also write a collection of bundles with an hcm_manifest.yml file. Use when the user asks to make an hcm bundle or collection, or to add a resource to a bundle. Also use it to add a collection manifest or a collection name to an existing folder of bundles. Also use it to fix a problem that hcm validate or hcm refs check reports.
|
|
3
|
+
flavors: [authoring]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Write an hcm bundle
|
|
7
|
+
|
|
8
|
+
A bundle is a folder with an `hcm.yaml` manifest. The name of each subfolder
|
|
9
|
+
tells hcm the kind of the resources in it. There is no list of resources to
|
|
10
|
+
keep up to date.
|
|
11
|
+
|
|
12
|
+
The manifest fields and the frontmatter of each kind are in
|
|
13
|
+
[the bundle reference](./reference.md).
|
|
14
|
+
|
|
15
|
+
## Layout
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
my-kit/
|
|
19
|
+
├── hcm.yaml # name, version, description, and optional fields
|
|
20
|
+
├── subagents/<name>.md # a worker with its own prompt
|
|
21
|
+
├── skills/<name>/SKILL.md # a skill, and its supporting files beside it
|
|
22
|
+
├── commands/<name>.md # a slash command or prompt
|
|
23
|
+
├── rules/<name>.md # instructions for the files that match a glob
|
|
24
|
+
├── context/<NN>-<name>.md # instructions that load in each session, one section per file
|
|
25
|
+
├── mcp/<name>.json # one MCP server per file
|
|
26
|
+
├── settings/settings.json # a settings fragment that hcm merges
|
|
27
|
+
└── assets/ # files that hcm copies without change
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
One file is one resource. The file name is the resource name. For a skill, the
|
|
31
|
+
folder name is the resource name.
|
|
32
|
+
|
|
33
|
+
## Procedure
|
|
34
|
+
|
|
35
|
+
1. Make the bundle: `hcm init my-kit`. Delete the example resources that you do not need.
|
|
36
|
+
2. Write the manifest. `name` and `version` are mandatory. Use a semantic version, for example `1.0.0`.
|
|
37
|
+
3. Write each resource in the folder for its kind.
|
|
38
|
+
4. Check the bundle: `hcm validate ./my-kit`. Fix each problem that it reports.
|
|
39
|
+
5. Check the references: `hcm refs check --path ./my-kit`. Fix each broken reference.
|
|
40
|
+
6. Register the bundle in place: `hcm registry add ./my-kit --dev`. Then each install reads your latest edits.
|
|
41
|
+
7. Preview the result: `hcm info my-kit`. The output shows the destination of each item in each harness.
|
|
42
|
+
8. Test the bundle in an empty folder. See [Test a bundle](#test-a-bundle).
|
|
43
|
+
9. Publish the bundle. Push it to GitHub and tag a version. Users then run `hcm registry add owner/repo/path#v1.0.0`.
|
|
44
|
+
|
|
45
|
+
## Rules for content
|
|
46
|
+
|
|
47
|
+
- Write each `description` as "what it does, and when to use it". The harness reads the description to decide when to use the subagent or skill.
|
|
48
|
+
- Start each context file with a level-2 heading. hcm puts the text into an instruction file that the user owns.
|
|
49
|
+
- Keep context short. The harness loads it in each session. Put long instructions in a skill.
|
|
50
|
+
- Use one context file for each section. Start each file name with a two-digit number, for example `10-`, to set the order.
|
|
51
|
+
- Do not give a subagent, a skill and a command the same name. Some harnesses keep them in one namespace.
|
|
52
|
+
- Put a prefix on the names of MCP servers, subagents and commands that belong to a team or product: `acme-postgres`, not `postgres`.
|
|
53
|
+
- Do not put secrets in a bundle. In MCP and settings files, refer to an environment variable: `"API_KEY": "${MY_API_KEY}"`.
|
|
54
|
+
- Keep settings fragments small. The user cannot change a key that the bundle sets without drift in `hcm status`.
|
|
55
|
+
|
|
56
|
+
## References between files
|
|
57
|
+
|
|
58
|
+
Write a path to a file of the bundle as the bundle is laid out, from the bundle
|
|
59
|
+
root. A file beside the referring file can also use its plain name. During the
|
|
60
|
+
install, hcm changes each path to the location of the file in each harness.
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
Follow `./checklist.md`. <- a file beside this SKILL.md
|
|
64
|
+
See [the reviewer](subagents/code-reviewer.md). <- a path from the bundle root
|
|
65
|
+
Run `assets/scripts/audit.sh`. <- a path from the bundle root
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- `hcm refs check` reads links, `[[wikilinks]]`, `@paths`, and paths that start with `./` or `../`. It ignores a bare file name in a sentence. Thus, start a path to a file of the bundle with `./`.
|
|
69
|
+
- hcm does not change URLs, absolute paths, paths in fenced code blocks, or paths that start with a hidden folder such as `.claude/`.
|
|
70
|
+
- A path in an MCP or settings value is resolved by the harness, usually from the project root. Check these paths with `hcm info` before you publish.
|
|
71
|
+
|
|
72
|
+
## Optional features
|
|
73
|
+
|
|
74
|
+
Use these features only when the bundle needs them. The full syntax is in
|
|
75
|
+
[the bundle reference](./reference.md).
|
|
76
|
+
|
|
77
|
+
| Feature | Use it when | Manifest key |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| Targets | The bundle has no use in some harnesses. | `targets` |
|
|
80
|
+
| Dependencies | The bundle needs the content of a different bundle. | `dependencies` |
|
|
81
|
+
| Flavors | Users want only part of the bundle, for example one language. | `flavors` |
|
|
82
|
+
| Parameters | A value is different in each project, for example a team name. | `parameters` |
|
|
83
|
+
|
|
84
|
+
## Test a bundle
|
|
85
|
+
|
|
86
|
+
Run these commands in an empty temporary folder:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
hcm install /path/to/my-kit -t claude-code --no-prompt
|
|
90
|
+
hcm status
|
|
91
|
+
hcm uninstall my-kit -t claude-code
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
After the uninstall, the folder must be empty. Do these checks too:
|
|
95
|
+
|
|
96
|
+
- If the bundle has flavors, install each flavor in its own empty folder. Make sure that the common part works without the other flavors.
|
|
97
|
+
- If the bundle has dependencies, make sure that the uninstall removes them.
|
|
98
|
+
- To see what users get from a new version, run `hcm update my-kit --dry-run`. The output shows the items that the update removes and the items that it writes.
|
|
99
|
+
|
|
100
|
+
## Collections of bundles
|
|
101
|
+
|
|
102
|
+
A collection is one folder, usually one repository, with more than one bundle.
|
|
103
|
+
Its `hcm_manifest.yml` file holds the data that is the same for all its
|
|
104
|
+
bundles:
|
|
105
|
+
|
|
106
|
+
- `collection` gives the bundles a name in the registry. `hcm registry remove --collection <name>` then removes all of them.
|
|
107
|
+
- `bundles` lists the bundle folders. Without it, hcm reads each direct subfolder that contains an `hcm.yaml`.
|
|
108
|
+
|
|
109
|
+
Read [the collections guide](./collections.md) for these tasks:
|
|
110
|
+
|
|
111
|
+
- Make a new collection.
|
|
112
|
+
- Add a manifest to a folder that already ships more than one bundle.
|
|
113
|
+
- Choose a collection name, and decide on the `bundles` list.
|
|
114
|
+
- Resolve a collection name clash.
|
|
115
|
+
|
|
116
|
+
## Ship a bundle with your software
|
|
117
|
+
|
|
118
|
+
To ship the bundle with a CLI tool, with a library, or as a separate download,
|
|
119
|
+
use the `hcm-integration` skill.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Collections of bundles
|
|
2
|
+
|
|
3
|
+
A collection is one folder that holds more than one bundle. Usually it is one
|
|
4
|
+
repository. `hcm registry add <collection>` registers each bundle in it, and
|
|
5
|
+
each bundle keeps its own name, id and version.
|
|
6
|
+
|
|
7
|
+
A collection can have a collection manifest, `hcm_manifest.yml`, in its root
|
|
8
|
+
folder. The manifest holds the data that is the same for all bundles of the
|
|
9
|
+
collection. The full syntax is in
|
|
10
|
+
[the bundle reference](./reference.md#collection-manifest-hcm_manifestyml).
|
|
11
|
+
|
|
12
|
+
## When to use a collection
|
|
13
|
+
|
|
14
|
+
Use a collection when the parts of a kit are useful alone. A user installs and
|
|
15
|
+
removes bundles one at a time. Thus, a user can take the review kit without the
|
|
16
|
+
database kit.
|
|
17
|
+
|
|
18
|
+
Use one bundle with flavors when the parts are always used together, and only
|
|
19
|
+
the language or the role changes.
|
|
20
|
+
|
|
21
|
+
## Layout
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
agent-kits/
|
|
25
|
+
├── hcm_manifest.yml # the collection name, and the list of bundle folders
|
|
26
|
+
├── README.md # not a bundle; hcm ignores it
|
|
27
|
+
├── review-kit/
|
|
28
|
+
│ └── hcm.yaml
|
|
29
|
+
└── db-kit/
|
|
30
|
+
└── hcm.yaml
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
# agent-kits/hcm_manifest.yml
|
|
35
|
+
collection: acme-agent-kits
|
|
36
|
+
bundles:
|
|
37
|
+
- review-kit
|
|
38
|
+
- db-kit
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- Put each bundle in its own folder, with its own `hcm.yaml`.
|
|
42
|
+
- Do not put an `hcm.yaml` in the collection root. hcm refuses a folder that has `hcm.yaml` and `hcm_manifest.yml`.
|
|
43
|
+
- Give each bundle a different `name`. The registry has one entry for each name.
|
|
44
|
+
- Give each bundle its own `version`. The collection manifest has no version.
|
|
45
|
+
|
|
46
|
+
## Choose the collection name
|
|
47
|
+
|
|
48
|
+
hcm records the collection name on each bundle in the registry of the user.
|
|
49
|
+
`hcm registry remove --collection <name>` removes all bundles of the
|
|
50
|
+
collection in one step.
|
|
51
|
+
|
|
52
|
+
- Use the name of the repository, the product or the team. Add the organization as a prefix: `acme-agent-kits`, not `kits`.
|
|
53
|
+
- Use letters, digits, dots, dashes and underscores. Start with a letter or a digit.
|
|
54
|
+
- Do not change the name after you publish the collection. A user keeps the old name until the user registers the collection again. Scripts that use the old name then fail.
|
|
55
|
+
|
|
56
|
+
A unique name prevents clashes. A clash occurs when the registry of the user
|
|
57
|
+
already has the name for bundles from another source. hcm then asks the user to
|
|
58
|
+
join that collection, to use another name, or to stop. See
|
|
59
|
+
[Name clashes](#name-clashes).
|
|
60
|
+
|
|
61
|
+
## Decide on the `bundles` list
|
|
62
|
+
|
|
63
|
+
Without `bundles`, hcm reads each direct subfolder that contains an `hcm.yaml`.
|
|
64
|
+
Give a `bundles` list in these conditions:
|
|
65
|
+
|
|
66
|
+
- The bundles are deeper than one level, for example in `bundles/review-kit`.
|
|
67
|
+
- The repository contains bundles that are not for users, for example test data.
|
|
68
|
+
- You want a fixed order in the output of hcm.
|
|
69
|
+
|
|
70
|
+
Each path in the list is relative to the collection root, and must stay inside
|
|
71
|
+
it. Each listed folder must contain an `hcm.yaml`. hcm reads only the listed
|
|
72
|
+
folders.
|
|
73
|
+
|
|
74
|
+
## Dependencies between bundles of a collection
|
|
75
|
+
|
|
76
|
+
hcm finds a dependency in a folder beside the bundle that requires it. Thus:
|
|
77
|
+
|
|
78
|
+
- Keep a bundle and its dependencies in the same parent folder.
|
|
79
|
+
- If the folders have different parents, give a `source` for the dependency. See [Dependencies](./reference.md#dependencies).
|
|
80
|
+
|
|
81
|
+
## Make a new collection
|
|
82
|
+
|
|
83
|
+
1. Make the collection folder. In it, make each bundle with `hcm init <bundle-name>`.
|
|
84
|
+
2. Write `hcm_manifest.yml` in the collection root. Give a `collection` name. Give `bundles` if a condition above applies.
|
|
85
|
+
3. Check all bundles: `hcm validate <collection>`. Fix each problem that it reports.
|
|
86
|
+
4. Check the references: `hcm refs check --path <collection>`. Fix each broken reference.
|
|
87
|
+
5. Register the collection in place: `hcm registry add <collection> --dev`. If hcm reports a name clash, see [Name clashes](#name-clashes).
|
|
88
|
+
6. Make sure that the name is correct: `hcm registry list --collection <name>`. The output must list each bundle.
|
|
89
|
+
7. Test each bundle in an empty folder. See [Test a bundle](./SKILL.md#test-a-bundle).
|
|
90
|
+
8. Publish the collection. Push it to a repository and tag a version.
|
|
91
|
+
|
|
92
|
+
Tell users to register the whole collection, for example
|
|
93
|
+
`hcm registry add acme/agent-kits#v1.0.0`. A bundle that a user registers from
|
|
94
|
+
its own folder gets no collection name.
|
|
95
|
+
|
|
96
|
+
## Add a manifest to an existing collection
|
|
97
|
+
|
|
98
|
+
Use this procedure for a folder or repository that already ships more than one
|
|
99
|
+
bundle, but has no `hcm_manifest.yml`.
|
|
100
|
+
|
|
101
|
+
1. Make sure that hcm reads collection manifests. Run `hcm registry add --help`. The output must show `--collection`. If not, tell the user to upgrade hcm.
|
|
102
|
+
2. Find the bundles. List each folder in the collection that contains an `hcm.yaml`. Look deeper than one level.
|
|
103
|
+
3. Make sure that the collection root has no `hcm.yaml`. If it has one, the folder is one bundle, not a collection. Stop and ask the user.
|
|
104
|
+
4. Ask the user which bundles are for distribution. Do not include test data or examples.
|
|
105
|
+
5. Choose the collection name. See [Choose the collection name](#choose-the-collection-name).
|
|
106
|
+
6. Run `hcm registry list`. If another source already uses the name, choose a different name, or ask the user.
|
|
107
|
+
7. Write `hcm_manifest.yml` in the collection root. Give `collection`. Give `bundles` if the bundles are deeper than one level, or if some folders are not for distribution.
|
|
108
|
+
8. Check the result: `hcm validate <collection>`. The output must list each bundle for distribution, and no other bundle.
|
|
109
|
+
9. Do not change the version of a bundle for this change. The manifest does not change the content of a bundle.
|
|
110
|
+
10. Commit `hcm_manifest.yml`. For a remote collection, tag a new version of the repository.
|
|
111
|
+
|
|
112
|
+
### Update the registry after the retrofit
|
|
113
|
+
|
|
114
|
+
hcm records the collection name when it registers the collection.
|
|
115
|
+
`hcm registry update` does not read the collection manifest. Thus, register the
|
|
116
|
+
collection again:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
hcm registry add <collection> # snapshot entries
|
|
120
|
+
hcm registry add <collection> --dev # entries that read the folder in place
|
|
121
|
+
hcm registry list --collection <name> # check: each bundle shows the name
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- A second registration keeps the id of each bundle. Installed bundles do not change.
|
|
125
|
+
- `--dev` applies to all bundles of the command. If only some entries are `--dev` entries, register those bundles one at a time: `hcm registry add <collection>/<bundle> --dev --collection <name>`. A folder inside the collection is not a clash.
|
|
126
|
+
- For a remote source, for example `owner/repo#v1.0.0`, give that source again with the new tag.
|
|
127
|
+
|
|
128
|
+
Tell the users of a published collection to register the collection again
|
|
129
|
+
with the new tag. Give them the command.
|
|
130
|
+
|
|
131
|
+
## Name clashes
|
|
132
|
+
|
|
133
|
+
A clash occurs when a registration asks for a collection name, and bundles of
|
|
134
|
+
a different source already have that name. hcm asks the user what to do:
|
|
135
|
+
|
|
136
|
+
| Choice | Result |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| `join` | The new bundles go into the existing collection. `hcm registry remove --collection` then removes both groups. |
|
|
139
|
+
| `rename` | The new bundles go into a collection with another name, for example `<name>-2`. hcm records the rename. A later registration of the same source gets the same name, with no question. |
|
|
140
|
+
| `abort` | hcm registers nothing. |
|
|
141
|
+
|
|
142
|
+
These cases are not clashes:
|
|
143
|
+
|
|
144
|
+
- The source already has bundles in the collection.
|
|
145
|
+
- The sources differ only in the ref, for example `#v1.0.0` and `#v1.1.0`.
|
|
146
|
+
- One source is inside the other, for example a collection folder and one of its bundle folders.
|
|
147
|
+
- The only bundles with the name are bundles that the registration replaces.
|
|
148
|
+
|
|
149
|
+
An agent has no terminal, so hcm cannot ask. hcm then stops, registers nothing,
|
|
150
|
+
and names the bundles that have the name. Do these steps:
|
|
151
|
+
|
|
152
|
+
1. Tell the user which source already uses the name.
|
|
153
|
+
2. Ask the user to choose `join`, `rename` or `abort`.
|
|
154
|
+
3. Run the command again with `--on-collection-clash <choice>`.
|
|
155
|
+
|
|
156
|
+
Do not choose `join` without the consent of the user. After a join, one removal
|
|
157
|
+
command removes the bundles of both sources.
|
|
158
|
+
|
|
159
|
+
## A collection that you cannot change
|
|
160
|
+
|
|
161
|
+
A user can name a collection that has no manifest. Give the name on the command
|
|
162
|
+
line:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
hcm registry add acme/agent-kits#v1.0.0 --collection acme-agent-kits
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`--collection` also replaces the name of a collection manifest.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# hcm bundle reference
|
|
2
|
+
|
|
3
|
+
## Manifest: `hcm.yaml`
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
name: my-kit # mandatory; also a file name, so use letters, digits and dashes
|
|
7
|
+
version: 1.0.0 # mandatory; a semantic version
|
|
8
|
+
description: What the bundle is for, and when to install it
|
|
9
|
+
author: Your Name
|
|
10
|
+
homepage: https://github.com/acme/my-kit
|
|
11
|
+
tags: [review, typescript]
|
|
12
|
+
targets: [claude-code, pi] # optional; omit it to support all harnesses
|
|
13
|
+
dependencies: [jira-board@^1.2.0]
|
|
14
|
+
flavors:
|
|
15
|
+
python: Python tooling
|
|
16
|
+
parameters:
|
|
17
|
+
TEAM:
|
|
18
|
+
description: The team that owns the project
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The harness ids are `claude-code`, `copilot`, `copilot-cli`, `reasonix`,
|
|
22
|
+
`opencode` and `pi`. hcm refuses to install a bundle into a harness that
|
|
23
|
+
`targets` does not list.
|
|
24
|
+
|
|
25
|
+
## Collection manifest: `hcm_manifest.yml`
|
|
26
|
+
|
|
27
|
+
A folder that holds more than one bundle can have this file in its root. The
|
|
28
|
+
file names `hcm_manifest.yaml` and `hcm_manifest.json` also work. The procedures
|
|
29
|
+
are in [the collections guide](./collections.md).
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
collection: acme-agent-kits # optional; the collection name of each bundle in the registry
|
|
33
|
+
bundles: # optional; the bundle folders, relative to this file
|
|
34
|
+
- review-kit
|
|
35
|
+
- bundles/db-kit
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
| Field | Rules |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `collection` | Letters, digits, dots, dashes and underscores. Start with a letter or a digit. hcm ignores the case of collection names. |
|
|
41
|
+
| `bundles` | A list with one or more folders. Each folder must contain an `hcm.yaml`, and must be inside the collection folder. A path cannot be in the list two times. |
|
|
42
|
+
|
|
43
|
+
- Without `bundles`, hcm reads each direct subfolder that contains an `hcm.yaml`.
|
|
44
|
+
- With `bundles`, hcm reads only the listed folders, in the list order.
|
|
45
|
+
- An empty file is valid. The folder is then a collection with no name.
|
|
46
|
+
- hcm refuses a folder that contains `hcm.yaml` and `hcm_manifest.yml`.
|
|
47
|
+
- hcm reads the file only when a command gets the collection folder. A bundle that the user registers from its own folder gets no collection name.
|
|
48
|
+
- `hcm registry add --collection <name>` replaces `collection`.
|
|
49
|
+
- Another source can already use the name in the registry of the user. Then hcm asks the user to join, rename or abort. See [Name clashes](./collections.md#name-clashes).
|
|
50
|
+
|
|
51
|
+
## Resource kinds
|
|
52
|
+
|
|
53
|
+
### Subagent: `subagents/<name>.md`
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
---
|
|
57
|
+
description: Reviews changed code for correctness. Use before you open a pull request.
|
|
58
|
+
tools: [Read, Grep, Glob, Bash]
|
|
59
|
+
model: sonnet
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
You are a code reviewer...
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- The body is the system prompt.
|
|
66
|
+
- `name` in the frontmatter replaces the file name as the subagent name.
|
|
67
|
+
- hcm changes the shape of `tools` for each harness. It does not change the tool names. OpenCode and Pi without the `pi-subagents` extension do not use `tools`.
|
|
68
|
+
- Reasonix and Pi keep a subagent as a skill. Thus a subagent and a skill with the same name collide there.
|
|
69
|
+
|
|
70
|
+
### Skill: `skills/<name>/SKILL.md`
|
|
71
|
+
|
|
72
|
+
```markdown
|
|
73
|
+
---
|
|
74
|
+
description: Audits dependencies for known vulnerabilities. Use before a release.
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
Work through `./checklist.md`, then report the results.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
- hcm copies all files in the skill folder. It changes only the frontmatter of `SKILL.md`.
|
|
81
|
+
- Put long reference material in supporting files beside `SKILL.md`, and link to them.
|
|
82
|
+
|
|
83
|
+
### Command: `commands/<name>.md`
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
---
|
|
87
|
+
description: Review the current branch against a base branch
|
|
88
|
+
argumentHint: "[base-branch]"
|
|
89
|
+
allowedTools: [Read, Grep, Bash]
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
Review this branch against `$ARGUMENTS`.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Copilot CLI has no folder for commands, so hcm writes a command there as a
|
|
96
|
+
skill. Thus a command and a skill with the same name collide there.
|
|
97
|
+
|
|
98
|
+
### Rule: `rules/<name>.md`
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
---
|
|
102
|
+
description: TypeScript conventions
|
|
103
|
+
appliesTo: ["**/*.ts", "**/*.tsx"]
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
- Use named exports.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Without `appliesTo`, the rule loads in each session. Reasonix, OpenCode and Pi
|
|
110
|
+
have no glob-scoped rules. There, the rule loads in each session, with the globs
|
|
111
|
+
written as text. Keep rules short.
|
|
112
|
+
|
|
113
|
+
### Context: `context/<NN>-<name>.md`
|
|
114
|
+
|
|
115
|
+
Each file becomes one section of the instruction file of the harness:
|
|
116
|
+
`CLAUDE.md`, `.github/copilot-instructions.md`, `REASONIX.md` or `AGENTS.md`.
|
|
117
|
+
Start each file with a level-2 heading. The file names set the order of the
|
|
118
|
+
sections. If you rename a context file, the old section stays in the projects
|
|
119
|
+
of your users until they run `hcm update`.
|
|
120
|
+
|
|
121
|
+
### MCP server: `mcp/<name>.json`
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{ "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "."] }
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{ "url": "https://mcp.example.com", "headers": { "Authorization": "Bearer ${EXAMPLE_TOKEN}" } }
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The file name is the server name. The keys are `command`, `args`, `env`, `type`,
|
|
132
|
+
`url`, `headers`, `startupTimeoutSeconds`, `callTimeoutSeconds` and
|
|
133
|
+
`toolTimeoutSeconds`. hcm writes `${VAR}` references without change. Each
|
|
134
|
+
harness expands them.
|
|
135
|
+
|
|
136
|
+
### Settings: `settings/<name>.json`
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{ "permissions": { "allow": ["Bash(npm test:*)"] } }
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
hcm merges the fragment into the settings file of the harness. hcm adds array
|
|
143
|
+
items to the existing array. A scalar value that is already there with a
|
|
144
|
+
different value is a conflict.
|
|
145
|
+
|
|
146
|
+
### Assets: `assets/**`
|
|
147
|
+
|
|
148
|
+
hcm copies these files without change. Use them for scripts, templates and
|
|
149
|
+
images that other resources refer to.
|
|
150
|
+
|
|
151
|
+
## Dependencies
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
dependencies:
|
|
155
|
+
- jira-board # any version
|
|
156
|
+
- team-conventions@^2.0.0 # a version range
|
|
157
|
+
- name: db-kit # the long form
|
|
158
|
+
version: ">=2.1 <3"
|
|
159
|
+
source: acme/agent-kits/db-kit # a GitHub reference or a relative path
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
- hcm looks for a dependency in this order: the bundles of the same run, the registry, a folder beside the bundle, and then `source`.
|
|
163
|
+
- Give a `source` for each dependency of a published bundle. Other machines do not have your registry.
|
|
164
|
+
- The version ranges are `1.2.3`, `^1.2.3`, `~1.2.3`, `>=1.2.3`, `1.2.x` and `*`. A space means "and". `||` means "or".
|
|
165
|
+
- Only one version of a bundle can be in a scope. Use wide ranges.
|
|
166
|
+
- Every hcm installation has the built-in bundle `hcm`. A bundle can require it by name.
|
|
167
|
+
|
|
168
|
+
## Flavors
|
|
169
|
+
|
|
170
|
+
A resource in no flavor is common, and it installs each time. A resource in a
|
|
171
|
+
flavor installs only when the user asks for that flavor, or asks for no flavor.
|
|
172
|
+
|
|
173
|
+
A markdown resource names its flavors in its frontmatter:
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
---
|
|
177
|
+
description: Runs pytest and reports the failures.
|
|
178
|
+
flavors: [python]
|
|
179
|
+
---
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The manifest names the other resources by path. A folder path includes all the
|
|
183
|
+
files in the folder. `*`, `**` and `?` are wildcards.
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
flavors:
|
|
187
|
+
python:
|
|
188
|
+
description: Python typing, linting and test tooling
|
|
189
|
+
includes:
|
|
190
|
+
- mcp/pyright.json
|
|
191
|
+
- assets/python
|
|
192
|
+
csharp: C# analyzers
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`all` is not a valid flavor name. `hcm validate` reports a flavor that a
|
|
196
|
+
resource names and the manifest does not declare.
|
|
197
|
+
|
|
198
|
+
## Parameters
|
|
199
|
+
|
|
200
|
+
A placeholder in the text of a resource gets a value at install time:
|
|
201
|
+
|
|
202
|
+
```markdown
|
|
203
|
+
You work for the <%%TEAM%> team.
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
```yaml
|
|
207
|
+
parameters:
|
|
208
|
+
TEAM:
|
|
209
|
+
description: The team that owns the project # the help text for the user
|
|
210
|
+
default: Platform # also the suggested answer
|
|
211
|
+
required: false # true by default when there is no default
|
|
212
|
+
choices: [Platform, Data] # the value must be one of these
|
|
213
|
+
pattern: '^[A-Za-z ]+$' # the value must match this regular expression
|
|
214
|
+
secret: false # true: hcm does not record the value
|
|
215
|
+
flavors: [python] # ask only when this flavor is installed
|
|
216
|
+
targets: [claude-code] # ask only for this harness
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
- hcm fills placeholders in markdown, frontmatter, context, all skill files, string values of MCP and settings files, and text assets. It never fills a placeholder in a path.
|
|
220
|
+
- To write a literal placeholder, double the first `%`.
|
|
221
|
+
- Give a default to each parameter that can have one.
|
|
222
|
+
- `hcm validate` reports a placeholder with no declared parameter, a parameter that no file uses, and a placeholder in a `name:` field.
|