@harnesspm/cli 0.0.0-snapshot.412a718 → 0.0.0-snapshot.5e392dd

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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  **In short**
4
4
 
5
+ - Every task starts with one command, `npx -y @harnesspm/cli`. In a project it prints the project's report; elsewhere, what the folder is and the task for it, each with the one command that starts it. Every command's output names the next step ([below](#where-every-task-starts)).
5
6
  - Projects use `init`, `sync`, `status`, `doctor`, `why`, `approve` and `run`. Jobs that do not install dependencies use `fetch`.
6
7
  - From outside a project, such as a repository that cloned it, add `-C <dir>` before the command. `help` lists the project's packages, and `help <package>` prints one in full.
7
8
  - `help <tool>` prints a tool's usage, its answer exit codes and its run command, without running it.
@@ -12,23 +13,52 @@
12
13
 
13
14
  The npm package is `@harnesspm/cli`, and the command it installs is `harnesspm`. `npx -y @harnesspm/cli …` works everywhere: in a project that depends on it, npx runs the installed version, and elsewhere it downloads the package by its full name. Every text, message, block and hook that harnesspm writes uses this one form ([4.6](04-outputs.md#46-managed-blocks)). It never writes the bare `npx harnesspm …`: that works only in a project that depends on harnesspm, and elsewhere npx would fetch whatever is published under the unscoped name, without asking in a hook. An allow rule always has the prefix of the command it allows.
14
15
 
15
- `harnesspm help` lists every command, and `harnesspm <command> --help` shows one. Inside a project, or with `-C`, `help` also lists the project's packages ([below](#the-project-in-help)), and `help <package | rule ID | tool>` prints one of them in full ([below](#help-for-a-package-a-rule-or-a-tool)). A message that names a step for a person, such as trusting a package or approving a version, says that a person takes it. An agent reads every message too, and must not take that step as its own.
16
+ `npx -y @harnesspm/cli --help` lists every command, and `<command> --help` shows one. Inside a project, or with `-C`, `help` lists the project's packages ([below](#the-project-in-help)) and points at `--help`; elsewhere it lists every command. `help <package | rule ID | tool>` prints one of them in full ([below](#help-for-a-package-a-rule-or-a-tool)). A message that names a step for a person, such as trusting a package or approving what an agent could not grant, says that a person takes it, and names `approve` for every step that a person's run of harnesspm takes. An agent reads every message too, and must not take that step as its own.
17
+
18
+ ### Where every task starts
19
+
20
+ `npx -y @harnesspm/cli`, without a command, is where every task starts. The site shows this command, and the CLI, versioned with the package, holds the steps. In a project that uses harnesspm (a `harnesspm.json` in the folder or above it), it prints the project's report ([10.5](#105-the-report)). Elsewhere it writes nothing and prints at most 12 lines: harnesspm's version, what the folder is, its tasks with the likeliest first, each with the one command that starts it, who decides what runs, and where every command and the docs are.
21
+
22
+ | The folder | What it says | Its tasks, in order |
23
+ | --- | --- | --- |
24
+ | A package that does not use harnesspm | Which dependencies ship a harness | `init`, `new rule usage`, `add <source>`, a harness of your own (`new rule workflow`) |
25
+ | A package with `harness/` | It shares a harness | `check`, `init` to see the harness as its users' agents will, `new <kind> <name>`, `add <source>` |
26
+ | A parent folder ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)) | The projects right below it | `sync`, `-C <project> help`, `add <source>` |
27
+ | A folder with `harness/` and no `package.json` | It is a harness, not a project | `check`, `new <kind> <name>`, `add <the folder>`, which a person runs |
28
+ | Any other folder | It is not a project | `new rule workflow`, `add <source>`, then `init` and `new rule usage` in a project or package |
29
+
30
+ ```text
31
+ $ npx -y @harnesspm/cli
32
+ harnesspm 0.17.0: rules, docs, skills and tools from npm packages, for Claude Code and Codex.
33
+ This folder (app) does not use harnesspm. 3 dependencies ship a harness: @acme/ui, @acme/colors, @acme/styles.
34
+
35
+ Pick the task, run its command, and follow what it prints:
36
+ Give this project's agents its dependencies' harness npx -y @harnesspm/cli init
37
+ Share a harness from this package npx -y @harnesspm/cli new rule usage
38
+ Add your own or your team's harness, on every repo npx -y @harnesspm/cli add <github:owner/repo | folder>
39
+ Start a harness of your own, in an empty folder npx -y @harnesspm/cli new rule workflow
40
+
41
+ A person decides what runs: they add a harness and trust a package. An agent asks first.
42
+ Every command: npx -y @harnesspm/cli --help · Docs: https://harnesspm.tenphi.me
43
+ ```
44
+
45
+ The command that a task starts with prints the next step in turn: `init` its report, `new` the steps for the folder (10.2), and an error the command that fixes it. One module, `src/start.ts`, holds these texts.
16
46
 
17
47
  ## 10.1 Projects
18
48
 
19
49
  | Command | What it does |
20
50
  | --- | --- |
21
- | `harnesspm init` | Creates `harnesspm.json`, adds the [install hook](#the-install-hook) to the `postinstall` script of a private package or to `prepare` otherwise, makes `CLAUDE.md` import `AGENTS.md`, then runs `harnesspm sync` and names the committed files ([1.7](01-overview.md#17-what-is-committed)) that git sees as new or changed. It MUST stop before it changes anything when the project's `package.json` does not list `@harnesspm/cli` in `dependencies`, `devDependencies` or `optionalDependencies`: the script it adds calls the `harnesspm` command, so the next install would fail. |
22
- | `harnesspm sync` | Resolves the layers and writes all outputs. Runs on every install. In a repository that does not use harnesspm (it has no `harnesspm.json`), or whose dependencies are not installed, it writes only the per-machine outputs of added harnesses, so it never wipes the committed block. When an agent runs it, new allow rules, hooks and MCP servers stay pending outside the reviewed state, and the held-back line says what differs ([06-trust.md](06-trust.md#62-trusting-a-package)). With `CI=true`, it writes only the per-machine outputs and leaves the committed ones to `sync --check` ([06-trust.md](06-trust.md#64-ci)). In a parent folder, which is not in a git repository and has projects right below it, it writes their hooks and a pointer block for sessions that start there, and a project's sync keeps its entries there current. With added harnesses, it also writes their per-machine outputs in each git repository right below the folder ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)). |
51
+ | `harnesspm init` | Sets up the project, in this order. (1) When its `package.json` does not list `@harnesspm/cli` in `dependencies`, `devDependencies` or `optionalDependencies`, it installs the package as a dev dependency, at its own version or a later compatible one, with the project's package manager: the one of its lockfile, else of its `packageManager` field, else npm (`npm i -D`, `pnpm add -D`, `yarn add -D`, `bun add -d`; `-w` at a pnpm workspace root, `-W` at a Yarn 1 one). The script that `init` adds calls the `harnesspm` command, so the next install would fail without the package. (2) It creates `harnesspm.json`, adds the [install hook](#the-install-hook) to the `postinstall` script of a private package or to `prepare` otherwise, unless a Yarn plugin already runs harnesspm (point 7), makes `CLAUDE.md` import `AGENTS.md`, and adds `/.harnesspm/` to the `.gitignore` of the project folder when no `.gitignore` ignores that folder ([4.3](04-outputs.md#43-project-outputs), note 8). (3) It runs `harnesspm sync`. (4) It reports what it wrote, the tools of each package that is not trusted, with what each does and whether it runs without a prompt, the committed files ([1.7](01-overview.md#17-what-is-committed)) that git sees as new or changed, the check for CI, and what the agent does next. It MUST stop before it changes anything when the install fails, and when the project uses Yarn Plug'n'Play, which writes no `node_modules`. An agent's run installs too: the person asked for the setup. Trust and the entries that only a person grants stay with the person ([06-trust.md](06-trust.md#62-trusting-a-package)). |
52
+ | `harnesspm sync` | Resolves the layers and writes all outputs. Runs on every install. In a repository that does not use harnesspm (it has no `harnesspm.json`), or whose dependencies are not installed, it writes only the per-machine outputs of added harnesses, so it never wipes the committed block. When an agent runs it, new allow rules, hooks and MCP servers stay pending outside the reviewed state, and the line under "Waiting for a person" says what differs and names `approve` ([06-trust.md](06-trust.md#62-trusting-a-package)). With `CI=true`, it writes only the per-machine outputs and leaves the committed ones to `sync --check` ([06-trust.md](06-trust.md#64-ci)). In a parent folder, which is not in a git repository and has projects right below it, it writes their hooks and a pointer block for sessions that start there, and a project's sync keeps its entries there current. With added harnesses, it also writes their per-machine outputs in each git repository right below the folder ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)). |
23
53
  | `harnesspm sync --check` | Writes nothing and ignores added harnesses, as every run with `CI=true` does. Fails when a committed output or the lock is out of date. For CI. |
24
54
  | `harnesspm sync --write` | Writes the committed outputs with `CI=true` too, for a job that commits them. `init`, `approve` and `new` always write them. |
25
- | `harnesspm status` | Layers, packages, versions, pending trust, entries an agent's sync would hold back (the list `sync` prints), changes that added harnesses make to the repository's units, always-on size per agent, managed blocks that Codex does not reach ([4.9](04-outputs.md#49-size-limits)), and whether telemetry is on, held or off on this machine. Points to `doctor` when a per-machine file has a problem. |
26
- | `harnesspm doctor` | Checks that the repository is ready for harnesses, its own and a person's. It changes nothing. Each problem names the command that fixes it. Exits `1` when a check fails; warnings, such as pending trust, do not fail. See [10.5](#105-doctor). |
55
+ | `harnesspm status` | The project's report ([10.5](#105-the-report)): layers, packages and versions, changes that added harnesses make, always-on size per agent, telemetry, the checks that the repository is ready for harnesses, its own and a person's, and everything that waits for a person. The bare command prints it in a project. Exits `0`. |
56
+ | `harnesspm doctor` | The same report. Exits `1` when a check fails; what waits for a person does not fail. |
27
57
  | `harnesspm why <ID>` | Owner, source, repository and whether the unit is editable ([08-improving.md](08-improving.md#81-find-the-source)). Works for every unit ID ([2.8](02-package-format.md#28-unit-ids)), also for a unit of a project entry that does not apply here ([8.1](08-improving.md#81-find-the-source)). For a script, also the command that runs it; for a script, hook, MCP server or sub-agent of a dependency, whether its package is trusted. |
28
- | `harnesspm approve [<package>]` | Writes the entries that a model run left pending, and records a `"pin"` package's new version as approved in the lock. A person runs it, not an agent. |
58
+ | `harnesspm approve [<package>]` | The person's step. Writes the entries that a model run held back, and the tools of a package that a person just added to `trust`, then records a `"pin"` package's new version as approved in the lock. It syncs as a person's `sync` does. A person runs it, not an agent. |
29
59
  | `harnesspm run [--agent <agent>] <plugin>:<script> [-- args]` | Runs a script ([05-executables.md](05-executables.md#51-scripts)) in the caller's folder. Hooks pass `--agent`, which sets `HARNESSPM_AGENT`. Without an install, it runs the script from the [fetched packages](01-overview.md#15-terms). When there are none, it says so and names `fetch` and the install, not `No script`. |
30
60
  | `harnesspm fetch` | Downloads only the harness packages in the lock, without a full install, and checks their integrity ([04-outputs.md](04-outputs.md#42-stable-package-paths)). Writes their docs copies, which search tools find ([4.3](04-outputs.md#43-project-outputs), note 8). For review bots and CI jobs that do not install dependencies, and for a clone that an agent uses without installing it. |
31
- | `harnesspm help` | Every command. Inside a project, or with `-C`, also the project's packages, one line each ([below](#the-project-in-help)). |
61
+ | `harnesspm help` | Inside a project, or with `-C`, the project's packages, one line each ([below](#the-project-in-help)), and a pointer to `--help`. Elsewhere, every command, as `--help` prints. |
32
62
  | `harnesspm help <package \| rule ID \| tool>` | A package's rules, docs, tools, MCP servers, skills and hooks in full, one rule, or a tool's usage and run command ([below](#help-for-a-package-a-rule-or-a-tool)). Needs no install. |
33
63
 
34
64
  ### `-C <dir>`
@@ -47,13 +77,16 @@ npx -y @harnesspm/cli -C work/app run uikit:colors surface
47
77
 
48
78
  ### The project in `help`
49
79
 
50
- Inside a project, or with `-C`, `help` ends with a "This project" section. It gives each package of the dependency and project layers one line, across all workspaces: what it covers (its `description` in `plugin.json`, else the titles of its always-on rules), how many rules, tools, MCP servers, skills and hooks it has, and the `help <package>` command that prints the rest.
80
+ Inside a project, or with `-C`, `help` prints a "This project" section. It gives each package of the dependency and project layers one line, across all workspaces: what it covers (its `description` in `plugin.json`, else the titles of its always-on rules), how many rules, tools, MCP servers, skills and hooks it has, and the `help <package>` command that prints the rest.
51
81
 
52
82
  ```text
53
83
  This project: app (work/app)
54
84
  Paths start at the current folder. The tools run here too, with -C.
55
85
 
56
86
  - @acme/ui — Acme UI. 1 rule, docs, 1 tool, 1 skill: `npx -y @harnesspm/cli -C work/app help @acme/ui`
87
+
88
+ A tool's options: `npx -y @harnesspm/cli -C work/app help <tool>`. Run a tool: `npx -y @harnesspm/cli -C work/app run <tool> [args]`.
89
+ Every command: `npx -y @harnesspm/cli --help`.
57
90
  ```
58
91
 
59
92
  ### Help for a package, a rule or a tool
@@ -62,9 +95,9 @@ Paths start at the current folder. The tools run here too, with -C.
62
95
 
63
96
  | Target | What `help` prints |
64
97
  | --- | --- |
65
- | A package, by its npm name or plugin name | Everything it contributes, with the project's `patch`, `replace` and `exclude` applied, and nothing left out: each rule in full, with how it becomes active and who changed it; its docs index; its tools, each with its description, its `usage` and the exact `run` command; its MCP servers; its skills, with the path of each `SKILL.md`; the hooks it registers. When the package is not trusted, the tools, MCP servers and hooks carry a line that says so. |
98
+ | A package, by its npm name or plugin name | Everything it contributes, with the project's `patch`, `replace` and `exclude` applied, and nothing left out: each rule in full, with how it becomes active and who changed it; its docs index; its tools, each with its description, its `usage`, the exact `run` command and `no prompt` when it asks to run without one (`allow`, [5.4](05-executables.md#54-permissions)); its MCP servers; its skills, with the path of each `SKILL.md`; the hooks it registers. When the package is not trusted, the tools, MCP servers and hooks carry a line that says so. |
66
99
  | A rule ID, such as `acme-ui:rules/usage` | That rule in full. |
67
- | A tool, as `<plugin>:<script>` or by its ID | Its description, its `usage` ([5.1](05-executables.md#51-scripts)), its `answers` and the exact `run` command. Without a `usage`, it says that none is declared. With `answers`, an `Exit:` line says that those codes are answers, such as "found problems", not a broken tool. The tool line in `help <package>` and the managed block stays one line and leaves them out. It never runs the script, so it works without an install. |
100
+ | A tool, as `<plugin>:<script>` or by its ID | Its description, its `usage` ([5.1](05-executables.md#51-scripts)), whether it runs without a prompt, its `answers` and the exact `run` command. Without a `usage`, it says that none is declared. With `answers`, an `Exit:` line says that those codes are answers, such as "found problems", not a broken tool. The tool line in `help <package>` and the managed block stays one line and leaves them out. It never runs the script, so it works without an install. |
68
101
 
69
102
  For every target:
70
103
 
@@ -89,21 +122,12 @@ node -e "try{require.resolve('@harnesspm/cli/package.json');process.exit(1)}catc
89
122
  4. `node -e`, `||` and parentheses work in sh, Windows cmd and Yarn's own shell. `|| true` would not: cmd has no `true` command.
90
123
  5. Older versions of `init` wrote the hook as plain `harnesspm sync`, which fails such an install. `init` replaces that form, alone or after ` && `, and `doctor` warns about it. A script that runs `harnesspm sync` in any other form stays as it is.
91
124
  6. The `node -e` part names the package that the project lists. A project that still lists `@tenphi/harnesspm` gets a hook for that name. A hook for a name the project no longer lists would skip every sync, so `init` replaces it with the hook for the listed name, and `doctor` warns about it.
125
+ 7. A project may sync on install another way: a Yarn plugin in `.yarnrc.yml` that runs `harnesspm sync` after every install. When the path or spec of a plugin there names harnesspm, `init` adds no hook, which would sync a second time on each install, and says so ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/package-managers.md)).
92
126
 
93
127
  The `node -e` part resolves `@harnesspm/cli/package.json` from the project folder. So the package's `exports` field MUST export `./package.json`. It does, next to `./telemetry` ([14.9](14-telemetry.md#149-events-from-a-projects-own-tools)).
94
128
 
95
129
  `harnesspm mcp [--agent <agent>] <plugin>:<server>` also exists. Agents call it to start stdio MCP servers. `harnesspm track --agent <agent>` is the command of harnesspm's own telemetry hooks ([14.4](14-telemetry.md#144-agent-events)). People do not need either.
96
130
 
97
- ```text
98
- $ npx -y @harnesspm/cli status
99
- 📦 dependencies @cube-dev/ui-kit 0.206.1 → @tenphi/tasty 3.17.1, @tenphi/glaze 2.0.0
100
- 🏢 project harnesspm.json: 1 replace · 1 patch
101
- ➕ added github:cube-js/frontend-harness (user) · github:alex/harness (user), project entry cube-ui-kit
102
- ⏳ pending some-third-party: 1 hook (not trusted)
103
- 📏 always-on Codex 18.4 KiB of 32 KiB · Claude Code 212 lines
104
- 📡 telemetry run, mcp, sync, why, read, skill, session → file .harnesspm/events.jsonl
105
- ```
106
-
107
131
  ### Moving from `@tenphi/harnesspm`
108
132
 
109
133
  Up to version 0.16, the package was `@tenphi/harnesspm`. From 0.17 it is `@harnesspm/cli`, with the same command, `harnesspm`, and the same versions, so a project moves with one install:
@@ -113,19 +137,25 @@ npm i -D @harnesspm/cli && npm rm @tenphi/harnesspm
113
137
  npx -y @harnesspm/cli init
114
138
  ```
115
139
 
140
+ A machine with an added harness ([07-added.md](07-added.md)) runs one command once, because its user-level hook still runs the earlier package:
141
+
142
+ ```shell
143
+ npx -y @harnesspm/cli update
144
+ ```
145
+
116
146
  `init` updates the install hook; the next `sync` rewrites the rest. Until then, and until harnesspm 1.0, harnesspm treats the earlier name as its own:
117
147
 
118
148
  | Where the earlier name is | What harnesspm does |
119
149
  |---|---|
120
150
  | The installed CLI file, `node_modules/@tenphi/harnesspm/dist/cli.js` | Hooks and MCP servers start it when `@harnesspm/cli` is not installed ([5.2](05-executables.md#52-hooks)). |
121
151
  | Hook commands and allow rules with `npx -y @tenphi/harnesspm` or that file | They grant the same as the current form. So `sync` replaces them even in a run of the agent's model, and nothing is held back ([6.2](06-trust.md#62-trusting-a-package), rule 4). |
122
- | The user-level `SessionStart` hook, `npx -y @tenphi/harnesspm update` or `sync` | A sync by a person, a setup script or a hook replaces it with `npx -y @harnesspm/cli update` ([7.5](07-added.md#75-applying-in-every-repository)). |
152
+ | The user-level `SessionStart` hook, `npx -y @tenphi/harnesspm update` or `sync` | It runs the earlier package, whose versions cannot rewrite it. A person runs `npx -y @harnesspm/cli update` once on each machine with an added harness; that run replaces it with `npx -y @harnesspm/cli update` ([7.5](07-added.md#75-applying-in-every-repository)). A later sync of the new version by a person, a setup script or a hook does the same. |
123
153
  | The project's `package.json` | `init` and the `harnesspm` command accept either name. `doctor` warns that the package moved and names the two commands above. |
124
154
  | The install hook | See [the install hook](#the-install-hook), point 6. |
125
155
  | Both packages installed | They ship the same harness, so `@harnesspm/cli` gives it and the other is left out, with no plugin name clash. |
126
156
  | `$schema` in `harnesspm.json` | The earlier URL keeps working, because the registry keeps the earlier package. `doctor` names the current one. |
127
157
 
128
- `@tenphi/harnesspm` is deprecated on npm, with a message that names the new package. Its versions stay installable. harnesspm 1.0 drops the earlier name: the list `OLD_PACKAGE_NAMES` in `src/util.ts` holds it.
158
+ `@tenphi/harnesspm` is deprecated on npm, with a message that names the new package and both commands above. No release of the new code goes out under the earlier name. Its versions stay installable. harnesspm 1.0 drops the earlier name: the list `OLD_PACKAGE_NAMES` in `src/util.ts` holds it.
129
159
 
130
160
  ## 10.2 Authors
131
161
 
@@ -151,31 +181,36 @@ npx -y @harnesspm/cli init
151
181
  | `1` | Error: invalid harness, failed check. |
152
182
  | `2` | `harnesspm run` refused a script ([05-executables.md](05-executables.md#51-scripts)). When a hook calls it, `2` also blocks the event: harnesspm fails closed. |
153
183
 
154
- ## 10.5 Doctor
184
+ ## 10.5 The report
185
+
186
+ `npx -y @harnesspm/cli status`, `doctor` and the bare command in a project print one report. It answers three questions: what the project gives its agents, whether a person can work here with harnesses, the repository's and their own, without per-machine files reaching a commit, and what waits for a person.
155
187
 
156
- `npx -y @harnesspm/cli doctor` answers one question: can a person work here with harnesses, the repository's and their own, without per-machine files reaching a commit?
188
+ It opens with one line each for the dependencies, the project's changes, the units that added harnesses change (`✏️ changed here`), the always-on size per agent, and telemetry when the project configures it: on, held or off on this machine. The checks follow:
157
189
 
158
190
  | Group | Check | Fails when |
159
191
  | --- | --- | --- |
160
192
  | 🔒 Local files | Every per-machine file on disk is ignored by git and not tracked. The files are the ones harnesspm lists in `.git/info/exclude`, plus `harnesspm.local.json`, `CLAUDE.local.md`, `.claude/settings.local.json` and a telemetry file. Git answers, so `.gitignore`, `.git/info/exclude` and a global excludes file all count. | A file is tracked (fix: `git rm --cached`), or not ignored (fix: `sync` for a file harnesspm writes, otherwise a `.gitignore` entry). When a `!` pattern brings a file back, it names the pattern and its file. Outside a git repository it only warns. |
161
193
  | ➕ Harnesses of your own | The clone's exclude file can be written. Each added harness is on this machine. | The exclude file cannot be written, or an added harness is missing. |
162
- | 📦 Outputs | Committed outputs are up to date, as `sync --check` checks. Per-machine links and generated files are in place. `AGENTS.md` fits in Codex's 32 KiB, and Codex reaches every managed block ([4.9](04-outputs.md#49-size-limits)). | A committed output or the lock is out of date. Four problems only warn: missing per-machine outputs, because `sync` writes them; an `AGENTS.md` over 32 KiB; a managed block that Codex never reads, or reads only in part; and an [install hook](#the-install-hook) in the old form, which fails an install without dev dependencies. |
163
- | 🛡️ Trust | Entries that wait for trust or for a person, with a held telemetry handler: the list that `sync` prints. | Never: these are warnings ([10.4](#104-exit-codes)). |
194
+ | 📝 Outputs | Committed outputs are up to date, as `sync --check` checks. Per-machine links and generated files are in place, with the entries that the default branch records ([6.2](06-trust.md#62-trusting-a-package), rule 4). `AGENTS.md` fits in Codex's 32 KiB, and Codex reaches every managed block ([4.9](04-outputs.md#49-size-limits)). | A committed output or the lock is out of date. These only warn: missing per-machine outputs and entries, because `sync` writes them; an `AGENTS.md` over or close to 32 KiB; a managed block that Codex never reads, or reads only in part, or that starts past line 30; and an [install hook](#the-install-hook) in the old form, which fails an install without dev dependencies. |
195
+ | ⏳ Waiting for a person | Packages that are not trusted, `"pin"` versions that are not approved, and entries that an agent's run held back, a held telemetry handler first: the list that `sync` prints. Each line names the person's step: trust, then `approve`; in a Claude Code cloud session, the line for the setup script ([9.1](09-cloud.md#91-the-repositorys-harness)). | Never: these are not problems ([10.4](#104-exit-codes)). |
164
196
 
165
197
  ```text
166
198
  $ npx -y @harnesspm/cli doctor
199
+ 📦 dependencies @acme/ui 4.2.0 → @acme/colors 2.1.0, @acme/styles 3.4.1
200
+ 🏢 project harnesspm.json: no changes
201
+ 📏 always-on Codex 1.7 KiB of 32 KiB · Claude Code 31 lines
167
202
  🔒 Local files
168
203
  ❌ CLAUDE.local.md is tracked by git, so a commit can include this machine's files, and harnesspm writes no added harnesses into it. Run `git rm --cached CLAUDE.local.md` and commit.
169
204
  ➕ Harnesses of your own
170
205
  ✅ .git/info/exclude can be written, so harnesspm keeps per-machine files out of git
171
206
  ✅ Added: alex (github:alex/harness, user)
172
- 📦 Outputs
207
+ 📝 Outputs
173
208
  ✅ Committed outputs are up to date
174
- ✅ 14 per-machine outputs in place
175
- 🛡️ Trust
176
- ✅ Nothing waits for trust
209
+ ✅ 40 per-machine outputs in place
210
+ ⏳ Waiting for a person
211
+ - @acme/styles: 1 script, 1 hook (not trusted). A person adds "@acme/styles": true to "trust" in harnesspm.json, then runs `npx -y @harnesspm/cli approve`.
177
212
 
178
213
  ❌ 1 problem. Each line above says how to fix it.
179
214
  ```
180
215
 
181
- `doctor` never edits `.gitignore`, never untracks a file and never writes outputs. `sync` writes, and the person decides the rest.
216
+ `status` exits `0`. `doctor` exits `1` when a check fails, so a job can gate on it. The report never edits `.gitignore`, never untracks a file and never writes outputs. `sync` writes, and the person decides the rest.
@@ -8,5 +8,5 @@ paths: ["/harnesspm.json", "/harnesspm.local.json", "/harness/**"]
8
8
  - `harnesspm.json` and `harness/` belong to the team and are committed. `harnesspm.local.json` lists harnesses added for this repository only, and a person's telemetry opt-out. It is never committed.
9
9
  - To change a few sections of an upstream rule, create a patch with `npx -y @harnesspm/cli new patch <rule ID>`, keep only the sections you change, and edit them. To change a whole rule, or a whole skill with a folder of your own, use `replace`. To drop a unit, use `exclude`. Do not copy the whole upstream harness.
10
10
  - Executable units (scripts, hooks, MCP servers, allow permissions) run only for trusted packages. Do not add a package to `trust` without the user's agreement.
11
- - `telemetry` sends events about harness use to the team's handler. Change it only when the user asks. A handler you add or change waits until the user runs `npx -y @harnesspm/cli sync` in their own terminal.
11
+ - `telemetry` sends events about harness use to the team's handler. Change it only when the user asks. A handler you add or change waits until the user runs `npx -y @harnesspm/cli approve` in their own terminal.
12
12
  - After a change, run `npx -y @harnesspm/cli sync`, and `npx -y @harnesspm/cli check <folder>` for a changed harness folder. Fix every reported problem.
@@ -39,5 +39,5 @@ Keep always-on rules short. One topic per file, split into small `##` sections,
39
39
  1. If `package.json` has a `files` field, make sure it lists `harness` and the docs folder, if used.
40
40
  2. Run `npx -y @harnesspm/cli check`. Fix every problem.
41
41
  3. Add `"prepack": "harnesspm check"` to the `package.json` scripts.
42
- 4. Add a short note to the README: the package ships a harness for coding agents, and a project gets it with `npm i -D @harnesspm/cli` and `npx -y @harnesspm/cli init`. A project that does not use harnesspm gets nothing by itself.
42
+ 4. Add a short note to the README: the package ships a harness for coding agents, and a project gets it with `npx -y @harnesspm/cli init`. A project that does not use harnesspm gets nothing by itself.
43
43
  5. To see the harness as users' agents will, run `npx -y @harnesspm/cli init` in this repository. Its own harness then shows in its `AGENTS.md` block.
@@ -1,34 +1,26 @@
1
1
  ---
2
2
  name: harnesspm-import
3
- description: Set up harnesspm in a project, take agent harness from its dependencies, trust packages that ship tools, or add a harness on top, such as the user's team's or their own. Use when the user asks to use a package's agent rules or tools, to set up harnesspm, or to add a harness in this project or session.
3
+ description: Work with the harness a project takes from its dependencies, after setup, or add one on top. Covers trusting a package that ships tools, a cloned repository's harness with -C, a folder above several repositories, telemetry, and adding a harness such as the user's team's or their own. Use when the user asks about a package's agent rules or tools, to trust a package, to add a harness in this project or session, or to set up harnesspm.
4
4
  ---
5
5
 
6
6
  # Using harness in a project
7
7
 
8
- ## 1. Set up the project (once)
8
+ Setup is one command: `npx -y @harnesspm/cli init`. Do what it prints, and commit what it lists. In any folder, `npx -y @harnesspm/cli` says what the folder is and which command starts each task. In a project, it prints the report: packages, checks, and what waits for a person.
9
9
 
10
- ```bash
11
- npm i -D @harnesspm/cli
12
- npx -y @harnesspm/cli init
13
- ```
14
-
15
- `init` adds `harnesspm sync` to the `postinstall` script of a private package, or to `prepare` otherwise, so every full install updates the agent files. The `node -e` check in front of it skips the sync when harnesspm is not installed, as in `npm ci --omit=dev`. Keep it: a plain `harnesspm sync` fails such installs. When `doctor` reports the plain form, run `npx -y @harnesspm/cli init` again. After `npm install <pkg>` or `pnpm add`, run `npx -y @harnesspm/cli sync` yourself. Commit `package.json` and the package manager's lockfile, `harnesspm.json`, `harnesspm.lock.json`, the `AGENTS.md` block and the `CLAUDE.md` files that import `AGENTS.md`, also the ones next to nested `AGENTS.md` files.
16
-
17
- In CI, run `npx -y @harnesspm/cli sync --check` after the install. With `CI=true`, `sync` leaves committed files as they are, so the check sees a missed sync. A job that commits them runs `npx -y @harnesspm/cli sync --write`.
10
+ ## Trust and permissions
18
11
 
19
- ## 2. Check what arrived
12
+ - **Tools of a package that is not trusted stay off.** Ask the user before you add a package to `trust` in `harnesspm.json`. Say what each tool does and whether it runs without a prompt: `npx -y @harnesspm/cli help <package>` lists them.
13
+ - **You cannot grant permissions.** When you run harnesspm, new allow rules, hooks and MCP servers wait for a person, unless the default branch already records them. Ask the user to run `npx -y @harnesspm/cli approve` in their own terminal. In a Claude Code cloud session, where the user has no terminal, give them the line that harnesspm prints for the environment's setup script instead. Do not edit agent settings files to work around it.
20
14
 
21
- Run `npx -y @harnesspm/cli status`. It lists the packages, pending tools and the always-on size.
15
+ ## Other tasks
22
16
 
23
- - **Pending tools** come from packages the project does not trust yet. Ask the user before adding a package to `trust` in `harnesspm.json`, and say what each tool does: `harness/plugin.json` of its package has each script's `description`, and `"allow": true` when it asks to run without a prompt.
24
- - **You cannot grant permissions.** When you run harnesspm, new allow rules, hooks and MCP servers stay pending, unless the default branch already records them. The held-back line says what differs. Ask the user to run `npx -y @harnesspm/cli approve` in their own terminal. In a Claude Code cloud session, where the user has no terminal, give them the line that harnesspm prints for the environment's setup script instead. Do not edit agent settings files to work around it.
25
17
  - **One upstream rule does not fit** the project: run `npx -y @harnesspm/cli new patch <rule ID>` and edit only the sections that differ. Use a `replace` entry in `harnesspm.json` to change a whole rule or skill, or an `exclude` entry to drop a unit.
26
18
  - **A job that does not install dependencies**, such as a review bot, runs `npx -y @harnesspm/cli fetch` first.
27
19
  - **You work in a clone below your session's folder**, such as `work/app`: run `npx -y @harnesspm/cli -C work/app help` to list its tools, rules and skills, and add `-C work/app` to each tool command. Nothing in your own repository changes. Without the clone's install, self-contained scripts run from the fetched packages; a script that needs the install says so.
28
- - **Sessions start in a folder above several repositories**, such as `/home/user` in a cloud session with more than one, or `~/work`: ask the user to run `npx -y @harnesspm/cli sync` in that folder, after the installs (in a cloud session, in the environment's setup script). It writes each repository's hooks there and a block in that folder's `AGENTS.md` that names each repository. If you run it, the block appears and the hooks stay held back.
29
- - **The team wants to see how agents use the harness:** add `"telemetry": { "send": { "file": ".harnesspm/events.jsonl" } }` to `harnesspm.json`, or a command as `send`, and ask the user to run `npx -y @harnesspm/cli sync`. A person opts out with `DO_NOT_TRACK=1`. The spec's telemetry chapter, in the docs index, has the events and a rule template for reporting harness problems.
20
+ - **Sessions start in a folder above several repositories**, such as `/home/user` in a cloud session with more than one, or `~/work`: ask the user to run `npx -y @harnesspm/cli sync` in that folder, after the installs (in a cloud session, in the environment's setup script). It writes each repository's hooks there and a block in that folder's `AGENTS.md` that names each repository. If you run it, the block appears and the hooks wait for a person.
21
+ - **The team wants to see how agents use the harness:** add `"telemetry": { "send": { "file": ".harnesspm/events.jsonl" } }` to `harnesspm.json`, or a command as `send`, and ask the user to run `npx -y @harnesspm/cli approve`. A person opts out with `DO_NOT_TRACK=1`. The spec's telemetry chapter, in the docs index, has the events and a rule template for reporting harness problems.
30
22
 
31
- ## 3. Add a harness on top
23
+ ## Add a harness on top
32
24
 
33
25
  ```bash
34
26
  npx -y @harnesspm/cli add <source> # every repository on this machine
@@ -37,4 +29,4 @@ npx -y @harnesspm/cli add <source> --local # this repository only
37
29
 
38
30
  The source is `github:<owner>/<repo>`, `git:<url>`, `npm:<package>` or a folder path. Add a team's harness before the user's own, so the user's wins. The command prints the added rules. Follow them from now on in this session.
39
31
 
40
- Outputs of added harnesses never go into the project's repository. Do not commit them. Then run `npx -y @harnesspm/cli doctor`: it finds a per-machine file that git could commit, and names the fix. Ask the user before you untrack a file.
32
+ Outputs of added harnesses never go into the project's repository. Do not commit them. `npx -y @harnesspm/cli doctor` finds a per-machine file that git could commit, and names the fix. Ask the user before you untrack a file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harnesspm/cli",
3
- "version": "0.0.0-snapshot.412a718",
3
+ "version": "0.0.0-snapshot.5e392dd",
4
4
  "description": "The harness package manager: share agent rules, docs, skills and tools through npm packages",
5
5
  "license": "MIT",
6
6
  "type": "module",