harness-config-manager 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +131 -3
  2. package/builtin/hcm/README.md +1 -1
  3. package/builtin/hcm/context/10-hcm.md +1 -0
  4. package/builtin/hcm/hcm.yaml +1 -1
  5. package/builtin/hcm/skills/hcm-bundle-authoring/SKILL.md +25 -0
  6. package/builtin/hcm/skills/hcm-bundle-authoring/collections.md +18 -0
  7. package/builtin/hcm/skills/hcm-integration/remote.md +13 -1
  8. package/builtin/hcm/skills/hcm-usage/SKILL.md +36 -3
  9. package/builtin/hcm/skills/hcm-usage/commands.md +4 -2
  10. package/builtin/hcm/skills/hcm-usage/requirements.md +182 -0
  11. package/dist/cli.js +75 -8
  12. package/dist/cli.js.map +1 -1
  13. package/dist/commands/install-source.d.ts +24 -0
  14. package/dist/commands/install-source.js +92 -0
  15. package/dist/commands/install-source.js.map +1 -0
  16. package/dist/commands/install.js +2 -0
  17. package/dist/commands/install.js.map +1 -1
  18. package/dist/commands/requirements.d.ts +12 -0
  19. package/dist/commands/requirements.js +110 -0
  20. package/dist/commands/requirements.js.map +1 -0
  21. package/dist/commands/update.d.ts +12 -0
  22. package/dist/commands/update.js +131 -6
  23. package/dist/commands/update.js.map +1 -1
  24. package/dist/commands/upgrade.d.ts +26 -0
  25. package/dist/commands/upgrade.js +108 -0
  26. package/dist/commands/upgrade.js.map +1 -0
  27. package/dist/core/digest.d.ts +21 -0
  28. package/dist/core/digest.js +60 -0
  29. package/dist/core/digest.js.map +1 -0
  30. package/dist/core/git-cli.d.ts +64 -0
  31. package/dist/core/git-cli.js +147 -0
  32. package/dist/core/git-cli.js.map +1 -0
  33. package/dist/core/git.d.ts +19 -0
  34. package/dist/core/git.js +36 -4
  35. package/dist/core/git.js.map +1 -1
  36. package/dist/core/refs.js +1 -1
  37. package/dist/core/refs.js.map +1 -1
  38. package/dist/core/registry.js +6 -3
  39. package/dist/core/registry.js.map +1 -1
  40. package/dist/core/requirements.d.ts +101 -0
  41. package/dist/core/requirements.js +350 -0
  42. package/dist/core/requirements.js.map +1 -0
  43. package/dist/core/types.d.ts +7 -0
  44. package/dist/core/types.js.map +1 -1
  45. package/package.json +1 -1
package/README.md CHANGED
@@ -24,6 +24,10 @@ npm install -g harness-config-manager # puts `hcm` on your PATH
24
24
  hcm --version
25
25
  ```
26
26
 
27
+ To upgrade to the latest version, run `hcm upgrade`. The command runs
28
+ `npm install -g harness-config-manager@<latest>` for you. To only see if a new
29
+ version is available, run `hcm upgrade --check`.
30
+
27
31
  To try it without installing anything:
28
32
 
29
33
  ```bash
@@ -1268,8 +1272,9 @@ hcm install my-kit --on-conflict prompt # ask even where hcm would not have
1268
1272
 
1269
1273
  | Command | What it does |
1270
1274
  | --- | --- |
1271
- | `hcm install <bundle...>` | Install, with whatever it requires. `-t/--target`, `-f/--flavor`, `-s/--scope`, `--param`, `--params-file`, `--no-prompt`, `--dry-run`, `--force`, `--on-conflict`, `--refresh`, `--no-deps`, `--pi-subagents`, `--track registry\|source` |
1272
- | `hcm update [<bundle...>\|all]` | Re-read bundles from the registry or from their sources, and reinstall them in place. No argument: everything installed here; `all`: that, and everything registered. `-t`, `-f`, `-s`, `--param`, `--params-file`, `--reconfigure`, `--no-prompt`, `--dry-run`, `--force`, `--on-conflict`, `--pi-subagents`, `--track registry\|source`, `--from <source>`, `--no-registry` |
1275
+ | `hcm install <bundle...>` | Install, with whatever it requires. `-t/--target`, `-f/--flavor`, `-s/--scope`, `--param`, `--params-file`, `--no-prompt`, `--dry-run`, `--force`, `--on-conflict`, `--refresh`, `--no-deps`, `--pi-subagents`, `--track registry\|source`, `--source <repo> [--ref <ref>]` ([from a repository](#install-from-a-repository-into-one-project---source)) |
1276
+ | `hcm install -r [file]` | Install each bundle of a [requirements file](#a-project-requirements-file-hcm-requirementstxt). Default file: `hcm-requirements.txt`. Takes the options of `hcm install`, except `--track` |
1277
+ | `hcm update [<bundle...>\|all]` | Re-read bundles from the registry or from their sources, and reinstall each bundle that changed, in place. No argument: everything installed here; `all`: that, and everything registered. `-t`, `-f`, `-s`, `--param`, `--params-file`, `--reconfigure`, `--no-prompt`, `--dry-run`, `--force`, `--on-conflict`, `--pi-subagents`, `--track registry\|source`, `--from <source>`, `--ref <ref>`, `--no-registry`, `--reinstall` |
1273
1278
  | `hcm uninstall <bundle...>` | Remove exactly what was installed. `-t`, `-s`, `--dry-run`, `--force`, `--cascade`, `--ignore-dependents`, `--keep-orphans` |
1274
1279
  | `hcm list` | Registered bundles with their ids and their status in this project (`●` = installed here). A "Local bundles" section shows the bundles that this project installed from its own dependencies, not from the registry. `-v/--verbose` (sources, flavors, parameters), `--descriptions`, `--json` |
1275
1280
  | `hcm list --installed` | Installed bundles. `--scope project\|user\|all`, `--json` |
@@ -1296,6 +1301,7 @@ hcm install my-kit --on-conflict prompt # ask even where hcm would not have
1296
1301
  | `hcm export [file]` | Write installed (or `--registry`) bundles to `bundles.txt` |
1297
1302
  | `hcm import [file]` | Register everything a bundles file lists; `--install` to install too, `-f/--flavor`, `--param`, `--params-file`, `--on-conflict` |
1298
1303
  | `hcm config` | Show settings; `config set\|get\|unset` to change them |
1304
+ | `hcm upgrade` | Upgrade hcm to the latest version on npm. `--check` only reports if a new version is available. Alias: `hcm self-update` |
1299
1305
 
1300
1306
  `-t/--target` takes one or more harnesses — by id, alias or unambiguous prefix
1301
1307
  (`-t claude pi`) — or `all` for every one of them. In a folder used by several
@@ -1415,7 +1421,8 @@ hcm registry add https://bitbucket.org/workspace/repo.git#:bundles/my-kit # a
1415
1421
  - A branch is not a fixed version. `hcm registry update` downloads its latest commit.
1416
1422
  - `hcm` also reads the browser URL of an Azure DevOps folder, with its `path` and `version` parameters.
1417
1423
  - To read a GitHub repository with the git protocol, write `git+` before the URL: `git+https://github.com/owner/repo.git`. Use this form for a private GitHub repository.
1418
- - An SSH URL works only for github.com. For each other host, use the HTTPS clone URL.
1424
+ - An SSH URL works for each host: `git@ssh.dev.azure.com:v3/org/project/repo`, `ssh://git@gitlab.com/group/repo.git`. For an SSH URL, `hcm` runs the `git` program, which uses your SSH keys. The machine then needs git.
1425
+ - An SSH URL of github.com without `git+` reads the public archive, as before. To read a private GitHub repository over SSH, write `git+ssh://git@github.com/owner/repo.git`.
1419
1426
  - `hcm` does not write symbolic links or submodules.
1420
1427
 
1421
1428
  #### Private repositories
@@ -1539,6 +1546,28 @@ version now collides with is put to you the same way `hcm install` does, and
1539
1546
  Bundles that are registered but not installed anywhere just get their stored
1540
1547
  copy refreshed.
1541
1548
 
1549
+ #### Up to date: no rollback, no install
1550
+
1551
+ Each installation records the version of its bundle and a digest of the bundle
1552
+ files. `hcm update` reads the source, and compares both values:
1553
+
1554
+ ```
1555
+ review-kit v1.2.0 (up to date) [source]
1556
+ from https://dev.azure.com/acme/platform/_git/agent-kits#HEAD:bundles/review-kit
1557
+ up to date in copilot (project); nothing to do
1558
+ ```
1559
+
1560
+ - If the version and the files are the same, hcm does not change the installation.
1561
+ - If the version is different, hcm installs the new version.
1562
+ - If the files changed and the version did not, hcm also installs them. A branch can change without a new version.
1563
+ - If the run changes a setting, hcm installs again. The settings are `--flavor`, `--param`, `--params-file`, `--reconfigure`, `--pi-subagents`, `--track` and `--from`.
1564
+ - A record from an hcm without digests has no digest. The next update installs it one time, and records the digest.
1565
+ - To install again with no change, use `--reinstall`. For example, use it to put back an installed file that somebody deleted.
1566
+
1567
+ hcm must read the source to know its version. Thus an update of a remote
1568
+ bundle still downloads the files of the ref, also when the result is "up to
1569
+ date".
1570
+
1542
1571
  ### Follow the registry or the source
1543
1572
 
1544
1573
  Software that ships a bundle is installed in one of two ways, and each way needs
@@ -1594,6 +1623,40 @@ Rules:
1594
1623
  - If the source is gone, `hcm update` reports it, updates the other bundles, and exits with code 1. To point the installation at the new place, use `--from`.
1595
1624
  - The built-in `hcm` bundle always has the version of the hcm that runs. It cannot follow a source.
1596
1625
 
1626
+ ### Install from a repository into one project: `--source`
1627
+
1628
+ A team can keep its bundles in one repository, and install them into each
1629
+ project directly from there. Then no machine needs a registry entry:
1630
+
1631
+ ```bash
1632
+ hcm install review-kit --source https://dev.azure.com/acme/platform/_git/agent-kits -t copilot
1633
+ hcm install review-kit db-kit --source acme/agent-kits --ref v2.0.0 -t claude-code
1634
+ hcm install --source https://gitlab.com/acme/agent-kits.git -t copilot # each bundle of the repository
1635
+ ```
1636
+
1637
+ Later, in the same project:
1638
+
1639
+ ```bash
1640
+ hcm update -t copilot --no-prompt
1641
+ ```
1642
+
1643
+ - `--source` takes each form that `hcm install` takes: a GitHub `owner/repo`, a GitHub URL, the [clone URL of any git host](#other-git-hosts-azure-devops-bitbucket-gitlab), an SSH URL, or a folder.
1644
+ - `--ref` names a branch, a tag or a commit. Without it, hcm reads the ref of the source, or else the default branch. Do not give two different refs.
1645
+ - hcm finds each bundle by the `name` field of its `hcm.yaml`. The bundle can be in any folder of the repository, as for a [requirements file](#a-project-requirements-file-hcm-requirementstxt).
1646
+ - If a name is wrong, hcm reports each wrong name, and installs nothing.
1647
+ - Without a bundle name, hcm installs each bundle of the source.
1648
+ - hcm records the folder of each bundle, with its ref, in `.hcm/state.json`. The installation follows that source, as with `--track source`. The registry does not change.
1649
+ - `hcm update` downloads the recorded ref again. If the bundle has a new version or new files, hcm installs it. Else it reports "up to date". See [Up to date](#up-to-date-no-rollback-no-install).
1650
+ - A branch gives its latest commit on each update. A tag stays on the same commit.
1651
+ - To move to a new tag, run `hcm update <bundle> --ref <new-tag>`. hcm reads the same folder of the same repository at that ref, installs it, and follows that ref from then on.
1652
+ - Do not run `hcm install` again to change the ref. An install does not remove the items that the new version dropped. `hcm update` removes them.
1653
+ - For a private repository, set a [token](#private-repositories).
1654
+ - Commit `.hcm/state.json` with the project. Then a teammate runs `hcm update`, and gets the same source.
1655
+
1656
+ To list several bundles and their sources in one file, use a
1657
+ [requirements file](#a-project-requirements-file-hcm-requirementstxt). A line
1658
+ `review-kit @ <url>@<ref>` has the same effect as `--source` and `--ref`.
1659
+
1597
1660
  ### Removing
1598
1661
 
1599
1662
  ```bash
@@ -1768,6 +1831,71 @@ their source on next use, so a relocated store repopulates itself. A bundle
1768
1831
  registered with `--dev` is never in the store at all — it is read from your
1769
1832
  working directory.
1770
1833
 
1834
+ ### A project requirements file: `hcm-requirements.txt`
1835
+
1836
+ A requirements file lists the bundles that one project uses. Put it in the
1837
+ project, and commit it. Then each person who has hcm installs the same bundles
1838
+ into that project:
1839
+
1840
+ ```bash
1841
+ hcm install -r # reads hcm-requirements.txt
1842
+ hcm install -r tools/agents.txt -t claude-code --no-prompt
1843
+ ```
1844
+
1845
+ The syntax follows the direct references of pip's `requirements.txt`. Each line
1846
+ is `<bundle> @ <source> [options]`, or `<bundle>` alone:
1847
+
1848
+ ```
1849
+ # hcm-requirements.txt
1850
+ my-bundle-1 @ https://github.com/fleskovar/agent_assets.git@branch_a
1851
+ my-bundle-3 @ https://github.com/fleskovar/agent_assets.git@branch_b
1852
+ my-bundle-4 @ git+ssh://git@github.com:fleskovar/agent_assets.git@branch_c --flavor python
1853
+ ado-kit @ https://dev.azure.com/org/project/_git/kits@v1.2.0
1854
+ ado-ssh-kit @ git@ssh.dev.azure.com:v3/org/project/kits@main
1855
+ docs-kit @ ./agents # a folder, from the folder of this file
1856
+ my-bundle-5 # no source: the bundle registered on this machine
1857
+ ```
1858
+
1859
+ - The name selects one bundle. A repository can hold many bundles, and hcm installs only the bundles that the file names. Above, the file does not name `my-bundle-2`, so hcm does not install it.
1860
+ - hcm finds the bundle by the `name` of its manifest. It searches the repository root, its subfolders, and deeper folders. You do not give the folder of the bundle.
1861
+ - If two bundles in the source have the same name, add `#subdirectory=<folder>` to the source, as in pip.
1862
+ - The ref follows the last `@` of the URL. It is a branch, a tag or a full commit id. Without a ref, hcm reads the default branch. An `@` before the host is a user name, not a ref.
1863
+ - A line with no source installs the bundle that is registered on this machine with that name. If no bundle has that name, hcm reports the line and installs nothing.
1864
+ - `#` starts a comment, at the start of a line or after a space.
1865
+
1866
+ The sources:
1867
+
1868
+ | Source | Download |
1869
+ | --- | --- |
1870
+ | `https://github.com/owner/repo.git[@ref]` | The GitHub archive. Public repositories only |
1871
+ | `git+https://github.com/owner/repo.git[@ref]` | The git protocol over HTTPS. A private repository needs `HCM_GIT_TOKEN` |
1872
+ | `https://dev.azure.com/org/project/_git/repo[@ref]`, or any other HTTPS clone URL | The git protocol over HTTPS. A private repository needs a [token](#private-repositories) |
1873
+ | `git+ssh://git@host/path[@ref]`, `ssh://...`, `git@host:path[@ref]` | The `git` program, with your SSH keys |
1874
+ | `./folder`, `../folder`, an absolute path, `file:///...` | Read in place. A relative path starts in the folder of the requirements file |
1875
+
1876
+ The options of a line apply to that bundle only. They replace the same option
1877
+ of the command line:
1878
+
1879
+ | Option | Meaning |
1880
+ | --- | --- |
1881
+ | `--flavor <flavor...>`, `-f` | Install the common part and these flavors |
1882
+ | `--target <harness...>`, `-t` | Install into these harnesses |
1883
+ | `--param NAME=value` | Set a parameter of this bundle. Repeat it for more parameters. Put a value that has spaces in quotes |
1884
+
1885
+ How the install works:
1886
+
1887
+ 1. hcm reads all lines, downloads each source, and finds each bundle. A repository that several lines use is downloaded one time.
1888
+ 2. If a line has an error, hcm reports all errors with their line numbers, and installs nothing.
1889
+ 3. hcm installs the bundles in the order of the file. One set of answers applies to the whole file: a question about a conflict or a parameter comes one time.
1890
+
1891
+ - A line with a source records that source, with its ref, in `.hcm/state.json`. `hcm update` then reads the same branch or tag. It does not read the registry.
1892
+ - Each run downloads the sources again, so a branch gives its latest commit. To change the version, change the ref in the file and run `hcm install -r` again.
1893
+ - `hcm install -r` does not remove a bundle that you deleted from the file. Remove it with `hcm uninstall <bundle>`.
1894
+
1895
+ `bundles.txt`, below, is a different file. It registers bundles on a machine.
1896
+ A requirements file installs bundles into one project, and does not change the
1897
+ registry.
1898
+
1771
1899
  ### Sharing a setup: `bundles.txt`
1772
1900
 
1773
1901
  `hcm export` writes the bundles you have as a plain list, one reference per
@@ -7,7 +7,7 @@ from the registry.
7
7
  | Resource | Flavor | Use |
8
8
  | --- | --- | --- |
9
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. |
10
+ | `skills/hcm-usage/` | common | Find, install, update and remove bundles. Write and install the requirements file of a project, `hcm-requirements.txt`. Manage the registry, and the named collections in it. |
11
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
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
13
 
@@ -7,6 +7,7 @@ harness folders, for example `.claude/`, `.github/` and `.pi/`.
7
7
  - Do not edit a file that hcm installed. Change the bundle that supplies it, then run `hcm update <bundle>`.
8
8
  - An edit to an installed file stops `hcm update` and `hcm uninstall` for that bundle.
9
9
  - Some bundles come from a dependency of this project, for example from `.venv/` or `node_modules/`. `hcm list` shows them in the "Local bundles" section, and `hcm list --installed` marks them `[source]`. After an upgrade of the dependency, run `hcm update`.
10
+ - If the project has an `hcm-requirements.txt` file, it lists the bundles of the project. To add, upgrade or remove a bundle, change that file. Then run `hcm install -r`.
10
11
  - To see the files that hcm installed, and the files that changed after the install, run `hcm status`.
11
12
  - hcm keeps its sections of this file between `hcm:begin` and `hcm:end` comments. Keep these comments when you edit this file.
12
13
  - If an hcm section is missing from this file, run `hcm context append`.
@@ -1,5 +1,5 @@
1
1
  name: hcm
2
- version: 0.1.5
2
+ version: 0.1.7
3
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
4
  author: harness-config-manager
5
5
  homepage: https://github.com/fleskovar/harness_config_manager
@@ -41,6 +41,7 @@ folder name is the resource name.
41
41
  7. Preview the result: `hcm info my-kit`. The output shows the destination of each item in each harness.
42
42
  8. Test the bundle in an empty folder. See [Test a bundle](#test-a-bundle).
43
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
+ 10. Tell users the line for the requirements file of their projects. See [Tell users how to require the bundle](#tell-users-how-to-require-the-bundle).
44
45
 
45
46
  ## Rules for content
46
47
 
@@ -113,6 +114,30 @@ Read [the collections guide](./collections.md) for these tasks:
113
114
  - Choose a collection name, and decide on the `bundles` list.
114
115
  - Resolve a collection name clash.
115
116
 
117
+ ## Tell users how to require the bundle
118
+
119
+ A project can list its bundles in an `hcm-requirements.txt` file. Then each
120
+ person who works on the project gets the same bundles with `hcm install -r`.
121
+ Give your users the line for your bundle in your README:
122
+
123
+ ```
124
+ my-kit @ https://github.com/acme/agent-kits.git@v1.0.0
125
+ my-kit @ git+ssh://git@github.com:acme/agent-kits.git@v1.0.0 # private, over SSH
126
+ my-kit @ https://dev.azure.com/acme/platform/_git/agent-kits@v1.0.0 # Azure DevOps
127
+ ```
128
+
129
+ - The first word is the `name` in `hcm.yaml`, not the folder name.
130
+ - Give the clone URL of the repository. Users do not give the folder of the bundle. hcm finds the bundle by its name.
131
+ - Put the tag of the release after the last `@`. A tag gives each person the same version.
132
+ - If the bundle has flavors, show the option: `--flavor <flavor>`.
133
+ - If a required parameter has no default, show the option: `--param NAME=value`.
134
+ - Do not change the `name` of a published bundle. The requirements files of your users use it.
135
+
136
+ To test the line, write it in `hcm-requirements.txt` in an empty folder. Then
137
+ run `hcm install -r -t claude-code --no-prompt --dry-run`.
138
+
139
+ The full syntax is in the requirements file guide of the `hcm-usage` skill.
140
+
116
141
  ## Ship a bundle with your software
117
142
 
118
143
  To ship the bundle with a CLI tool, with a library, or as a separate download,
@@ -71,6 +71,24 @@ Each path in the list is relative to the collection root, and must stay inside
71
71
  it. Each listed folder must contain an `hcm.yaml`. hcm reads only the listed
72
72
  folders.
73
73
 
74
+ ## Collections in a requirements file
75
+
76
+ A project can name one bundle of your collection in its `hcm-requirements.txt`
77
+ file:
78
+
79
+ ```
80
+ review-kit @ https://github.com/acme/agent-kits.git@v2.0.0
81
+ ```
82
+
83
+ hcm downloads the repository and finds the bundle by its `name`. It does not
84
+ read the `bundles` list for this search. It searches each folder of the
85
+ repository, to a depth of four folders. Thus:
86
+
87
+ - Give each bundle in the repository a different `name`. This includes test data and examples. If two folders have the same name, the line of the user fails.
88
+ - Keep each bundle in the first four folder levels of the repository.
89
+ - If a repository must keep two bundles with the same name, tell users to add `#subdirectory=<folder>` to the URL.
90
+ - Tag the repository for each release. One tag then gives a version of each bundle in it.
91
+
74
92
  ## Dependencies between bundles of a collection
75
93
 
76
94
  hcm finds a dependency in a folder beside the bundle that requires it. Thus:
@@ -45,7 +45,7 @@ hcm install my-lib -t claude-code
45
45
 
46
46
  - The form is `<clone-url>#<ref>:<folder>`. Without a ref, hcm reads the default branch: `<clone-url>#:hcm-bundle`.
47
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.
48
+ - An SSH URL works too, for example `git@ssh.dev.azure.com:v3/org/project/repo#v1.2.0:hcm-bundle`. hcm then runs git, which uses the SSH keys of the user. The machine must have git.
49
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
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
51
 
@@ -142,6 +142,18 @@ hcm install owner/repo/hcm-bundle#v1.2.0 --track source -t claude-code --no-prom
142
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
143
  - Other projects of the user can pin other releases.
144
144
 
145
+ A project can also list the bundle in its requirements file,
146
+ `hcm-requirements.txt`. Commit the file with the project:
147
+
148
+ ```
149
+ # hcm-requirements.txt
150
+ my-lib @ https://github.com/owner/repo.git@v1.2.0
151
+ ```
152
+
153
+ Each developer then runs `hcm install -r -t <harness> --no-prompt`. hcm finds
154
+ the bundle `my-lib` in the repository, and the installation follows the tag
155
+ `v1.2.0`. To upgrade, change the tag in the file and run the command again.
156
+
145
157
  A team can also record the bundle version in a `bundles.txt` file. This
146
158
  registers the bundle, so all projects of the user share one version. Put the
147
159
  reference in the file and commit it:
@@ -1,5 +1,5 @@
1
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.
2
+ description: Install, update and remove hcm bundles in a project or for the user, and check the result. Also write, change and install the requirements file of a project, hcm-requirements.txt, that lists the bundles of the project with their sources. 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
3
  ---
4
4
 
5
5
  # Use hcm
@@ -17,7 +17,8 @@ exact options of the installed version, run `hcm <command> --help`.
17
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
18
  2. Run `hcm targets`. The output shows the harnesses that this folder uses, and the files that two harnesses share.
19
19
  3. Run `hcm list`. The output shows the bundles that you can install, with their ids. A `●` marks a bundle that is installed in this project. The "Local bundles" section shows the bundles that come from a dependency of this project, not from the registry. For sources, flavors and parameters, add `--verbose`.
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. To find the bundle that wrote a file, run `hcm list --analysis`.
20
+ 4. Look for an `hcm-requirements.txt` file in the project root. If it is there, the project lists its bundles in it. Read [the requirements file guide](./requirements.md) before you install or change bundles.
21
+ 5. 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. To find the bundle that wrote a file, run `hcm list --analysis`.
21
22
 
22
23
  The npm package name is `harness-config-manager`. The npm package `hcm` is a
23
24
  different program.
@@ -60,6 +61,33 @@ install for all projects of the user.
60
61
  To install part of a bundle, give `--flavor <name...>`. `hcm info <bundle>`
61
62
  lists the flavors of a bundle.
62
63
 
64
+ ## The requirements file of a project
65
+
66
+ A project can list its bundles in `hcm-requirements.txt`, and commit the file.
67
+ Each person who works on the project then installs the same bundles:
68
+
69
+ ```bash
70
+ hcm install -r -t <harness> --no-prompt --dry-run # preview
71
+ hcm install -r -t <harness> --no-prompt # install
72
+ ```
73
+
74
+ Each line is `<bundle> @ <source>[@ref] [options]`, or `<bundle>` alone for a
75
+ registered bundle:
76
+
77
+ ```
78
+ review-kit @ https://github.com/acme/agent-kits.git@v2.0.0
79
+ db-kit @ https://dev.azure.com/acme/platform/_git/kits@v1.4.0
80
+ py-kit @ git+ssh://git@github.com:acme/agent-kits.git@main --flavor python
81
+ team-kit
82
+ ```
83
+
84
+ - A source can hold many bundles. hcm installs only the bundles that the file names.
85
+ - If a line has an error, hcm installs nothing.
86
+ - When the project uses a requirements file, change the file to add, upgrade or change a bundle. Do not install the bundle with `hcm install <bundle>` only. The next person does not get it.
87
+
88
+ The syntax, the procedure to write a file, and the errors are in
89
+ [the requirements file guide](./requirements.md).
90
+
63
91
  ## Register a bundle
64
92
 
65
93
  Register a bundle to install it by name or id:
@@ -85,6 +113,9 @@ the latest edits.
85
113
  | Install the new version of one bundle | `hcm update <bundle> -t <harness> --no-prompt` |
86
114
  | Install the new version from the recorded sources, with no change to the registry | `hcm update --no-registry -t <harness> --no-prompt` |
87
115
  | Install a bundle that must follow its own folder, for example a library in `.venv/` | `hcm install <folder> --track source -t <harness> --no-prompt` |
116
+ | Install a bundle from a team repository into this project only, with no registry entry | `hcm install <bundle> --source <repository-url> [--ref <ref>] -t <harness> --no-prompt` |
117
+ | Move a bundle from `--source` to a new tag or branch | `hcm update <bundle> --ref <ref> -t <harness> --no-prompt` |
118
+ | Install an up-to-date bundle again, for example to put back a deleted file | `hcm update <bundle> --reinstall -t <harness> --no-prompt` |
88
119
  | Point an installation at a new folder, for example after the `.venv/` moved | `hcm update <bundle> --from <folder> -t <harness> --no-prompt` |
89
120
  | Make an installation follow the registry again | `hcm update <bundle> --track registry -t <harness> --no-prompt` |
90
121
  | Remove a bundle, and the dependencies that no other bundle needs | `hcm uninstall <bundle> -t <harness>` |
@@ -95,7 +126,8 @@ Each installation follows the registry or its source. `hcm update` reads the
95
126
  next version from there:
96
127
 
97
128
  - 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.
129
+ - An installation made with `--track source` or `--source` follows its folder or repository. `hcm update` does not read the registry for it. Libraries and team repositories use this mode, because each project can pin another version.
130
+ - `hcm update` reads each source. If the source has the same version and the same files, hcm reports "up to date", and does not change the installation.
99
131
  - 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
132
  - `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
133
 
@@ -229,6 +261,7 @@ and remove the hcm sections. hcm keeps a copy of each section in
229
261
 
230
262
  ## Share a setup
231
263
 
264
+ - To give each person of a project the same bundles, write `hcm-requirements.txt`. See [The requirements file of a project](#the-requirements-file-of-a-project).
232
265
  - `hcm export` writes the installed bundles to `bundles.txt`.
233
266
  - `hcm import bundles.txt --install -t <harness> --no-prompt` registers and installs them on another machine.
234
267
  - `hcm params init` writes the parameter values of this project to `params.yaml`. Give that file back with `--params-file params.yaml`.
@@ -23,8 +23,9 @@ options.
23
23
 
24
24
  | Command | What it does |
25
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. |
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. `--source <repo> [--ref <ref>]` finds the named bundles in a repository or folder, and follows that source. With no name, it installs each bundle of the source. |
27
+ | `hcm install -r [file]` | Install each bundle of the requirements file of the project. The default file is `hcm-requirements.txt`. Each line is `<bundle> @ <url>[@ref] [--flavor ...] [--target ...] [--param N=v]`, or `<bundle>` for a registered bundle. The URL is HTTPS or SSH, of any git host. See [the requirements file guide](./requirements.md). |
28
+ | `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. `--ref <ref>` reads the recorded repository of the named bundles at another branch, tag or commit, and follows that ref. An installation is up to date when its source has the same version and the same files: hcm then does not change it. `--reinstall` installs it again anyway. |
28
29
  | `hcm uninstall <bundle...>` | Remove exactly what hcm installed. Also `--cascade`, `--ignore-dependents`, `--keep-orphans`. |
29
30
 
30
31
  ## Inspect
@@ -66,6 +67,7 @@ options.
66
67
  | `hcm export [file]` | Write the installed bundles, or the registry with `--registry`, to `bundles.txt`. |
67
68
  | `hcm import [file]` | Register the bundles in a bundles file. `--install` installs them too. |
68
69
  | `hcm config` | Show the settings. `config set\|get\|unset` changes them. |
70
+ | `hcm upgrade` | Install the latest version of hcm from npm. `--check` only shows if a new version is available. |
69
71
 
70
72
  ## Environment variables
71
73
 
@@ -0,0 +1,182 @@
1
+ # The project requirements file
2
+
3
+ A requirements file lists the bundles that one project uses. The file is part
4
+ of the project, and goes into version control with it. Each person who has hcm
5
+ then installs the same bundles with one command.
6
+
7
+ The default file name is `hcm-requirements.txt`, in the project root. The
8
+ syntax follows the direct references of the `requirements.txt` file of pip.
9
+
10
+ ```
11
+ # hcm-requirements.txt
12
+ review-kit @ https://github.com/acme/agent-kits.git@v2.0.0
13
+ db-kit @ https://dev.azure.com/acme/platform/_git/kits@v1.4.0
14
+ py-kit @ git+ssh://git@github.com:acme/agent-kits.git@main --flavor python
15
+ docs-kit @ ./agents
16
+ team-kit
17
+ ```
18
+
19
+ ## Choose the correct file
20
+
21
+ | File | Use it when | Command |
22
+ | --- | --- | --- |
23
+ | `hcm-requirements.txt` | The bundles belong to one project. Each person who works on the project must get them. | `hcm install -r` |
24
+ | `bundles.txt` | One user wants the same registry on another machine. | `hcm import bundles.txt --install` |
25
+ | No file | One project pins one bundle, and nobody else installs it. | `hcm install <bundle> --source <repository> [--ref <ref>]` |
26
+
27
+ A requirements file does not change the registry. It installs into the project
28
+ only.
29
+
30
+ ## Install the bundles of a project
31
+
32
+ Do these steps when a project has an `hcm-requirements.txt` file, or when the
33
+ user asks you to install the bundles of the project.
34
+
35
+ 1. Read the file. Find the lines with no source. Each of them needs a registered bundle of that name. Run `hcm registry list` to make sure that the bundle is there.
36
+ 2. Preview the install: `hcm install -r -t <harness> --no-prompt --dry-run`.
37
+ 3. Read the plan. If hcm reports errors, see [When the install fails](#when-the-install-fails).
38
+ 4. Install: `hcm install -r -t <harness> --no-prompt`.
39
+ 5. Check the result: `hcm status`.
40
+
41
+ For a file with a different name or in a different folder, give its path:
42
+ `hcm install -r tools/agents.txt -t <harness> --no-prompt`.
43
+
44
+ Rules:
45
+
46
+ - Do not give bundle names and `-r` in one command. hcm refuses the command.
47
+ - Do not give `--track`. A line with a source follows that source. A line with no source follows the registry.
48
+ - The command-line options apply to each line. An option on a line replaces the same command-line option for that bundle.
49
+ - hcm reads all lines and downloads all sources first. If one line has an error, hcm installs nothing.
50
+ - One set of answers applies to the whole file. A conflict question or a parameter question comes one time only.
51
+ - Each run downloads the sources again. A line with a branch then gets the latest commit of the branch.
52
+ - You can run the command again at any time. A bundle that did not change installs the same items again.
53
+
54
+ ### Private repositories
55
+
56
+ | Source | What the user must do |
57
+ | --- | --- |
58
+ | HTTPS URL of a host other than github.com | Set an access token in `HCM_GIT_TOKEN`, or in `HCM_GIT_TOKEN_<HOST>`, for example `HCM_GIT_TOKEN_DEV_AZURE_COM`. |
59
+ | `git+https://github.com/...` | Set a GitHub token in `HCM_GIT_TOKEN`, or in `HCM_GIT_TOKEN_GITHUB_COM`. |
60
+ | `https://github.com/...` with no `git+` | Nothing is possible. This form reads only public repositories. Change the line to `git+https://` or `git+ssh://`. |
61
+ | SSH URL | Install git. Make sure that `git ls-remote <url>` works in the terminal of the user. |
62
+
63
+ Do not put a token in the file. hcm refuses a URL that contains a password.
64
+ Ask the user to set the variable. Do not set it yourself.
65
+
66
+ ## Write a requirements file
67
+
68
+ Do these steps when the user asks you to make the project install the same
69
+ bundles for each person.
70
+
71
+ 1. For each bundle, find its source: the repository, or the folder in the project.
72
+ 2. Find the bundle name. It is the `name` in the `hcm.yaml` of the bundle, not the folder name. To list the names of the bundles in a source, see [Find the bundle names](#find-the-bundle-names).
73
+ 3. Choose a ref for each remote source. See [Choose the ref](#choose-the-ref).
74
+ 4. Write one line for each bundle. Do not write a line for a bundle that the project does not use.
75
+ 5. Add `--flavor`, `--target` or `--param` to a line only when that bundle needs it.
76
+ 6. Save the file as `hcm-requirements.txt` in the project root.
77
+ 7. Preview: `hcm install -r -t <harness> --no-prompt --dry-run`. Fix each error that hcm reports.
78
+ 8. Tell the user to commit the file. Also tell the user about the tokens or SSH access that each person needs.
79
+
80
+ To make a file from the bundles that are already installed, run
81
+ `hcm list --installed --json`. Each record has the `bundle`, its `source` and
82
+ its `flavors`. Write one line for each bundle. Do not write a line for a record
83
+ with `"auto": true`. hcm installed that bundle only because another bundle
84
+ requires it.
85
+
86
+ ### The line
87
+
88
+ ```
89
+ <bundle> @ <source>[@ref][#subdirectory=<folder>] [options] # comment
90
+ <bundle> [options] # comment
91
+ ```
92
+
93
+ - `<bundle>` is the name in the manifest of the bundle. Use letters, digits, dots, dashes and underscores.
94
+ - Spaces around the `@` are optional.
95
+ - A line with no source installs the registered bundle of that name.
96
+ - `#` starts a comment, at the start of a line or after a space. A `#` in a URL is not a comment.
97
+ - Put a value that contains spaces in quotes: `--param TEAM="Platform team"`.
98
+ - Each bundle name can occur on one line only.
99
+
100
+ ### The source
101
+
102
+ | Source | Example | hcm downloads it with |
103
+ | --- | --- | --- |
104
+ | GitHub, HTTPS | `https://github.com/acme/kits.git@v1.0.0` | The GitHub archive. Public repositories only. |
105
+ | GitHub, git protocol | `git+https://github.com/acme/kits.git@v1.0.0` | The git protocol over HTTPS. |
106
+ | Azure DevOps, HTTPS | `https://dev.azure.com/acme/platform/_git/kits@v1.0.0` | The git protocol over HTTPS. |
107
+ | Other git host, HTTPS | `https://gitlab.com/acme/kits.git@v1.0.0` | The git protocol over HTTPS. |
108
+ | SSH, URL form | `git+ssh://git@github.com/acme/kits.git@main` | The `git` program, with the SSH keys of the user. |
109
+ | SSH, scp-like form | `git@ssh.dev.azure.com:v3/acme/platform/kits@main` | The `git` program, with the SSH keys of the user. |
110
+ | A folder | `./agents`, `../shared/kits`, `/opt/kits`, `file:///opt/kits` | Nothing. hcm reads the folder in place. |
111
+
112
+ - A relative folder starts in the folder of the requirements file, not in the current folder.
113
+ - A source can hold many bundles. hcm installs only the bundle that the line names.
114
+ - hcm finds the bundle by its name. It searches the root of the source and the folders below it, to a depth of four folders.
115
+ - If the source has two bundles with the same name, add `#subdirectory=<folder>` to the source. The folder is relative to the root of the repository.
116
+ - Use an HTTPS URL when the users have tokens and possibly no git. Use an SSH URL when the users have SSH keys for the host.
117
+
118
+ ### Choose the ref
119
+
120
+ The ref follows the last `@` of the URL. An `@` before the host is a user name,
121
+ not a ref: `https://acme@dev.azure.com/...` and `git@github.com:...`.
122
+
123
+ | Ref | Example | Result |
124
+ | --- | --- | --- |
125
+ | A tag | `@v1.2.0` | Each person gets the same version. Use a tag when you can. |
126
+ | A full commit id | `@3f2a9c1e...` (40 characters) | Each person gets the same version, also when somebody moves a tag. |
127
+ | A branch | `@main`, `@release/2` | Each run gets the latest commit of the branch. Two people can get different versions. |
128
+ | No ref | | The default branch, with the same result as a branch. |
129
+
130
+ A folder source has no ref. It gives the files that are in the folder now.
131
+
132
+ ### The options of a line
133
+
134
+ | Option | Meaning |
135
+ | --- | --- |
136
+ | `--flavor <flavor...>`, `-f <flavor...>` | Install the common part of the bundle and these flavors. To see the flavors, run `hcm info <bundle>`. |
137
+ | `--target <harness...>`, `-t <harness...>` | Install this bundle into these harnesses only. |
138
+ | `--param NAME=value` | Set a parameter of this bundle. Give the option one time for each parameter. hcm applies it to this bundle only, not to its dependencies. |
139
+
140
+ `--flavor` and `--target` take all values until the next option. Put a
141
+ comment after the options, not between them.
142
+
143
+ ### Find the bundle names
144
+
145
+ Use one of these methods:
146
+
147
+ - Read the `hcm.yaml` of each bundle in the repository, and find the `name`.
148
+ - Run `hcm info <source>`. For a collection, the output shows each bundle.
149
+ - Write a line with a name that you think is correct, and run `hcm install -r --dry-run`. If the name is not correct, hcm lists the names of the bundles in that source: `Bundles there: alpha, beta`.
150
+
151
+ ## Change the file
152
+
153
+ | Task | Do this |
154
+ | --- | --- |
155
+ | Use a new version of a bundle | Change the ref on its line. Run `hcm install -r -t <harness> --no-prompt`. |
156
+ | Add a bundle | Add a line. Run `hcm install -r -t <harness> --no-prompt`. |
157
+ | Change the flavors of a bundle | Change `--flavor` on its line. Run `hcm install -r -t <harness> --no-prompt`. hcm removes the items of the old flavors. |
158
+ | Remove a bundle | Delete its line. Then run `hcm uninstall <bundle> -t <harness>`. hcm does not remove a bundle only because its line is gone. |
159
+ | Get the latest commits of the branches | Run `hcm install -r -t <harness> --no-prompt` again. `hcm update -t <harness> --no-prompt` also reads the recorded branch of each bundle. |
160
+
161
+ After a change, preview with `--dry-run` first. Then tell the user to commit
162
+ the file.
163
+
164
+ ## When the install fails
165
+
166
+ hcm reports each error with the line number. Fix all of them, then run the
167
+ command again.
168
+
169
+ | hcm reports | Cause | Do this |
170
+ | --- | --- | --- |
171
+ | `No such file: .../hcm-requirements.txt` | The file is not in the current folder. | Run the command in the project root, or give the path after `-r`. |
172
+ | `"<name>" is also on line <n>` | Two lines name the same bundle. | Delete one of the lines. |
173
+ | `"<option>" is not an option of a requirements line` | The line has an option that a requirements file does not take. | Use only `--flavor`, `--target` and `--param` on a line. Give the other options on the command line. |
174
+ | `"#..." is not a fragment that hcm reads` | The URL has a `#ref:folder` fragment, which is the form of `hcm registry add`. | Put the ref after `@`. Put the folder in `#subdirectory=<folder>`. |
175
+ | `There is no bundle "<name>" in <source>` | No manifest in the source has that name. | Use a name from the `Bundles there:` list. If the bundle is more than four folders deep, add `#subdirectory=<folder>`. |
176
+ | `<source> has <n> bundles named "<name>"` | The name is not unique in the source. | Add `#subdirectory=<folder>` with one of the folders that hcm lists. |
177
+ | `gives no source, and no bundle of that name is registered` | The line has no source, and the registry of this machine does not have the bundle. | Ask the user for the source. Add it to the line, or register the bundle with `hcm registry add`. |
178
+ | `git could not read <url> at <ref>` | The SSH access failed, or the ref does not exist. | Ask the user to run `git ls-remote <url>`. If that works, check the ref. |
179
+ | `An SSH or git:// URL needs the git program` | Git is not installed, or it is not on the PATH. | Ask the user to install git, or change the line to an HTTPS URL. |
180
+ | An HTTP status, or a message about a token | The repository is private, and no token is set. | See [Private repositories](#private-repositories). |
181
+ | `Give bundle names or -r, not both` | The command has bundle names and `-r`. | Run two commands. |
182
+ | `--track does not apply to -r` | The command has `--track`. | Remove `--track`. |