@coresource/hz 0.21.3 → 0.21.5
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 +103 -0
- package/dist/hz.mjs +7402 -2159
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# hz
|
|
2
|
+
|
|
3
|
+
`hz` is the **reactive local planner** for cloud launches. Planning happens in a continuous reactive loop that supports investigation, targeted clarification, native plan editing, and explicit finalization — all while keeping local state authoritative until the user approves.
|
|
4
|
+
|
|
5
|
+
## Core commands
|
|
6
|
+
|
|
7
|
+
### `hz plan`
|
|
8
|
+
|
|
9
|
+
`hz plan "<task>" --repo <path>` starts or resumes a local planning session in a deterministic launch bucket:
|
|
10
|
+
|
|
11
|
+
- **Fresh runs** enter the reactive planner loop, show live progress during turns, and create mutable planner state.
|
|
12
|
+
- **Interrupted sessions** resume from the exact working state (open items, diagnostics, investigation findings) rather than regenerating approximations.
|
|
13
|
+
- **Approval** is required to finalize: this produces `mission-draft.json`, `plan-history.json`, finalized `plannerPlan` (embedded inside `mission-draft.json`), and infrastructure artifacts.
|
|
14
|
+
- **Superseding revisions** rotate history and clear stale downstream state before execution continues.
|
|
15
|
+
|
|
16
|
+
### `hz mission run`
|
|
17
|
+
|
|
18
|
+
`hz mission run "<task>" --repo <path>` uses the **same normalized request identity** as `hz plan`:
|
|
19
|
+
|
|
20
|
+
- Resumes partial planning if no finalized draft exists.
|
|
21
|
+
- Reuses finalized local drafts without replanning or mutating mission-draft/plan-history.
|
|
22
|
+
- Continues into upload, mission creation, and monitoring after finalization.
|
|
23
|
+
|
|
24
|
+
Both commands avoid retired `/plan/*` routes in the normal planning flow.
|
|
25
|
+
|
|
26
|
+
## Local artifacts
|
|
27
|
+
|
|
28
|
+
Planning state is stored under `~/.hz/cloud-launches/<request-id>/`:
|
|
29
|
+
|
|
30
|
+
| Artifact | Purpose |
|
|
31
|
+
|----------|---------|
|
|
32
|
+
| `request.json` | Normalized request identity and launch bootstrap metadata |
|
|
33
|
+
| `planner-state.json` | Mutable planner state: milestones, work items, assertions, dependencies, clarification items, diagnostics, investigation findings |
|
|
34
|
+
| `mission-draft.json` | Finalized mission snapshot (created only on approval) |
|
|
35
|
+
| `plan-history.json` | Finalized revision history and supersession lineage |
|
|
36
|
+
| `infrastructure/` | Generated deployables, TDD skills, and idempotent init scripts |
|
|
37
|
+
|
|
38
|
+
Resume, reuse, and supersession all hang off deterministic launch identity derived from normalized task text plus sorted, deduped absolute repo paths.
|
|
39
|
+
|
|
40
|
+
## Auth and environment
|
|
41
|
+
|
|
42
|
+
Planning uses the existing CLI auth surface:
|
|
43
|
+
|
|
44
|
+
- `HZ_API_KEY`, or
|
|
45
|
+
- `hz auth login` (stores auth in `~/.hz/config.json`)
|
|
46
|
+
|
|
47
|
+
An explicitly empty `HZ_API_KEY` is treated as an error.
|
|
48
|
+
|
|
49
|
+
## Optional remote sync (finalized-only)
|
|
50
|
+
|
|
51
|
+
If both of these are set, `hz plan` will sync the finalized local plan after approval:
|
|
52
|
+
|
|
53
|
+
- `HZ_STATE_STORE_URL`
|
|
54
|
+
- `HZ_STATE_STORE_MISSION_ID` (target mission-scoped store identifier)
|
|
55
|
+
|
|
56
|
+
Optional overrides:
|
|
57
|
+
|
|
58
|
+
- `HZ_STATE_STORE_TOKEN` (otherwise `HZ_API_KEY` is reused)
|
|
59
|
+
- `HZ_STATE_STORE_STEP_ID`
|
|
60
|
+
- `HZ_STATE_STORE_WORKER_SESSION_ID`
|
|
61
|
+
|
|
62
|
+
Rules:
|
|
63
|
+
|
|
64
|
+
- Sync runs **only after** local finalization.
|
|
65
|
+
- Sync uses mission-scoped `/missions/{missionId}/plan` routes with optimistic versioning.
|
|
66
|
+
- Read-back is verified after PUT.
|
|
67
|
+
- Retries are bounded.
|
|
68
|
+
- Sync failures warn, but the local draft remains authoritative and retryable later.
|
|
69
|
+
- Retired `/plan/*` routes are not used in normal flow.
|
|
70
|
+
|
|
71
|
+
## Build and test
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install
|
|
75
|
+
npm run typecheck
|
|
76
|
+
npm run build
|
|
77
|
+
npm test
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Built-binary sanity checks:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
node dist/hz.mjs plan --help
|
|
84
|
+
node dist/hz.mjs mission run --help
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Architecture invariants
|
|
88
|
+
|
|
89
|
+
1. **Local state is authoritative until explicit finalization.**
|
|
90
|
+
2. **Working state and finalized artifacts are separate surfaces** — downstream consumers only see finalized outputs.
|
|
91
|
+
3. **Reactive editing preserves stable IDs** for unchanged entities across edits and superseding revisions.
|
|
92
|
+
4. **Blocking diagnostics prevent finalization.**
|
|
93
|
+
5. **Normal planning flow makes zero requests under `/plan/`.**
|
|
94
|
+
6. **`hz plan` and `hz mission run` agree on request identity, resume, and reuse semantics.**
|
|
95
|
+
7. **Remote sync is finalized-only** — the mission-planner store is a finalized snapshot + step-state store, not a live remote planner.
|
|
96
|
+
|
|
97
|
+
## Notes for developers
|
|
98
|
+
|
|
99
|
+
- Planner decisions and validation outcomes are persisted so interruptions are recoverable and inspectable.
|
|
100
|
+
- Mutable planner state is distinct from bootstrap state (`request.json`) and finalized artifacts (`mission-draft.json`).
|
|
101
|
+
- Review-only planner state (e.g., `planningReview`) is excluded from downstream mission payloads and remote sync.
|
|
102
|
+
- Step-state sync uses version-aware rebasing when the same worker session spans superseding syncs.
|
|
103
|
+
- The deployed mission-store verification path uses a dedicated mission ID; retired routes currently return 404/405 (functionally equivalent to the ideal 410 Gone contract).
|