@tenphi/harnesspm 0.0.0-snapshot.7984e7b

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 (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +21 -0
  3. package/README.md +88 -0
  4. package/dist/added.js +189 -0
  5. package/dist/check.js +160 -0
  6. package/dist/cli.js +139 -0
  7. package/dist/commands.js +414 -0
  8. package/dist/config.js +43 -0
  9. package/dist/exec-outputs.js +360 -0
  10. package/dist/exec-units.js +144 -0
  11. package/dist/fetch.js +93 -0
  12. package/dist/frontmatter.js +35 -0
  13. package/dist/homes.js +17 -0
  14. package/dist/lock.js +102 -0
  15. package/dist/manifest.js +154 -0
  16. package/dist/new.js +223 -0
  17. package/dist/outputs.js +453 -0
  18. package/dist/render.js +119 -0
  19. package/dist/resolve.js +396 -0
  20. package/dist/run.js +83 -0
  21. package/dist/sections.js +121 -0
  22. package/dist/user-outputs.js +195 -0
  23. package/dist/util.js +140 -0
  24. package/dist/workspaces.js +61 -0
  25. package/docs/spec/01-overview.md +130 -0
  26. package/docs/spec/02-package-format.md +238 -0
  27. package/docs/spec/03-resolution.md +104 -0
  28. package/docs/spec/04-outputs.md +109 -0
  29. package/docs/spec/05-executables.md +158 -0
  30. package/docs/spec/06-trust.md +72 -0
  31. package/docs/spec/07-added.md +104 -0
  32. package/docs/spec/08-improving.md +77 -0
  33. package/docs/spec/09-cloud.md +47 -0
  34. package/docs/spec/10-cli.md +60 -0
  35. package/docs/spec/11-standards.md +49 -0
  36. package/docs/spec/12-dogfooding.md +51 -0
  37. package/docs/spec/13-open-questions.md +85 -0
  38. package/docs/spec/README.md +33 -0
  39. package/harness/dev.harnesspm/rules/generated-files.md +4 -0
  40. package/harness/dev.harnesspm/rules/harnesspm-config.md +11 -0
  41. package/harness/plugin.json +13 -0
  42. package/harness/skills/harnesspm-export/SKILL.md +39 -0
  43. package/harness/skills/harnesspm-import/SKILL.md +35 -0
  44. package/harness/skills/harnesspm-improve/SKILL.md +38 -0
  45. package/package.json +60 -0
  46. package/schema/harnesspm.schema.json +31 -0
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: harnesspm-export
3
+ description: Share agent rules, docs, skills or tools from a package through harnesspm, or change what a package already shares. Use when the user wants a library's users to get its agent guidance, asks to create or edit files under harness/, or wants to pass on the harness of packages it builds on.
4
+ ---
5
+
6
+ # Sharing a harness from a package
7
+
8
+ ## 1. Start small
9
+
10
+ If the package has no `harness/` folder, run `npx harnesspm new rule <name>`. It creates `harness/plugin.json` and one rule. That is a complete harness.
11
+
12
+ ## 2. Decide what goes in
13
+
14
+ Share what the package's **users** need. Keep contributor-only instructions (release steps, internal structure) in the repository's own `AGENTS.md`.
15
+
16
+ | Users need | Unit kind | Command |
17
+ | --- | --- | --- |
18
+ | A rule to always follow | Rule, no frontmatter | `npx harnesspm new rule <name>` |
19
+ | A rule for some files only | Rule with `paths` frontmatter | same, then add `paths` |
20
+ | Background to read when needed | Docs, or a rule with `description` only | set `docs` in `plugin.json` |
21
+ | A multi-step workflow | Skill, named `<plugin name>-<name>` | `npx harnesspm new skill <name>` |
22
+ | A specialist the agent can delegate to | Sub-agent, written for Claude Code and Codex | `npx harnesspm new agent <name>` |
23
+ | A tool to run | Script | `npx harnesspm new script <name>` |
24
+ | Something that runs on an agent event | Hook that runs a script | `npx harnesspm new hook <name>` |
25
+
26
+ Write each skill's `description` as what it does, then "Use when …" with the situations and words people use. Agents pick skills by that text, but not every time: when a skill must run in a situation, also add an always-on rule that names it.
27
+
28
+ Keep always-on rules short. One topic per file, split into small `##` sections, so users can patch one section, replace one file or drop it.
29
+
30
+ ## 3. Pass on upstream harness
31
+
32
+ - List the packages it builds on in `extends` in `plugin.json`.
33
+ - To change one of their rules for all users, prefer a patch: `npx harnesspm new patch <rule ID>` registers it in `harness/plugin.json`. Keep and edit only the sections that change. Use `replace` for a whole unit and `exclude` to drop one. Find IDs in the `AGENTS.md` block or with `npx harnesspm why <ID>`.
34
+
35
+ ## 4. Check and publish
36
+
37
+ 1. Run `npx harnesspm check`. Fix every problem.
38
+ 2. If `package.json` has a `files` field, make sure it lists `harness` and the docs folder, if used.
39
+ 3. Add `"prepack": "harnesspm check"` to the `package.json` scripts.
@@ -0,0 +1,35 @@
1
+ ---
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.
4
+ ---
5
+
6
+ # Using harness in a project
7
+
8
+ ## 1. Set up the project (once)
9
+
10
+ ```bash
11
+ npm i -D @tenphi/harnesspm
12
+ npx harnesspm 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. After `npm install <pkg>` or `pnpm add`, run `npx harnesspm sync` yourself. Commit `harnesspm.json`, `harnesspm.lock.json` and the `AGENTS.md` block.
16
+
17
+ ## 2. Check what arrived
18
+
19
+ Run `npx harnesspm status`. It lists the packages, pending tools and the always-on size.
20
+
21
+ - **Pending tools** come from packages the project does not trust yet. Ask the user before adding a package to `trust` in `harnesspm.json`.
22
+ - **You cannot grant permissions.** When you run harnesspm, new allow rules, hooks and MCP servers stay pending. Ask the user to run `npx harnesspm approve` in their own terminal. Do not edit agent settings files to work around it.
23
+ - **One upstream rule does not fit** the project: run `npx harnesspm new patch <rule ID>` and edit only the sections that differ. Use a `replace` or `exclude` entry in `harnesspm.json` to change or drop a whole unit.
24
+ - **A job that does not install dependencies**, such as a review bot, runs `npx -y @tenphi/harnesspm fetch` first.
25
+
26
+ ## 3. Add a harness on top
27
+
28
+ ```bash
29
+ npx -y @tenphi/harnesspm add <source> # every repository on this machine
30
+ npx -y @tenphi/harnesspm add <source> --local # this repository only
31
+ ```
32
+
33
+ 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.
34
+
35
+ Outputs of added harnesses never go into the project's repository. Do not commit them.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: harnesspm-improve
3
+ description: Change or add a rule, note, skill, script or other unit in any harnesspm harness (a dependency's, the project's, or one the user added, such as their team's or their own) and save the change the way its owner wants. Use when a rule is wrong or missing, when the user says "remember this", or asks to improve their harness.
4
+ ---
5
+
6
+ # Improving a harness
7
+
8
+ ## 1. Find the owner
9
+
10
+ For an existing unit, run `npx harnesspm why <ID>`. The ID is at the end of each line in the `AGENTS.md` block. It tells you the owner, the source file and whether you can edit it.
11
+
12
+ For something new, choose the owner:
13
+
14
+ | The change is about | Owner | Create with |
15
+ | --- | --- | --- |
16
+ | How a package should be used, for all its users | The package (dependency) | — propose upstream, see 3 |
17
+ | This project, for the whole team | The project | `npx harnesspm new <kind> <name>` |
18
+ | How the user or their team works, everywhere | The added harness (see `npx harnesspm status`) | `npx harnesspm new <kind> <name> --to <plugin>` |
19
+ | This project, only for the user or their team | The added harness, project entry | `npx harnesspm new <kind> <name> --to <plugin> --entry` |
20
+
21
+ Ask the user when it is not clear. Never put private data from this project into an added harness without the user's agreement.
22
+
23
+ ## 2. Edit the source
24
+
25
+ - Edit the source file that `why` names, never an output (the `AGENTS.md` block, `CLAUDE.local.md`, `.codex/`).
26
+ - Run `npx harnesspm sync`, then `npx harnesspm check <folder>` for the harness folder you changed.
27
+
28
+ ## 3. Save the change the owner's way
29
+
30
+ 1. Read `AGENTS.md` and `CONTRIBUTING.md` at the root of the owner's repository. Follow them.
31
+ 2. If they say nothing about saving:
32
+ 1. Show the user the change and ask before going on.
33
+ 2. Create a branch `harnesspm/<topic>` and commit with a message that says what and why.
34
+ 3. Push it and open a pull request or merge request with the tools you have.
35
+ 4. If a step is not possible, stop and tell the user what is done and what is left. In a cloud session, show the full change.
36
+ 3. Never push to the default branch unless the owner's rules allow it.
37
+
38
+ For a dependency: change it now with a patch (`npx harnesspm new patch <rule ID>`, add `--to <plugin>` to keep it in an added harness), or a `replace` or `exclude`. Then offer to open an issue or pull request at the package's repository.
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@tenphi/harnesspm",
3
+ "version": "0.0.0-snapshot.7984e7b",
4
+ "description": "The harness package manager: share agent rules, docs, skills and tools through npm packages",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "harnesspm": "dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "schema",
13
+ "harness",
14
+ "docs/spec",
15
+ "CHANGELOG.md"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "engines": {
21
+ "node": ">=20"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/tenphi/harnesspm.git"
26
+ },
27
+ "homepage": "https://github.com/tenphi/harnesspm#readme",
28
+ "keywords": [
29
+ "agents",
30
+ "harness",
31
+ "ai",
32
+ "claude-code",
33
+ "codex",
34
+ "agents-md",
35
+ "skills",
36
+ "mcp",
37
+ "agent-plugins"
38
+ ],
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.build.json",
41
+ "typecheck": "tsc -p tsconfig.json --noEmit",
42
+ "test": "node --test \"test/**/*.test.ts\"",
43
+ "sync": "node src/cli.ts sync",
44
+ "check": "node src/cli.ts check && node src/cli.ts sync --check",
45
+ "harnesspm": "node src/cli.ts",
46
+ "prepack": "npm run build && node dist/cli.js check",
47
+ "changeset": "changeset",
48
+ "version-packages": "changeset version && npm install --package-lock-only --ignore-scripts",
49
+ "release": "changeset publish"
50
+ },
51
+ "dependencies": {
52
+ "yaml": "^2.9.1"
53
+ },
54
+ "devDependencies": {
55
+ "@changesets/changelog-github": "^1.0.1",
56
+ "@changesets/cli": "^3.0.3",
57
+ "@types/node": "^22.20.5",
58
+ "typescript": "^7.0.2"
59
+ }
60
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unpkg.com/@tenphi/harnesspm/schema/harnesspm.schema.json",
4
+ "title": "harnesspm.json",
5
+ "description": "Project configuration for harnesspm, the harness package manager. Every field is optional.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "$schema": { "type": "string" },
10
+ "exclude": {
11
+ "description": "Packages or unit IDs to drop, such as \"@tenphi/glaze\" or \"tasty:rules/legacy\".",
12
+ "type": "array",
13
+ "items": { "type": "string" }
14
+ },
15
+ "replace": {
16
+ "description": "Unit ID → path of a project file that takes its place.",
17
+ "type": "object",
18
+ "additionalProperties": { "type": "string" }
19
+ },
20
+ "patch": {
21
+ "description": "Rule ID → path of a patch that changes some of its sections.",
22
+ "type": "object",
23
+ "additionalProperties": { "type": "string" }
24
+ },
25
+ "trust": {
26
+ "description": "Packages whose executable units may run: true follows upgrades, \"pin\" needs an approval for each new version.",
27
+ "type": "object",
28
+ "additionalProperties": { "enum": [true, "pin"] }
29
+ }
30
+ }
31
+ }