@osfactory/har 1.0.0 → 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 (61) hide show
  1. package/dist/index.js +813 -818
  2. package/dist/templates/AGENTS.md.template +1 -1
  3. package/dist/templates/adaptation-prompt-init.md +18 -23
  4. package/dist/templates/adaptation-prompt-maintain.md +1 -1
  5. package/dist/templates/adaptation-prompt-plugin.md +1 -1
  6. package/dist/templates/agent-skills/har-wt.md +1 -1
  7. package/dist/templates/agent-skills/setup-har.md +4 -4
  8. package/dist/templates/har-boilerplate/harness.env +1 -1
  9. package/dist/templates/har-boilerplate/justfile +11 -12
  10. package/dist/templates/har-boilerplate/stages.json +3 -9
  11. package/dist/templates/har-boilerplate-cli/harness.env +1 -1
  12. package/dist/templates/har-boilerplate-cli/justfile +9 -10
  13. package/dist/templates/har-boilerplate-cli/stages.json +2 -7
  14. package/dist/templates/har-boilerplate-ios/harness.env +1 -1
  15. package/dist/templates/har-boilerplate-ios/justfile +9 -10
  16. package/dist/templates/har-boilerplate-ios/stages.json +3 -8
  17. package/dist/templates/migration-prompt.md +2 -2
  18. package/dist/templates/plugins/custom-stage-skeleton.sh +2 -2
  19. package/dist/templates/plugins/gitleaks/.har/stages/secrets-scan.sh +2 -2
  20. package/dist/templates/plugins/gitleaks/template.manifest.json +1 -1
  21. package/dist/templates/plugins/kerno/.github/workflows/kerno.yml +1 -1
  22. package/dist/templates/plugins/kerno/.har/stages/KERNO.md +2 -2
  23. package/dist/templates/plugins/kerno/.har/stages/backend-validation.sh +3 -3
  24. package/dist/templates/plugins/kerno/README.md +2 -2
  25. package/dist/templates/plugins/kerno/template.manifest.json +1 -1
  26. package/dist/templates/plugins/playwright/.har/stages/PLAYWRIGHT.md +2 -2
  27. package/dist/templates/plugins/playwright/.har/stages/browser-e2e.sh +3 -3
  28. package/dist/templates/plugins/playwright/README.md +1 -1
  29. package/dist/templates/plugins/playwright/playwright.config.js +2 -2
  30. package/dist/templates/plugins/playwright/template.manifest.json +1 -1
  31. package/dist/templates/plugins/rocketsim/.har/stages/ROCKETSIM.md +1 -1
  32. package/dist/templates/plugins/rocketsim/.har/stages/rocketsim-flows.sh +3 -3
  33. package/dist/templates/plugins/rocketsim/README.md +1 -1
  34. package/dist/templates/plugins/rocketsim/flows/example-smoke.sh +1 -1
  35. package/dist/templates/plugins/rocketsim/template.manifest.json +1 -1
  36. package/dist/templates/plugins/semgrep/.har/stages/SEMGREP.md +1 -1
  37. package/dist/templates/plugins/semgrep/.har/stages/sast.sh +3 -3
  38. package/dist/templates/plugins/semgrep/README.md +2 -2
  39. package/dist/templates/plugins/semgrep/template.manifest.json +1 -1
  40. package/dist/templates/plugins/trivy/.har/stages/TRIVY.md +1 -1
  41. package/dist/templates/plugins/trivy/.har/stages/vuln-scan.sh +3 -3
  42. package/dist/templates/plugins/trivy/template.manifest.json +1 -1
  43. package/dist/templates/profiles/cli/docs/readme/quick-start.md +2 -3
  44. package/dist/templates/profiles/cli/docs/readme/verification-contract.md +3 -3
  45. package/dist/templates/profiles/cli/docs/readme/what-s-in-here.md +1 -2
  46. package/dist/templates/profiles/default/docs/readme/quick-start.md +2 -3
  47. package/dist/templates/profiles/default/docs/readme/verification-contract.md +3 -3
  48. package/dist/templates/profiles/default/docs/readme/what-s-in-here.md +1 -2
  49. package/dist/templates/profiles/ios/docs/readme/quick-start.md +2 -3
  50. package/dist/templates/profiles/ios/docs/readme/what-s-in-here.md +1 -2
  51. package/dist/templates/runtime-bundles/shared-kernel/STAGES.md +1 -1
  52. package/dist/templates/runtime-bundles/shared-kernel/lib/verify-runner.mjs +1 -1
  53. package/dist/templates/shared-docs/readme/maintaining-this-harness.md +3 -3
  54. package/package.json +1 -1
  55. package/dist/templates/runtime-bundles/pm2-runtime/attach.sh +0 -53
  56. package/dist/templates/runtime-bundles/shared-kernel/agent-cli.sh +0 -52
  57. package/dist/templates/runtime-bundles/shared-kernel/launch.sh +0 -52
  58. package/dist/templates/runtime-bundles/shared-kernel/preflight.sh +0 -52
  59. package/dist/templates/runtime-bundles/shared-kernel/setup-infra.sh +0 -52
  60. package/dist/templates/runtime-bundles/shared-kernel/teardown.sh +0 -52
  61. package/dist/templates/runtime-bundles/shared-kernel/verify.sh +0 -52
@@ -3,7 +3,7 @@
3
3
  # Outputs JSON to stdout, human-readable progress to stderr.
4
4
  #
5
5
  # Usage: ./.har/stages/browser-e2e.sh <agent-id>
6
- # Prerequisite: ./.har/launch.sh <agent-id>
6
+ # Prerequisite: har env launch <agent-id>
7
7
  set -euo pipefail
8
8
 
9
9
  # 1.0 stage surface: the runner exports WORK_DIR, ENV_FILE, AGENT_ID and
@@ -17,8 +17,8 @@ now_ms() { node -e 'process.stdout.write(String(Date.now()))'; }
17
17
 
18
18
  log() { echo "==> [browser-e2e agent-$AGENT_ID] $*" >&2; }
19
19
 
20
- ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run ./.har/launch.sh ${AGENT_ID} first}"
21
- WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run ./.har/launch.sh ${AGENT_ID} first}"
20
+ ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
21
+ WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
22
22
  FE_PORT="${FE_PORT:-$(( HARNESS_FE_BASE_PORT + AGENT_ID * 10 ))}"
23
23
  API_PORT="${API_PORT:-$(( HARNESS_API_BASE_PORT + AGENT_ID * 10 ))}"
24
24
 
@@ -7,7 +7,7 @@ This plugin was added by `har env add-plugin playwright`. It registers a `browse
7
7
  ```bash
8
8
  npm install
9
9
  npx playwright install
10
- ./.har/launch.sh 1
10
+ har env launch 1
11
11
  ./.har/stages/browser-e2e.sh 1
12
12
  ```
13
13
 
@@ -4,14 +4,14 @@
4
4
  // -------------------
5
5
  // - Stage id: `browser-e2e` (`.har/stages/browser-e2e.sh`, registered in `stages.json`).
6
6
  // - Runs automatically on FULL verify only — not on quick verify:
7
- // ./.har/verify.sh <id> --full
7
+ // har env verify <id> --full
8
8
  // har env verify <id> --full
9
9
  // har env complete <id> # always full; required before declaring done
10
10
  // - Quick verify (`verify.sh <id>`) stops at typecheck / unit tests / api-health.
11
11
  //
12
12
  // Prerequisites
13
13
  // -------------
14
- // 1. Launch a slot first: ./.har/launch.sh <id>
14
+ // 1. Launch a slot first: har env launch <id>
15
15
  // 2. Install browsers once: npx playwright install chromium
16
16
  //
17
17
  // Environment (injected by browser-e2e.sh — never hardcode slot ports in specs)
@@ -67,7 +67,7 @@
67
67
  "nextSteps": [
68
68
  "npm install",
69
69
  "npx playwright install",
70
- "./.har/launch.sh 1",
70
+ "har env launch 1",
71
71
  "./.har/stages/browser-e2e.sh 1",
72
72
  "npx playwright show-report .har/artifacts/browser-e2e/playwright-report"
73
73
  ],
@@ -111,7 +111,7 @@ fi
111
111
  ./.har/stages/rocketsim-flows.sh 1 example-smoke
112
112
 
113
113
  # Included in full verify
114
- ./.har/verify.sh 1 --full
114
+ har env verify 1 --full
115
115
  ```
116
116
 
117
117
  Screenshots and per-flow logs are saved under `.har/artifacts/rocketsim-flows/`.
@@ -6,7 +6,7 @@
6
6
  # Usage: ./.har/stages/rocketsim-flows.sh <agent-id> [flow-name]
7
7
  # flow-name (optional): run only flows/<flow-name>.sh instead of all flows
8
8
  #
9
- # Prerequisite: ./.har/launch.sh <agent-id> AND app installed+running on simulator
9
+ # Prerequisite: har env launch <agent-id> AND app installed+running on simulator
10
10
  # See: ./.har/stages/ROCKETSIM.md for the full authoring guide.
11
11
  set -euo pipefail
12
12
 
@@ -38,8 +38,8 @@ if ! rocketsim doctor --quiet 2>/dev/null; then
38
38
  fi
39
39
 
40
40
  # ── Resolve agent env ─────────────────────────────────────────────────────────
41
- ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run ./.har/launch.sh ${AGENT_ID} first}"
42
- WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run ./.har/launch.sh ${AGENT_ID} first}"
41
+ ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
42
+ WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
43
43
 
44
44
  # ── Discover flows ─────────────────────────────────────────────────────────────
45
45
  FLOWS_DIR="$WORK_DIR/flows"
@@ -62,5 +62,5 @@ cp flows/example-smoke.sh flows/my-feature.sh
62
62
  ./.har/stages/rocketsim-flows.sh 1
63
63
 
64
64
  # 7. Validate everything
65
- ./.har/verify.sh 1 --full
65
+ har env verify 1 --full
66
66
  ```
@@ -20,7 +20,7 @@ log() { echo "==> [example-smoke] $*" >&2; }
20
20
  log "Checking simulator focus..."
21
21
  FOCUSED=$(rocketsim simulator focused 2>/dev/null || echo "")
22
22
  if [ -z "$FOCUSED" ]; then
23
- log "✗ No focused simulator — run ./.har/setup-infra.sh first"
23
+ log "✗ No focused simulator — run har env setup-infra first"
24
24
  exit 1
25
25
  fi
26
26
  log "Simulator: $(echo "$FOCUSED" | node -e "let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const j=JSON.parse(d);process.stdout.write(j.name||d.trim());}catch{process.stdout.write(d.trim());}})" 2>/dev/null || echo "$FOCUSED")"
@@ -41,7 +41,7 @@
41
41
  ],
42
42
  "nextSteps": [
43
43
  "rocketsim doctor",
44
- "./.har/launch.sh 1",
44
+ "har env launch 1",
45
45
  "Build and install your app on the simulator",
46
46
  "./.har/stages/rocketsim-flows.sh 1",
47
47
  "Open .har/artifacts/rocketsim-flows/ for screenshots and per-flow results",
@@ -14,7 +14,7 @@ runs it automatically once it is listed in `verificationStages`.
14
14
  ./.har/stages/sast.sh 1 src/ lib/auth.py
15
15
 
16
16
  # Included in full verify
17
- ./.har/verify.sh 1 --full
17
+ har env verify 1 --full
18
18
  ```
19
19
 
20
20
  Reports land under `.har/artifacts/sast/` in the **main repo root** (not the worktree):
@@ -11,7 +11,7 @@
11
11
  # .har/harness.env to pin rulesets. Registry configs (auto, p/...) need
12
12
  # network access and send pseudonymized metrics to semgrep.dev.
13
13
  #
14
- # Prerequisite: ./.har/launch.sh <agent-id> AND the semgrep CLI installed
14
+ # Prerequisite: har env launch <agent-id> AND the semgrep CLI installed
15
15
  # See: ./.har/stages/SEMGREP.md for the full adaptation guide.
16
16
  set -euo pipefail
17
17
 
@@ -44,8 +44,8 @@ fi
44
44
  # Artifacts land in the main repo root (where .har/ lives), not the worktree.
45
45
  MAIN_REPO_ROOT="$REPO_ROOT"
46
46
 
47
- ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run ./.har/launch.sh ${AGENT_ID} first}"
48
- WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run ./.har/launch.sh ${AGENT_ID} first}"
47
+ ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
48
+ WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
49
49
 
50
50
  # ── Artifact directory (main repo root, not the worktree) ─────────────────────
51
51
  ARTIFACT_DIR="$MAIN_REPO_ROOT/.har/artifacts/sast"
@@ -50,8 +50,8 @@ evidence. See `.har/stages/SEMGREP.md` for the full story.
50
50
 
51
51
  ```bash
52
52
  pipx install semgrep
53
- ./.har/launch.sh 1
53
+ har env launch 1
54
54
  ./.har/stages/sast.sh 1
55
55
  # reports: .har/artifacts/sast/semgrep.json (+ .sarif, scan.log)
56
- ./.har/verify.sh 1 --full
56
+ har env verify 1 --full
57
57
  ```
@@ -43,7 +43,7 @@
43
43
  ],
44
44
  "nextSteps": [
45
45
  "pipx install semgrep # or: pip install semgrep / brew install semgrep",
46
- "./.har/launch.sh 1",
46
+ "har env launch 1",
47
47
  "./.har/stages/sast.sh 1",
48
48
  "Open .har/artifacts/sast/ for the JSON and SARIF reports",
49
49
  "Read .har/stages/SEMGREP.md to pin rulesets (HARNESS_SEMGREP_CONFIG) or add local rules",
@@ -84,5 +84,5 @@ produce the evidence.
84
84
 
85
85
  ```bash
86
86
  ./.har/stages/vuln-scan.sh 1 # standalone
87
- ./.har/verify.sh 1 --full # as part of full verification
87
+ har env verify 1 --full # as part of full verification
88
88
  ```
@@ -12,7 +12,7 @@
12
12
  # TRIVY_CACHE_DIR vulnerability DB cache (default: ~/.cache/trivy —
13
13
  # shared across slots so the DB downloads once)
14
14
  #
15
- # Prerequisite: ./.har/launch.sh <agent-id>
15
+ # Prerequisite: har env launch <agent-id>
16
16
  # See: ./.har/stages/TRIVY.md for the full adaptation guide.
17
17
  set -euo pipefail
18
18
 
@@ -39,8 +39,8 @@ if ! command -v trivy >/dev/null 2>&1; then
39
39
  fi
40
40
 
41
41
  # ── Resolve agent env ─────────────────────────────────────────────────────────
42
- ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run ./.har/launch.sh ${AGENT_ID} first}"
43
- WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run ./.har/launch.sh ${AGENT_ID} first}"
42
+ ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
43
+ WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
44
44
 
45
45
  # ── Configuration ─────────────────────────────────────────────────────────────
46
46
  SEVERITY="${HARNESS_TRIVY_SEVERITY:-HIGH,CRITICAL}"
@@ -47,7 +47,7 @@
47
47
  ],
48
48
  "nextSteps": [
49
49
  "Install trivy: brew install trivy (or https://trivy.dev/latest/getting-started/installation/)",
50
- "./.har/launch.sh 1",
50
+ "har env launch 1",
51
51
  "./.har/stages/vuln-scan.sh 1",
52
52
  "Open .har/artifacts/vuln-scan/summary.txt for findings",
53
53
  "Tune HARNESS_TRIVY_SEVERITY / HARNESS_TRIVY_SCANNERS in .har/harness.env — read .har/stages/TRIVY.md"
@@ -11,8 +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
- `./.har/*.sh` exist as compatibility shims over the same runtime — generated,
15
- never edited, and not the way to drive the harness. Take explicit ownership of
16
- them with `har env eject`.
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 …`).
17
16
 
18
17
  Read **`stages.json`** and **`verificationStages`**. Optional: `har env add-plugin playwright`.
@@ -1,13 +1,13 @@
1
1
  ## Verification contract
2
2
 
3
3
  Steps in `har env verify` are **project-specific examples** — adapt them to your stack
4
- during `har env init` / `har env maintain` / benchmark setup. The table describes
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
@@ -15,11 +15,10 @@
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
- | `har env launch` / `har env verify` / `har env teardown` / `har env setup-infra` / `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 |
@@ -11,8 +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
- `./.har/*.sh` exist as compatibility shims over the same runtime — generated,
15
- never edited, and not the way to drive the harness. Take explicit ownership of
16
- them with `har env eject`.
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 …`).
17
16
 
18
17
  Read **`stages.json`** for registered stages and **`verificationStages`** for the expected pass set.
@@ -1,13 +1,13 @@
1
1
  ## Verification contract
2
2
 
3
3
  Steps in `har env verify` are **project-specific examples** — adapt them to your stack
4
- during `har env init` / `har env maintain`. The table describes each tier's intent,
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
@@ -18,11 +18,10 @@
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
- | `har env launch` / `har env verify` / `har env teardown` / `har env setup-infra` / `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 |
@@ -11,6 +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
- `./.har/*.sh` exist as compatibility shims over the same runtime — generated,
15
- never edited, and not the way to drive the harness. Take explicit ownership of
16
- them with `har env eject`.
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 …`).
@@ -15,11 +15,10 @@
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
- | `har env launch` / `har env verify` / `har env teardown` / `har env setup-infra` / `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 |
@@ -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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osfactory/har",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "HAR: open agent harness CLI and MCP server for coding agents, isolated worktrees, and software-factory workflows",
5
5
  "keywords": [
6
6
  "har",
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Attach to the tmux session for an agent.
3
- # The runtime lives in the HAR package (#234) — this file only forwards to it.
4
- # Usage: ./.har/attach.sh <agent-id>
5
- set -euo pipefail
6
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
- REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
8
- # Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
9
- # package — it executes this script as authoritative, which would exec back
10
- # into har forever (one node process per cycle). Trip on re-entry for this
11
- # harness root, and skip har binaries older than the pinned runtime (#298).
12
- HAR_SHIM_GUARD="attach@${REPO_ROOT}"
13
- case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
14
- echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
15
- echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
16
- echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
17
- exit 86
18
- ;;
19
- esac
20
- export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
21
- # True when $1 reports a version >= the pinned runtime. Comparing only the
22
- # major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
23
- # passed it and then bounced straight back into this shim. Compare the full
24
- # release triple, and treat anything unparseable as unusable.
25
- har_runtime_compatible() {
26
- local v pinned="__HAR_VERSION__" i a b
27
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
28
- v="${v#v}"
29
- v="${v%%[-+ ]*}"
30
- local -a have pin
31
- IFS=. read -r -a have <<<"$v"
32
- IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
33
- for i in 0 1 2; do
34
- a="${have[i]:-0}"
35
- b="${pin[i]:-0}"
36
- case "$a" in ''|*[!0-9]*) return 1 ;; esac
37
- case "$b" in ''|*[!0-9]*) return 1 ;; esac
38
- [ "$a" -gt "$b" ] && return 0
39
- [ "$a" -lt "$b" ] && return 1
40
- done
41
- return 0
42
- }
43
- # `$1` (not a named var) so `har env eject` can lift this delegate verbatim.
44
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
45
- exec har env agent "${1:?Usage: attach.sh <agent-id>}" attach
46
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
47
- exec "$REPO_ROOT/node_modules/.bin/har" env agent "${1:?Usage: attach.sh <agent-id>}" attach
48
- elif command -v npx >/dev/null 2>&1; then
49
- exec npx --yes @osfactory/har@__HAR_VERSION__ env agent "${1:?Usage: attach.sh <agent-id>}" attach
50
- fi
51
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
52
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env agent" >&2
53
- exit 127
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Namespaced CLI for managing a running agent environment.
3
- # The runtime lives in the HAR package (#234) — this file only forwards to it.
4
- # Usage: ./.har/agent-cli.sh <agent-id> <command> [args...]
5
- set -euo pipefail
6
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
- REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
8
- # Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
9
- # package — it executes this script as authoritative, which would exec back
10
- # into har forever (one node process per cycle). Trip on re-entry for this
11
- # harness root, and skip har binaries older than the pinned runtime (#298).
12
- HAR_SHIM_GUARD="agent@${REPO_ROOT}"
13
- case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
14
- echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
15
- echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
16
- echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
17
- exit 86
18
- ;;
19
- esac
20
- export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
21
- # True when $1 reports a version >= the pinned runtime. Comparing only the
22
- # major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
23
- # passed it and then bounced straight back into this shim. Compare the full
24
- # release triple, and treat anything unparseable as unusable.
25
- har_runtime_compatible() {
26
- local v pinned="__HAR_VERSION__" i a b
27
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
28
- v="${v#v}"
29
- v="${v%%[-+ ]*}"
30
- local -a have pin
31
- IFS=. read -r -a have <<<"$v"
32
- IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
33
- for i in 0 1 2; do
34
- a="${have[i]:-0}"
35
- b="${pin[i]:-0}"
36
- case "$a" in ''|*[!0-9]*) return 1 ;; esac
37
- case "$b" in ''|*[!0-9]*) return 1 ;; esac
38
- [ "$a" -gt "$b" ] && return 0
39
- [ "$a" -lt "$b" ] && return 1
40
- done
41
- return 0
42
- }
43
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
44
- exec har env agent "$@"
45
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
46
- exec "$REPO_ROOT/node_modules/.bin/har" env agent "$@"
47
- elif command -v npx >/dev/null 2>&1; then
48
- exec npx --yes @osfactory/har@__HAR_VERSION__ env agent "$@"
49
- fi
50
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
51
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env agent" >&2
52
- exit 127
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Launch an isolated agent environment slot (fresh suffixed worktree; occupied slots block).
3
- # The runtime lives in the HAR package (#234) — this file only forwards to it.
4
- # Usage: ./.har/launch.sh <agent-id> [--no-worktree] [--resume]
5
- set -euo pipefail
6
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
- REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
8
- # Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
9
- # package — it executes this script as authoritative, which would exec back
10
- # into har forever (one node process per cycle). Trip on re-entry for this
11
- # harness root, and skip har binaries older than the pinned runtime (#298).
12
- HAR_SHIM_GUARD="launch@${REPO_ROOT}"
13
- case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
14
- echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
15
- echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
16
- echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
17
- exit 86
18
- ;;
19
- esac
20
- export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
21
- # True when $1 reports a version >= the pinned runtime. Comparing only the
22
- # major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
23
- # passed it and then bounced straight back into this shim. Compare the full
24
- # release triple, and treat anything unparseable as unusable.
25
- har_runtime_compatible() {
26
- local v pinned="__HAR_VERSION__" i a b
27
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
28
- v="${v#v}"
29
- v="${v%%[-+ ]*}"
30
- local -a have pin
31
- IFS=. read -r -a have <<<"$v"
32
- IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
33
- for i in 0 1 2; do
34
- a="${have[i]:-0}"
35
- b="${pin[i]:-0}"
36
- case "$a" in ''|*[!0-9]*) return 1 ;; esac
37
- case "$b" in ''|*[!0-9]*) return 1 ;; esac
38
- [ "$a" -gt "$b" ] && return 0
39
- [ "$a" -lt "$b" ] && return 1
40
- done
41
- return 0
42
- }
43
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
44
- exec har env launch "$@"
45
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
46
- exec "$REPO_ROOT/node_modules/.bin/har" env launch "$@"
47
- elif command -v npx >/dev/null 2>&1; then
48
- exec npx --yes @osfactory/har@__HAR_VERSION__ env launch "$@"
49
- fi
50
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
51
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env launch" >&2
52
- exit 127
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Launch readiness gate — run before launch.sh or standalone.
3
- # The runtime lives in the HAR package (#234) — this file only forwards to it.
4
- # Usage: ./.har/preflight.sh <agent-id>
5
- set -euo pipefail
6
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
- REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
8
- # Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
9
- # package — it executes this script as authoritative, which would exec back
10
- # into har forever (one node process per cycle). Trip on re-entry for this
11
- # harness root, and skip har binaries older than the pinned runtime (#298).
12
- HAR_SHIM_GUARD="preflight@${REPO_ROOT}"
13
- case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
14
- echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
15
- echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
16
- echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
17
- exit 86
18
- ;;
19
- esac
20
- export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
21
- # True when $1 reports a version >= the pinned runtime. Comparing only the
22
- # major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
23
- # passed it and then bounced straight back into this shim. Compare the full
24
- # release triple, and treat anything unparseable as unusable.
25
- har_runtime_compatible() {
26
- local v pinned="__HAR_VERSION__" i a b
27
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
28
- v="${v#v}"
29
- v="${v%%[-+ ]*}"
30
- local -a have pin
31
- IFS=. read -r -a have <<<"$v"
32
- IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
33
- for i in 0 1 2; do
34
- a="${have[i]:-0}"
35
- b="${pin[i]:-0}"
36
- case "$a" in ''|*[!0-9]*) return 1 ;; esac
37
- case "$b" in ''|*[!0-9]*) return 1 ;; esac
38
- [ "$a" -gt "$b" ] && return 0
39
- [ "$a" -lt "$b" ] && return 1
40
- done
41
- return 0
42
- }
43
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
44
- exec har env preflight "$@"
45
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
46
- exec "$REPO_ROOT/node_modules/.bin/har" env preflight "$@"
47
- elif command -v npx >/dev/null 2>&1; then
48
- exec npx --yes @osfactory/har@__HAR_VERSION__ env preflight "$@"
49
- fi
50
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
51
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env preflight" >&2
52
- exit 127