@giamme/forge 0.22.0 → 0.23.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 (153) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +19 -12
  3. package/SKILL.md +137 -216
  4. package/VERSION +1 -1
  5. package/docs/README.md +2 -3
  6. package/docs/add-ons.md +5 -3
  7. package/docs/artifacts.md +17 -2
  8. package/docs/commands.md +85 -63
  9. package/docs/decomposed-runs.md +195 -21
  10. package/docs/development.md +11 -9
  11. package/docs/forge-ui.md +33 -4
  12. package/docs/install.md +37 -5
  13. package/docs/memory.md +6 -1
  14. package/docs/models.md +36 -10
  15. package/docs/reviews.md +44 -25
  16. package/docs/safety.md +27 -2
  17. package/docs/troubleshooting.md +7 -10
  18. package/forge +25 -4
  19. package/package.json +2 -1
  20. package/references/dataset.md +10 -9
  21. package/references/decompose-integration.md +337 -0
  22. package/references/decompose-opt-in.md +527 -0
  23. package/references/decompose-recovery.md +569 -0
  24. package/references/decompose-review.md +256 -0
  25. package/references/decompose.md +99 -1606
  26. package/references/findings.md +68 -0
  27. package/references/harnesses.md +7 -12
  28. package/references/memory.md +13 -2
  29. package/references/planning.md +48 -18
  30. package/references/ripwire.md +38 -13
  31. package/references/runtime.md +22 -33
  32. package/references/setup.md +90 -0
  33. package/references/solo.md +13 -42
  34. package/references/ui.md +12 -5
  35. package/registry.tsv +40 -22
  36. package/scripts/forge-artifact.sh +143 -12
  37. package/scripts/forge-compare.py +5 -15
  38. package/scripts/forge-config.py +14 -1
  39. package/scripts/forge-contract.py +216 -53
  40. package/scripts/forge-control.py +777 -54
  41. package/scripts/forge-dispatch.sh +95 -12
  42. package/scripts/forge-du.py +13 -3
  43. package/scripts/forge-handoff.py +221 -39
  44. package/scripts/forge-install-ripwire.sh +100 -24
  45. package/scripts/forge-install.sh +18 -32
  46. package/scripts/forge-issues.py +6 -4
  47. package/scripts/forge-jev-options.sh +3 -5
  48. package/scripts/forge-lib-adopt.sh +169 -5
  49. package/scripts/forge-lib-attribute.sh +10 -3
  50. package/scripts/forge-lib-decompose.sh +454 -0
  51. package/scripts/forge-lib-env.sh +21 -0
  52. package/scripts/forge-lib-group.sh +4 -1
  53. package/scripts/forge-lib-plans.sh +30 -18
  54. package/scripts/forge-lib-review.sh +28 -8
  55. package/scripts/forge-lib-task.sh +225 -56
  56. package/scripts/forge-lib-verify.sh +59 -10
  57. package/scripts/forge-memory.sh +81 -4
  58. package/scripts/forge-metrics.sh +4 -2
  59. package/scripts/forge-parallel-options.sh +23 -4
  60. package/scripts/forge-parallel.sh +447 -175
  61. package/scripts/forge-plan-check.py +71 -8
  62. package/scripts/forge-planner.py +303 -17
  63. package/scripts/forge-pr.py +9 -1
  64. package/scripts/forge-prompt.py +2 -2
  65. package/scripts/forge-review-links.py +248 -0
  66. package/scripts/forge-ripwire.py +234 -16
  67. package/scripts/forge-route.py +19 -27
  68. package/scripts/forge-runs-rm.py +92 -21
  69. package/scripts/forge-runs.py +46 -5
  70. package/scripts/forge-runtime.py +37 -12
  71. package/scripts/forge-schedule.py +124 -33
  72. package/scripts/forge-setup-stale.py +236 -0
  73. package/scripts/forge-setup.py +804 -0
  74. package/scripts/forge-shadow.py +2 -20
  75. package/scripts/forge-solo-lock.py +46 -0
  76. package/scripts/forge-solo.sh +33 -56
  77. package/scripts/forge-sweep.py +2 -1
  78. package/scripts/forge-ui.py +8 -1
  79. package/scripts/forge-update.sh +2 -2
  80. package/scripts/forge-verify.py +16 -1
  81. package/scripts/forge-version.py +13 -1
  82. package/scripts/forge-watch.py +7 -2
  83. package/scripts/forge_dataset/__init__.py +1 -1
  84. package/scripts/forge_dataset/capture.py +0 -34
  85. package/scripts/forge_dataset/checks.py +0 -1
  86. package/scripts/forge_dataset/cli.py +5 -1
  87. package/scripts/forge_dataset/export.py +28 -6
  88. package/scripts/forge_dataset/facts.py +1 -2
  89. package/scripts/forge_dataset/forecast.py +1 -1
  90. package/scripts/forge_dataset/harvest.py +107 -7
  91. package/scripts/forge_dataset/importer.py +3 -2
  92. package/scripts/forge_dataset/pairs.py +3 -3
  93. package/scripts/forge_dataset/reviewers.py +4 -3
  94. package/scripts/forge_dataset/routing.py +6 -3
  95. package/scripts/forge_dataset/tiers.py +1 -1
  96. package/scripts/forge_decide/__init__.py +1 -1
  97. package/scripts/forge_decide/profiles.py +11 -14
  98. package/scripts/forge_decompose.py +987 -0
  99. package/scripts/forge_groups/review.py +6 -1
  100. package/scripts/forge_jev/__init__.py +1 -1
  101. package/scripts/forge_jev/cli.py +10 -1
  102. package/scripts/forge_jev/gates.py +10 -1
  103. package/scripts/forge_jev/verify.py +10 -2
  104. package/scripts/forge_legacy.py +86 -0
  105. package/scripts/forge_memory_home.py +57 -0
  106. package/scripts/forge_models.py +151 -0
  107. package/scripts/forge_prefs.py +138 -0
  108. package/scripts/forge_side/__init__.py +10 -0
  109. package/scripts/forge_storage.py +28 -15
  110. package/ui/README.md +22 -10
  111. package/ui/docs/api.md +121 -99
  112. package/ui/forge_ui/control.py +46 -14
  113. package/ui/forge_ui/export.py +0 -10
  114. package/ui/forge_ui/models.py +15 -2
  115. package/ui/forge_ui/projects.py +4 -1
  116. package/ui/forge_ui/reader.py +456 -59
  117. package/ui/forge_ui/server.py +0 -10
  118. package/ui/forge_ui/static/app.js +28 -9
  119. package/ui/forge_ui/static/checksview.js +12 -3
  120. package/ui/forge_ui/static/controls.js +147 -11
  121. package/ui/forge_ui/static/convo.js +5 -2
  122. package/ui/forge_ui/static/diffview.js +4 -5
  123. package/ui/forge_ui/static/panel.js +180 -77
  124. package/ui/forge_ui/static/projectsview.js +16 -2
  125. package/ui/forge_ui/static/runmodel.js +18 -4
  126. package/ui/forge_ui/static/scene3d.js +29 -29
  127. package/ui/forge_ui/static/settings.js +1 -1
  128. package/ui/forge_ui/static/storageview.js +2 -2
  129. package/ui/forge_ui/static/style.css +23 -6
  130. package/ui/forge_ui/static/worktreesview.js +8 -4
  131. package/ui/forge_ui/transcripts.py +6 -0
  132. package/ui/forge_ui/worktrees.py +13 -1
  133. package/docs/fractal.md +0 -181
  134. package/references/fractal-dashboard.md +0 -21
  135. package/references/fractal.md +0 -307
  136. package/scripts/forge-fractal-dispatch.sh +0 -4
  137. package/scripts/forge-fractal-options.sh +0 -54
  138. package/scripts/forge-fractal.py +0 -6
  139. package/scripts/forge-install-fractal.sh +0 -4
  140. package/scripts/forge_fractal/__init__.py +0 -88
  141. package/scripts/forge_fractal/bridge.py +0 -46
  142. package/scripts/forge_fractal/cli.py +0 -224
  143. package/scripts/forge_fractal/dashboard.css +0 -138
  144. package/scripts/forge_fractal/dashboard.html +0 -41
  145. package/scripts/forge_fractal/dashboard.js +0 -687
  146. package/scripts/forge_fractal/decomposition.py +0 -262
  147. package/scripts/forge_fractal/execution.py +0 -659
  148. package/scripts/forge_fractal/inspection.py +0 -261
  149. package/scripts/forge_fractal/install.py +0 -158
  150. package/scripts/forge_fractal/invocation.py +0 -95
  151. package/scripts/forge_fractal/pipeline.py +0 -125
  152. package/scripts/forge_fractal/selection.py +0 -180
  153. package/ui/forge_ui/fractal.py +0 -582
package/references/ui.md CHANGED
@@ -21,12 +21,17 @@ run goes on, with the same exit code.
21
21
  reviewer, filterable by project, difficulty and period.
22
22
  - **Diffs with findings in place:** any task diff, the exact diff each reviewer read, or a final
23
23
  review's combined diff, with every P0–P3 finding shown under the line it names.
24
- - **Fractal child tasks:** the tree a Fractal task was split into, in the inspector and above
25
- the opened task in 3D, each node with its decision, cost, output and candidate diff.
24
+ - **Subtasks:** the tree a split task was split into, through every level, in the task's
25
+ inspector: each node with its status, model, attempts, tokens, decision (split, kept whole,
26
+ kept whole at a limit), who decided and why, and a link to its diff. The run shows the limits
27
+ and how much of it was split; a sub-plan opens as a run of its own from its task. A run made
28
+ with Fractal (removed in 0.23) opens read-only, with a note saying so.
26
29
  - **Controls:** change a live plan from its inspector: QA threshold, timeout, escalate-after,
27
30
  the effort step, verify retries, the infrastructure backoff, and (while a scheduler is live)
28
31
  the retry and infra-retry budgets, max parallel, Drain/Resume, Stop and Stop now; per task, a
29
- threshold override (`None` exempts it), a retry budget, a one-shot model pin and, on a live run,
32
+ threshold override (`None` exempts it), a retry budget, a one-shot model pin (each spec shows the
33
+ model id it runs), the implementer and reviewer per difficulty tier for tasks not started yet
34
+ (`forge control models`) and, on a live run,
30
35
  *Retry now* for a stopped or failed task (optionally on a chosen model), which shows its queued
31
36
  request until the scheduler applies or refuses it. Each infrastructure pause gets a line: what
32
37
  is paused, why, its tasks and the time left. Each is one `forge control` call; the change is
@@ -96,7 +101,7 @@ run goes on, with the same exit code.
96
101
  the page does not run it), the findings from `attribution.json` with ambiguous rows marked,
97
102
  the rounds with each member's commit and attempt, known issues, `qa.last`, and a link to the
98
103
  review transcript. The group's QA dispatch lives in `groups/<gid>/attempts`. See
99
- [Groups and group review](decompose.md#groups-and-group-review-opt-in).
104
+ [Groups and group review](decompose-opt-in.md#groups-and-group-review-opt-in).
100
105
  - **Checks:** each attempt's tests, type checks, lints and builds, read from its dwarf's and
101
106
  reviewer's logs, with exits, times and counts, a failed one's last lines, and which of the
102
107
  commands its `## Acceptance criteria` name never ran. codex and grok logs carry no times, so
@@ -187,6 +192,8 @@ bash <skill_dir>/scripts/forge-solo.sh "$FORGE_RUN" --repo "$REPO" --dwarf <spec
187
192
  - When the server can write, the page's own actions are forge commands too, each with `--actor ui`
188
193
  except compact: Worktrees *Remove* is `forge worktrees rm`, Memories *Forget selected* is
189
194
  `forge memory forget`, a waiting task's *Send answer* is `forge control retry --answer-file -`,
195
+ a task's *Queue message* (for its next attempt) is `forge control steer --file -`, and its
196
+ *Send now* (to a running claude or openclaude implementer) adds `--now`,
190
197
  and Disk *Compact* / *Compact all* is `forge runs compact --logs`. Removing, forgetting and
191
198
  compacting dry-run and ask first; sending an answer does not. `--read-only` hides those buttons
192
199
  and leaves every copy button. See [forge-ui](../docs/forge-ui.md#controls).
@@ -239,7 +246,7 @@ random token and puts it in the page it serves; every change must send it back,
239
246
  it is refused before any CLI runs. There are no CORS headers, so another site in your browser
240
247
  can neither send nor read a change. Any process that can fetch the page can read the token, as
241
248
  it can read the runs, so on a shared machine start the server **read-only**: `--read-only`
242
- (`python3 -m forge_ui`) or `FORGE_UI_READONLY=1` (also for `forge ui open`). A read-only server
249
+ (`python3 -m forge_ui`), `FORGE_UI_READONLY=1` (also for `forge ui open`), or `forge setup set ui_controls off`. A read-only server
243
250
  issues no token and answers every change with 405; its `/api/health` says `"controls": false`.
244
251
  No Remove, Forget selected, Compact or Send answer button is shown, and every copy button stays.
245
252
  `forge ui open` never reuses a server in the other mode: it replaces it, as it does one running
package/registry.tsv CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Columns (tab-separated):
4
4
  # alias short name you type in --dwarf / --qa
5
- # harness which CLI runs it: codex | claude | openclaude | opencode | antigravity
5
+ # harness which CLI runs it: codex | claude | openclaude | opencode | antigravity | grok
6
6
  # model the exact model id that harness expects
7
7
  # effort which reasoning efforts this pairing accepts, in one of four forms:
8
8
  # <=X any effort on the harness ladder up to and including X
@@ -20,8 +20,8 @@
20
20
  # max/ultra/ultracode x2. The result and its source are recorded as
21
21
  # `timeout=` and `timeout_source=` in <role>.resolved.
22
22
  # Commented examples (not enabled; write the real number for your model):
23
- # # sol codex gpt-6.1-sol <=ultra 1800
24
- # # opus claude opus <=max -
23
+ # # sol codex gpt-6.2-sol <=ultra 1800
24
+ # # opus claude claude-opus-5-5 <=max -
25
25
  #
26
26
  # FORGE_REGISTRY=<file> points dispatch at a different registry (useful for trying a
27
27
  # row without editing this one); the capability cache keys on the file actually used.
@@ -34,17 +34,23 @@
34
34
  # harness. `--dwarf sol` means sol on codex; `--dwarf sol:high:openclaude` moves
35
35
  # the same model to a different harness.
36
36
  #
37
+ # An alias is ONE model on every harness: every row of an alias names the same model
38
+ # family and version (a provider prefix such as github-copilot/ or a -preview suffix
39
+ # aside). A harness that only serves another version gets a versioned alias
40
+ # (`opus-4.6`, `grok-4.6`), never a row under the newer name; tests/test_model_registry.py
41
+ # fails on an alias whose rows disagree.
42
+ #
37
43
  # An alias with no row here is not an error — it is passed through as a literal
38
44
  # model id, but only when you name the harness explicitly (forge cannot guess a
39
45
  # default harness for a model it has never heard of).
40
46
  #
41
47
  # alias harness model effort [timeout]
42
- sol codex gpt-6.1-sol <=ultra
43
- sol openclaude gpt-6.1-sol <=max
44
- sol opencode github-copilot/gpt-6.1-sol -
45
- astra codex gpt-6-astra <=ultra
46
- astra openclaude gpt-6-astra <=max
47
- astra opencode github-copilot/gpt-6-astra -
48
+ sol codex gpt-6.2-sol <=ultra
49
+ sol openclaude gpt-6.2-sol <=max
50
+ sol opencode github-copilot/gpt-6.2-sol -
51
+ astra codex gpt-6.2-astra <=ultra
52
+ astra openclaude gpt-6.2-astra <=max
53
+ astra opencode github-copilot/gpt-6.2-astra -
48
54
  terra codex gpt-6.1-terra <=ultra
49
55
  terra openclaude gpt-6.1-terra <=max
50
56
  terra opencode github-copilot/gpt-6.1-terra -
@@ -53,34 +59,46 @@ terra opencode github-copilot/gpt-6.1-terra -
53
59
  terra-5.6 codex gpt-5.6-terra <=ultra
54
60
  terra-5.6 openclaude gpt-5.6-terra <=max
55
61
  terra-5.6 opencode github-copilot/gpt-5.6-terra -
62
+ # The sol and astra before 6.2 (#180), kept the same way.
63
+ sol-6.1 codex gpt-6.1-sol <=ultra
64
+ sol-6.1 openclaude gpt-6.1-sol <=max
65
+ sol-6.1 opencode github-copilot/gpt-6.1-sol -
66
+ astra-6 codex gpt-6-astra <=ultra
67
+ astra-6 openclaude gpt-6-astra <=max
68
+ astra-6 opencode github-copilot/gpt-6-astra -
56
69
  luna codex gpt-6-luna <=max
57
70
  luna openclaude gpt-6-luna <=max
58
71
  luna opencode opencode-go/gpt-6-luna -
59
- opus claude opus <=max
60
- opus openclaude opus <=ultracode
61
- opus antigravity claude-opus-4-6-thinking none
72
+ # Claude models by exact id, not the claude CLI's moving `opus`/`sonnet` names, so the
73
+ # approval table, statistics and forge-ui show the version that runs. A new Claude release is
74
+ # a registry edit: move the alias and keep the old model under `<alias>-<version>`.
75
+ opus claude claude-opus-5-5 <=max
76
+ opus openclaude claude-opus-5-5 <=ultracode
62
77
  opus opencode github-copilot/claude-opus-5.5 -
63
- sonnet claude sonnet <=max
64
- sonnet openclaude sonnet <=ultracode
65
- sonnet antigravity claude-sonnet-4-6 none
78
+ sonnet claude claude-sonnet-5-5 <=max
79
+ sonnet openclaude claude-sonnet-5-5 <=ultracode
66
80
  sonnet opencode github-copilot/claude-sonnet-5.5 -
67
- fable claude fable <=max
68
- fable openclaude fable <=ultracode
69
- fable opencode github-copilot/claude-fable-5.1 -
70
- haiku claude haiku <=max
71
- haiku openclaude haiku <=ultracode
81
+ fable claude claude-fable-5-2 <=max
82
+ fable openclaude claude-fable-5-2 <=ultracode
83
+ haiku claude claude-haiku-5-5 <=max
84
+ haiku openclaude claude-haiku-5-5 <=ultracode
72
85
  haiku opencode github-copilot/claude-haiku-5.5 -
86
+ # Older Claude models some harnesses still serve. An alias names one model on every harness
87
+ # (tests/test_model_registry.py checks it), so these have aliases of their own.
88
+ opus-4.6 antigravity claude-opus-4-6-thinking none
89
+ sonnet-4.6 antigravity claude-sonnet-4-6 none
90
+ fable-5.1 opencode github-copilot/claude-fable-5.1 -
73
91
  # Antigravity (agy). Gemini models take effort as a flag on the UNSUFFIXED id;
74
92
  # the suffixed ids agy lists (gemini-3.7-flash-low) conflict with --effort.
75
93
  gemini antigravity gemini-3.7-flash low,medium,high
76
- gemini opencode github-copilot/gemini-3.1-pro-preview -
77
94
  gemini-flash antigravity gemini-3.7-flash low,medium,high
78
95
  gemini-pro antigravity gemini-3.1-pro low,high
96
+ gemini-pro opencode github-copilot/gemini-3.1-pro-preview -
79
97
  gemini-3.6 antigravity gemini-3.6-flash low,medium,high
80
98
  gemini-3.5 antigravity gemini-3.5-flash low,medium,high
81
99
  gpt-oss antigravity gpt-oss-120b medium
82
100
  grok grok grok-4.7 <=xhigh
83
- grok opencode github-copilot/grok-4.6 -
101
+ grok-4.6 opencode github-copilot/grok-4.6 -
84
102
  kimi opencode github-copilot/kimi-k3 -
85
103
  glm opencode opencode-go/glm-5.2 -
86
104
  qwen opencode opencode-go/qwen3.8-max -
@@ -1,5 +1,57 @@
1
1
  #!/usr/bin/env bash
2
2
  # Shared artifact operations. A private index never stages or unstages user work.
3
+ _FORGE_ARTIFACT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4
+
5
+ _forge_links_script() {
6
+ if [ -n "${SKILL_DIR:-}" ] && [ -f "$SKILL_DIR/scripts/forge-review-links.py" ]; then
7
+ printf '%s\n' "$SKILL_DIR/scripts/forge-review-links.py"
8
+ else
9
+ printf '%s\n' "$_FORGE_ARTIFACT_DIR/forge-review-links.py"
10
+ fi
11
+ }
12
+
13
+ _forge_links_run() {
14
+ if declare -F forge_ensure_python3 >/dev/null 2>&1; then forge_ensure_python3; fi
15
+ local py=python3
16
+ case "$(command -v python3 2>/dev/null || true)" in
17
+ ''|*[Ww]indows[Aa]pps*) command -v python >/dev/null 2>&1 && py=python ;;
18
+ esac
19
+ "$py" "$@"
20
+ }
21
+
22
+ _forge_link_file() { # source file, dest path; hardlink on native Windows (no Admin), symlink on POSIX
23
+ local src="$1" dest="$2" is_win=1
24
+ if declare -F forge_is_windows >/dev/null 2>&1; then
25
+ forge_is_windows && is_win=0
26
+ else
27
+ case "${OSTYPE:-}" in
28
+ msys*|cygwin*) [ "${FORGE_WIN_MODE:-native}" != msys2 ] && is_win=0 ;;
29
+ esac
30
+ fi
31
+ if [ "$is_win" = 0 ]; then
32
+ ln "$src" "$dest" 2>/dev/null
33
+ else
34
+ ln -s "$src" "$dest" 2>/dev/null
35
+ fi
36
+ }
37
+
38
+ forge_capture_ignored_before() { # checkout, out_file (#198)
39
+ local script
40
+ script="$(_forge_links_script)"
41
+ [ -f "$script" ] || return 0
42
+ _forge_links_run "$script" capture-before "$1" "$2" 2>/dev/null || true
43
+ }
44
+
45
+ forge_record_setup_generated() { # checkout, before_file, [out_file] (#198)
46
+ local script
47
+ script="$(_forge_links_script)"
48
+ [ -f "$script" ] || return 0
49
+ if [ -n "${3:-}" ]; then
50
+ _forge_links_run "$script" capture-after "$1" "$2" --out "$3" --dep-dirs "$FORGE_DEP_DIRS" 2>/dev/null || true
51
+ else
52
+ _forge_links_run "$script" capture-after "$1" "$2" --dep-dirs "$FORGE_DEP_DIRS" 2>/dev/null || true
53
+ fi
54
+ }
3
55
  # forge_tree <dir> [--tracked]: the tree of everything in <dir> that is not ignored. --tracked
4
56
  # leaves untracked files out, for a copy whose artifact is a commit: there an untracked file
5
57
  # (a test run's __pycache__/ in a repository with no .gitignore) cannot reach what merges.
@@ -88,15 +140,13 @@ _forge_dep_dirs() { # checkout: its dependency directories, relative, never one
88
140
  sed 's#^\./##'
89
141
  }
90
142
 
91
- forge_review_deps() { # source checkout, review snapshot, note file (#117)
92
- # Links the dependency directories of the checkout under review (what .forge/setup filled, so
93
- # they match the attempt, unlike the source repo's) into its snapshot, at the root and in
94
- # workspace packages, and writes what the reviewer has to the note. An untracked link counts for
95
- # no fingerprint, and the exclude keeps it out of the reviewer's `git status`: a `node_modules/`
96
- # ignore pattern does not match a link. A directory the snapshot already holds is committed: it
97
- # stays as it is. `ln` fails where the snapshot lacks the parent (an old run's dir in a solo
98
- # repo): that is no part of the change, so nothing is linked there.
99
- local src rel linked="" committed
143
+ forge_review_deps() { # source checkout, review snapshot, note file, [extra paths file] (#117, #198)
144
+ # Links the dependency directories and setup-generated (or .forge/review-links) ignored paths of
145
+ # the checkout under review into its snapshot, and writes what the reviewer has to the note. An
146
+ # untracked link counts for no fingerprint, and .git/info/exclude keeps it out of `git status`:
147
+ # a `node_modules/` ignore pattern does not match a link. Paths the snapshot already holds stay
148
+ # as they are. Secret-looking files (such as .env) are never linked.
149
+ local src rel linked="" committed gen_linked="" gen_unlinked="" kind script plan_rows extra="${4:-}"
100
150
  src="$(cd "$1" && pwd)" || src=""
101
151
  committed="$(_forge_dep_dirs "$2" | sort | awk 'NR > 1 { printf ", " } { printf "%s", $0 }')"
102
152
  if [ -n "$src" ]; then
@@ -110,24 +160,105 @@ forge_review_deps() { # source checkout, review snapshot, note file (#117)
110
160
  mkdir -p "$2/.git/info" && echo "/$rel" >> "$2/.git/info/exclude"
111
161
  linked="$linked${linked:+, }$rel"
112
162
  done <<< "$(_forge_dep_dirs "$src" | sort)"
163
+
164
+ script="$(_forge_links_script)"
165
+ if [ -f "$script" ]; then
166
+ if [ -n "$extra" ]; then
167
+ plan_rows="$(_forge_links_run "$script" plan-extra "$src" "$2" --extra-file "$extra" --dep-dirs "$FORGE_DEP_DIRS" 2>/dev/null || true)"
168
+ else
169
+ plan_rows="$(_forge_links_run "$script" plan-extra "$src" "$2" --dep-dirs "$FORGE_DEP_DIRS" 2>/dev/null || true)"
170
+ fi
171
+ while IFS=$'\t' read -r kind rel; do
172
+ rel="${rel%$'\r'}"
173
+ [ -n "$kind" ] && [ -n "$rel" ] || continue
174
+ case "$kind" in
175
+ LINK_DIR)
176
+ if declare -F forge_link_dir >/dev/null 2>&1; then
177
+ if forge_link_dir "$src/$rel" "$2/$rel" 2>/dev/null; then
178
+ mkdir -p "$2/.git/info" && echo "/$rel" >> "$2/.git/info/exclude"
179
+ gen_linked="$gen_linked${gen_linked:+, }$rel"
180
+ else
181
+ gen_unlinked="$gen_unlinked${gen_unlinked:+, }$rel"
182
+ fi
183
+ elif ln -s "$src/$rel" "$2/$rel" 2>/dev/null; then
184
+ mkdir -p "$2/.git/info" && echo "/$rel" >> "$2/.git/info/exclude"
185
+ gen_linked="$gen_linked${gen_linked:+, }$rel"
186
+ else
187
+ gen_unlinked="$gen_unlinked${gen_unlinked:+, }$rel"
188
+ fi
189
+ ;;
190
+ LINK_FILE)
191
+ if _forge_link_file "$src/$rel" "$2/$rel"; then
192
+ mkdir -p "$2/.git/info" && echo "/$rel" >> "$2/.git/info/exclude"
193
+ gen_linked="$gen_linked${gen_linked:+, }$rel"
194
+ else
195
+ gen_unlinked="$gen_unlinked${gen_unlinked:+, }$rel"
196
+ fi
197
+ ;;
198
+ UNLINKED)
199
+ gen_unlinked="$gen_unlinked${gen_unlinked:+, }$rel"
200
+ ;;
201
+ esac
202
+ done <<< "$plan_rows"
203
+ fi
113
204
  fi
114
205
  {
115
206
  if [ -n "$linked" ]; then
116
207
  echo "Dependencies linked into your checkout from the attempt's own copy: $linked. Use them to run tests, and do not write to them. forge does not check that they are complete, or look more than five levels down."
208
+ elif [ -z "$committed" ] && [ -n "$gen_linked$gen_unlinked" ]; then
209
+ echo "Dependencies in your checkout: no dependency directories."
117
210
  fi
118
211
  if [ -n "$committed" ]; then
119
212
  echo "Dependency directories committed in your checkout, holding only what was committed: $committed."
120
213
  fi
121
- if [ -z "$linked$committed" ]; then
214
+ if [ -n "$gen_linked" ]; then
215
+ echo "Setup-generated paths linked into your checkout from the attempt's own copy: $gen_linked. Use them to run tests, and do not write to them."
216
+ fi
217
+ if [ -n "$gen_unlinked" ]; then
218
+ echo "Setup-generated paths forge could not provide in your checkout: $gen_unlinked."
219
+ fi
220
+ if [ -z "$linked$committed$gen_linked$gen_unlinked" ]; then
122
221
  echo "Dependencies in your checkout: none. It holds committed files only, with no installed packages."
123
222
  fi
124
223
  } > "$3"
125
224
  }
126
225
 
127
- forge_tests_note() { # QA reply: the reason, when the reviewer says its tests could not run (#117)
226
+ forge_tests_note() { # QA reply: the reason, when the reviewer says its tests were partial or could not run (#117, #223)
128
227
  grep -qs 'FORGE_TESTS:' "$1" || return 0
129
228
  python3 "$SKILL_DIR/scripts/forge-contract.py" tests --qa-last "$1" 2>/dev/null |
130
- awk -F'\t' '$1 == "could_not_run" { print ($2 == "" ? "no reason given" : $2) }'
229
+ awk -F'\t' '$1 == "could_not_run" { print ($2 == "" ? "no reason given" : $2) }
230
+ $1 == "partial" { print "partial: " ($2 == "" ? "some checks stopped or skipped" : $2) }'
231
+ }
232
+
233
+ forge_review_submodules() { # source checkout, review snapshot, note file (#255)
234
+ # A snapshot is a fresh repository, so every submodule (a gitlink) comes out an empty directory and
235
+ # a reviewer cannot run tests that import it. Fill each one the way a task worktree is filled
236
+ # (forge-submodules.py): from the submodule's own repository in the source when it has one, else a
237
+ # copy of the source's files. No `.git` is made there, so git does not see the files: the
238
+ # snapshot's fingerprint and the reviewer's `git status` stay as they were. Appends what the
239
+ # reviewer has to the note that forge_review_deps wrote. Never fails the review.
240
+ local list st path _sha detail filled="" missing=""
241
+ git -C "$2" ls-files -s 2>/dev/null | awk '$1 == "160000" { found = 1 } END { exit !found }' || return 0
242
+ list="$(mktemp "${TMPDIR:-/tmp}/forge-review-submodules.XXXXXX")" || return 0
243
+ python3 "$SKILL_DIR/scripts/forge-submodules.py" populate --source "$1" --worktree "$2" --out "$list" \
244
+ >/dev/null 2>&1 || :
245
+ while IFS="$(printf '\t')" read -r st path _sha detail; do
246
+ [ -n "$path" ] || continue
247
+ case "$st" in
248
+ exported|copied|kept) filled="$filled${filled:+, }$path" ;;
249
+ *) missing="$missing${missing:+; }$path (${detail:-not available})" ;;
250
+ esac
251
+ done < "$list"
252
+ rm -f "$list"
253
+ {
254
+ if [ -n "$filled" ]; then
255
+ echo "Submodules filled in your checkout with the attempt's files: $filled. Use them to run tests. They are not part of the change, and git does not see them."
256
+ fi
257
+ if [ -n "$missing" ]; then
258
+ echo "Submodules forge could not fill in your checkout, so their directories are empty: $missing."
259
+ fi
260
+ } >> "$3"
261
+ return 0
131
262
  }
132
263
 
133
264
  forge_fingerprint() { # forge_fingerprint <dir> [--tracked], as forge_tree
@@ -34,12 +34,13 @@ import time
34
34
  SKILL = Path(__file__).resolve().parent.parent
35
35
  sys.path.insert(0, str(SKILL / 'scripts'))
36
36
  sys.path.insert(0, str(SKILL / 'ui'))
37
+ import forge_legacy # noqa: E402
37
38
 
38
39
  # Plan options that travel with a rerun, so it is judged the way the original was. Not the ones
39
40
  # `plan` writes itself (routing, Jev's frozen selection) or that a fresh plan decides (exploration).
40
41
  OPTION_FILES = ('no_ripwire', 'no_memory', 'yolo_dwarf', 'yolo_qa', 'reviewer_session', 'reviewer_session_rate', 'reviewer_session_tasks', 'implementer_session', 'fast',
41
- 'pre_review_tests', 'pre_review_parallel', 'qa_threshold', 'timeout', 'verify_retries', 'verify_cmd',
42
- 'verify_parallel', 'setup_cmd', 'final_qa', 'shadow_qa', 'shadow_rate', 'escalate_after', 'retry_per_model', 'fail_first', 'profile.json',
42
+ 'pre_review_tests', 'pre_review_parallel', 'qa_threshold', 'qa_test_minutes', 'timeout', 'verify_retries', 'verify_cmd',
43
+ 'verify_parallel', 'setup_cmd', 'setup_before_verify', 'final_qa', 'shadow_qa', 'shadow_rate', 'escalate_after', 'retry_per_model', 'fail_first', 'profile.json',
43
44
  'retro_mode', 'brief', 'brief_scope', 'brief_model', 'summaries', 'summaries_model',
44
45
  'groups.tsv', 'groups.frozen', 'group_max_tasks', 'group_max_diff_kb', 'after')
45
46
  # The feature files are rewritten from the source's effective settings (copy_plan), not only copied.
@@ -81,16 +82,6 @@ def table(path: Path) -> list:
81
82
  return rows
82
83
 
83
84
 
84
- def fractal_enabled(plan: Path) -> bool:
85
- raw = text(plan / 'fractal-selection.json')
86
- if not raw:
87
- return False
88
- try:
89
- return json.loads(raw).get('enabled') is not False
90
- except (ValueError, AttributeError):
91
- return True
92
-
93
-
94
85
  def source(run_dir: str) -> dict:
95
86
  """The plan a rerun starts from, or a Refusal saying what is missing."""
96
87
  plan = Path(run_dir).resolve()
@@ -108,9 +99,8 @@ def source(run_dir: str) -> dict:
108
99
  'to rerun from (use it as it is: forge-parallel.sh run)' % plan)
109
100
  if git(repo, 'rev-parse', '--verify', '--quiet', base + '^{commit}')[0] != 0:
110
101
  raise Refusal('the commit %s that the run started from is not in %s any more' % (base[:7], repo))
111
- if fractal_enabled(plan):
112
- raise Refusal('this plan runs under Fractal, which binds each task to output paths under the plan directory; '
113
- 'a Fractal-backed plan cannot be rerun')
102
+ if forge_legacy.was_fractal(plan):
103
+ raise Refusal(forge_legacy.refusal('this plan') + ' It cannot be rerun.')
114
104
  running = [r['id'] for r in rows if text(plan / 'tasks' / r['id'] / 'status') == 'RUNNING']
115
105
  if running:
116
106
  raise Refusal('task %s is RUNNING (or a run was killed); let it finish, or settle it with '
@@ -662,9 +662,22 @@ def set_feature(args):
662
662
  data.setdefault('version', 1)
663
663
  save_user(data)
664
664
  emit(args, args.key, previous, value)
665
+ if args.key in _LATER and not args.json:
666
+ live = _LATER[args.key]
667
+ print(' applies to runs planned from now on; a plan keeps the value it was planned with'
668
+ + ('. For a live plan: %s' % live if live else ''))
665
669
  return 0
666
670
 
667
671
 
672
+ # Feature keys a plan copies when it is planned (#162): a change reaches later plans only.
673
+ _LATER = {
674
+ 'retro': None, 'brief': None, 'brief.scope': None,
675
+ 'brief.model': 'forge control set <plan> brief-model <spec>',
676
+ 'summaries': 'forge control set <plan> summaries on|off',
677
+ 'summaries.model': 'forge control set <plan> summaries-model <spec>',
678
+ }
679
+
680
+
668
681
  def unset_feature(args):
669
682
  """Remove one feature key from the user file. A missing file is left missing."""
670
683
  if not user_path().exists():
@@ -712,7 +725,7 @@ _PROFILE_NAME = re.compile(r'^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$')
712
725
  _PROFILE_TEXT_MAX = 1024 * 1024
713
726
  _PROFILE_KEYS = (
714
727
  'routing.dwarf.<tier>, routing.qa.<tier> (tier is any, low, medium or high), '
715
- 'routing.planner, routing.fractal_planner, routing.final_reviewer, '
728
+ 'routing.planner, routing.final_reviewer, '
716
729
  'routing.escalate_after, routing.escalate_effort, policy.qa_threshold, '
717
730
  'policy.retry_failed, policy.infra_retries, policy.verify_retries, policy.timeout, '
718
731
  'policy.explore, policy.shadow_rate, policy.shadow_qa, policy.fast')