@osfactory/har 0.1.1

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 (71) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +208 -0
  3. package/control/docker-compose.build.yml +7 -0
  4. package/control/docker-compose.yml +31 -0
  5. package/dist/index.js +41753 -0
  6. package/dist/prompts/system-authoring.md +104 -0
  7. package/dist/templates/AGENT.md.template +40 -0
  8. package/dist/templates/CLAUDE.md.template +5 -0
  9. package/dist/templates/adaptation-prompt-init.md +124 -0
  10. package/dist/templates/adaptation-prompt-maintain.md +73 -0
  11. package/dist/templates/cursor-rule.mdc.template +101 -0
  12. package/dist/templates/har-boilerplate/CLAUDE.agent.md +54 -0
  13. package/dist/templates/har-boilerplate/README.md +134 -0
  14. package/dist/templates/har-boilerplate/agent-cli.sh +172 -0
  15. package/dist/templates/har-boilerplate/agent-slot.sh +270 -0
  16. package/dist/templates/har-boilerplate/attach.sh +16 -0
  17. package/dist/templates/har-boilerplate/docker-compose.agent.yml +66 -0
  18. package/dist/templates/har-boilerplate/ecosystem.agent.template.cjs +44 -0
  19. package/dist/templates/har-boilerplate/env.template +37 -0
  20. package/dist/templates/har-boilerplate/harness.env +50 -0
  21. package/dist/templates/har-boilerplate/justfile +39 -0
  22. package/dist/templates/har-boilerplate/launch.sh +229 -0
  23. package/dist/templates/har-boilerplate/setup-infra.sh +102 -0
  24. package/dist/templates/har-boilerplate/stages/README.sh +9 -0
  25. package/dist/templates/har-boilerplate/stages.json +67 -0
  26. package/dist/templates/har-boilerplate/teardown.sh +86 -0
  27. package/dist/templates/har-boilerplate/verify.sh +163 -0
  28. package/dist/templates/har-boilerplate-cli/CLAUDE.agent.md +41 -0
  29. package/dist/templates/har-boilerplate-cli/README.md +112 -0
  30. package/dist/templates/har-boilerplate-cli/agent-cli.sh +162 -0
  31. package/dist/templates/har-boilerplate-cli/agent-slot.sh +270 -0
  32. package/dist/templates/har-boilerplate-cli/docker-compose.agent.yml +64 -0
  33. package/dist/templates/har-boilerplate-cli/harness.env +40 -0
  34. package/dist/templates/har-boilerplate-cli/justfile +27 -0
  35. package/dist/templates/har-boilerplate-cli/launch.sh +132 -0
  36. package/dist/templates/har-boilerplate-cli/setup-infra.sh +102 -0
  37. package/dist/templates/har-boilerplate-cli/stages/README.sh +9 -0
  38. package/dist/templates/har-boilerplate-cli/stages.json +61 -0
  39. package/dist/templates/har-boilerplate-cli/teardown.sh +66 -0
  40. package/dist/templates/har-boilerplate-cli/verify.sh +113 -0
  41. package/dist/templates/har-boilerplate-ios/ADAPT-PROMPT.md +57 -0
  42. package/dist/templates/har-boilerplate-ios/CLAUDE.agent.md +65 -0
  43. package/dist/templates/har-boilerplate-ios/README.md +88 -0
  44. package/dist/templates/har-boilerplate-ios/agent-cli.sh +125 -0
  45. package/dist/templates/har-boilerplate-ios/agent-slot.sh +270 -0
  46. package/dist/templates/har-boilerplate-ios/docker-compose.agent.yml +17 -0
  47. package/dist/templates/har-boilerplate-ios/harness.env +42 -0
  48. package/dist/templates/har-boilerplate-ios/justfile +33 -0
  49. package/dist/templates/har-boilerplate-ios/launch.sh +132 -0
  50. package/dist/templates/har-boilerplate-ios/setup-infra.sh +84 -0
  51. package/dist/templates/har-boilerplate-ios/stages/README.sh +12 -0
  52. package/dist/templates/har-boilerplate-ios/stages.json +61 -0
  53. package/dist/templates/har-boilerplate-ios/teardown.sh +64 -0
  54. package/dist/templates/har-boilerplate-ios/verify.sh +165 -0
  55. package/dist/templates/stage-templates/playwright/.github/workflows/playwright.yml +30 -0
  56. package/dist/templates/stage-templates/playwright/.har/stages/PLAYWRIGHT.md +21 -0
  57. package/dist/templates/stage-templates/playwright/.har/stages/browser-e2e.sh +83 -0
  58. package/dist/templates/stage-templates/playwright/README.md +14 -0
  59. package/dist/templates/stage-templates/playwright/package.fragment.json +14 -0
  60. package/dist/templates/stage-templates/playwright/playwright.config.js +30 -0
  61. package/dist/templates/stage-templates/playwright/template.manifest.json +44 -0
  62. package/dist/templates/stage-templates/playwright/tests/a11y/smoke.spec.js +14 -0
  63. package/dist/templates/stage-templates/playwright/tests/api/health.spec.js +10 -0
  64. package/dist/templates/stage-templates/playwright/tests/frontend/smoke.spec.js +9 -0
  65. package/dist/templates/stage-templates/rocketsim/.har/stages/ROCKETSIM.md +126 -0
  66. package/dist/templates/stage-templates/rocketsim/.har/stages/rocketsim-flows.sh +188 -0
  67. package/dist/templates/stage-templates/rocketsim/README.md +66 -0
  68. package/dist/templates/stage-templates/rocketsim/flows/README.md +36 -0
  69. package/dist/templates/stage-templates/rocketsim/flows/example-smoke.sh +60 -0
  70. package/dist/templates/stage-templates/rocketsim/template.manifest.json +38 -0
  71. package/package.json +78 -0
package/README.md ADDED
@@ -0,0 +1,208 @@
1
+ <p align="center">
2
+ <img src="logo.png" alt="har logo" width="120">
3
+ </p>
4
+
5
+ # har — Your AI harness orchestrator
6
+
7
+ [![Release](https://img.shields.io/github/v/release/antoineFrau/har)](https://github.com/antoineFrau/har/releases)
8
+ [![CI](https://github.com/antoineFrau/har/actions/workflows/test.yml/badge.svg)](https://github.com/antoineFrau/har/actions/workflows/test.yml)
9
+
10
+ **Make any repository agent-ready without binding it to one coding agent, test runner, or hosted platform.**
11
+
12
+ HAR is an open-source CLI and MCP control plane for project-owned development harnesses. It scaffolds an editable `.har/` runtime contract so humans and MCP-capable coding agents can discover how to launch, verify, reset, inspect, and tear down a repository.
13
+
14
+ HAR does not own the coding LLM and does not replace CI/CD. It gives agents a stable, machine-readable way to use the workflow your team already trusts.
15
+
16
+ ## How It Works
17
+
18
+ 1. **Project-owned harness** — `.har/` contains editable scripts, docs, environment metadata, logs, artifacts, and optional stage definitions.
19
+ 2. **CLI control plane** — `har env ...` scaffolds, maintains, launches, verifies, reports status, and tears down local or self-hosted harness runs.
20
+ 3. **MCP adapter** — agents use HAR MCP tools to describe the project, run generic stages, read logs, list artifacts, and inspect status without learning repo-specific shell details.
21
+ 4. **Generic stages** — setup, launch, verify, test, inspect, reset, teardown, and custom stages expose normalized status, logs, durations, artifacts, and URLs.
22
+ 5. **Configurable agent slots** — parallel environment limits are defined in `.har/stages.json` (`agentSlots`) and `.har/harness.env`, not by the HAR CLI.
23
+ 6. **Optional stage templates** — add workflows like Playwright with `har env add-stage playwright`. They compile to generic stages (`test`, `custom`, etc.), not hardcoded HAR APIs.
24
+
25
+ ## Install
26
+
27
+ **From npm** (after the first GitHub Release — `@osfactory/har` is not on npm yet):
28
+
29
+ ```bash
30
+ npm install -g @osfactory/har
31
+ ```
32
+
33
+ **From source** (recommended until the first release):
34
+
35
+ ```bash
36
+ git clone https://github.com/antoineFrau/har har-project && cd har-project
37
+ npm install && npm run build && npm link
38
+ ```
39
+
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
+
42
+ ## Quick start
43
+
44
+ ```bash
45
+ cd my-app
46
+ har env init
47
+
48
+ # Paste the printed prompt into your coding agent to adapt .har/ and AGENT.md
49
+ git add .har/ AGENT.md
50
+ git commit -m "Add agent harness"
51
+
52
+ har env launch 1
53
+ har env verify 1
54
+ ```
55
+
56
+ Shell fallback when the CLI is not installed: `./.har/setup-infra.sh`, `./.har/launch.sh 1`, `./.har/verify.sh 1`.
57
+
58
+ For built-in Claude adaptation (requires `ANTHROPIC_API_KEY`): `har env init --auto`.
59
+
60
+ ## Repo layout after init
61
+
62
+ ```
63
+ my-app/
64
+ ├── AGENT.md # Short pointer for coding agents (you approve this)
65
+ └── .har/
66
+ ├── README.md # Full harness documentation (maintained by har)
67
+ ├── manifest.json # Generator metadata
68
+ ├── stages.json # Optional generic stage registry
69
+ ├── setup-infra.sh
70
+ ├── launch.sh
71
+ ├── verify.sh
72
+ ├── agent-cli.sh
73
+ ├── logs/
74
+ ├── artifacts/
75
+ ├── harness.env
76
+ ├── CLAUDE.agent.md
77
+ └── ...
78
+ ```
79
+
80
+ ## Generic Stage Contract
81
+
82
+ HAR stages are project-defined operations with stable identifiers and normalized results. A stage can be as simple as `verify` or as specific as `browser-e2e`, `migration-check`, `accessibility`, or `load-smoke`.
83
+
84
+ The important boundary is that HAR runs and reports stages generically. It does not need a special Playwright, migration, accessibility, or load-test API in the core product.
85
+
86
+ ### Playwright (optional)
87
+
88
+ ```bash
89
+ har env init
90
+ har env add-stage playwright # registers browser-e2e + scaffolds tests/
91
+ npm install && npx playwright install
92
+ ./.har/launch.sh 1
93
+ ./.har/stages/browser-e2e.sh 1
94
+ ```
95
+
96
+ See `.har/stages/PLAYWRIGHT.md` in the target repo after applying the template.
97
+
98
+ ## CLI commands
99
+
100
+ | Command | Description |
101
+ |---------|-------------|
102
+ | `har env init` | Scaffold `.har/` + print coding-agent adaptation prompt |
103
+ | `har env add-stage playwright` | Add Playwright `browser-e2e` stage + test scaffold |
104
+ | `har env maintain` | Validate harness + print maintenance prompt |
105
+ | `har env launch 1` | Launch agent slot 1 |
106
+ | `har env verify 1` | Run verification |
107
+ | `har env status` | Show status for all agent slots (`--json` for structured output) |
108
+ | `har env runs list` | List persisted run history (`--json`) |
109
+ | `har env runs get <runId>` | Fetch one run record |
110
+ | `har env teardown 1` | Tear down agent slot 1 |
111
+ | `har control up` | Start local Mission Control dashboard (Docker Compose) |
112
+ | `har control register` | Register a repo with Mission Control |
113
+ | `har control sync` | Sync runs + slot status to Mission Control |
114
+ | `har control watch` | Continuously sync registered repos |
115
+ | `har mcp` | Start the HAR MCP server (stdio) |
116
+
117
+ Options: `--force`, `--auto` (built-in Claude adaptation), `--smoke`, `--yes` (auto-apply AGENT.md with `--auto`), `--verbose`, `--profile cli`
118
+
119
+ ## MCP Surface
120
+
121
+ Start the server from a repository (or pass `repo` on each tool call):
122
+
123
+ ```bash
124
+ har mcp
125
+ ```
126
+
127
+ Example Cursor MCP config:
128
+
129
+ ```json
130
+ {
131
+ "mcpServers": {
132
+ "har": {
133
+ "command": "har",
134
+ "args": ["mcp", "--repo", "/path/to/my-app"]
135
+ }
136
+ }
137
+ }
138
+ ```
139
+
140
+ Core tools (generic — no stack-specific operations like `run_playwright`):
141
+
142
+ | Tool | Purpose |
143
+ |------|---------|
144
+ | `har_describe_project` | Manifest, scripts, stages, agent slot limits, stack hints |
145
+ | `har_init_harness` | Scaffold `.har/` (optionally skip LLM) |
146
+ | `har_launch_environment` | Launch slot; return preview URLs |
147
+ | `har_run_stage` | Run one stage by id or kind |
148
+ | `har_run_verification` | Run the verification pipeline |
149
+ | `har_get_status` | Slot/process status |
150
+ | `har_get_logs` | Recent logs for a slot |
151
+ | `har_teardown_environment` | Stop a slot |
152
+ | `har_list_artifacts` | List files under `.har/artifacts/` |
153
+ | `har_list_runs` | List persisted run records from `.har/runs/` |
154
+ | `har_get_run` | Fetch one run record by `runId` |
155
+
156
+ ## Mission Control (local dashboard)
157
+
158
+ Free OSS dashboard for observing harness runs, worktrees, and agent slots on your machine:
159
+
160
+ ```bash
161
+ har control up # pulls theosfactory/har-control:<cli-version> + Postgres at http://localhost:3847
162
+ har env init # remembers the repo for sync when Control starts
163
+ har control sync # push runs + slot status
164
+ ```
165
+
166
+ See [`control/AGENT.md`](./control/AGENT.md) for dashboard development. Hosted team features are **HAR Cloud** (paid).
167
+
168
+ Agents can still use GitHub, Linear, observability, and other MCP servers directly. HAR focuses on the repository harness and run state.
169
+
170
+ ## HAR Cloud
171
+
172
+ The open-source CLI and MCP harness are the core. Paid HAR Cloud should add hosted operational value that teams do not want to build themselves:
173
+
174
+ - Hosted branch previews and remote harness runs
175
+ - Run history, logs, artifacts, screenshots, traces, and result timelines
176
+ - QA handoff, approvals, and shareable preview links
177
+ - Slack, Linear, GitHub, and observability integrations
178
+ - Team dashboards for status, policy, audit trails, and cost controls
179
+
180
+ HAR Cloud should coordinate and observe the factory. The repo-owned `.har/` contract remains portable.
181
+
182
+ ## For Coding Agents
183
+
184
+ Agents should read **`AGENT.md`** first, then **`.har/README.md`**. Prefer **HAR MCP tools** (in Cursor) or **`har env …`** for launch, verify, and teardown — they persist run history. Use `./.har/*.sh` only when the CLI is not installed.
185
+
186
+ ## License
187
+
188
+ **Dual licensing.** This project uses different licenses for code, documentation, and branding.
189
+
190
+ | Material | License | Details |
191
+ |----------|---------|---------|
192
+ | Software (CLI, MCP server, Mission Control code, tooling) | [AGPL-3.0-only](./LICENSE) | Copyleft; network use (SaaS) triggers source-offer obligations |
193
+ | Documentation and written guides | [CC BY-SA 4.0](./DOCUMENTATION-LICENSE.md) | Share and adapt with attribution and share-alike |
194
+ | Name, logo, trademarks | All rights reserved | See [TRADEMARK.md](./TRADEMARK.md) |
195
+
196
+ **Commercial use without AGPL obligations** — closed-source products, managed hosting, training/certification programs, trademark use, or other rights beyond the public licenses require a separate agreement. See [LICENSE-COMMERCIAL.md](./LICENSE-COMMERCIAL.md).
197
+
198
+ Copyright © 2026 [Antoine Frau](https://github.com/antoineFrau/har).
199
+
200
+ Contributors agree to the [Contributor License Agreement](./CLA.md).
201
+
202
+ **Note:** Earlier releases may have been published under MIT. Those versions remain under MIT; new releases from this license change forward are under AGPL-3.0-only unless you obtain a commercial license.
203
+
204
+ ## Security
205
+
206
+ Report vulnerabilities via [SECURITY.md](./SECURITY.md) (GitHub private advisory preferred).
207
+
208
+ Inspired by [Lightdash's agent-harness](https://github.com/lightdash/lightdash/tree/main/agent-harness).
@@ -0,0 +1,7 @@
1
+ # Local development override — merged when `har control up --build` or HAR_CONTROL_BUILD=true.
2
+ services:
3
+ app:
4
+ build:
5
+ context: ..
6
+ dockerfile: control/Dockerfile
7
+ pull_policy: build
@@ -0,0 +1,31 @@
1
+ services:
2
+ db:
3
+ image: postgres:16-alpine
4
+ environment:
5
+ POSTGRES_USER: har
6
+ POSTGRES_PASSWORD: har
7
+ POSTGRES_DB: har_control
8
+ ports:
9
+ - "5433:5432"
10
+ volumes:
11
+ - har_control_pg:/var/lib/postgresql/data
12
+ healthcheck:
13
+ test: ["CMD-SHELL", "pg_isready -U har -d har_control"]
14
+ interval: 5s
15
+ timeout: 5s
16
+ retries: 5
17
+
18
+ app:
19
+ image: ${HAR_CONTROL_IMAGE:-theosfactory/har-control}:${HAR_CONTROL_IMAGE_TAG}
20
+ pull_policy: always
21
+ ports:
22
+ - "3847:3847"
23
+ environment:
24
+ DATABASE_URL: postgresql://har:har@db:5432/har_control
25
+ NODE_ENV: production
26
+ depends_on:
27
+ db:
28
+ condition: service_healthy
29
+
30
+ volumes:
31
+ har_control_pg: