@osfactory/har 0.9.0 → 0.11.0

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 (26) hide show
  1. package/README.md +43 -2
  2. package/dist/index.js +1240 -586
  3. package/dist/templates/agent-skills/har-maintain.md +36 -0
  4. package/dist/templates/agent-skills/har-wt.md +47 -0
  5. package/dist/templates/agent-skills/setup-har.md +70 -0
  6. package/dist/templates/agent-skills/skills.manifest.json +48 -0
  7. package/dist/templates/claude-worktree-guard.sh.template +38 -0
  8. package/dist/templates/har-boilerplate/CLAUDE.agent.md +4 -2
  9. package/dist/templates/har-boilerplate/STAGES.md +91 -0
  10. package/dist/templates/har-boilerplate/agent-slot.sh +35 -6
  11. package/dist/templates/har-boilerplate/stages/README.sh +7 -5
  12. package/dist/templates/har-boilerplate/verify.sh +9 -2
  13. package/dist/templates/har-boilerplate-cli/CLAUDE.agent.md +3 -1
  14. package/dist/templates/har-boilerplate-cli/STAGES.md +91 -0
  15. package/dist/templates/har-boilerplate-cli/agent-slot.sh +35 -6
  16. package/dist/templates/har-boilerplate-cli/stages/README.sh +7 -5
  17. package/dist/templates/har-boilerplate-cli/verify.sh +9 -2
  18. package/dist/templates/har-boilerplate-ios/CLAUDE.agent.md +2 -0
  19. package/dist/templates/har-boilerplate-ios/STAGES.md +91 -0
  20. package/dist/templates/har-boilerplate-ios/agent-slot.sh +35 -6
  21. package/dist/templates/har-boilerplate-ios/stages/README.sh +6 -7
  22. package/dist/templates/har-boilerplate-ios/verify.sh +9 -3
  23. package/dist/templates/stage-templates/custom-stage-skeleton.sh +65 -0
  24. package/dist/templates/stage-templates/playwright/template.manifest.json +9 -1
  25. package/dist/templates/stage-templates/rocketsim/template.manifest.json +2 -1
  26. package/package.json +1 -1
package/README.md CHANGED
@@ -83,6 +83,34 @@ Shell fallback when the CLI is not installed: `./.har/setup-infra.sh`, `./.har/l
83
83
 
84
84
  See [Harness profiles](#harness-profiles) above if your repo is a CLI/library or iOS app rather than a web app.
85
85
 
86
+ ## Agent skills (/setup-har, /har-wt, /har-maintain)
87
+
88
+ `har env init` can scaffold **project-owned skills/commands** for coding agents, so the har workflow is one slash command away for every teammate who clones the repo:
89
+
90
+ | Skill | Who invokes it | What it does |
91
+ |-------|----------------|--------------|
92
+ | `/setup-har` | You, once | Installs har if missing, picks a profile, runs `har env init`, performs the adaptation prompt itself, proves launch + verify, commits |
93
+ | `/har-wt` | The agent, on every coding task | Launches a harness slot, does all edits in the session worktree (never the main checkout), verifies through the harness |
94
+ | `/har-maintain` | You, when the harness drifts | Runs `har env maintain`, applies the adaptation, finalizes and re-verifies |
95
+
96
+ Targets are auto-detected at `init`/`maintain` (or forced with `--agents claude,cursor,codex`); you can also manage them standalone:
97
+
98
+ ```bash
99
+ har agents install --claude --cursor # .claude/skills/ + .cursor/commands/ (committed to the repo)
100
+ har agents install --codex # ~/.codex/prompts/ (global — Codex has no per-repo prompts)
101
+ har agents remove --claude
102
+ ```
103
+
104
+ Scaffolded files carry a `managed by har` header and are refreshed by `har env maintain`; files you edit by hand are left alone.
105
+
106
+ **Optional enforcement (Claude Code):** make `/har-wt` self-triggering instead of memory-dependent —
107
+
108
+ ```bash
109
+ har hooks install --claude
110
+ ```
111
+
112
+ installs a `PreToolUse` guard (`.har/hooks/claude-worktree-guard.sh` + an entry in `.claude/settings.json`) that blocks `Edit`/`Write` in the **main checkout** of a har repo and points the agent to `/har-wt`. Edits inside session worktrees pass through. Remove with `har hooks uninstall --claude`; humans can bypass with `HAR_SKIP_WT_GUARD=1`.
113
+
86
114
  ## Repo layout after init
87
115
 
88
116
  ```
@@ -107,7 +135,16 @@ my-app/
107
135
 
108
136
  HAR stages are project-defined operations with stable identifiers and normalized results. A stage can be as simple as `verify` or as specific as `browser-e2e`, `migration-check`, `accessibility`, or `load-smoke`.
109
137
 
110
- The important boundary is that HAR runs and reports stages generically. It does not need a special Playwright, migration, accessibility, or load-test API in the core product.
138
+ The important boundary is that HAR runs and reports stages generically. It does not need a special Playwright, migration, accessibility, or load-test API in the core product. The authoring contract (command vs script stages, the script contract, how `verificationStages` controls `verify --full`) ships into every harness as `.har/STAGES.md`.
139
+
140
+ ### Custom stages
141
+
142
+ Register the project's real checks so they run in `verify --full` and surface to every agent:
143
+
144
+ ```bash
145
+ har env add-stage unit-tests --custom --kind test --command "npm test" --verification
146
+ har env add-stage db-integrity --custom --script # scaffolds .har/stages/db-integrity.sh
147
+ ```
111
148
 
112
149
  ### Playwright (optional)
113
150
 
@@ -126,7 +163,8 @@ See `.har/stages/PLAYWRIGHT.md` in the target repo after applying the template.
126
163
  | Command | Description |
127
164
  |---------|-------------|
128
165
  | `har env init` | Scaffold `.har/` + print coding-agent adaptation prompt |
129
- | `har env add-stage playwright` | Add Playwright `browser-e2e` stage + test scaffold |
166
+ | `har env add-stage playwright` | Add a stage template (`playwright`, `rocketsim`; `--list` shows all) |
167
+ | `har env add-stage <id> --custom` | Register a project-specific stage (`--command "npm test"` or `--script`) |
130
168
  | `har env maintain` | Validate harness + print maintenance prompt |
131
169
  | `har env launch 1` | Launch agent slot 1 |
132
170
  | `har env verify 1` | Run verification |
@@ -134,6 +172,9 @@ See `.har/stages/PLAYWRIGHT.md` in the target repo after applying the template.
134
172
  | `har env runs list` | List persisted run history (`--json`) |
135
173
  | `har env runs get <runId>` | Fetch one run record |
136
174
  | `har env teardown 1` | Tear down agent slot 1 |
175
+ | `har agents install` | Scaffold agent skills (`/setup-har`, `/har-wt`, `/har-maintain`) for Claude Code / Cursor / Codex |
176
+ | `har agents remove` | Remove har-managed agent skill files |
177
+ | `har hooks install` | Install the git commit gate (`--claude` for the Claude Code worktree guard) |
137
178
  | `har control up` | Start local Mission Control dashboard (Docker Compose) |
138
179
  | `har control register` | Register a repo with Mission Control |
139
180
  | `har control sync` | Sync runs + slot status to Mission Control |