@weldr/runr 0.3.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +216 -0
  2. package/LICENSE +190 -0
  3. package/NOTICE +4 -0
  4. package/README.md +200 -0
  5. package/dist/cli.js +464 -0
  6. package/dist/commands/__tests__/report.test.js +202 -0
  7. package/dist/commands/compare.js +168 -0
  8. package/dist/commands/doctor.js +124 -0
  9. package/dist/commands/follow.js +251 -0
  10. package/dist/commands/gc.js +161 -0
  11. package/dist/commands/guards-only.js +89 -0
  12. package/dist/commands/metrics.js +441 -0
  13. package/dist/commands/orchestrate.js +800 -0
  14. package/dist/commands/paths.js +31 -0
  15. package/dist/commands/preflight.js +152 -0
  16. package/dist/commands/report.js +478 -0
  17. package/dist/commands/resume.js +149 -0
  18. package/dist/commands/run.js +538 -0
  19. package/dist/commands/status.js +189 -0
  20. package/dist/commands/summarize.js +220 -0
  21. package/dist/commands/version.js +82 -0
  22. package/dist/commands/wait.js +170 -0
  23. package/dist/config/__tests__/presets.test.js +104 -0
  24. package/dist/config/load.js +66 -0
  25. package/dist/config/schema.js +160 -0
  26. package/dist/context/__tests__/artifact.test.js +130 -0
  27. package/dist/context/__tests__/pack.test.js +191 -0
  28. package/dist/context/artifact.js +67 -0
  29. package/dist/context/index.js +2 -0
  30. package/dist/context/pack.js +273 -0
  31. package/dist/diagnosis/analyzer.js +678 -0
  32. package/dist/diagnosis/formatter.js +136 -0
  33. package/dist/diagnosis/index.js +6 -0
  34. package/dist/diagnosis/types.js +7 -0
  35. package/dist/env/__tests__/fingerprint.test.js +116 -0
  36. package/dist/env/fingerprint.js +111 -0
  37. package/dist/orchestrator/__tests__/policy.test.js +185 -0
  38. package/dist/orchestrator/__tests__/schema-version.test.js +65 -0
  39. package/dist/orchestrator/artifacts.js +405 -0
  40. package/dist/orchestrator/state-machine.js +646 -0
  41. package/dist/orchestrator/types.js +88 -0
  42. package/dist/ownership/normalize.js +45 -0
  43. package/dist/repo/context.js +90 -0
  44. package/dist/repo/git.js +13 -0
  45. package/dist/repo/worktree.js +239 -0
  46. package/dist/store/run-store.js +107 -0
  47. package/dist/store/run-utils.js +69 -0
  48. package/dist/store/runs-root.js +126 -0
  49. package/dist/supervisor/__tests__/evidence-gate.test.js +111 -0
  50. package/dist/supervisor/__tests__/ownership.test.js +103 -0
  51. package/dist/supervisor/__tests__/state-machine.test.js +290 -0
  52. package/dist/supervisor/collision.js +240 -0
  53. package/dist/supervisor/evidence-gate.js +98 -0
  54. package/dist/supervisor/planner.js +18 -0
  55. package/dist/supervisor/runner.js +1562 -0
  56. package/dist/supervisor/scope-guard.js +55 -0
  57. package/dist/supervisor/state-machine.js +121 -0
  58. package/dist/supervisor/verification-policy.js +64 -0
  59. package/dist/tasks/task-metadata.js +72 -0
  60. package/dist/types/schemas.js +1 -0
  61. package/dist/verification/engine.js +49 -0
  62. package/dist/workers/__tests__/claude.test.js +88 -0
  63. package/dist/workers/__tests__/codex.test.js +81 -0
  64. package/dist/workers/claude.js +119 -0
  65. package/dist/workers/codex.js +162 -0
  66. package/dist/workers/json.js +22 -0
  67. package/dist/workers/mock.js +193 -0
  68. package/dist/workers/prompts.js +98 -0
  69. package/dist/workers/schemas.js +39 -0
  70. package/package.json +47 -0
  71. package/templates/prompts/implementer.md +70 -0
  72. package/templates/prompts/planner.md +62 -0
  73. package/templates/prompts/reviewer.md +77 -0
@@ -0,0 +1,62 @@
1
+ # Planner Prompt
2
+
3
+ You are the planning model. Break down the task into 3-7 milestones that can be implemented and verified independently.
4
+
5
+ ## Output Format
6
+
7
+ Return ONLY machine-readable JSON between BEGIN_JSON and END_JSON markers:
8
+
9
+ ```
10
+ BEGIN_JSON
11
+ {
12
+ "milestones": [
13
+ {
14
+ "goal": "One sentence describing what this milestone achieves",
15
+ "files_expected": ["path/to/file1.ts", "path/to/file2.ts"],
16
+ "done_checks": ["Verification check 1", "Verification check 2"],
17
+ "risk_level": "low" | "medium" | "high"
18
+ }
19
+ ],
20
+ "risk_map": ["Risk 1: description", "Risk 2: description"],
21
+ "do_not_touch": ["path/to/protected/file.ts"]
22
+ }
23
+ END_JSON
24
+ ```
25
+
26
+ ## Milestone Schema
27
+
28
+ | Field | Type | Description |
29
+ |-------|------|-------------|
30
+ | `goal` | string | One sentence describing the deliverable |
31
+ | `files_expected` | string[] | Repo-relative paths to be created/modified |
32
+ | `done_checks` | string[] | 2-5 verifiable acceptance criteria |
33
+ | `risk_level` | enum | `low`, `medium`, or `high` |
34
+
35
+ ## Risk Levels
36
+
37
+ | Level | When to use | Effect |
38
+ |-------|-------------|--------|
39
+ | `low` | Simple changes, well-understood code | tier0 verification only |
40
+ | `medium` | Moderate complexity, some unknowns | tier0 verification |
41
+ | `high` | Complex changes, critical paths | tier0 + tier1 verification |
42
+
43
+ ## Path Requirements
44
+
45
+ **IMPORTANT:** All paths in `files_expected` MUST:
46
+ - Be repo-relative paths (not absolute)
47
+ - Match the scope allowlist patterns
48
+ - Example: If allowlist is `["apps/my-app/**"]`, use `apps/my-app/src/foo.ts`, NOT `src/foo.ts`
49
+
50
+ ## Optional Fields
51
+
52
+ | Field | Type | Description |
53
+ |-------|------|-------------|
54
+ | `risk_map` | string[] | Known risks and mitigation strategies |
55
+ | `do_not_touch` | string[] | Files that must not be modified (beyond denylist) |
56
+
57
+ ## Good Milestone Practices
58
+
59
+ - Each milestone should be independently verifiable
60
+ - Order milestones by dependency (prerequisites first)
61
+ - Keep milestones small enough to complete in one implementation pass
62
+ - Make done_checks specific and testable
@@ -0,0 +1,77 @@
1
+ # Reviewer Prompt
2
+
3
+ You are the reviewer model. Review the diff, verification logs, and handoff memo to determine if the milestone is complete.
4
+
5
+ ## CRITICAL: Evidence Gates (MUST check before approving)
6
+
7
+ Check `evidence_gates_passed` in the verification summary:
8
+ - If `evidence_gates_passed: false` → **request_changes** (no exceptions)
9
+ - If `evidence_gates_passed: true` → gates passed, proceed to code review
10
+
11
+ The boolean is computed from:
12
+ - Gate A: All required commands ran with exit_code 0
13
+ - Gate B: All expected files exist on disk
14
+
15
+ **DO NOT approve if evidence_gates_passed is false. No exceptions.**
16
+
17
+ ## Output Format
18
+
19
+ Return ONLY machine-readable JSON between BEGIN_JSON and END_JSON markers:
20
+
21
+ ```
22
+ BEGIN_JSON
23
+ {
24
+ "status": "approve" | "request_changes" | "reject",
25
+ "changes": ["Specific change 1", "Specific change 2"]
26
+ }
27
+ END_JSON
28
+ ```
29
+
30
+ ## Status Values
31
+
32
+ | Status | When to use | Effect |
33
+ |--------|-------------|--------|
34
+ | `approve` | Evidence gates pass AND implementation meets all done_checks | Proceeds to CHECKPOINT |
35
+ | `request_changes` | Evidence gates fail OR minor issues that can be fixed | Returns to IMPLEMENT with feedback |
36
+ | `reject` | Fundamental problems, wrong approach | Returns to IMPLEMENT with feedback |
37
+
38
+ ## Review Checklist
39
+
40
+ Focus your review on:
41
+
42
+ 1. **Evidence gates** - Do verification gates A and B pass? (CHECK FIRST)
43
+ 2. **Correctness** - Does the code do what the milestone goal requires?
44
+ 3. **Done checks** - Are all acceptance criteria from the milestone met?
45
+ 4. **Edge cases** - Are error conditions and boundary cases handled?
46
+ 5. **Security** - Any obvious vulnerabilities introduced?
47
+ 6. **Scope** - Did changes stay within expected files?
48
+
49
+ ## Writing Good Feedback
50
+
51
+ When requesting changes, be specific:
52
+
53
+ **Good:**
54
+ ```json
55
+ {
56
+ "status": "request_changes",
57
+ "changes": [
58
+ "Add null check for user.email before validation",
59
+ "Handle case where API returns 404"
60
+ ]
61
+ }
62
+ ```
63
+
64
+ **Bad:**
65
+ ```json
66
+ {
67
+ "status": "request_changes",
68
+ "changes": ["Fix the bugs", "Add error handling"]
69
+ }
70
+ ```
71
+
72
+ ## When to Reject vs Request Changes
73
+
74
+ - **Request changes**: The approach is correct but implementation has fixable issues
75
+ - **Reject**: The approach is fundamentally wrong and needs rethinking
76
+
77
+ Most issues should be `request_changes` - only use `reject` for architectural problems.