@osfactory/har 0.3.0 → 0.5.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/README.md +29 -3
- package/dist/index.js +1 -1
- package/dist/templates/adaptation-prompt-init.md +15 -1
- package/dist/templates/har-boilerplate/README.md +9 -5
- package/dist/templates/har-boilerplate/verify.sh +8 -2
- package/dist/templates/har-boilerplate-cli/README.md +9 -5
- package/dist/templates/har-boilerplate-cli/verify.sh +9 -2
- package/dist/templates/har-boilerplate-ios/README.md +8 -5
- package/dist/templates/har-boilerplate-ios/verify.sh +14 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,11 +39,37 @@ npm install && npm run build && npm link
|
|
|
39
39
|
|
|
40
40
|
See [AGENT.md](./AGENT.md) for architecture and coding-agent guidance, and [CONTRIBUTING.md](./CONTRIBUTING.md) for the full development workflow, testing on sample projects, and project layout. To report security issues, see [SECURITY.md](./SECURITY.md).
|
|
41
41
|
|
|
42
|
+
## Harness profiles
|
|
43
|
+
|
|
44
|
+
`har env init` scaffolds `.har/` from a boilerplate profile. Pick the one that matches what agents need to run — you only choose this once at init time.
|
|
45
|
+
|
|
46
|
+
| Profile | Best for | What you get |
|
|
47
|
+
|---------|----------|--------------|
|
|
48
|
+
| `default` | Web apps (Next.js, Rails, Django, etc.) | Docker Compose for shared infra, PM2 for the primary app, per-slot ports and preview URLs |
|
|
49
|
+
| `cli` | CLI tools, libraries, npm packages | No PM2 or port wiring — agents run project commands in an isolated git worktree; optional Docker for databases |
|
|
50
|
+
| `ios` | iOS / Swift mobile apps | xcodebuild + iOS Simulator; configure scheme, project, and simulator in `harness.env` |
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Web app (default — omit --profile)
|
|
54
|
+
cd my-web-app && har env init
|
|
55
|
+
|
|
56
|
+
# CLI tool or library
|
|
57
|
+
cd my-cli && har env init --profile cli
|
|
58
|
+
|
|
59
|
+
# iOS app
|
|
60
|
+
cd MyApp && har env init --profile ios
|
|
61
|
+
har env add-stage rocketsim # optional: UI flow validation on the simulator
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
After init, paste the printed adaptation prompt into your coding agent to tailor scripts to your stack. For built-in Claude adaptation: `har env init --auto` (requires `ANTHROPIC_API_KEY`).
|
|
65
|
+
|
|
66
|
+
Optional stage templates depend on the profile: `har env add-stage playwright` for browser E2E on web apps, `har env add-stage rocketsim` for simulator user-flow checks on iOS.
|
|
67
|
+
|
|
42
68
|
## Quick start
|
|
43
69
|
|
|
44
70
|
```bash
|
|
45
71
|
cd my-app
|
|
46
|
-
har env init
|
|
72
|
+
har env init # or --profile cli / --profile ios
|
|
47
73
|
|
|
48
74
|
# Paste the printed prompt into your coding agent to adapt .har/ and AGENT.md
|
|
49
75
|
git add .har/ AGENT.md
|
|
@@ -55,7 +81,7 @@ har env verify 1
|
|
|
55
81
|
|
|
56
82
|
Shell fallback when the CLI is not installed: `./.har/setup-infra.sh`, `./.har/launch.sh 1`, `./.har/verify.sh 1`.
|
|
57
83
|
|
|
58
|
-
|
|
84
|
+
See [Harness profiles](#harness-profiles) above if your repo is a CLI/library or iOS app rather than a web app.
|
|
59
85
|
|
|
60
86
|
## Repo layout after init
|
|
61
87
|
|
|
@@ -114,7 +140,7 @@ See `.har/stages/PLAYWRIGHT.md` in the target repo after applying the template.
|
|
|
114
140
|
| `har control watch` | Continuously sync registered repos |
|
|
115
141
|
| `har mcp` | Start the HAR MCP server (stdio) |
|
|
116
142
|
|
|
117
|
-
Options: `--force`, `--auto` (built-in Claude adaptation), `--smoke`, `--yes` (auto-apply AGENT.md with `--auto`), `--verbose`, `--profile cli
|
|
143
|
+
Options: `--force`, `--auto` (built-in Claude adaptation), `--smoke`, `--yes` (auto-apply AGENT.md with `--auto`), `--verbose`, `--profile <default|cli|ios>`
|
|
118
144
|
|
|
119
145
|
## MCP Surface
|
|
120
146
|
|
package/dist/index.js
CHANGED
|
@@ -27244,7 +27244,7 @@ function patchStageRegistry(repoPath, manifest, force) {
|
|
|
27244
27244
|
if (verifyIdx >= 0) {
|
|
27245
27245
|
stages[verifyIdx] = {
|
|
27246
27246
|
...stages[verifyIdx],
|
|
27247
|
-
description: "Verification pipeline (quick by default; --full adds lint and browser-e2e when installed)",
|
|
27247
|
+
description: "Verification pipeline (quick smoke by default; --full adds tests, lint, and browser-e2e when installed)",
|
|
27248
27248
|
acceptsArgs: ["--full"]
|
|
27249
27249
|
};
|
|
27250
27250
|
}
|
|
@@ -42,7 +42,21 @@ Primary app, ports, `HARNESS_INFRA_SERVICES`, migrate/seed commands, health chec
|
|
|
42
42
|
PM2 processes for the primary application only, matching how it runs in dev. Skip entirely for the CLI profile.
|
|
43
43
|
|
|
44
44
|
### `.har/verify.sh`
|
|
45
|
-
|
|
45
|
+
Adapt verification for this repository's toolchain. Step lists in the template are
|
|
46
|
+
**examples, not exhaustive** — add, remove, or reorder `run_step` calls to match
|
|
47
|
+
how this project is built and tested.
|
|
48
|
+
|
|
49
|
+
**Tier contract:**
|
|
50
|
+
|
|
51
|
+
| Mode | Command | Intent |
|
|
52
|
+
|------|---------|--------|
|
|
53
|
+
| Quick (default) | `har env verify 1` | Smoke — compile / import / build / health only |
|
|
54
|
+
| Full | `har env verify 1 --full` | Stricter — unit tests, lint, readiness, optional browser-e2e |
|
|
55
|
+
|
|
56
|
+
- **Quick** must stay fast and minimal (syntax, compile, import smoke) — not the full test suite.
|
|
57
|
+
- **Full** holds unit tests, lint, and heavier checks; optional Playwright runs on `--full` when installed.
|
|
58
|
+
- Reuse real commands from `package.json`, `Makefile`, CI, `pyproject.toml`, etc.
|
|
59
|
+
- Replace all TODO placeholders in both tiers.
|
|
46
60
|
|
|
47
61
|
### Readiness vs liveness (required)
|
|
48
62
|
Do not treat a passing health check as adaptation complete. Before finishing,
|
|
@@ -20,7 +20,7 @@ Generated and maintained by [`har`](https://github.com/antoineFrau/har). Run `ha
|
|
|
20
20
|
| `agent-slot.sh` | Shared agent-id validation (reads limits from `harness.env`) |
|
|
21
21
|
| `setup-infra.sh` | Start shared Docker infra + create template database |
|
|
22
22
|
| `launch.sh` | Launch one agent slot (ports, DB clone, PM2 processes) |
|
|
23
|
-
| `verify.sh` | Verification pipeline (
|
|
23
|
+
| `verify.sh` | Verification pipeline (smoke by default; --full adds tests, lint, e2e) |
|
|
24
24
|
| `teardown.sh` | Tear down one agent slot |
|
|
25
25
|
| `agent-cli.sh` | Manage a running agent (status, logs, psql, health) |
|
|
26
26
|
| `attach.sh` | Attach to agent tmux session |
|
|
@@ -49,8 +49,8 @@ In Cursor with HAR MCP configured: use `har_launch_environment`, `har_run_verifi
|
|
|
49
49
|
```bash
|
|
50
50
|
./.har/setup-infra.sh # when HARNESS_INFRA_SERVICES is non-empty
|
|
51
51
|
./.har/launch.sh 1
|
|
52
|
-
./.har/verify.sh 1 # quick: typecheck
|
|
53
|
-
./.har/verify.sh 1 --full #
|
|
52
|
+
./.har/verify.sh 1 # quick: smoke (typecheck + health)
|
|
53
|
+
./.har/verify.sh 1 --full # + unit tests, lint, browser-e2e (if Playwright stage installed)
|
|
54
54
|
./.har/teardown.sh 1
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -58,10 +58,14 @@ Read **`stages.json`** for registered stages and **`verificationStages`** for th
|
|
|
58
58
|
|
|
59
59
|
## Verification contract
|
|
60
60
|
|
|
61
|
+
Steps in `verify.sh` are **project-specific examples** — adapt them to your stack
|
|
62
|
+
during `har env init` / `har env maintain`. The table describes each tier's intent,
|
|
63
|
+
not a fixed command list.
|
|
64
|
+
|
|
61
65
|
| Mode | Command | Typical steps |
|
|
62
66
|
|------|---------|---------------|
|
|
63
|
-
| Quick | `har env verify <id>` or `verify.sh <id>` |
|
|
64
|
-
| Full | `har env verify <id> --full` or `verify.sh <id> --full` |
|
|
67
|
+
| Quick | `har env verify <id>` or `verify.sh <id>` | Smoke: compile / typecheck / health (stops early on failure) |
|
|
68
|
+
| Full | `har env verify <id> --full` or `verify.sh <id> --full` | + unit tests, lint, optional readiness smoke + **`browser-e2e`** when `.har/stages/browser-e2e.sh` exists |
|
|
65
69
|
|
|
66
70
|
Install Playwright stage: `har env add-stage playwright` (optional). UI changes should add or update specs under `tests/`.
|
|
67
71
|
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
# Outputs JSON to stdout, human-readable progress to stderr.
|
|
4
4
|
#
|
|
5
5
|
# Usage: ./.har/verify.sh <agent-id> [--full]
|
|
6
|
+
#
|
|
7
|
+
# Quick (default): smoke — compile / typecheck / health only
|
|
8
|
+
# Full (--full): + unit tests, lint, optional readiness + browser-e2e
|
|
9
|
+
# Step lists are examples — not exhaustive. Adapt commands to this repo's stack.
|
|
6
10
|
set -euo pipefail
|
|
7
11
|
|
|
8
12
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -133,14 +137,16 @@ process.stdout.write(JSON.stringify(arr));
|
|
|
133
137
|
}
|
|
134
138
|
|
|
135
139
|
# ── Verification stages ─────────────────────────────────────────────────────
|
|
136
|
-
#
|
|
140
|
+
# Customize these steps for your project — lists below are examples, not exhaustive.
|
|
137
141
|
# Edit this section directly — do not use a separate config file.
|
|
138
142
|
|
|
143
|
+
# Quick (default): smoke — prove the slot can compile/load, not full test suites.
|
|
139
144
|
run_step "typecheck" "echo 'TODO: npm run typecheck'" || { [ -z "$FULL" ] && true; }
|
|
140
|
-
run_step "unit-tests" "echo 'TODO: npm test'" || { [ -z "$FULL" ] && true; }
|
|
141
145
|
run_http_step "api-health" "http://localhost:${API_PORT}${HARNESS_HEALTH_CHECK_PATH}" || { [ -z "$FULL" ] && true; }
|
|
142
146
|
|
|
143
147
|
if [ -n "$FULL" ]; then
|
|
148
|
+
# Full: project-specific checks — add/remove/reorder steps for this repo.
|
|
149
|
+
run_step "unit-tests" "echo 'TODO: npm test'" || true
|
|
144
150
|
run_step "lint" "echo 'TODO: npm run lint'" || true
|
|
145
151
|
run_step "readiness" "run_readiness_if_configured \"$AGENT_ID\"" || true
|
|
146
152
|
run_step "browser-e2e" "run_browser_e2e_if_present \"$SCRIPT_DIR\" \"$AGENT_ID\"" || true
|
|
@@ -20,7 +20,7 @@ Generated and maintained by [`har`](https://github.com/antoineFrau/har). Run `ha
|
|
|
20
20
|
| `agent-slot.sh` | Shared agent-id validation (reads limits from `harness.env`) |
|
|
21
21
|
| `setup-infra.sh` | Start optional Docker Compose stack + template database |
|
|
22
22
|
| `launch.sh` | Launch one agent slot (git worktree by default, deps, env file) |
|
|
23
|
-
| `verify.sh` | Verification pipeline (
|
|
23
|
+
| `verify.sh` | Verification pipeline (smoke by default; --full adds tests, lint, e2e) |
|
|
24
24
|
| `teardown.sh` | Tear down one agent slot (worktree + env file) |
|
|
25
25
|
| `agent-cli.sh` | Inspect slot status, run commands in the work dir |
|
|
26
26
|
| `docker-compose.agent.yml` | Shared infrastructure containers (services listed in `HARNESS_INFRA_SERVICES`) |
|
|
@@ -47,8 +47,8 @@ In Cursor with HAR MCP configured: use `har_launch_environment`, `har_run_verifi
|
|
|
47
47
|
```bash
|
|
48
48
|
./.har/setup-infra.sh # when HARNESS_INFRA_SERVICES is non-empty
|
|
49
49
|
./.har/launch.sh 1
|
|
50
|
-
./.har/verify.sh 1
|
|
51
|
-
./.har/verify.sh 1 --full # +
|
|
50
|
+
./.har/verify.sh 1 # quick: smoke (typecheck + build)
|
|
51
|
+
./.har/verify.sh 1 --full # + unit tests, lint, browser-e2e (if Playwright installed)
|
|
52
52
|
./.har/teardown.sh 1
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -56,10 +56,14 @@ Read **`stages.json`** and **`verificationStages`**. Optional: `har env add-stag
|
|
|
56
56
|
|
|
57
57
|
## Verification contract
|
|
58
58
|
|
|
59
|
+
Steps in `verify.sh` are **project-specific examples** — adapt them to your stack
|
|
60
|
+
during `har env init` / `har env maintain` / benchmark setup. The table describes
|
|
61
|
+
each tier's intent, not a fixed command list.
|
|
62
|
+
|
|
59
63
|
| Mode | Command | Typical steps |
|
|
60
64
|
|------|---------|---------------|
|
|
61
|
-
| Quick | `har env verify <id>` or `verify.sh <id>` | typecheck
|
|
62
|
-
| Full | `har env verify <id> --full` or `verify.sh <id> --full` | + lint, optional readiness smoke, **browser-e2e** when `stages/browser-e2e.sh` exists |
|
|
65
|
+
| Quick | `har env verify <id>` or `verify.sh <id>` | Smoke: compile / typecheck / build (language-agnostic) |
|
|
66
|
+
| Full | `har env verify <id> --full` or `verify.sh <id> --full` | + unit tests, lint, optional readiness smoke, **browser-e2e** when `stages/browser-e2e.sh` exists |
|
|
63
67
|
|
|
64
68
|
For repos that need runtime services, distinguish health from usability. If the
|
|
65
69
|
harness skips slow local-dev setup, document the skipped steps and add a minimal
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Verification pipeline for CLI/library repos
|
|
2
|
+
# Verification pipeline for CLI/library repos.
|
|
3
3
|
# Outputs JSON to stdout, human-readable progress to stderr.
|
|
4
4
|
#
|
|
5
5
|
# Usage: ./.har/verify.sh <agent-id> [--full]
|
|
6
|
+
#
|
|
7
|
+
# Quick (default): smoke — compile / typecheck / build only
|
|
8
|
+
# Full (--full): + unit tests, lint, optional readiness + browser-e2e
|
|
9
|
+
# Step lists are examples — not exhaustive. Adapt commands to this repo's stack.
|
|
6
10
|
set -euo pipefail
|
|
7
11
|
|
|
8
12
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -89,12 +93,15 @@ process.stdout.write(JSON.stringify(arr));
|
|
|
89
93
|
fi
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
# ── Quick (default): smoke only ──────────────────────────────────────────────
|
|
97
|
+
# Customize for this repo: compile / import / build — not the full test suite.
|
|
92
98
|
run_step "typecheck" "npm run typecheck" || { [ -z "$FULL" ] && true; }
|
|
93
99
|
# Some unit tests exec dist/index.js (e.g. stage-templates CLI add-stage).
|
|
94
100
|
run_step "build" "npm run build" || { [ -z "$FULL" ] && true; }
|
|
95
|
-
run_step "unit-tests" "npm test" || { [ -z "$FULL" ] && true; }
|
|
96
101
|
|
|
97
102
|
if [ -n "$FULL" ]; then
|
|
103
|
+
# ── Full: project-specific checks (examples — add/remove/reorder as needed) ─
|
|
104
|
+
run_step "unit-tests" "npm test" || true
|
|
98
105
|
run_step "lint" "npm run lint" || true
|
|
99
106
|
run_step "readiness" "run_readiness_if_configured \"$AGENT_ID\"" || true
|
|
100
107
|
run_step "browser-e2e" "run_browser_e2e_if_present \"$SCRIPT_DIR\" \"$AGENT_ID\"" || true
|
|
@@ -20,7 +20,7 @@ Generated and maintained by [`har`](https://github.com/antoineFrau/har). Run `ha
|
|
|
20
20
|
| `agent-slot.sh` | Shared agent-id validation and slot registry helpers |
|
|
21
21
|
| `setup-infra.sh` | Boot the iOS Simulator; start optional Docker services |
|
|
22
22
|
| `launch.sh` | Launch one agent slot (git worktree, CocoaPods/SPM deps, env file) |
|
|
23
|
-
| `verify.sh` | Verification pipeline (build
|
|
23
|
+
| `verify.sh` | Verification pipeline (build smoke by default; --full adds tests, lint, flows) |
|
|
24
24
|
| `teardown.sh` | Tear down one agent slot (worktree + env file) |
|
|
25
25
|
| `agent-cli.sh` | Inspect slot status, run xcodebuild commands, install/launch app |
|
|
26
26
|
| `docker-compose.agent.yml` | Optional shared backend services |
|
|
@@ -47,8 +47,8 @@ In Cursor with HAR MCP configured: use `har_launch_environment`, `har_run_verifi
|
|
|
47
47
|
```bash
|
|
48
48
|
./.har/setup-infra.sh # boots the iOS Simulator
|
|
49
49
|
./.har/launch.sh 1
|
|
50
|
-
./.har/verify.sh 1 # build
|
|
51
|
-
./.har/verify.sh 1 --full # + lint
|
|
50
|
+
./.har/verify.sh 1 # quick: build smoke (compile-only)
|
|
51
|
+
./.har/verify.sh 1 --full # + unit tests, lint, rocketsim-flows (if installed)
|
|
52
52
|
./.har/teardown.sh 1
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -64,10 +64,13 @@ This installs `.har/stages/rocketsim-flows.sh` and a `flows/` directory. Add flo
|
|
|
64
64
|
|
|
65
65
|
## Verification contract
|
|
66
66
|
|
|
67
|
+
Steps in `verify.sh` are **project-specific examples** — adapt them to your stack.
|
|
68
|
+
The table describes each tier's intent, not a fixed command list.
|
|
69
|
+
|
|
67
70
|
| Mode | Command | Typical steps |
|
|
68
71
|
|------|---------|---------------|
|
|
69
|
-
| Quick | `har env verify <id>` | build
|
|
70
|
-
| Full | `har env verify <id> --full` | + lint, optional readiness smoke, **rocketsim-flows** when installed |
|
|
72
|
+
| Quick | `har env verify <id>` | build smoke (compile-only) |
|
|
73
|
+
| Full | `har env verify <id> --full` | + unit tests, lint, optional readiness smoke, **rocketsim-flows** when installed |
|
|
71
74
|
|
|
72
75
|
For apps that depend on local backends, auth, seeded state, or simulator flows,
|
|
73
76
|
distinguish build/test health from agent usability. Document any skipped full
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
#
|
|
5
5
|
# Usage: ./.har/verify.sh <agent-id> [--full]
|
|
6
6
|
#
|
|
7
|
-
# Quick (default): build
|
|
8
|
-
# Full (--full): + lint (SwiftLint)
|
|
7
|
+
# Quick (default): build smoke (compile-only)
|
|
8
|
+
# Full (--full): + unit tests, lint (SwiftLint), rocketsim-flows (if installed)
|
|
9
|
+
# Step lists are examples — not exhaustive. Adapt commands to this repo's stack.
|
|
9
10
|
set -euo pipefail
|
|
10
11
|
|
|
11
12
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -114,7 +115,7 @@ process.stdout.write(JSON.stringify(arr));
|
|
|
114
115
|
fi
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
#
|
|
118
|
+
# Quick (default): compile-only — catches syntax errors and missing symbols
|
|
118
119
|
run_step "build" "xcodebuild build \
|
|
119
120
|
${XC_FLAGS} \
|
|
120
121
|
-scheme \"${XC_SCHEME}\" \
|
|
@@ -128,21 +129,21 @@ run_step "build" "xcodebuild build \
|
|
|
128
129
|
-derivedDataPath \"${XC_DERIVED}\" \
|
|
129
130
|
CODE_SIGNING_ALLOWED=NO" || { [ -z "$FULL" ] && true; }
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
-scheme \"${XC_SCHEME}\" \
|
|
135
|
-
-destination \"${XC_DESTINATION}\" \
|
|
136
|
-
-derivedDataPath \"${XC_DERIVED}\" \
|
|
137
|
-
CODE_SIGNING_ALLOWED=NO \
|
|
138
|
-
| xcbeautify 2>/dev/null || xcodebuild test \
|
|
132
|
+
if [ -n "$FULL" ]; then
|
|
133
|
+
# Full: project-specific checks — add/remove/reorder steps for this repo.
|
|
134
|
+
run_step "unit-tests" "xcodebuild test \
|
|
139
135
|
${XC_FLAGS} \
|
|
140
136
|
-scheme \"${XC_SCHEME}\" \
|
|
141
137
|
-destination \"${XC_DESTINATION}\" \
|
|
142
138
|
-derivedDataPath \"${XC_DERIVED}\" \
|
|
143
|
-
CODE_SIGNING_ALLOWED=NO
|
|
139
|
+
CODE_SIGNING_ALLOWED=NO \
|
|
140
|
+
| xcbeautify 2>/dev/null || xcodebuild test \
|
|
141
|
+
${XC_FLAGS} \
|
|
142
|
+
-scheme \"${XC_SCHEME}\" \
|
|
143
|
+
-destination \"${XC_DESTINATION}\" \
|
|
144
|
+
-derivedDataPath \"${XC_DERIVED}\" \
|
|
145
|
+
CODE_SIGNING_ALLOWED=NO" || true
|
|
144
146
|
|
|
145
|
-
if [ -n "$FULL" ]; then
|
|
146
147
|
# SwiftLint — optional, skip gracefully when not installed
|
|
147
148
|
run_step "lint" "command -v \"${HARNESS_SWIFTLINT_CMD:-swiftlint}\" >/dev/null 2>&1 && \
|
|
148
149
|
\"${HARNESS_SWIFTLINT_CMD:-swiftlint}\" --quiet 2>&1 || echo 'swiftlint not installed — skipping'" || true
|