@osfactory/har 0.18.1 → 0.19.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 +641 -208
- package/dist/templates/cursor-rule.mdc.template +8 -7
- package/dist/templates/har-boilerplate/README.md +10 -8
- package/dist/templates/har-boilerplate/agent-slot.sh +11 -0
- package/dist/templates/har-boilerplate-cli/README.md +10 -8
- package/dist/templates/har-boilerplate-cli/agent-slot.sh +11 -0
- package/dist/templates/har-boilerplate-ios/README.md +7 -3
- package/dist/templates/har-boilerplate-ios/agent-slot.sh +11 -0
- package/package.json +1 -1
|
@@ -15,13 +15,14 @@ work around it with ad-hoc commands.
|
|
|
15
15
|
|
|
16
16
|
## Before making changes
|
|
17
17
|
|
|
18
|
-
1. **
|
|
19
|
-
2. **
|
|
20
|
-
3.
|
|
21
|
-
4. Read [.
|
|
22
|
-
5.
|
|
18
|
+
1. **On the main checkout, switch to the intended base** (usually `main`) — every launch creates a worktree from that HEAD. `--replace` does not select the base.
|
|
19
|
+
2. **Launch your slot FIRST — before editing any file.** Use `har_launch_environment` with `agentId: 1` (MCP) or `har env launch 1`. Launch always creates a **fresh session worktree** and returns its **work dir**.
|
|
20
|
+
3. **Make ALL file edits under the returned work dir — never in the main checkout.** The work dir looks like `~/worktrees/<base-branch>-<sha4>-har-agent-<id>-<rand4>` (recorded in `.har/slots/agent-<id>.json`). Edits there hot-reload in the running slot; use `har env restart <id>` or `./.har/agent-cli.sh <id> restart` if a change doesn't take.
|
|
21
|
+
4. Read [AGENT.md](./AGENT.md) at the repo root
|
|
22
|
+
5. Read [.har/README.md](./.har/README.md) and [.har/stages.json](./.har/stages.json)
|
|
23
|
+
6. After launch, read [.har/CLAUDE.agent.md](./.har/CLAUDE.agent.md) for slot URLs and definition of done
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
When a slot is occupied: prefer `complete` / `teardown` if the previous task is finished, then launch. Use `--replace` / `confirmReplace=true` only to reuse the same slot id immediately (destroys the old worktree; the old branch is kept if committed). If the previous session has uncommitted changes, you must also pass `force`/`--force` after **explicit user approval** — never autonomously. Failed launches: `--resume` / `recover`, not `--replace`.
|
|
25
26
|
|
|
26
27
|
### Slot safety (read before launch)
|
|
27
28
|
|
|
@@ -30,7 +31,7 @@ Relaunching a slot **replaces** its previous session (the old branch is kept). R
|
|
|
30
31
|
- **Never** set `force`/`confirmReplace` without the user explicitly approving replacement.
|
|
31
32
|
- **Commit early and often** in the session worktree — teardown keeps the branch, not uncommitted work.
|
|
32
33
|
- **Gitignored paths are ephemeral** (`state/`, `runs/`, local clones) — they are lost when the worktree is removed.
|
|
33
|
-
-
|
|
34
|
+
- With telemetry prompts enabled, Mission Control derives session purpose from the first captured user prompt.
|
|
34
35
|
|
|
35
36
|
<!-- Monorepo: if this repository contains multiple .har harnesses, list them here
|
|
36
37
|
and pick by the files you are changing. Example:
|
|
@@ -179,15 +179,17 @@ The authoring agent updates scripts and this README. Review changes before commi
|
|
|
179
179
|
|
|
180
180
|
## Session lifecycle
|
|
181
181
|
|
|
182
|
-
Every `launch` starts a **fresh session**: a new git worktree from the
|
|
182
|
+
Every `launch` starts a **fresh session**: a new git worktree from the **main
|
|
183
|
+
checkout's current HEAD** at
|
|
183
184
|
`~/worktrees/<base-branch>-<sha4>-har-agent-<id>-<rand4>`, on a branch of the same name.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
work dir
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
Switch that checkout to your intended base before launch. The session is recorded in
|
|
186
|
+
`.har/slots/agent-<id>.json` (the slot registry) — status, verify, and teardown resolve
|
|
187
|
+
the work dir through it. Make ALL file edits under the work dir printed by launch,
|
|
188
|
+
never in the main checkout.
|
|
189
|
+
|
|
190
|
+
- Prefer `complete` / `teardown` when a task is finished, then launch.
|
|
191
|
+
- `--replace` destroys the previous worktree (requires confirmation); it does **not**
|
|
192
|
+
choose `main`. Uncommitted changes also need `--force` after explicit user approval.
|
|
191
193
|
- `teardown` removes the worktree but **keeps the session branch** so you can push it
|
|
192
194
|
or open a PR (`--delete-branch` to drop it).
|
|
193
195
|
- If launch fails after creating a worktree/env file, the registry records `status: failed`.
|
|
@@ -535,6 +535,17 @@ print_slot_replace_warning() {
|
|
|
535
535
|
[ -n "$created" ] && echo " Since: ${created}" >&2
|
|
536
536
|
echo " Git: ${dirty_summary}" >&2
|
|
537
537
|
echo "" >&2
|
|
538
|
+
local base_root="${HARNESS_ROOT:-${REPO_ROOT:-}}"
|
|
539
|
+
if [ -n "$base_root" ] && [ -d "$base_root" ]; then
|
|
540
|
+
local base_branch base_sha
|
|
541
|
+
base_branch="$(git -C "$base_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo detached)"
|
|
542
|
+
base_sha="$(git -C "$base_root" rev-parse --short HEAD 2>/dev/null || true)"
|
|
543
|
+
echo " New session will be based on: ${base_branch}${base_sha:+ @ ${base_sha}}" >&2
|
|
544
|
+
echo " (HEAD of ${base_root})" >&2
|
|
545
|
+
echo " --replace does not choose this base — switch that checkout first for a new unrelated task." >&2
|
|
546
|
+
echo "" >&2
|
|
547
|
+
fi
|
|
548
|
+
echo " Prefer complete/teardown when the previous task is finished, then launch." >&2
|
|
538
549
|
echo " The session branch is kept only if you committed. Gitignored paths" >&2
|
|
539
550
|
echo " (state/, runs/, local clones, .env.local) are NOT preserved." >&2
|
|
540
551
|
echo "" >&2
|
|
@@ -137,15 +137,17 @@ The authoring agent updates scripts and this README. Review changes before commi
|
|
|
137
137
|
|
|
138
138
|
## Session lifecycle
|
|
139
139
|
|
|
140
|
-
Every `launch` starts a **fresh session**: a new git worktree from the
|
|
140
|
+
Every `launch` starts a **fresh session**: a new git worktree from the **main
|
|
141
|
+
checkout's current HEAD** at
|
|
141
142
|
`~/worktrees/<base-branch>-<sha4>-har-agent-<id>-<rand4>`, on a branch of the same name.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
work dir
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
Switch that checkout to your intended base before launch. The session is recorded in
|
|
144
|
+
`.har/slots/agent-<id>.json` (the slot registry) — status, verify, and teardown resolve
|
|
145
|
+
the work dir through it. Make ALL file edits under the work dir printed by launch,
|
|
146
|
+
never in the main checkout.
|
|
147
|
+
|
|
148
|
+
- Prefer `complete` / `teardown` when a task is finished, then launch.
|
|
149
|
+
- `--replace` destroys the previous worktree (requires confirmation); it does **not**
|
|
150
|
+
choose `main`. Uncommitted changes also need `--force` after explicit user approval.
|
|
149
151
|
- `teardown` removes the worktree but **keeps the session branch** so you can push it
|
|
150
152
|
or open a PR (`--delete-branch` to drop it).
|
|
151
153
|
- If launch fails after creating a worktree/env file, resume with
|
|
@@ -515,6 +515,17 @@ print_slot_replace_warning() {
|
|
|
515
515
|
[ -n "$created" ] && echo " Since: ${created}" >&2
|
|
516
516
|
echo " Git: ${dirty_summary}" >&2
|
|
517
517
|
echo "" >&2
|
|
518
|
+
local base_root="${HARNESS_ROOT:-${REPO_ROOT:-}}"
|
|
519
|
+
if [ -n "$base_root" ] && [ -d "$base_root" ]; then
|
|
520
|
+
local base_branch base_sha
|
|
521
|
+
base_branch="$(git -C "$base_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo detached)"
|
|
522
|
+
base_sha="$(git -C "$base_root" rev-parse --short HEAD 2>/dev/null || true)"
|
|
523
|
+
echo " New session will be based on: ${base_branch}${base_sha:+ @ ${base_sha}}" >&2
|
|
524
|
+
echo " (HEAD of ${base_root})" >&2
|
|
525
|
+
echo " --replace does not choose this base — switch that checkout first for a new unrelated task." >&2
|
|
526
|
+
echo "" >&2
|
|
527
|
+
fi
|
|
528
|
+
echo " Prefer complete/teardown when the previous task is finished, then launch." >&2
|
|
518
529
|
echo " The session branch is kept only if you committed. Gitignored paths" >&2
|
|
519
530
|
echo " (state/, runs/, local clones, .env.local) are NOT preserved." >&2
|
|
520
531
|
echo "" >&2
|
|
@@ -113,10 +113,14 @@ When your app talks to a local backend, read the resolved host port from `.env.a
|
|
|
113
113
|
|
|
114
114
|
## Session lifecycle
|
|
115
115
|
|
|
116
|
-
Every `launch` starts a **fresh session**: a new git worktree from the
|
|
116
|
+
Every `launch` starts a **fresh session**: a new git worktree from the **main
|
|
117
|
+
checkout's current HEAD** at
|
|
117
118
|
`~/worktrees/<base-branch>-<sha4>-har-agent-<id>-<rand4>`, on a branch of the same name.
|
|
118
|
-
The session is recorded in
|
|
119
|
+
Switch that checkout to your intended base before launch. The session is recorded in
|
|
120
|
+
`.har/slots/agent-<id>.json`.
|
|
119
121
|
|
|
120
|
-
-
|
|
122
|
+
- Prefer `complete` / `teardown` when a task is finished, then launch.
|
|
123
|
+
- `--replace` destroys the previous worktree; it does **not** choose `main`.
|
|
124
|
+
Uncommitted changes also require `--force` after explicit approval.
|
|
121
125
|
- `teardown` removes the worktree but **keeps the session branch** for push / PR.
|
|
122
126
|
- `har env complete <id>` finishes a session: full verify + teardown, branch kept.
|
|
@@ -176,6 +176,17 @@ print_slot_replace_warning() {
|
|
|
176
176
|
[ -n "$created" ] && echo " Since: ${created}" >&2
|
|
177
177
|
echo " Git: ${dirty_summary}" >&2
|
|
178
178
|
echo "" >&2
|
|
179
|
+
local base_root="${HARNESS_ROOT:-${REPO_ROOT:-}}"
|
|
180
|
+
if [ -n "$base_root" ] && [ -d "$base_root" ]; then
|
|
181
|
+
local base_branch base_sha
|
|
182
|
+
base_branch="$(git -C "$base_root" rev-parse --abbrev-ref HEAD 2>/dev/null || echo detached)"
|
|
183
|
+
base_sha="$(git -C "$base_root" rev-parse --short HEAD 2>/dev/null || true)"
|
|
184
|
+
echo " New session will be based on: ${base_branch}${base_sha:+ @ ${base_sha}}" >&2
|
|
185
|
+
echo " (HEAD of ${base_root})" >&2
|
|
186
|
+
echo " --replace does not choose this base — switch that checkout first for a new unrelated task." >&2
|
|
187
|
+
echo "" >&2
|
|
188
|
+
fi
|
|
189
|
+
echo " Prefer complete/teardown when the previous task is finished, then launch." >&2
|
|
179
190
|
echo " The session branch is kept only if you committed. Gitignored paths" >&2
|
|
180
191
|
echo " (state/, runs/, local clones, .env.local) are NOT preserved." >&2
|
|
181
192
|
echo "" >&2
|