@giamme/forge 0.17.0 → 0.18.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/CHANGELOG.md +24 -0
- package/SKILL.md +16 -3
- package/VERSION +1 -1
- package/docs/artifacts.md +8 -0
- package/docs/commands.md +70 -6
- package/docs/dataset.md +5 -0
- package/docs/decomposed-runs.md +8 -0
- package/docs/forge-ui.md +23 -2
- package/docs/memory.md +2 -0
- package/docs/safety.md +8 -0
- package/forge +24 -1
- package/package.json +1 -1
- package/references/dataset.md +19 -0
- package/references/decompose.md +134 -1
- package/references/solo.md +2 -1
- package/references/ui.md +5 -2
- package/scripts/forge-artifact.sh +14 -0
- package/scripts/forge-brief.py +132 -0
- package/scripts/forge-compare.py +11 -1
- package/scripts/forge-config.py +176 -9
- package/scripts/forge-contract.py +46 -3
- package/scripts/forge-control.py +86 -13
- package/scripts/forge-dispatch.sh +14 -10
- package/scripts/forge-du.py +167 -0
- package/scripts/forge-lib-adopt.sh +1 -0
- package/scripts/forge-lib-plans.sh +5 -2
- package/scripts/forge-lib-review.sh +29 -1
- package/scripts/forge-metrics.sh +7 -3
- package/scripts/forge-parallel-options.sh +4 -0
- package/scripts/forge-parallel.sh +503 -9
- package/scripts/forge-prompt.py +120 -0
- package/scripts/forge-retro.py +115 -0
- package/scripts/forge-runs-compact.py +443 -0
- package/scripts/forge-runs-rm.py +2 -0
- package/scripts/forge-runs.py +18 -3
- package/scripts/forge-schedule.py +279 -4
- package/scripts/forge-shadow.py +7 -1
- package/scripts/forge-solo.sh +2 -0
- package/scripts/forge-summarize.py +698 -0
- package/scripts/forge-ui-options.sh +10 -0
- package/scripts/forge_brief/__init__.py +587 -0
- package/scripts/forge_brief/answers.py +459 -0
- package/scripts/forge_dataset/__init__.py +10 -0
- package/scripts/forge_dataset/export.py +18 -4
- package/scripts/forge_dataset/facts.py +6 -4
- package/scripts/forge_dataset/harvest.py +40 -6
- package/scripts/forge_dataset/history.py +5 -3
- package/scripts/forge_decide/__init__.py +11 -1
- package/scripts/forge_locations.py +366 -0
- package/scripts/forge_registry.py +19 -0
- package/scripts/forge_retro/__init__.py +417 -0
- package/scripts/forge_retro/issues.py +1193 -0
- package/scripts/forge_retro/report.py +671 -0
- package/scripts/forge_side/__init__.py +477 -0
- package/scripts/forge_storage.py +515 -0
- package/ui/README.md +68 -8
- package/ui/docs/api.md +205 -17
- package/ui/forge_ui/control.py +92 -11
- package/ui/forge_ui/export.py +24 -5
- package/ui/forge_ui/links.py +337 -0
- package/ui/forge_ui/models.py +57 -4
- package/ui/forge_ui/projects.py +4 -1
- package/ui/forge_ui/reader.py +661 -30
- package/ui/forge_ui/static/app.js +86 -4
- package/ui/forge_ui/static/briefview.js +302 -0
- package/ui/forge_ui/static/checksview.js +6 -2
- package/ui/forge_ui/static/controls.js +5 -0
- package/ui/forge_ui/static/index.html +3 -0
- package/ui/forge_ui/static/panel.js +268 -2
- package/ui/forge_ui/static/runmodel.js +13 -1
- package/ui/forge_ui/static/storageview.js +271 -0
- package/ui/forge_ui/static/style.css +99 -3
- package/ui/forge_ui/static/worktreesview.js +3 -3
- package/ui/forge_ui/storage.py +136 -0
- package/ui/forge_ui/transcripts.py +35 -10
- package/ui/forge_ui/worktrees.py +154 -13
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
# qa.out, verdict (PASS | FAIL | UNKNOWN | INVALIDATED | ACCEPTED; absent when nothing was
|
|
27
27
|
# judged), qa.gate and known_issues.md (with a threshold), qa.infra (infrastructure stop),
|
|
28
28
|
# review.meta, context.md, notes.md, tasks.summary, combined.diff (when inlined),
|
|
29
|
-
# source/review.fingerprint and review-<pid>/ (the disposable checkout the reviewer ran in
|
|
29
|
+
# source/review.fingerprint and review-<pid>/ (the disposable checkout the reviewer ran in, removed
|
|
30
|
+
# when the review ends; FORGE_KEEP_SNAPSHOTS=1 keeps it).
|
|
30
31
|
# `review` also keeps $PLAN/final-review (a link to the newest directory) and
|
|
31
32
|
# $PLAN/final-review.verdict (a copy of its verdict).
|
|
32
33
|
#
|
|
@@ -357,7 +358,19 @@ PY
|
|
|
357
358
|
# src is a repository or worktree that contains both revisions; it is also the checkout
|
|
358
359
|
# whose fingerprint must not change while the reviewer runs. Never uses `die`/`exit`:
|
|
359
360
|
# it is called from inside do_integrate.
|
|
361
|
+
# The review snapshot goes once the review is over, on every return (#139). A signal that ends the
|
|
362
|
+
# process first leaves it, and the next final review of the plan removes it: they hold the plan's
|
|
363
|
+
# lock, so one runs at a time and any snapshot already there is an interrupted one's.
|
|
360
364
|
final_review() {
|
|
365
|
+
local final_rc
|
|
366
|
+
FINAL_REVIEW_SNAPSHOT=""
|
|
367
|
+
final_review_body "$@"; final_rc=$?
|
|
368
|
+
forge_drop_snapshot "$FINAL_REVIEW_SNAPSHOT"
|
|
369
|
+
FINAL_REVIEW_SNAPSHOT=""
|
|
370
|
+
return "$final_rc"
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
final_review_body() {
|
|
361
374
|
local plan="$1" base="$2" tip="$3" src="$4" out="$5" spec="$6" yolo="${7:-}"
|
|
362
375
|
local review n rc verdict thr gate_line gate_forced source_fp review_fp vdir tflag="" inline=1 diff_n ft
|
|
363
376
|
local plan_real prev="" prev_rel=none prev_tip="" since=none integration="" prev_note=""
|
|
@@ -391,8 +404,13 @@ final_review() {
|
|
|
391
404
|
|
|
392
405
|
# `forge_review_snapshot` writes review.base beside the snapshot, so it gets a directory
|
|
393
406
|
# of its own under the artifact dir.
|
|
407
|
+
local stale
|
|
408
|
+
for stale in "$out"/review-* "$plan"/final-review*/review-* "$plan"/integrate-*/final-review/review-*; do
|
|
409
|
+
[ -d "$stale/.git" ] && forge_drop_snapshot "$stale"
|
|
410
|
+
done
|
|
394
411
|
review="$out/review-$$"; n=0
|
|
395
412
|
while [ -e "$review" ]; do n=$((n+1)); review="$out/review-$$-$n"; done
|
|
413
|
+
FINAL_REVIEW_SNAPSHOT="$review"
|
|
396
414
|
forge_review_snapshot "$src" "$base" "$tip" "$review" > "$out/snapshot.log" 2>&1 ||
|
|
397
415
|
{ note "final review: cannot build the review snapshot (see $out/snapshot.log)"; return 3; }
|
|
398
416
|
forge_review_deps "$src" "$review" "$out/review.deps"
|
|
@@ -482,6 +500,9 @@ final_review() {
|
|
|
482
500
|
echo " git diff HEAD~1 HEAD -- . ':(exclude).forge'"
|
|
483
501
|
echo "(and 'git diff --stat HEAD~1 HEAD' for the overview)."
|
|
484
502
|
fi
|
|
503
|
+
# Last. A shadow of a task review copies qa.input itself; this prompt is the final
|
|
504
|
+
# review's, and nothing copies it onward. Off prints nothing.
|
|
505
|
+
forge_retro_prompt "$plan" review
|
|
485
506
|
} > "$out/qa.input"
|
|
486
507
|
|
|
487
508
|
[ -s "$plan/timeout" ] && tflag="--timeout $(cat "$plan/timeout")"
|
|
@@ -516,12 +537,19 @@ final_review() {
|
|
|
516
537
|
fi
|
|
517
538
|
rs_mode=fresh
|
|
518
539
|
mv "$out/qa.out" "$out/qa.continue.out" 2>/dev/null || true
|
|
540
|
+
# The fresh dispatch deletes qa.last and qa.log as it starts. Record the continuation
|
|
541
|
+
# first; a failure to record does not change rc, which the fresh dispatch sets next.
|
|
542
|
+
forge_retro_record "$plan" qa "$out"
|
|
519
543
|
FORGE_CAPABILITY_CACHE="${FORGE_CAPABILITY_CACHE:-$plan/capabilities}" \
|
|
520
544
|
"${qa_cmd[@]}" > "$out/qa.out" 2>&1
|
|
521
545
|
rc=$?
|
|
522
546
|
fi
|
|
523
547
|
[ ! -f "$plan/reviewer_session" ] || { echo "session=$rs_mode"; echo "session_reason=$rs_reason"; } >> "$out/review.meta"
|
|
524
548
|
if [ "${FORGE_OUTPUT:-summary}" = full ]; then cat "$out/qa.out"; fi
|
|
549
|
+
# The dispatch role is qa, so the notes are in qa.last. No task: this is the whole run.
|
|
550
|
+
# Record and the regenerated report never change rc; the case below still decides it.
|
|
551
|
+
forge_retro_record "$plan" qa "$out"
|
|
552
|
+
forge_retro_report "$plan"
|
|
525
553
|
case "$rc" in
|
|
526
554
|
0) ;;
|
|
527
555
|
8) note "final review: the reviewer hit an infrastructure failure; nothing was judged"
|
package/scripts/forge-metrics.sh
CHANGED
|
@@ -5,8 +5,9 @@ forge_metric_begin() {
|
|
|
5
5
|
FORGE_METRIC="$(python3 "$SKILL_DIR/scripts/forge-runtime.py" begin "$1" "$2")" || return 3
|
|
6
6
|
# Dispatches started from here name this execution as their parent in the run dataset.
|
|
7
7
|
export FORGE_DATASET_PARENT="${FORGE_METRIC##*/}"
|
|
8
|
-
# The hook, when the caller defines it, records status before finish and Fractal's _outcome.
|
|
9
|
-
|
|
8
|
+
# The hook, when the caller defines it, records status before finish and Fractal's _outcome. A review
|
|
9
|
+
# snapshot the runner names in FORGE_REVIEW_SNAPSHOT is removed on every way out (#139).
|
|
10
|
+
trap 'metric_rc=$?; [ -z "${FORGE_REVIEW_SNAPSHOT:-}" ] || ! declare -F forge_drop_snapshot >/dev/null || forge_drop_snapshot "$FORGE_REVIEW_SNAPSHOT"; ! declare -F forge_metric_on_exit >/dev/null || forge_metric_on_exit "$metric_rc"; python3 "$SKILL_DIR/scripts/forge-runtime.py" finish "$FORGE_METRIC" "$FORGE_METRIC_ROOT" "$FORGE_METRIC_ROLE" pipeline "$metric_rc"; if [ -n "${FORGE_FRACTAL_RUN:-}" ]; then python3 "$SKILL_DIR/scripts/forge-fractal.py" _outcome "$FORGE_METRIC_ROOT" "$metric_rc"; fi; exit "$metric_rc"' EXIT
|
|
10
11
|
}
|
|
11
12
|
forge_metric_phase() {
|
|
12
13
|
python3 "$SKILL_DIR/scripts/forge-runtime.py" phase "$FORGE_METRIC" "$1"
|
|
@@ -25,8 +26,11 @@ forge_dataset_event() { # forge_dataset_event <name> --dir <dir> [--task id] [--
|
|
|
25
26
|
}
|
|
26
27
|
# A worktree forge added or removed (#125): forge-ui's Worktrees screen lists every one, removed ones too.
|
|
27
28
|
# <kind> is task, integration, candidate or attribute (scripts/forge_worktrees.py); <branch> is - when detached.
|
|
28
|
-
#
|
|
29
|
+
# Always into forge's location list (forge_locations.py, off only with FORGE_RUN_REGISTRY=off), so forge knows
|
|
30
|
+
# where its worktrees are whatever the dataset says; the dataset event is off with FORGE_DATASET=off.
|
|
29
31
|
forge_worktree_event() { # forge_worktree_event created|removed <run dir> <repo> <path> <branch|-> <kind> [task]
|
|
32
|
+
python3 -I "$SKILL_DIR/scripts/forge_locations.py" worktree "$1" "$2" "$3" "$4" "$5" "$6" ${7:+"$7"} \
|
|
33
|
+
</dev/null >/dev/null 2>&1 || true
|
|
30
34
|
forge_dataset_event "worktree_$1" --dir "$2" ${7:+--task "$7"} --set repo_path="$3" --set path="$4" \
|
|
31
35
|
--set branch="$5" --set kind="$6"
|
|
32
36
|
}
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
# --infra-retries when `run` or `retry` is not given them; a flag wins. On `retry` they are
|
|
16
16
|
# the further attempts after this one (while its review fails) and the waits out of an infrastructure stop.
|
|
17
17
|
#
|
|
18
|
+
# `plan` also writes retro, brief, brief_scope, brief_model, summaries and summaries_model
|
|
19
|
+
# (--retro, --brief, --brief-scope, --brief-model, --summaries, --summaries-model; #132, #133,
|
|
20
|
+
# #135). They are plan-only flags, parsed in do_plan, not here; see forge_features_resolve.
|
|
21
|
+
#
|
|
18
22
|
# Persisted options become files in the plan dir, like --verify and --setup, so a later
|
|
19
23
|
# `retry` or the scheduler's task processes see them. Cost-bearing options that change
|
|
20
24
|
# what a run is allowed to spend (--retry-failed, --infra-retries) are deliberately NOT
|