@giamme/forge 0.16.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/SKILL.md +16 -3
  3. package/VERSION +1 -1
  4. package/docs/artifacts.md +8 -0
  5. package/docs/commands.md +70 -6
  6. package/docs/dataset.md +13 -0
  7. package/docs/decomposed-runs.md +8 -0
  8. package/docs/forge-ui.md +23 -2
  9. package/docs/memory.md +2 -0
  10. package/docs/reviews.md +15 -1
  11. package/docs/safety.md +8 -0
  12. package/forge +24 -1
  13. package/package.json +1 -1
  14. package/references/dataset.md +143 -5
  15. package/references/decision-models.md +15 -2
  16. package/references/decompose.md +180 -11
  17. package/references/planning.md +3 -2
  18. package/references/solo.md +2 -1
  19. package/references/ui.md +5 -2
  20. package/scripts/forge-artifact.sh +14 -0
  21. package/scripts/forge-brief.py +132 -0
  22. package/scripts/forge-compare.py +11 -1
  23. package/scripts/forge-config.py +176 -9
  24. package/scripts/forge-contract.py +98 -4
  25. package/scripts/forge-control.py +86 -13
  26. package/scripts/forge-dispatch.sh +14 -10
  27. package/scripts/forge-du.py +167 -0
  28. package/scripts/forge-issues.py +4 -3
  29. package/scripts/forge-ledger.py +3 -1
  30. package/scripts/forge-lib-adopt.sh +8 -1
  31. package/scripts/forge-lib-plans.sh +5 -2
  32. package/scripts/forge-lib-review.sh +29 -1
  33. package/scripts/forge-metrics.sh +29 -3
  34. package/scripts/forge-parallel-options.sh +4 -0
  35. package/scripts/forge-parallel.sh +506 -10
  36. package/scripts/forge-plan-check.py +25 -2
  37. package/scripts/forge-planner.py +20 -6
  38. package/scripts/forge-prompt.py +120 -0
  39. package/scripts/forge-retro.py +115 -0
  40. package/scripts/forge-runs-compact.py +443 -0
  41. package/scripts/forge-runs-rm.py +2 -0
  42. package/scripts/forge-runs.py +18 -3
  43. package/scripts/forge-schedule.py +279 -4
  44. package/scripts/forge-shadow.py +35 -10
  45. package/scripts/forge-solo.sh +2 -0
  46. package/scripts/forge-summarize.py +698 -0
  47. package/scripts/forge-sweep.py +25 -10
  48. package/scripts/forge-ui-options.sh +10 -0
  49. package/scripts/forge_brief/__init__.py +587 -0
  50. package/scripts/forge_brief/answers.py +459 -0
  51. package/scripts/forge_dataset/__init__.py +10 -0
  52. package/scripts/forge_dataset/cli.py +83 -0
  53. package/scripts/forge_dataset/export.py +18 -4
  54. package/scripts/forge_dataset/facts.py +280 -0
  55. package/scripts/forge_dataset/harvest.py +56 -9
  56. package/scripts/forge_dataset/history.py +5 -3
  57. package/scripts/forge_dataset/outcomes.py +206 -58
  58. package/scripts/forge_dataset/pairs.py +174 -0
  59. package/scripts/forge_dataset/risk.py +108 -0
  60. package/scripts/forge_dataset/tiers.py +427 -0
  61. package/scripts/forge_decide/__init__.py +11 -1
  62. package/scripts/forge_decide/cli.py +23 -2
  63. package/scripts/forge_decide/labels.py +30 -6
  64. package/scripts/forge_decide/replay.py +10 -4
  65. package/scripts/forge_locations.py +366 -0
  66. package/scripts/forge_registry.py +19 -0
  67. package/scripts/forge_retro/__init__.py +417 -0
  68. package/scripts/forge_retro/issues.py +1193 -0
  69. package/scripts/forge_retro/report.py +671 -0
  70. package/scripts/forge_side/__init__.py +477 -0
  71. package/scripts/forge_storage.py +515 -0
  72. package/ui/README.md +68 -8
  73. package/ui/docs/api.md +217 -20
  74. package/ui/forge_ui/control.py +92 -11
  75. package/ui/forge_ui/export.py +31 -5
  76. package/ui/forge_ui/findings.py +4 -2
  77. package/ui/forge_ui/links.py +337 -0
  78. package/ui/forge_ui/models.py +57 -4
  79. package/ui/forge_ui/projects.py +4 -1
  80. package/ui/forge_ui/reader.py +732 -34
  81. package/ui/forge_ui/server.py +8 -0
  82. package/ui/forge_ui/static/app.js +92 -5
  83. package/ui/forge_ui/static/briefview.js +302 -0
  84. package/ui/forge_ui/static/checksview.js +6 -2
  85. package/ui/forge_ui/static/controls.js +5 -0
  86. package/ui/forge_ui/static/diffview.js +7 -3
  87. package/ui/forge_ui/static/index.html +3 -0
  88. package/ui/forge_ui/static/panel.js +311 -4
  89. package/ui/forge_ui/static/runmodel.js +13 -1
  90. package/ui/forge_ui/static/storageview.js +271 -0
  91. package/ui/forge_ui/static/style.css +100 -3
  92. package/ui/forge_ui/static/worktreesview.js +3 -3
  93. package/ui/forge_ui/storage.py +136 -0
  94. package/ui/forge_ui/transcripts.py +35 -10
  95. package/ui/forge_ui/worktrees.py +154 -13
@@ -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
- trap 'metric_rc=$?; ! 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
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,11 +26,36 @@ 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
- # Off with the dataset (FORGE_DATASET=off), as forge_dataset_event is.
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
  }
37
+ # The outcomes that came due for a run's repository (#120): what older integrations' lines became,
38
+ # read from git alone. At the end of `run` and `integrate`; bounded (FORGE_OUTCOMES_TIMEOUT seconds,
39
+ # default 20, plus a kill 10 s later), never changes the caller's exit code, logs its errors to the
40
+ # dataset's errors.log, and is off with FORGE_OUTCOMES=off or with the dataset.
41
+ forge_outcomes_harvest() { # forge_outcomes_harvest <plan dir>
42
+ forge_dataset_off && return 0
43
+ case "${FORGE_OUTCOMES:-on}" in off|OFF|Off|0|no|false) return 0 ;; esac
44
+ local repo limit pid watcher
45
+ repo="$(cat "$1/repo" 2>/dev/null)"
46
+ [ -n "$repo" ] && [ -d "$repo" ] || return 0
47
+ limit="${FORGE_OUTCOMES_TIMEOUT:-20}"
48
+ case "$limit" in ''|*[!0-9]*) limit=20 ;; esac
49
+ [ "$limit" -gt 0 ] || return 0
50
+ python3 "$SKILL_DIR/scripts/forge-dataset.py" outcomes --repo "$repo" --deadline "$limit" --quiet \
51
+ </dev/null >/dev/null 2>&1 &
52
+ pid=$!
53
+ ( sleep $(( limit + 10 )); kill -KILL "$pid" 2>/dev/null ) >/dev/null 2>&1 &
54
+ watcher=$!
55
+ wait "$pid" 2>/dev/null
56
+ pkill -P "$watcher" 2>/dev/null; kill "$watcher" 2>/dev/null; wait "$watcher" 2>/dev/null
57
+ return 0
58
+ }
33
59
  forge_dataset_invocation() { # forge_dataset_invocation <command> <rc> <started> [argv...]
34
60
  forge_dataset_off && return 0
35
61
  local command="$1" rc="$2" started="$3"; shift 3
@@ -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