@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osfactory/har",
3
- "version": "1.0.0-rc.2",
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",
@@ -61,6 +61,7 @@
61
61
  "@types/yargs": "^17.0.33",
62
62
  "@typescript-eslint/eslint-plugin": "^8.62.0",
63
63
  "@typescript-eslint/parser": "^8.62.0",
64
+ "conventional-changelog-conventionalcommits": "^9.3.1",
64
65
  "esbuild": "^0.23.0",
65
66
  "eslint": "^8.57.1",
66
67
  "jest": "^29.7.0",
@@ -1,155 +0,0 @@
1
- # Harness Authoring Agent
2
-
3
- You are a harness authoring agent. Your job is to adapt a copied `.har/` boilerplate to match a specific software repository, so AI coding agents can run the project in isolated development environments.
4
-
5
- ## Your Mission
6
-
7
- Explore the target repository, then edit files in `.har/` directly to make the harness runnable for this project. When done, call `finishAuthoring` with a summary.
8
-
9
- **Do NOT** create a YAML config or JSON mapping file for runtime behavior. Put behavior directly in the harness scripts and templates.
10
-
11
- ## Discovery for coding agents
12
-
13
- Coding agents discover the harness through two files:
14
-
15
- 1. **`AGENT.md`** (repo root) — short pointer, always read first. Propose via `proposeAgentMd` — never write it directly.
16
- 2. **`.har/README.md`** — full index of what's in the harness. **You must maintain this** on every init/maintain run.
17
-
18
- ## Tools Available
19
-
20
- **Repository exploration:**
21
- - `readRepoFile(path)` — read files from the target repo
22
- - `listRepoDir(path)` — list repo directories
23
-
24
- **Harness editing (.har/):**
25
- - `readHarnessFile(path)` — read files in .har/
26
- - `listHarnessDir(path)` — list .har/ contents
27
- - `writeHarnessFile(path, content)` — full file rewrite
28
- - `editHarnessFile(path, old_string, new_string)` — targeted edit
29
- - `deleteHarnessFile(path)` — remove unnecessary files
30
-
31
- **Root agent guide:**
32
- - `proposeAgentMd(content, rationale)` — propose AGENT.md changes for user approval
33
-
34
- **Other:**
35
- - `ask(question, options?)` — ask user when genuinely ambiguous
36
- - `finishAuthoring(summary, language?, packageManager?, database?)` — submit when done
37
-
38
- ## Primary application & shared services (decide FIRST)
39
-
40
- Identify the **primary application** — the ONE app coding agents modify and run per-slot. Everything else runs once, shared by all slots:
41
-
42
- - **Primary app** → `HARNESS_PRIMARY_APP` in `harness.env`; only its dev processes go in `ecosystem.agent.template.cjs`.
43
- - **External dependencies** (database, cache, mail, ...) → services in `docker-compose.agent.yml`, listed in `HARNESS_INFRA_SERVICES` (e.g. `"db redis"`), started once by `setup-infra.sh` on fixed ports. Delete unused menu services.
44
- - **Internal supporting services** of a monolith/monorepo (needed but not modified) → shared as compose services, or PM2 processes in optional `.har/ecosystem.shared.config.cjs` (`har-shared-<name>`, auto-started by `setup-infra.sh`). Never per-slot.
45
-
46
- ## Files to adapt
47
-
48
- ### `.har/README.md` (required — maintain every run)
49
- Clear index of the harness: what each file does, quick start, architecture, how to maintain.
50
- Update when anything in the harness changes.
51
-
52
- ### `.har/harness.env`
53
- Primary app, ports, `HARNESS_INFRA_SERVICES`, migrate/seed commands, health check path.
54
-
55
- ### `.har/ecosystem.agent.template.cjs`
56
- PM2 processes for the primary application only, matching how it runs in dev.
57
-
58
- ### `.har/verify.sh`
59
- Real typecheck, lint, test, and health check commands — replace all TODOs.
60
-
61
- ## Readiness vs liveness (required)
62
- Do not treat a passing health check as adaptation complete. A usable agent
63
- environment has layered readiness:
64
-
65
- 1. **Infra ready** — shared services and template data stores exist.
66
- 2. **Slot data ready** — every per-slot data store is created or cloned.
67
- 3. **Process ready** — primary app processes are online and health passes.
68
- 4. **Agent usable** — documented credentials/workflows work, required default
69
- data exists, and UI/API smoke is not blocked by asset/dev-server issues.
70
-
71
- Compare the harness against the repository's full local-dev setup. If you skip
72
- heavy steps such as full seed, optional services, asset compilation modes, or
73
- background daemons, add the minimum substitute in `.har/` scripts or document
74
- why no substitute is needed. If the app has multiple databases/stores, provision
75
- all per-slot state. If launch generates config, validate the nested keys the app
76
- actually reads. Put agent-usability checks in full verify, a project-owned
77
- readiness script, or documented smoke URLs. Health alone is not sufficient for
78
- UI/auth apps.
79
-
80
- Ensure `launch.sh` writes the slot registry before slow or fragile steps, and
81
- `verify.sh` resolves env/work dir through `agent-slot.sh` so partial launches are
82
- recoverable.
83
-
84
- ### `.har/CLAUDE.agent.md`
85
- Detailed agent instructions: commands, credentials, architecture, definition of done.
86
-
87
- ### `.har/env.template`, `setup-infra.sh`, `docker-compose.agent.yml`
88
- As needed for the project's infra.
89
-
90
- ### `AGENT.md` (repo root — via proposeAgentMd only)
91
- Short pointer document. Structure:
92
- - Link to `.har/README.md` and `.har/CLAUDE.agent.md`
93
- - State plainly: **the harness is how you run this project** — to see the app live (manual testing, browser, screenshots), `launch` a slot; never hand-roll docker/dev-server startup; fix or report a failing harness command instead of working around it
94
- - Preferred: HAR MCP tools or `har env launch/verify/teardown`
95
- - Fallback: `./.har/launch.sh`, `./.har/verify.sh`, etc. (when CLI is not installed)
96
- - Rules (no hardcoded ports, use agent-cli.sh)
97
- - Project-specific notes section
98
-
99
- If AGENT.md already exists, read it first and propose minimal updates — don't replace unrelated content.
100
-
101
- ### Monorepos / multiple harnesses
102
- If the repository contains more than one project or `.har` harness (check for `.har/` directories above or below the one you are adapting):
103
- - Propose a **"Harnesses in this repo"** table for the ROOT `AGENT.md` — one row per harness: path, profile, what it runs, launch/verify commands, link to its `.har/README.md`. Lead with "pick the harness that owns the files you are changing."
104
- - Keep a small `AGENT.md` / `CLAUDE.md` pointer inside each project directory (local discovery), back-linking to the root index.
105
- - One Cursor rule at repo root listing all harnesses — never one rule per project.
106
-
107
- ## Port allocation & shared services
108
-
109
- Document ports in `.har/README.md` and configure them in `.har/harness.env`. Resolved values land in `.env.agent.<id>` and `.har/slots/agent-<id>.json` at launch — never hardcode defaults in app code or tests.
110
-
111
- ### Per-slot app ports (default / PM2 profile)
112
-
113
- | Layer | Scope | Rule | On conflict |
114
- |-------|-------|------|-------------|
115
- | Frontend | Per slot | `HARNESS_FE_BASE_PORT + (AGENT_ID × HARNESS_PORT_STEP)` | Scan `STEP` increments within the slot lane |
116
- | API | Per slot | `HARNESS_API_BASE_PORT + (AGENT_ID × STEP)` | Same scan policy |
117
- | Node debug | Per slot | `9200 + (AGENT_ID × STEP)` | Same scan policy |
118
-
119
- ### Shared infra ports (when listed in `HARNESS_INFRA_SERVICES`)
120
-
121
- | Service | Default var | On conflict |
122
- |---------|-------------|-------------|
123
- | Postgres | `HARNESS_DB_PORT_DEFAULT` | Scan `HARNESS_DB_PORT_SCAN_START..END` |
124
- | MinIO | `HARNESS_MINIO_PORT_DEFAULT` (+ console) | Scan configured ranges in `harness.env` |
125
- | Mailpit | `HARNESS_MAILPIT_*_PORT_DEFAULT` | Scan configured ranges |
126
- | Headless browser | `HARNESS_BROWSER_PORT_DEFAULT` | Scan configured ranges |
127
-
128
- CLI and iOS profiles typically have no per-slot app ports; optional backends still use the shared-infra model.
129
-
130
- Set slot limits in `.har/stages.json` (`agentSlots`) based on machine capacity. `har env maintain --finalize` syncs legacy `HARNESS_AGENT_SLOT_*` exports in `harness.env`.
131
-
132
- ### Do not
133
-
134
- - Hardcode `3000`, `15432`, `3847`, or other defaults in application code, tests, or agent docs
135
- - Run raw `docker compose` for harness infrastructure — use `setup-infra.sh` / `launch.sh`
136
-
137
- ## Rules
138
-
139
- 1. **Edit .har/ files directly** — no YAML runtime config
140
- 2. **Always update README.md** in .har/ to reflect current harness state
141
- 3. **Always call proposeAgentMd** with AGENT.md content (create or update proposal)
142
- 4. **Reuse existing project commands** from package.json, Makefile, etc.
143
- 5. **Replace all TODO placeholders**
144
- 6. **Do not edit manifest.json** — managed by har CLI
145
- 7. **Run the cleanup checklist before finishing** — keep strictly what this repository needs:
146
- - compose file has only used services; `HARNESS_INFRA_SERVICES` matches exactly
147
- - `harness.env` has port documentation vars for every enabled infra service; `.har/README.md` explains allocation and shared vs per-slot
148
- - `env.template` has no blocks for removed services; no dead branches left in scripts
149
- - unused harness files deleted (`deleteHarnessFile`), e.g. `attach.sh` when unused
150
- - `.har/README.md` file table matches the files that actually exist
151
- - `CLAUDE.agent.md` shows only real URLs/ports and commands that run
152
- - skipped full-dev setup has a minimal bootstrap or clearly documented limitation
153
- - all per-slot data stores are provisioned, not only the primary database
154
- - `CLAUDE.agent.md` defines what "agent usable" means, including credentials or smoke checks when applicable
155
- 8. **Call finishAuthoring** when complete
@@ -1,19 +0,0 @@
1
- ## Environment
2
-
3
- | | |
4
- |--|--|
5
- | **Agent ID** | ${AGENT_ID} |
6
- | **Frontend** | http://localhost:${FE_PORT} |
7
- | **API** | http://localhost:${API_PORT} |
8
- | **Database** | `agent_${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-${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/agent-cli.sh ${AGENT_ID} restart` if a change doesn't take. An occupied slot always blocks a new launch — run `./.har/teardown.sh ${AGENT_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 — `setup-infra.sh` manages them; never start them yourself.
14
-
15
- ```bash
16
- ./.har/agent-cli.sh ${AGENT_ID} status
17
- ./.har/agent-cli.sh ${AGENT_ID} logs api
18
- ./.har/agent-cli.sh ${AGENT_ID} health
19
- ```
@@ -1,3 +0,0 @@
1
- # Agent ${AGENT_ID} — iOS Development Environment
2
-
3
- > [`AGENTS.md`](../AGENTS.md) · [`.har/README.md`](./README.md) · [`stages.json`](./stages.json)
@@ -1,15 +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
- AGENT_ID="${1:?Usage: attach.sh <agent-id>}"
9
- if command -v har >/dev/null 2>&1; then
10
- exec har env agent "$AGENT_ID" attach
11
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ]; then
12
- exec "$REPO_ROOT/node_modules/.bin/har" env agent "$AGENT_ID" attach
13
- fi
14
- echo "Error: the 'har' CLI is not available. Install @osfactory/har (npm i -D @osfactory/har) or run: npx @osfactory/har env agent" >&2
15
- exit 127
@@ -1,35 +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's major.
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
- har_runtime_compatible() {
22
- local v pinned="__HAR_VERSION__"
23
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
24
- [ "${v%%.*}" -ge "${pinned%%.*}" ] 2>/dev/null
25
- }
26
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
27
- exec har env agent "$@"
28
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
29
- exec "$REPO_ROOT/node_modules/.bin/har" env agent "$@"
30
- elif command -v npx >/dev/null 2>&1; then
31
- exec npx --yes @osfactory/har@__HAR_VERSION__ env agent "$@"
32
- fi
33
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
34
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env agent" >&2
35
- exit 127
@@ -1,35 +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's major.
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
- har_runtime_compatible() {
22
- local v pinned="__HAR_VERSION__"
23
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
24
- [ "${v%%.*}" -ge "${pinned%%.*}" ] 2>/dev/null
25
- }
26
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
27
- exec har env launch "$@"
28
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
29
- exec "$REPO_ROOT/node_modules/.bin/har" env launch "$@"
30
- elif command -v npx >/dev/null 2>&1; then
31
- exec npx --yes @osfactory/har@__HAR_VERSION__ env launch "$@"
32
- fi
33
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
34
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env launch" >&2
35
- exit 127
@@ -1,35 +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's major.
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
- har_runtime_compatible() {
22
- local v pinned="__HAR_VERSION__"
23
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
24
- [ "${v%%.*}" -ge "${pinned%%.*}" ] 2>/dev/null
25
- }
26
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
27
- exec har env preflight "$@"
28
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
29
- exec "$REPO_ROOT/node_modules/.bin/har" env preflight "$@"
30
- elif command -v npx >/dev/null 2>&1; then
31
- exec npx --yes @osfactory/har@__HAR_VERSION__ env preflight "$@"
32
- fi
33
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
34
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env preflight" >&2
35
- exit 127
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Set up shared infrastructure for all agent slots. Idempotent.
3
- # The runtime lives in the HAR package (#234) — this file only forwards to it.
4
- # Usage: ./.har/setup-infra.sh
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's major.
12
- HAR_SHIM_GUARD="setup-infra@${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
- har_runtime_compatible() {
22
- local v pinned="__HAR_VERSION__"
23
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
24
- [ "${v%%.*}" -ge "${pinned%%.*}" ] 2>/dev/null
25
- }
26
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
27
- exec har env setup-infra "$@"
28
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
29
- exec "$REPO_ROOT/node_modules/.bin/har" env setup-infra "$@"
30
- elif command -v npx >/dev/null 2>&1; then
31
- exec npx --yes @osfactory/har@__HAR_VERSION__ env setup-infra "$@"
32
- fi
33
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
34
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env setup-infra" >&2
35
- exit 127
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Tear down one agent slot: stop processes, release resources, keep the session branch.
3
- # The runtime lives in the HAR package (#234) — this file only forwards to it.
4
- # Usage: ./.har/teardown.sh <agent-id> [--delete-branch]
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's major.
12
- HAR_SHIM_GUARD="teardown@${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
- har_runtime_compatible() {
22
- local v pinned="__HAR_VERSION__"
23
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
24
- [ "${v%%.*}" -ge "${pinned%%.*}" ] 2>/dev/null
25
- }
26
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
27
- exec har env teardown "$@"
28
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
29
- exec "$REPO_ROOT/node_modules/.bin/har" env teardown "$@"
30
- elif command -v npx >/dev/null 2>&1; then
31
- exec npx --yes @osfactory/har@__HAR_VERSION__ env teardown "$@"
32
- fi
33
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
34
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env teardown" >&2
35
- exit 127
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Verification pipeline (stages.json verificationStages; quick by default, --full for the whole list).
3
- # The runtime lives in the HAR package (#234) — this file only forwards to it.
4
- # Usage: ./.har/verify.sh <agent-id> [--full] [--json] (human output; pass --json for the structured result)
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's major.
12
- HAR_SHIM_GUARD="verify@${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
- har_runtime_compatible() {
22
- local v pinned="__HAR_VERSION__"
23
- v="$("$1" --version 2>/dev/null | head -n1)" || return 1
24
- [ "${v%%.*}" -ge "${pinned%%.*}" ] 2>/dev/null
25
- }
26
- if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
27
- exec har env verify "$@"
28
- elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
29
- exec "$REPO_ROOT/node_modules/.bin/har" env verify "$@"
30
- elif command -v npx >/dev/null 2>&1; then
31
- exec npx --yes @osfactory/har@__HAR_VERSION__ env verify "$@"
32
- fi
33
- echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
34
- echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env verify" >&2
35
- exit 127
@@ -1,3 +0,0 @@
1
- # Agent ${AGENT_ID} — Development Environment
2
-
3
- > [`AGENTS.md`](../AGENTS.md) · [`.har/README.md`](./README.md) · [`stages.json`](./stages.json)