@osfactory/har 1.0.0 → 1.2.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.
- package/dist/index.js +815 -820
- package/dist/templates/AGENTS.md.template +1 -1
- package/dist/templates/adaptation-prompt-init.md +18 -23
- package/dist/templates/adaptation-prompt-maintain.md +1 -1
- package/dist/templates/adaptation-prompt-plugin.md +1 -1
- package/dist/templates/agent-skills/factory-line.md +96 -0
- package/dist/templates/agent-skills/har-wt.md +1 -1
- package/dist/templates/agent-skills/setup-har.md +4 -4
- package/dist/templates/agent-skills/skills.manifest.json +13 -0
- package/dist/templates/har-boilerplate/harness.env +1 -1
- package/dist/templates/har-boilerplate/justfile +11 -12
- package/dist/templates/har-boilerplate/stages.json +3 -9
- package/dist/templates/har-boilerplate-cli/harness.env +1 -1
- package/dist/templates/har-boilerplate-cli/justfile +9 -10
- package/dist/templates/har-boilerplate-cli/stages.json +2 -7
- package/dist/templates/har-boilerplate-ios/harness.env +1 -1
- package/dist/templates/har-boilerplate-ios/justfile +9 -10
- package/dist/templates/har-boilerplate-ios/stages.json +3 -8
- package/dist/templates/migration-prompt.md +2 -2
- package/dist/templates/plugins/custom-stage-skeleton.sh +2 -2
- package/dist/templates/plugins/gitleaks/.har/stages/secrets-scan.sh +2 -2
- package/dist/templates/plugins/gitleaks/template.manifest.json +1 -1
- package/dist/templates/plugins/kerno/.github/workflows/kerno.yml +1 -1
- package/dist/templates/plugins/kerno/.har/stages/KERNO.md +2 -2
- package/dist/templates/plugins/kerno/.har/stages/backend-validation.sh +3 -3
- package/dist/templates/plugins/kerno/README.md +2 -2
- package/dist/templates/plugins/kerno/template.manifest.json +1 -1
- package/dist/templates/plugins/playwright/.har/stages/PLAYWRIGHT.md +2 -2
- package/dist/templates/plugins/playwright/.har/stages/browser-e2e.sh +3 -3
- package/dist/templates/plugins/playwright/README.md +1 -1
- package/dist/templates/plugins/playwright/playwright.config.js +2 -2
- package/dist/templates/plugins/playwright/template.manifest.json +1 -1
- package/dist/templates/plugins/rocketsim/.har/stages/ROCKETSIM.md +1 -1
- package/dist/templates/plugins/rocketsim/.har/stages/rocketsim-flows.sh +3 -3
- package/dist/templates/plugins/rocketsim/README.md +1 -1
- package/dist/templates/plugins/rocketsim/flows/example-smoke.sh +1 -1
- package/dist/templates/plugins/rocketsim/template.manifest.json +1 -1
- package/dist/templates/plugins/semgrep/.har/stages/SEMGREP.md +1 -1
- package/dist/templates/plugins/semgrep/.har/stages/sast.sh +3 -3
- package/dist/templates/plugins/semgrep/README.md +2 -2
- package/dist/templates/plugins/semgrep/template.manifest.json +1 -1
- package/dist/templates/plugins/trivy/.har/stages/TRIVY.md +1 -1
- package/dist/templates/plugins/trivy/.har/stages/vuln-scan.sh +3 -3
- package/dist/templates/plugins/trivy/template.manifest.json +1 -1
- package/dist/templates/profiles/cli/docs/readme/quick-start.md +2 -3
- package/dist/templates/profiles/cli/docs/readme/verification-contract.md +3 -3
- package/dist/templates/profiles/cli/docs/readme/what-s-in-here.md +1 -2
- package/dist/templates/profiles/default/docs/readme/quick-start.md +2 -3
- package/dist/templates/profiles/default/docs/readme/verification-contract.md +3 -3
- package/dist/templates/profiles/default/docs/readme/what-s-in-here.md +1 -2
- package/dist/templates/profiles/ios/docs/readme/quick-start.md +2 -3
- package/dist/templates/profiles/ios/docs/readme/what-s-in-here.md +1 -2
- package/dist/templates/runtime-bundles/shared-kernel/STAGES.md +1 -1
- package/dist/templates/runtime-bundles/shared-kernel/lib/verify-runner.mjs +1 -1
- package/dist/templates/shared-docs/readme/maintaining-this-harness.md +3 -3
- package/package.json +1 -1
- package/dist/templates/runtime-bundles/pm2-runtime/attach.sh +0 -53
- package/dist/templates/runtime-bundles/shared-kernel/agent-cli.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/launch.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/preflight.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/setup-infra.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/teardown.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/verify.sh +0 -52
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
],
|
|
44
44
|
"nextSteps": [
|
|
45
45
|
"Install gitleaks: brew install gitleaks — or a release binary from https://github.com/gitleaks/gitleaks/releases",
|
|
46
|
-
"
|
|
46
|
+
"har env launch 1",
|
|
47
47
|
"./.har/stages/secrets-scan.sh 1",
|
|
48
48
|
"Open .har/artifacts/secrets-scan/report.json for findings (secrets are redacted)",
|
|
49
49
|
"Tune allowlists in .gitleaks.toml — read .har/stages/GITLEAKS.md for the adaptation guide"
|
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
- name: Install Kerno CLI
|
|
31
31
|
run: npm install -g @kerno/cli
|
|
32
32
|
# - name: Start the app (adapt for your stack) and migrate/seed its database
|
|
33
|
-
# run:
|
|
33
|
+
# run: har env launch 1 && <start your app in the slot>
|
|
34
34
|
# - name: Bind a Kerno agent to this checkout
|
|
35
35
|
# run: kerno init
|
|
36
36
|
# - name: Run backend validation
|
|
@@ -47,7 +47,7 @@ concurrently across slots.
|
|
|
47
47
|
|
|
48
48
|
## Configuration the stage reads
|
|
49
49
|
|
|
50
|
-
All values come from the slot's `.env.agent.<id>` (written by `launch
|
|
50
|
+
All values come from the slot's `.env.agent.<id>` (written by `har env launch`) and `~/.kerno/agent.port`:
|
|
51
51
|
|
|
52
52
|
| Value | Source | Used for |
|
|
53
53
|
|-------|--------|----------|
|
|
@@ -101,7 +101,7 @@ Under `.har/artifacts/backend-validation/`:
|
|
|
101
101
|
./.har/stages/backend-validation.sh 1
|
|
102
102
|
|
|
103
103
|
# As part of full verify
|
|
104
|
-
|
|
104
|
+
har env verify 1 --full
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
## Adapting per repo
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# via the local Kerno agent's REST API. Outputs JSON to stdout, progress to stderr.
|
|
5
5
|
#
|
|
6
6
|
# Usage: ./.har/stages/backend-validation.sh <agent-id>
|
|
7
|
-
# Prerequisite:
|
|
7
|
+
# Prerequisite: har env launch <agent-id>, the app running in the slot, AND a Kerno
|
|
8
8
|
# agent started with `kerno init` in THIS worktree (Kerno allows ONE agent per machine).
|
|
9
9
|
# See: ./.har/stages/KERNO.md for the full setup + adaptation guide.
|
|
10
10
|
set -euo pipefail
|
|
@@ -76,8 +76,8 @@ fi
|
|
|
76
76
|
trap cleanup EXIT
|
|
77
77
|
|
|
78
78
|
# ── Resolve agent env + slot target ───────────────────────────────────────────
|
|
79
|
-
ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run
|
|
80
|
-
WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run
|
|
79
|
+
ENV_FILE="${ENV_FILE:?No slot env for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
|
|
80
|
+
WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run har env launch ${AGENT_ID} first}"
|
|
81
81
|
|
|
82
82
|
# SUT URL: prefer an explicit override, then the app's own SITE_URL (both the default
|
|
83
83
|
# web profile and single-port apps like Next.js set SITE_URL to the running app), then a
|
|
@@ -55,13 +55,13 @@ kerno init # run inside the slot worktree
|
|
|
55
55
|
ls .kerno/scenarios/endpoints/
|
|
56
56
|
|
|
57
57
|
# 4. Launch the slot and start your app
|
|
58
|
-
|
|
58
|
+
har env launch 1
|
|
59
59
|
|
|
60
60
|
# 5. Run backend validation
|
|
61
61
|
./.har/stages/backend-validation.sh 1
|
|
62
62
|
|
|
63
63
|
# 6. Validate everything
|
|
64
|
-
|
|
64
|
+
har env verify 1 --full
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
Per-endpoint run responses and verdicts land in `.har/artifacts/backend-validation/`.
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"npm install -g @kerno/cli",
|
|
50
50
|
"kerno init # bind the single Kerno agent to THIS worktree",
|
|
51
51
|
"Ask your Kerno agent to generate a scenario suite (or ensure .kerno/scenarios/ is committed)",
|
|
52
|
-
"
|
|
52
|
+
"har env launch 1 # then start your app in the slot",
|
|
53
53
|
"./.har/stages/backend-validation.sh 1",
|
|
54
54
|
"Open .har/artifacts/backend-validation/ for verdicts and per-endpoint run responses"
|
|
55
55
|
],
|
|
@@ -10,12 +10,12 @@ Adapt specs under `tests/` for your application. Full verification (`verify --fu
|
|
|
10
10
|
|
|
11
11
|
## Run
|
|
12
12
|
|
|
13
|
-
After
|
|
13
|
+
After `har env launch <id>`:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
./.har/stages/browser-e2e.sh <id>
|
|
17
17
|
# included in:
|
|
18
|
-
|
|
18
|
+
har env verify <id> --full
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Adapt selectors and paths in the scaffold specs during harness adaptation.
|
|
@@ -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:
|
|
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
|
|
21
|
-
WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run
|
|
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
|
|
|
@@ -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
|
-
//
|
|
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:
|
|
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)
|
|
@@ -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:
|
|
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
|
|
42
|
-
WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run
|
|
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"
|
|
@@ -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
|
|
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
|
-
"
|
|
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
|
-
|
|
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:
|
|
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
|
|
48
|
-
WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run
|
|
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
|
-
|
|
53
|
+
har env launch 1
|
|
54
54
|
./.har/stages/sast.sh 1
|
|
55
55
|
# reports: .har/artifacts/sast/semgrep.json (+ .sarif, scan.log)
|
|
56
|
-
|
|
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
|
-
"
|
|
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",
|
|
@@ -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:
|
|
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
|
|
43
|
-
WORK_DIR="${WORK_DIR:?No slot work dir for agent ${AGENT_ID} — run
|
|
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
|
-
"
|
|
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
|
-
|
|
15
|
-
|
|
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
|
|
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>`
|
|
10
|
-
| Full | `har env verify <id> --full`
|
|
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
|
|
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
|
-
|
|
15
|
-
|
|
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
|
|
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>`
|
|
10
|
-
| Full | `har env verify <id> --full`
|
|
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
|
|
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
|
-
|
|
15
|
-
|
|
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
|
|
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
|
|
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
|
|
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/`).
|
|
13
|
-
|
|
14
|
-
|
|
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,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
|