Repository navigation
feat: harnesspm doctor checks that local files stay out of git - #5
Merged
Merged
Conversation
- ci.yml: typecheck, tests and `npm run check` on Node 24, and the built CLI (`--help`, `check`, `sync --check`) on Node 20 for `engines`. - release.yml: every PR publishes `0.0.0-snapshot.<sha>` under `pr_<number>` with a sticky comment; pushes to main open the version PR or publish with provenance, a `v<version>` tag and a GitHub Release. Both jobs use npm trusted publishing in the `release` environment. - Changesets replace the hand-written "Unreleased" line; AGENTS.md describes the new flow. The 0.1.0 notes stay in CHANGELOG.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
npm refuses a provenance statement from a private repository (E422), and with trusted publishing it adds one by itself once the repository is public. Also print the real OIDC availability in the publish jobs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
A re-run builds the same commit, so it got the same snapshot version, and npm never accepts a version twice. Add the attempt number on a re-run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
…ions `harnesspm why` found only rules, skills and docs, so it answered "No unit" for the script IDs the managed block prints. It now finds every unit kind, shows its source file, the command that runs a script, and whether the package of an executable unit is trusted. Test fixtures use `alex`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
A team turns on `telemetry` in harnesspm.json: which events, and a handler that gets them, a command (JSON on stdin) or a JSON Lines file. harnesspm sends events for script runs, MCP server starts, sync and why. With agent events on, a person's sync writes harnesspm's own async hooks: Claude Code reports reads of harness files, skills it loads and file-scoped rules it loads by itself; Claude Code and Codex report session starts. The hook runs the local binary (`track`), maps the path to a unit with an index that sync writes, hands the event off and exits 0. Events never hold arguments, file contents, prompts or absolute paths, and cover only the dependency and project layers. Sending never waits or fails a command: a command handler runs in a detached process with a 10 s limit. A handler gets events only as a person's sync recorded it in the lock. A model run keeps the recorded handler, so one an agent adds stays held until a person syncs. A person opts out with DO_NOT_TRACK=1 or "telemetry": false in harnesspm.local.json or ~/.harnesspm/config.json. Spec: new chapter 14 (with a rule template for reporting harness problems), terms and scenarios S14 and S15, 3.7, 4.3, 5.1, 6, 10, 11, and removed options in 13.12. Research: hook payloads and async hooks for both agents, from the docs, Codex source and a headless Claude Code probe. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
When a package's `extends` names a package that is not installed, sync warns. A package can now list an extends target as an optional peer dependency (`optional: true` in `peerDependenciesMeta`): projects that install it get its harness through the package, and projects that do not see no warning on every sync. Any other missing extends still warns. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Claude Code matches a `paths` pattern without a leading `/` at any depth. So `harness/**` loaded harnesspm's config rule whenever an agent only read a dependency's harness files in node_modules. A probe with Claude Code 2.1.323 showed that `/harness/**` loads for the project's own folder only, both as a plain file and as a symlink in .claude/rules/. - harnesspm-config: `/harnesspm.json`, `/harnesspm.local.json`, `/harness/**` - pointer lines show patterns without the leading `/` - spec 2.5 and the export skill say how to anchor a pattern - research: the probe result Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
The lock records the version of this repository's own harness. The version PR raised `version` in package.json but left the lock at the old version, so `sync --check` failed on main after every release, and the next pull request had to carry the lock change. `version-packages` now runs `npm run sync` after `changeset version`. Also refreshes the lock to 0.2.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
`harnesspm doctor` answers one question: can a person work here with harnesses, the repository's and their own, without per-machine files reaching a commit? It changes nothing, and each problem names its fix. - Local files: every per-machine file on disk (the ones in harnesspm's sections of .git/info/exclude, plus harnesspm.local.json, CLAUDE.local.md, .claude/settings.local.json and a telemetry file) is ignored by git and not tracked. Git answers through `git check-ignore` and `git ls-files`, so .gitignore, .git/info/exclude and a global excludes file all count. - Harnesses of your own: the exclude file can be written, and each added harness is on this machine. - Outputs: committed outputs are up to date (as `sync --check`), and per-machine links and files are in place. - Trust: pending and held entries, and a held telemetry handler, as warnings. Exits 1 when a check fails. `status` points to it when a per-machine file has a problem. Spec: scenario S16 and section 10.5. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Contributor
📦 Snapshot releasePublished |
…vent A command handler that exits before reading its event closes stdin, so writing the event fails with EPIPE. `deliver` logged that error instead of the handler's exit code. Node still reports the exit status, so EPIPE alone is no longer treated as a delivery failure. CI hit this race in "a command handler gets each event as JSON on stdin". A new test sends a 90 KB event, larger than a pipe buffer, to `exit 7`, which makes the race certain: it fails before this fix and passes after. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Merged
5 tasks done
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request has three changes:
harnesspm doctor, a new command. It checks that a repository is ready for harnesses, its own and a person's, and that no per-machine file can reach a commit.harnesspm.lock.json, somainstays valid after a release.doctorfound this bug on its first run.EPIPE. CI hit this race on this PR.1.
harnesspm doctorWhy
harnesspm keeps per-machine files out of git through
.git/info/exclude, but only whilesyncwrites them. Nothing checked them afterwards:syncwarned about two such files, and only while writing them.harnesspm.local.json, was unprotected until the nextsync..git/info/excludebelongs to one clone. On a fresh clone, agit add -Abefore the firstsynccommits everything.What it checks
It changes nothing. Each problem names the command that fixes it. It exits
1when a check fails; warnings do not fail..git/info/exclude, plusharnesspm.local.json,CLAUDE.local.md,.claude/settings.local.jsonand a telemetry file.git rm --cached), or not ignored (fix:syncfor a file harnesspm writes, otherwise a.gitignoreentry). If a!pattern in.gitignorebrings back an excluded file, it says so. Outside a git repository it only warns.sync --checkchecks. Per-machine links and generated files are in place.syncwrites them.Git answers.
git check-ignoreandgit ls-filesdecide, so.gitignore,.git/info/excludeand a global excludes file all count. harnesspm still never edits.gitignore.Where it shows up
statuspoints to it when a per-machine file has a problem:🩺 local files 1 problem. Run \npx harnesspm doctor`.`harnesspm-importskill runs it afteradd, and asks the user before untracking a file.Spec
.gitignore, untrack a file, write outputs).Left out on purpose
--fix.syncalready writes the excludes, andgit rm --cachedshould be a person's choice.SessionStarthook.add --no-hookturns it off on purpose, and harnesspm does not record that choice, so a check would warn wrongly.doctorruns, Node is new enough.2. The release flow refreshes the lock
The lock records the version of this repository's own harness. The version PR (#4) raised
versioninpackage.jsonto 0.2.0, but the lock stayed at 0.1.1:sync --checkhas failed onmainsince the release.version-packagesnow runsnpm run syncafterchangeset version. The release job hasCI=true, sosyncskips added harnesses and writes only the committed outputs. This PR also refreshes the lock to 0.2.0.AGENTS.md(Releasing) says what the version PR now changes.3. Telemetry: a handler that does not read its event
CI on this PR failed in the telemetry test "a command handler gets each event as JSON on stdin" (from #3):
exit 7ends before reading stdin, so writing the event fails withEPIPE.deliver.tslogged that error and skipped the exit code. Whether the shell exits before the write is a race, so it passed before.EPIPE.EPIPEalone is no longer a delivery failure: the exit code decides, as for any handler.exit 7, which makes the race certain (200 of 200 runs locally). It fails before the fix with the CI error, and passes after.patch.Verified
npm run typecheck,npm test(74 tests: 8 new fordoctor, 1 for the EPIPE race),npm run checkandnpm run syncpass.doctor: a synced project is ready; a trackedCLAUDE.local.mdfails with itsgit rm --cachedfix; a hand-madeharnesspm.local.jsonfails untilsynclists it, andstatuspoints todoctormeanwhile;.claude/settings.local.jsonthat harnesspm did not write needs a.gitignoreentry; a!pattern that brings a file back is named; an out-of-date lock fails; a missing added harness fails; outside git it only warns.dist/cli.js doctor) on this repository: ✅ ready, with 8 per-machine files checked.minorfordoctor,patchfor the telemetry fix. The release fix needs none (CI only).🤖 Generated with Claude Code
https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV