@osfactory/har 1.0.0-rc.2 → 1.1.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 (98) hide show
  1. package/dist/index.js +5231 -8674
  2. package/dist/templates/AGENTS.md.template +19 -66
  3. package/dist/templates/CLAUDE.md.template +1 -5
  4. package/dist/templates/adaptation-prompt-init.md +25 -29
  5. package/dist/templates/adaptation-prompt-maintain.md +5 -5
  6. package/dist/templates/adaptation-prompt-plugin.md +1 -1
  7. package/dist/templates/agent-skills/har-wt.md +2 -2
  8. package/dist/templates/agent-skills/setup-har.md +4 -4
  9. package/dist/templates/cursor-rule.mdc.template +7 -72
  10. package/dist/templates/har-boilerplate/gitignore.template +3 -1
  11. package/dist/templates/har-boilerplate/harness.env +1 -1
  12. package/dist/templates/har-boilerplate/justfile +11 -12
  13. package/dist/templates/har-boilerplate/stages.json +3 -9
  14. package/dist/templates/har-boilerplate-cli/gitignore.template +3 -1
  15. package/dist/templates/har-boilerplate-cli/harness.env +1 -1
  16. package/dist/templates/har-boilerplate-cli/justfile +9 -10
  17. package/dist/templates/har-boilerplate-cli/stages.json +2 -7
  18. package/dist/templates/har-boilerplate-ios/gitignore.template +2 -0
  19. package/dist/templates/har-boilerplate-ios/harness.env +1 -1
  20. package/dist/templates/har-boilerplate-ios/justfile +9 -10
  21. package/dist/templates/har-boilerplate-ios/stages.json +3 -8
  22. package/dist/templates/migration-prompt.md +4 -3
  23. package/dist/templates/plugins/custom-stage-skeleton.sh +2 -2
  24. package/dist/templates/plugins/gitleaks/.har/stages/secrets-scan.sh +2 -2
  25. package/dist/templates/plugins/gitleaks/template.manifest.json +1 -1
  26. package/dist/templates/plugins/kerno/.github/workflows/kerno.yml +1 -1
  27. package/dist/templates/plugins/kerno/.har/stages/KERNO.md +2 -2
  28. package/dist/templates/plugins/kerno/.har/stages/backend-validation.sh +3 -3
  29. package/dist/templates/plugins/kerno/README.md +2 -2
  30. package/dist/templates/plugins/kerno/template.manifest.json +1 -1
  31. package/dist/templates/plugins/playwright/.har/stages/PLAYWRIGHT.md +2 -2
  32. package/dist/templates/plugins/playwright/.har/stages/browser-e2e.sh +3 -3
  33. package/dist/templates/plugins/playwright/README.md +1 -1
  34. package/dist/templates/plugins/playwright/playwright.config.js +2 -2
  35. package/dist/templates/plugins/playwright/template.manifest.json +1 -1
  36. package/dist/templates/plugins/rocketsim/.har/stages/ROCKETSIM.md +1 -1
  37. package/dist/templates/plugins/rocketsim/.har/stages/rocketsim-flows.sh +3 -3
  38. package/dist/templates/plugins/rocketsim/README.md +1 -1
  39. package/dist/templates/plugins/rocketsim/flows/example-smoke.sh +1 -1
  40. package/dist/templates/plugins/rocketsim/template.manifest.json +1 -1
  41. package/dist/templates/plugins/semgrep/.har/stages/SEMGREP.md +1 -1
  42. package/dist/templates/plugins/semgrep/.har/stages/sast.sh +3 -3
  43. package/dist/templates/plugins/semgrep/README.md +2 -2
  44. package/dist/templates/plugins/semgrep/template.manifest.json +1 -1
  45. package/dist/templates/plugins/trivy/.har/stages/TRIVY.md +1 -1
  46. package/dist/templates/plugins/trivy/.har/stages/vuln-scan.sh +3 -3
  47. package/dist/templates/plugins/trivy/template.manifest.json +1 -1
  48. package/dist/templates/profiles/cli/docs/{claude-agent → readme}/definition-of-done.md +3 -3
  49. package/dist/templates/profiles/cli/docs/{claude-agent → readme}/do-not.md +1 -1
  50. package/dist/templates/profiles/cli/docs/{claude-agent → readme}/environment.md +3 -3
  51. package/dist/templates/profiles/cli/docs/readme/for-coding-agents.md +5 -7
  52. package/dist/templates/profiles/cli/docs/readme/port-shared-services-cli-profile.md +3 -3
  53. package/dist/templates/profiles/cli/docs/readme/quick-start.md +2 -9
  54. package/dist/templates/profiles/cli/docs/readme/verification-contract.md +5 -5
  55. package/dist/templates/profiles/cli/docs/readme/what-s-in-here.md +2 -3
  56. package/dist/templates/profiles/cli/profile.manifest.json +14 -11
  57. package/dist/templates/profiles/default/docs/readme/architecture.md +1 -1
  58. package/dist/templates/profiles/default/docs/{claude-agent → readme}/definition-of-done.md +3 -3
  59. package/dist/templates/profiles/default/docs/{claude-agent → readme}/do-not.md +2 -2
  60. package/dist/templates/profiles/default/docs/readme/environment.md +19 -0
  61. package/dist/templates/profiles/default/docs/readme/for-coding-agents.md +4 -6
  62. package/dist/templates/profiles/default/docs/readme/port-shared-services.md +5 -5
  63. package/dist/templates/profiles/default/docs/readme/quick-start.md +2 -9
  64. package/dist/templates/profiles/default/docs/readme/readiness-layers.md +4 -4
  65. package/dist/templates/profiles/default/docs/{claude-agent → readme}/readiness.md +1 -1
  66. package/dist/templates/profiles/default/docs/readme/verification-contract.md +4 -4
  67. package/dist/templates/profiles/default/docs/readme/what-s-in-here.md +2 -3
  68. package/dist/templates/profiles/default/profile.manifest.json +21 -13
  69. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/definition-of-done.md +3 -3
  70. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/do-not.md +1 -1
  71. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/environment.md +4 -4
  72. package/dist/templates/profiles/ios/docs/readme/port-shared-services-ios-profile.md +3 -3
  73. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/project-commands.md +4 -4
  74. package/dist/templates/profiles/ios/docs/readme/quick-start.md +2 -9
  75. package/dist/templates/profiles/ios/docs/readme/simulators.md +2 -2
  76. package/dist/templates/profiles/ios/docs/{claude-agent → readme}/user-flow-validation-rocketsim.md +2 -2
  77. package/dist/templates/profiles/ios/docs/readme/verification-contract.md +1 -1
  78. package/dist/templates/profiles/ios/docs/readme/what-s-in-here.md +2 -3
  79. package/dist/templates/profiles/ios/profile.manifest.json +15 -12
  80. package/dist/templates/runtime-bundles/shared-kernel/STAGES.md +1 -1
  81. package/dist/templates/runtime-bundles/shared-kernel/lib/verify-runner.mjs +1 -1
  82. package/dist/templates/shared-docs/readme/maintaining-this-harness.md +3 -3
  83. package/package.json +2 -1
  84. package/dist/prompts/system-authoring.md +0 -155
  85. package/dist/templates/profiles/default/docs/claude-agent/environment.md +0 -19
  86. package/dist/templates/profiles/ios/docs/claude-agent/intro.md +0 -3
  87. package/dist/templates/runtime-bundles/pm2-runtime/attach.sh +0 -15
  88. package/dist/templates/runtime-bundles/shared-kernel/agent-cli.sh +0 -35
  89. package/dist/templates/runtime-bundles/shared-kernel/launch.sh +0 -35
  90. package/dist/templates/runtime-bundles/shared-kernel/preflight.sh +0 -35
  91. package/dist/templates/runtime-bundles/shared-kernel/setup-infra.sh +0 -35
  92. package/dist/templates/runtime-bundles/shared-kernel/teardown.sh +0 -35
  93. package/dist/templates/runtime-bundles/shared-kernel/verify.sh +0 -35
  94. package/dist/templates/shared-docs/claude-agent/intro.md +0 -3
  95. /package/dist/templates/profiles/cli/docs/{claude-agent → readme}/project-commands.md +0 -0
  96. /package/dist/templates/profiles/cli/docs/{claude-agent → readme}/readiness.md +0 -0
  97. /package/dist/templates/profiles/default/docs/{claude-agent → readme}/project-commands.md +0 -0
  98. /package/dist/templates/profiles/ios/docs/{claude-agent → readme}/readiness.md +0 -0
@@ -11,14 +11,7 @@ har env teardown 1
11
11
 
12
12
  In Cursor with HAR MCP configured: use `har_launch_environment`, `har_run_verification`, and `har_teardown_environment`.
13
13
 
14
- **Shell shims** (same runtime — each `./.har/*.sh` forwards to `har env`, with a pinned `npx @osfactory/har` fallback):
15
-
16
- ```bash
17
- ./.har/setup-infra.sh # when HARNESS_INFRA_SERVICES is non-empty
18
- ./.har/launch.sh 1
19
- ./.har/verify.sh 1 # quick: ecosystem smoke (compile/import/build)
20
- ./.har/verify.sh 1 --full # + conventional tests, lint, browser-e2e (if installed)
21
- ./.har/teardown.sh 1
22
- ```
14
+ CLI and MCP are the only entry points. `har env eject` vendors the runtime into
15
+ `.har/runtime/` for offline ownership (`node .har/runtime/har.cjs env …`).
23
16
 
24
17
  Read **`stages.json`** and **`verificationStages`**. Optional: `har env add-plugin playwright`.
@@ -1,13 +1,13 @@
1
1
  ## Verification contract
2
2
 
3
- Steps in `verify.sh` are **project-specific examples** — adapt them to your stack
4
- during `har env init` / `har env maintain` / benchmark setup. The table describes
3
+ Steps in `har env verify` are **project-specific examples** — adapt them to your stack
4
+ during scaffold / `har env maintain` / benchmark setup. The table describes
5
5
  each tier's intent, not a fixed command list.
6
6
 
7
7
  | Mode | Command | Typical steps |
8
8
  |------|---------|---------------|
9
- | Quick | `har env verify <id>` or `verify.sh <id>` | Stock ecosystem smoke: compile / import / build conventions |
10
- | Full | `har env verify <id> --full` or `verify.sh <id> --full` | Stock conventional tests/lint + optional readiness smoke, **browser-e2e** when `stages/browser-e2e.sh` exists |
9
+ | Quick | `har env verify <id>` | Stock ecosystem smoke: compile / import / build conventions |
10
+ | Full | `har env verify <id> --full` | Stock conventional tests/lint + optional readiness smoke, **browser-e2e** when `stages/browser-e2e.sh` exists |
11
11
 
12
12
  The stock commands are deliberately generic conventions keyed by
13
13
  `HARNESS_ECOSYSTEM`. Replace them with the repository's real commands during
@@ -19,4 +19,4 @@ harness skips slow local-dev setup, document the skipped steps and add a minimal
19
19
  bootstrap/readiness check when agents need default data, credentials, or an
20
20
  authenticated workflow.
21
21
 
22
- Use `har env launch 1 --no-worktree` or `./.har/launch.sh 1 --no-worktree` only when working in the repo root.
22
+ Use `har env launch 1 --no-worktree` only when working in the repo root.
@@ -11,15 +11,14 @@
11
11
  | `hooks/` | Optional lifecycle hooks (`pre-launch.sh`, `post-launch.sh`, `pre-verify.sh`, `pre-teardown.sh`, `post-teardown.sh`) |
12
12
  | `plugins/` | Optional local plugins (`har plugin create <id>`) |
13
13
  | `docker-compose.agent.yml` | Optional shared infrastructure containers (services listed in `HARNESS_INFRA_SERVICES`) |
14
- | `CLAUDE.agent.md` | Detailed instructions for coding agents |
14
+ | `.har/README.md` | Detailed instructions for coding agents |
15
15
  | `STAGES.md` | Stage registry and script-contract guide |
16
16
  | `justfile` | Optional shortcuts (requires `just`) |
17
17
 
18
- **Generated shims and state** (don't edit — `har env eject` for full ownership):
18
+ **Generated state** (don't edit — `har env eject` vendors `.har/runtime/`):
19
19
 
20
20
  | File | Purpose |
21
21
  |------|---------|
22
- | `launch.sh` / `verify.sh` / `teardown.sh` / `setup-infra.sh` / `preflight.sh` / `agent-cli.sh` | Thin shims forwarding to the packaged runtime (`har env …`); same run records on every surface |
23
22
  | `manifest.json` | Runtime version, profile, checksums — managed by the har CLI |
24
23
  | `runs/` | Run history from every entry point — `.har/runs/YYYY-MM-DD/HH-mm-ss_<stageId>_agent-<id>.json` (gitignored) |
25
24
  | `artifacts/` | Stage outputs: reports, traces, logs |
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "id": "cli",
3
- "description": "CLI/library — shared kernel + CLI overlay (no PM2)",
3
+ "description": "CLI/library \u2014 shared kernel + CLI overlay (no PM2)",
4
4
  "bundles": [
5
- { "id": "shared-kernel", "path": "runtime-bundles/shared-kernel" },
6
- { "id": "runtime-cli", "path": "har-boilerplate-cli" }
5
+ {
6
+ "id": "shared-kernel",
7
+ "path": "runtime-bundles/shared-kernel"
8
+ },
9
+ {
10
+ "id": "runtime-cli",
11
+ "path": "har-boilerplate-cli"
12
+ }
7
13
  ],
8
14
  "capabilities": {
9
15
  "processManager": "none",
@@ -44,20 +50,17 @@
44
50
  "intro",
45
51
  "what-s-in-here",
46
52
  "quick-start",
53
+ "environment",
47
54
  "verification-contract",
55
+ "definition-of-done",
56
+ "readiness",
48
57
  "run-history",
49
58
  "for-coding-agents",
59
+ "project-commands",
50
60
  "port-shared-services-cli-profile",
61
+ "do-not",
51
62
  "maintaining-this-harness",
52
63
  "session-lifecycle"
53
- ],
54
- "CLAUDE.agent.md": [
55
- "intro",
56
- "environment",
57
- "readiness",
58
- "definition-of-done",
59
- "project-commands",
60
- "do-not"
61
64
  ]
62
65
  }
63
66
  }
@@ -1,6 +1,6 @@
1
1
  ## Architecture
2
2
 
3
- Each agent slot gets isolated app ports. Defaults follow `BASE + (AGENT_ID × HARNESS_PORT_STEP)`; when a default is busy, `launch.sh` scans the slot lane (`STEP` increments) and writes the resolved ports to `.env.agent.<id>` and `.har/slots/agent-<id>.json`.
3
+ Each agent slot gets isolated app ports. Defaults follow `BASE + (AGENT_ID × HARNESS_PORT_STEP)`; when a default is busy, `har env launch` scans the slot lane (`STEP` increments) and writes the resolved ports to `.env.agent.<id>` and `.har/slots/agent-<id>.json`.
4
4
 
5
5
  Configure how many slots your machine can run in parallel in `.har/stages.json` (`agentSlots`). Bash scripts and the CLI read that first; `harness.env` keeps legacy `HARNESS_AGENT_SLOT_*` exports in sync via `har env maintain --finalize`.
6
6
 
@@ -1,13 +1,13 @@
1
1
  ## Definition of done
2
2
 
3
- - [ ] Full verification returns `"status": "pass"` (`har env verify ${AGENT_ID} --full`, MCP `har_run_verification` with `full: true`, or `./.har/verify.sh ${AGENT_ID} --full`)
3
+ - [ ] Full verification returns `"status": "pass"` (`har env verify <id> --full`, MCP `har_run_verification` with `full: true`, or `har env verify <id> --full`)
4
4
  - [ ] The slot is agent-usable for this repo's documented smoke workflow, not only health-check green
5
5
  - [ ] Full verify runs every registered stage in `stages.json` `verificationStages` (Playwright, custom checks, …) — when `stages/browser-e2e.sh` exists, adapt specs under `tests/` for UI changes
6
6
  - [ ] New behavior has automated test coverage (unit and/or browser as appropriate)
7
7
  - [ ] Changes committed **in the session worktree** with a clear message
8
8
  - [ ] The user got the preview URLs to test the app themselves
9
9
  - [ ] Present session handoff (summary, branch, preview URLs) and **wait for user** before `complete`, push, or PR
10
- - [ ] On user approval of the default: push + open PR (when `gh`/GitHub MCP available), then `har env complete ${AGENT_ID}` (or MCP `har_complete_environment`) — full verify + validation + teardown, branch kept
10
+ - [ ] On user approval of the default: push + open PR (when `gh`/GitHub MCP available), then `har env complete <id>` (or MCP `har_complete_environment`) — full verify + validation + teardown, branch kept
11
11
 
12
12
  ### Session handoff
13
13
 
@@ -19,6 +19,6 @@ else as alternatives. If PR tooling is unavailable, recommend complete and repor
19
19
  the session branch for a manual push. Prefer `complete` over bare `teardown` when
20
20
  the work succeeded. See `.cursor/rules/har-workflow.mdc` for the handoff shape.
21
21
 
22
- Quick loop during development: MCP `har_run_verification`, `har env verify ${AGENT_ID}`, or `./.har/verify.sh ${AGENT_ID}` (smoke + health only; `--full` adds the registered verification stages).
22
+ Quick loop during development: MCP `har_run_verification`, `har env verify <id>`, or `har env verify <id>` (smoke + health only; `--full` adds the registered verification stages).
23
23
 
24
24
  Stages are the harness's single vocabulary for checks: templates and custom stages compile to generic kinds in `.har/stages.json`, and you interact with them only through the registry (`har_run_stage`, `verify`), never stack-specific tooling. Authoring guide: `.har/STAGES.md`.
@@ -3,8 +3,8 @@
3
3
  - Hand-roll docker/dev-server startup — `launch` is how you run the app (manual testing, browser, screenshots included)
4
4
  - Work around a failing harness command with ad-hoc setup — fix the harness or report the failure
5
5
  - Hardcode ports — use agent env / `agent-cli.sh url`
6
- - Run raw `docker compose` for shared harness infra — use `setup-infra.sh`
6
+ - Run raw `docker compose` for shared harness infra — use `har env setup-infra`
7
7
  - Start other services of the repo in your slot — only the primary app runs per-slot; shared services are already running
8
- - Edit `.env.agent.${AGENT_ID}` or PM2 ecosystem files by hand
8
+ - Edit `.env.agent.<id>` or PM2 ecosystem files by hand
9
9
  - Run `verify` before `launch` when health or e2e steps need a running server
10
10
  - Edit the main checkout — all edits go under the session work dir
@@ -0,0 +1,19 @@
1
+ ## Environment
2
+
3
+ | | |
4
+ |--|--|
5
+ | **Agent ID** | <id> |
6
+ | **Frontend** | http://localhost:${FE_PORT} |
7
+ | **API** | http://localhost:${API_PORT} |
8
+ | **Database** | `agent_<id>` on `localhost:${DB_PORT}` (when `db` is in `HARNESS_INFRA_SERVICES`) |
9
+ | **Work dir** | Fresh session worktree per launch — see the launch output or `.har/slots/agent-<id>.json` |
10
+
11
+ **Never edit the main checkout** — launch FIRST, then make ALL file edits under the work dir from the launch output. Edits there hot-reload in the running slot; use `har env agent <id> restart` if a change doesn't take. An occupied slot always blocks a new launch — run `har env teardown <id>` (or `complete`) first, then launch again.
12
+
13
+ This slot runs **only the primary application** (`HARNESS_PRIMARY_APP`). External dependencies and any supporting services run once, shared by all slots — `har env setup-infra` manages them; never start them yourself.
14
+
15
+ ```bash
16
+ har env agent <id> status
17
+ har env agent <id> logs api
18
+ har env agent <id> health
19
+ ```
@@ -1,9 +1,7 @@
1
1
  ## For coding agents
2
2
 
3
3
  1. Read repo [`AGENTS.md`](../AGENTS.md)
4
- 2. Read this file and `stages.json`
5
- 3. After launch, read `.har/CLAUDE.agent.md` for slot URLs and definition of done
6
-
7
- Prefer HAR MCP tools or `har env …` for launch, verify, and teardown. Use `./.har/*.sh` only when the CLI is not installed.
8
-
9
- Always use `./.har/agent-cli.sh <id> ...` — never hardcoded ports.
4
+ 2. Read this file and `stages.json` — this file is the harness reference:
5
+ slot environment, readiness, definition of done, project commands
6
+ 3. Drive the harness with HAR MCP tools or `har env …`; never hardcode ports —
7
+ ask `har env agent <id> url`
@@ -12,7 +12,7 @@
12
12
  | Mailpit | Per machine | `HARNESS_MAILPIT_*_PORT_DEFAULT` | Scan configured ranges |
13
13
  | Headless browser | Per machine | `HARNESS_BROWSER_PORT_DEFAULT` | Scan configured ranges |
14
14
 
15
- Resolved ports may differ from the formula when something else is already bound. Always use `./.har/agent-cli.sh <id>` or read `.har/slots/agent-<id>.json` — never hardcode `3010`, `15432`, etc. in app code or tests.
15
+ Resolved ports may differ from the formula when something else is already bound. Always use `har env agent <id>` or read `.har/slots/agent-<id>.json` — never hardcode `3010`, `15432`, etc. in app code or tests.
16
16
 
17
17
  ### Shared vs per-slot
18
18
 
@@ -24,18 +24,18 @@ Resolved ports may differ from the formula when something else is already bound.
24
24
  | Primary application | One PM2 ecosystem per slot (isolated ports) | `HARNESS_PRIMARY_APP`, `ecosystem.agent.template.cjs` |
25
25
  | Internal supporting services | Shared across all slots | `docker-compose.agent.yml` or `ecosystem.shared.config.cjs` |
26
26
 
27
- Shared infra starts once via `./.har/setup-infra.sh` (also run automatically by `launch.sh`). Per-slot databases are cloned in `launch.sh`.
27
+ Shared infra starts once via `har env setup-infra` (also run automatically by `har env launch`). Per-slot databases are cloned in `har env launch`.
28
28
 
29
29
  ### Do not
30
30
 
31
31
  - Hardcode default ports (`3000`, `15432`, `3847`, …) in application code, tests, or agent docs — read from `.env.agent.<id>`, `agent-cli.sh`, or the slot registry
32
- - Run raw `docker compose` for harness infrastructure — use `setup-infra.sh` / `launch.sh` so ports are scanned and persisted in `.har/state/infra.env`
32
+ - Run raw `docker compose` for harness infrastructure — use `har env setup-infra` / `har env launch` so ports are scanned and persisted in `.har/state/infra.env`
33
33
 
34
34
  ### Primary app vs shared services
35
35
 
36
36
  Each slot runs **only the primary application** (`HARNESS_PRIMARY_APP` in `harness.env`) — the app agents modify. Everything else runs **once**, shared by all slots on fixed ports:
37
37
 
38
- - **External dependencies** (Postgres, Redis, mail, ...): services in `docker-compose.agent.yml`, enabled via the `HARNESS_INFRA_SERVICES` list in `harness.env`, started by `setup-infra.sh`.
39
- - **Internal supporting services** (other services of a monolith/monorepo the agent depends on but does not change): either compose services in `docker-compose.agent.yml`, or PM2 processes in an optional `.har/ecosystem.shared.config.cjs` (named `har-shared-<name>`, started by `setup-infra.sh`).
38
+ - **External dependencies** (Postgres, Redis, mail, ...): services in `docker-compose.agent.yml`, enabled via the `HARNESS_INFRA_SERVICES` list in `harness.env`, started by `har env setup-infra`.
39
+ - **Internal supporting services** (other services of a monolith/monorepo the agent depends on but does not change): either compose services in `docker-compose.agent.yml`, or PM2 processes in an optional `.har/ecosystem.shared.config.cjs` (named `har-shared-<name>`, started by `har env setup-infra`).
40
40
 
41
41
  Isolation still applies where it matters: each slot gets its own database (`agent_<id>`, cloned from the template DB), ports, and git worktree.
@@ -11,14 +11,7 @@ har env teardown 1
11
11
 
12
12
  In Cursor with HAR MCP configured: use `har_launch_environment`, `har_run_verification`, and `har_teardown_environment`.
13
13
 
14
- **Shell shims** (same runtime — each `./.har/*.sh` forwards to `har env`, with a pinned `npx @osfactory/har` fallback):
15
-
16
- ```bash
17
- ./.har/setup-infra.sh # when HARNESS_INFRA_SERVICES is non-empty
18
- ./.har/launch.sh 1
19
- ./.har/verify.sh 1 # quick: ecosystem smoke + health
20
- ./.har/verify.sh 1 --full # + conventional tests/lint, browser-e2e (if installed)
21
- ./.har/teardown.sh 1
22
- ```
14
+ CLI and MCP are the only entry points. `har env eject` vendors the runtime into
15
+ `.har/runtime/` for offline ownership (`node .har/runtime/har.cjs env …`).
23
16
 
24
17
  Read **`stages.json`** for registered stages and **`verificationStages`** for the expected pass set.
@@ -5,10 +5,10 @@ section for the repository:
5
5
 
6
6
  | Layer | What it means | Where to encode it |
7
7
  |-------|---------------|--------------------|
8
- | Infra ready | Shared services and template data stores exist | `setup-infra.sh`, `docker-compose.agent.yml` |
9
- | Slot data ready | Every per-slot data store is created/cloned | `launch.sh` |
10
- | Process ready | Primary app is running and health passes | `launch.sh`, `verify.sh` |
11
- | Agent usable | Login/API/UI smoke works with documented data | `HARNESS_READINESS_CMD`, browser-e2e, `CLAUDE.agent.md` |
8
+ | Infra ready | Shared services and template data stores exist | `har env setup-infra`, `docker-compose.agent.yml` |
9
+ | Slot data ready | Every per-slot data store is created/cloned | `har env launch` |
10
+ | Process ready | Primary app is running and health passes | `har env launch`, `har env verify` |
11
+ | Agent usable | Login/API/UI smoke works with documented data | `HARNESS_READINESS_CMD`, browser-e2e, `.har/README.md` |
12
12
 
13
13
  If full local-dev setup is too heavy to run in the harness, document the skipped
14
14
  steps and add the minimum substitute directly in `.har/` scripts (for example an
@@ -3,7 +3,7 @@
3
3
  Adapt this section for the repository. A passing health check means the process
4
4
  is alive; it does not automatically mean an agent can use the app.
5
5
 
6
- - **Health**: `./.har/agent-cli.sh ${AGENT_ID} health`
6
+ - **Health**: `har env agent <id> health`
7
7
  - **Agent-usable smoke**: document the login/API/UI workflow agents should try,
8
8
  or wire it into `HARNESS_READINESS_CMD` / full verify.
9
9
  - **Credentials/default data**: document any test users, tenants, projects, or
@@ -1,13 +1,13 @@
1
1
  ## Verification contract
2
2
 
3
- Steps in `verify.sh` are **project-specific examples** — adapt them to your stack
4
- during `har env init` / `har env maintain`. The table describes each tier's intent,
3
+ Steps in `har env verify` are **project-specific examples** — adapt them to your stack
4
+ during scaffold / `har env maintain`. The table describes each tier's intent,
5
5
  not a fixed command list.
6
6
 
7
7
  | Mode | Command | Typical steps |
8
8
  |------|---------|---------------|
9
- | Quick | `har env verify <id>` or `verify.sh <id>` | Stock ecosystem smoke + health (stops early on failure) |
10
- | Full | `har env verify <id> --full` or `verify.sh <id> --full` | Stock conventional tests/lint, optional readiness smoke + **`browser-e2e`** when `.har/stages/browser-e2e.sh` exists |
9
+ | Quick | `har env verify <id>` | Stock ecosystem smoke + health (stops early on failure) |
10
+ | Full | `har env verify <id> --full` | Stock conventional tests/lint, optional readiness smoke + **`browser-e2e`** when `.har/stages/browser-e2e.sh` exists |
11
11
 
12
12
  The stock commands are deliberately generic conventions keyed by
13
13
  `HARNESS_ECOSYSTEM`. Replace them with the repository's real commands during
@@ -14,15 +14,14 @@
14
14
  | `ecosystem.agent.template.cjs` | PM2 processes for the **primary app only** (expanded at launch) |
15
15
  | `ecosystem.shared.config.cjs` | Optional — shared app services started once with the infra (only when the repo has supporting services) |
16
16
  | `docker-compose.agent.yml` | Shared infrastructure containers (services listed in `HARNESS_INFRA_SERVICES`) |
17
- | `CLAUDE.agent.md` | Detailed instructions for coding agents |
17
+ | `.har/README.md` | Detailed instructions for coding agents |
18
18
  | `STAGES.md` | Stage registry and script-contract guide |
19
19
  | `justfile` | Optional shortcuts (requires `just`) |
20
20
 
21
- **Generated shims and state** (don't edit — `har env eject` for full ownership):
21
+ **Generated state** (don't edit — `har env eject` vendors `.har/runtime/`):
22
22
 
23
23
  | File | Purpose |
24
24
  |------|---------|
25
- | `launch.sh` / `verify.sh` / `teardown.sh` / `setup-infra.sh` / `preflight.sh` / `agent-cli.sh` / `attach.sh` | Thin shims forwarding to the packaged runtime (`har env …`); same run records on every surface |
26
25
  | `manifest.json` | Runtime version, profile, checksums — managed by the har CLI |
27
26
  | `runs/` | Run history from every entry point — `.har/runs/YYYY-MM-DD/HH-mm-ss_<stageId>_agent-<id>.json` (gitignored) |
28
27
  | `artifacts/` | Stage outputs: reports, traces, screenshots, logs |
@@ -1,16 +1,27 @@
1
1
  {
2
2
  "id": "default",
3
- "description": "Web app — shared kernel + PM2 runtime + Docker infra",
3
+ "description": "Web app \u2014 shared kernel + PM2 runtime + Docker infra",
4
4
  "bundles": [
5
- { "id": "shared-kernel", "path": "runtime-bundles/shared-kernel" },
6
- { "id": "pm2-runtime", "path": "runtime-bundles/pm2-runtime" },
7
- { "id": "runtime-default", "path": "har-boilerplate" }
5
+ {
6
+ "id": "shared-kernel",
7
+ "path": "runtime-bundles/shared-kernel"
8
+ },
9
+ {
10
+ "id": "pm2-runtime",
11
+ "path": "runtime-bundles/pm2-runtime"
12
+ },
13
+ {
14
+ "id": "runtime-default",
15
+ "path": "har-boilerplate"
16
+ }
8
17
  ],
9
18
  "capabilities": {
10
19
  "processManager": "pm2",
11
20
  "appPortLanes": true,
12
21
  "infra": {
13
- "defaultServices": ["db"],
22
+ "defaultServices": [
23
+ "db"
24
+ ],
14
25
  "portLanes": "db=15432:15432-15499 minio=19000:19000-19049 minio-console=19050:19050-19099 browser=13001:13001-13099 mailpit-web=18025:18025-18099 mailpit-smtp=11025:11025-11099"
15
26
  },
16
27
  "defaultStages": [
@@ -49,22 +60,19 @@
49
60
  "intro",
50
61
  "what-s-in-here",
51
62
  "quick-start",
63
+ "environment",
52
64
  "verification-contract",
65
+ "definition-of-done",
66
+ "readiness",
53
67
  "readiness-layers",
54
68
  "run-history",
55
69
  "for-coding-agents",
70
+ "project-commands",
56
71
  "architecture",
57
72
  "port-shared-services",
73
+ "do-not",
58
74
  "maintaining-this-harness",
59
75
  "session-lifecycle"
60
- ],
61
- "CLAUDE.agent.md": [
62
- "intro",
63
- "environment",
64
- "readiness",
65
- "definition-of-done",
66
- "project-commands",
67
- "do-not"
68
76
  ]
69
77
  }
70
78
  }
@@ -1,12 +1,12 @@
1
1
  ## Definition of done
2
2
 
3
- - [ ] Full verification returns `"status": "pass"` (`har env verify ${AGENT_ID} --full`, MCP `har_run_verification` with `full: true`, or `./.har/verify.sh ${AGENT_ID} --full`)
3
+ - [ ] Full verification returns `"status": "pass"` (`har env verify <id> --full`, MCP `har_run_verification` with `full: true`, or `har env verify <id> --full`)
4
4
  - [ ] The slot is agent-usable for this repo's documented smoke workflow when runtime services are involved
5
5
  - [ ] When `stages/rocketsim-flows.sh` exists, full verify includes user-flow validation — add or update flow scripts in `flows/` for UI changes
6
6
  - [ ] New behavior has automated test coverage (unit tests via XCTest)
7
7
  - [ ] Changes committed **in the session worktree** with a clear message
8
8
  - [ ] Present session handoff (summary, branch, preview URLs) and **wait for user** before `complete`, push, or PR
9
- - [ ] On user approval of the default: push + open PR (when `gh`/GitHub MCP available), then `har env complete ${AGENT_ID}` (or MCP `har_complete_environment`) — full verify + validation + teardown, branch kept
9
+ - [ ] On user approval of the default: push + open PR (when `gh`/GitHub MCP available), then `har env complete <id>` (or MCP `har_complete_environment`) — full verify + validation + teardown, branch kept
10
10
 
11
11
  ### Session handoff
12
12
 
@@ -18,6 +18,6 @@ else as alternatives. If PR tooling is unavailable, recommend complete and repor
18
18
  the session branch for a manual push. Prefer `complete` over bare `teardown` when
19
19
  the work succeeded. See `.cursor/rules/har-workflow.mdc` for the handoff shape.
20
20
 
21
- Quick loop: MCP `har_run_verification`, `har env verify ${AGENT_ID}`, or `./.har/verify.sh ${AGENT_ID}`
21
+ Quick loop: MCP `har_run_verification`, `har env verify <id>`, or `har env verify <id>`
22
22
 
23
23
  Stages are the harness's single vocabulary for checks: templates and custom stages compile to generic kinds in `.har/stages.json`, and you interact with them only through the registry (`har_run_stage`, `verify`), never stack-specific tooling. Authoring guide: `.har/STAGES.md`.
@@ -1,6 +1,6 @@
1
1
  ## Do not
2
2
 
3
3
  - Work around a failing harness command with ad-hoc setup — fix the harness or report the failure
4
- - Edit `.env.agent.${AGENT_ID}` by hand
4
+ - Edit `.env.agent.<id>` by hand
5
5
  - Run verify before launch (the simulator and worktree must be set up first)
6
6
  - Edit the main checkout — all edits go under the session work dir
@@ -2,13 +2,13 @@
2
2
 
3
3
  | | |
4
4
  |--|--|
5
- | **Agent ID** | ${AGENT_ID} |
6
- | **Work dir** | Fresh session worktree per launch — see the launch output or `.har/slots/agent-${AGENT_ID}.json` |
7
- | **Simulator** | Created for this slot at launch — `HARNESS_SIMULATOR_UDID` in `.env.agent.${AGENT_ID}` |
5
+ | **Agent ID** | <id> |
6
+ | **Work dir** | Fresh session worktree per launch — see the launch output or `.har/slots/agent-<id>.json` |
7
+ | **Simulator** | Created for this slot at launch — `HARNESS_SIMULATOR_UDID` in `.env.agent.<id>` |
8
8
  | **Scheme** | Configured in `.har/harness.env` — `HARNESS_XCODE_SCHEME` |
9
9
 
10
10
  **Never edit the main checkout** — launch FIRST, then make ALL file edits under the work dir from the launch output. An occupied slot always blocks a new launch — run `har env teardown <id>` (or `complete <id>`) first, then launch again.
11
11
 
12
12
  ```bash
13
- ./.har/agent-cli.sh ${AGENT_ID} status
13
+ har env agent <id> status
14
14
  ```
@@ -9,17 +9,17 @@ Pure iOS apps have **no per-slot TCP ports** — agents build and run on a share
9
9
  | Optional backend (compose) | Per machine | `HARNESS_*_PORT_DEFAULT` for that service | Scan configured ranges in `harness.env` |
10
10
  | iOS Simulator | Per slot | One device created per agent — no harness port | None: `har-<project>-agent-<id>-<model>` is unique per slot |
11
11
 
12
- When your app talks to a local backend, read the resolved host port from `.env.agent.<id>` (set by `setup-infra.sh`) — never hardcode `15432` or similar in tests or flow scripts.
12
+ When your app talks to a local backend, read the resolved host port from `.env.agent.<id>` (set by `har env setup-infra`) — never hardcode `15432` or similar in tests or flow scripts.
13
13
 
14
14
  ### Shared vs per-slot
15
15
 
16
16
  | Resource | Model | Configuration |
17
17
  |----------|-------|---------------|
18
- | iOS Simulator | One device created per slot, deleted at teardown | `HARNESS_SIMULATOR_*`, `launch.sh` |
18
+ | iOS Simulator | One device created per slot, deleted at teardown | `HARNESS_SIMULATOR_*`, `har env launch` |
19
19
  | Optional backend | One shared compose service | `HARNESS_INFRA_SERVICES` (e.g. `"mock-server"`) |
20
20
  | Application code | Isolated git worktree per slot | `HARNESS_USE_WORKTREE=true` |
21
21
 
22
22
  ### Do not
23
23
 
24
24
  - Hardcode backend ports in RocketSim flows or unit tests — read from agent env
25
- - Run raw `docker compose` for harness infrastructure — use `setup-infra.sh`
25
+ - Run raw `docker compose` for harness infrastructure — use `har env setup-infra`
@@ -2,10 +2,10 @@
2
2
 
3
3
  Target **this slot's** simulator, never `booted` — another agent's device may also
4
4
  be booted. `HARNESS_IOS_DESTINATION` and `HARNESS_SIMULATOR_UDID` come from
5
- `.env.agent.${AGENT_ID}`.
5
+ `.env.agent.<id>`.
6
6
 
7
7
  ```bash
8
- source .env.agent.${AGENT_ID}
8
+ source .env.agent.<id>
9
9
 
10
10
  # Build
11
11
  xcodebuild build -scheme MyApp -destination "$HARNESS_IOS_DESTINATION" CODE_SIGNING_ALLOWED=NO
@@ -14,8 +14,8 @@ xcodebuild build -scheme MyApp -destination "$HARNESS_IOS_DESTINATION" CODE_SIGN
14
14
  xcodebuild test -scheme MyApp -destination "$HARNESS_IOS_DESTINATION"
15
15
 
16
16
  # Install and launch on this slot's device
17
- ./.har/agent-cli.sh ${AGENT_ID} install path/to/MyApp.app
18
- ./.har/agent-cli.sh ${AGENT_ID} launch-app
17
+ har env agent <id> install path/to/MyApp.app
18
+ har env agent <id> launch-app
19
19
  ```
20
20
 
21
21
  Adapt for your scheme — see `.har/harness.env`.
@@ -11,12 +11,5 @@ har env teardown 1
11
11
 
12
12
  In Cursor with HAR MCP configured: use `har_launch_environment`, `har_run_verification`, and `har_teardown_environment`.
13
13
 
14
- **Shell shims** (same runtime — each `./.har/*.sh` forwards to `har env`, with a pinned `npx @osfactory/har` fallback):
15
-
16
- ```bash
17
- ./.har/setup-infra.sh # boots the iOS Simulator
18
- ./.har/launch.sh 1
19
- ./.har/verify.sh 1 # quick: build smoke (compile-only)
20
- ./.har/verify.sh 1 --full # + unit tests, lint, rocketsim-flows (if installed)
21
- ./.har/teardown.sh 1
22
- ```
14
+ CLI and MCP are the only entry points. `har env eject` vendors the runtime into
15
+ `.har/runtime/` for offline ownership (`node .har/runtime/har.cjs env …`).
@@ -12,7 +12,7 @@ store, nothing carried over from the previous session.
12
12
  | `HARNESS_SIMULATOR_NAME` | The model to create — `iPhone 16`, `iPhone 17 Pro`, `iPad Air 11-inch (M2)`. Empty means the newest model of the family. See `xcrun simctl list devicetypes`. |
13
13
  | `HARNESS_SIMULATOR_FAMILY` | `auto` (read from the name) \| `iPhone` \| `iPad`. An iPad is only created when this resolves to iPad. |
14
14
  | `HARNESS_SIMULATOR_UDID` | Run every slot on one existing device instead. Slots then share it — for one-off debugging. |
15
- | `HARNESS_SIMULATOR_SHARED` | `true` restores one shared simulator for all slots, booted by `setup-infra.sh`. |
15
+ | `HARNESS_SIMULATOR_SHARED` | `true` restores one shared simulator for all slots, booted by `har env setup-infra`. |
16
16
 
17
17
  The runtime is the newest installed iOS that supports the model — a model retired
18
18
  from recent runtimes still resolves against an older one. When nothing matches,
@@ -42,4 +42,4 @@ blaming a sandbox.
42
42
  The device lands in `.env.agent.<id>` as `HARNESS_SIMULATOR_UDID`,
43
43
  `HARNESS_SIMULATOR_DEVICE_NAME` and `HARNESS_IOS_DESTINATION` — the model stays in
44
44
  `HARNESS_SIMULATOR_NAME`, so the two never mean the same thing in one place; what a slot holds is tracked in `.har/simulators/`.
45
- Use `./.har/agent-cli.sh <id> simulator` to see it.
45
+ Use `har env agent <id> simulator` to see it.
@@ -3,9 +3,9 @@
3
3
  If the RocketSim plugin is installed (`har env add-plugin rocketsim`):
4
4
 
5
5
  ```bash
6
- ./.har/stages/rocketsim-flows.sh ${AGENT_ID}
6
+ ./.har/stages/rocketsim-flows.sh <id>
7
7
  # included in:
8
- ./.har/verify.sh ${AGENT_ID} --full
8
+ har env verify <id> --full
9
9
  ```
10
10
 
11
11
  Add and edit user flow scripts in `flows/`. Read `.har/stages/ROCKETSIM.md` for the full authoring guide.
@@ -1,6 +1,6 @@
1
1
  ## Verification contract
2
2
 
3
- Steps in `verify.sh` are **project-specific examples** — adapt them to your stack.
3
+ Steps in `har env verify` are **project-specific examples** — adapt them to your stack.
4
4
  The table describes each tier's intent, not a fixed command list.
5
5
 
6
6
  | Mode | Command | Typical steps |
@@ -11,15 +11,14 @@
11
11
  | `hooks/` | Optional lifecycle hooks (`pre-launch.sh`, `post-launch.sh`, `pre-verify.sh`, `pre-teardown.sh`, `post-teardown.sh`) |
12
12
  | `plugins/` | Optional local plugins (`har plugin create <id>`) |
13
13
  | `docker-compose.agent.yml` | Optional shared backend services |
14
- | `CLAUDE.agent.md` | Detailed instructions for coding agents |
14
+ | `.har/README.md` | Detailed instructions for coding agents |
15
15
  | `STAGES.md` | Stage registry and script-contract guide |
16
16
  | `justfile` | Optional shortcuts (requires `just`) |
17
17
 
18
- **Generated shims and state** (don't edit — `har env eject` for full ownership):
18
+ **Generated state** (don't edit — `har env eject` vendors `.har/runtime/`):
19
19
 
20
20
  | File | Purpose |
21
21
  |------|---------|
22
- | `launch.sh` / `verify.sh` / `teardown.sh` / `setup-infra.sh` / `preflight.sh` / `agent-cli.sh` | Thin shims forwarding to the packaged runtime (`har env …`); same run records on every surface |
23
22
  | `manifest.json` | Runtime version, profile, checksums — managed by the har CLI |
24
23
  | `runs/` | Run history from every entry point — `.har/runs/YYYY-MM-DD/HH-mm-ss_<stageId>_agent-<id>.json` (gitignored) |
25
24
  | `artifacts/` | Stage outputs: test results, screenshots, logs |
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "id": "ios",
3
- "description": "iOS — shared kernel + Xcode/Simulator overlay (simulator runtime lives in the package)",
3
+ "description": "iOS \u2014 shared kernel + Xcode/Simulator overlay (simulator runtime lives in the package)",
4
4
  "bundles": [
5
- { "id": "shared-kernel", "path": "runtime-bundles/shared-kernel" },
6
- { "id": "runtime-ios", "path": "har-boilerplate-ios" }
5
+ {
6
+ "id": "shared-kernel",
7
+ "path": "runtime-bundles/shared-kernel"
8
+ },
9
+ {
10
+ "id": "runtime-ios",
11
+ "path": "har-boilerplate-ios"
12
+ }
7
13
  ],
8
14
  "capabilities": {
9
15
  "processManager": "simulator",
@@ -45,21 +51,18 @@
45
51
  "intro",
46
52
  "what-s-in-here",
47
53
  "quick-start",
54
+ "environment",
48
55
  "user-flow-validation",
49
56
  "verification-contract",
57
+ "definition-of-done",
58
+ "readiness",
59
+ "project-commands",
60
+ "user-flow-validation-rocketsim",
50
61
  "configuration",
51
62
  "simulators",
52
63
  "port-shared-services-ios-profile",
64
+ "do-not",
53
65
  "session-lifecycle"
54
- ],
55
- "CLAUDE.agent.md": [
56
- "intro",
57
- "environment",
58
- "readiness",
59
- "definition-of-done",
60
- "project-commands",
61
- "user-flow-validation-rocketsim",
62
- "do-not"
63
66
  ]
64
67
  }
65
68
  }
@@ -67,7 +67,7 @@ Every script under `.har/stages/` must:
67
67
  2. Take the agent slot id as `$1`, falling back to the exported `AGENT_ID`
68
68
  (`AGENT_ID="${1:-${AGENT_ID:?...}}"`); extra args may follow.
69
69
  3. Guard the runner contract with `${ENV_FILE:?...}` / `${WORK_DIR:?...}`
70
- (pointing at `./.har/launch.sh <id>`) and run checks from `$WORK_DIR`.
70
+ (pointing at `har env launch <id>`) and run checks from `$WORK_DIR`.
71
71
  4. Write artifacts (reports, screenshots, logs) under `.har/artifacts/<id>/`.
72
72
  5. Print **only** the normalized JSON result object on stdout
73
73
  (`status`, `stageId`, `agent_id`, `total_ms`, …); log progress to stderr.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // Verification runner: executes the stages.json verification plan.
3
- // Invoked by .har/verify.sh after it sources harness.env and the agent env
3
+ // Invoked by `har env verify` after it sources harness.env and the agent env
4
4
  // file (so the full slot environment is inherited). Replaces the bash
5
5
  // run_step/run_http_step/RESULTS_JSON plumbing: step names may contain any
6
6
  // characters, no result is ever silently dropped, and stage env vars are
@@ -9,6 +9,6 @@ har env maintain
9
9
  The authoring agent reconciles the config surface and this README. Review changes before committing.
10
10
 
11
11
  Customize through the contract — config (`harness.env`), stages (`stages.json` +
12
- `stages/`), hooks (`hooks/`), plugins (`plugins/`). The `*.sh` files are generated
13
- shims over the packaged runtime: don't edit them (`har env eject` exists for full
14
- ownership). `har env doctor` validates the result.
12
+ `stages/`), hooks (`hooks/`), plugins (`plugins/`). Drive the harness with
13
+ `har env …` or MCP. `har env eject` vendors `.har/runtime/` for offline ownership.
14
+ `har env doctor` validates the result.