@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
@@ -25,8 +25,12 @@ least as severe as --severity, from a task that is not itself a sweep task (one
25
25
  review finds goes to `forge issues`), not dismissed (`forge issues --dismiss`), located in a file the
26
26
  integration branch still has, and still there: when a later merge changed the file and the line the
27
27
  reviewer saw is gone from it, the finding is left for `forge issues` rather than "fixed" twice. A
28
- person's acceptance of a reviewer's FAIL (`accept`) is theirs to triage, so accepted findings are never
29
- swept. Every finding left out is listed in the plan with its reason.
28
+ person's acceptance of a reviewer's FAIL (`accept`, or `adopt --approved`) is theirs to triage, so accepted
29
+ findings are never swept. Every finding left out is listed in the plan with its reason.
30
+
31
+ A range `adopt` brought in has no task row, and what its review tolerated is swept like a task's (#131):
32
+ its fix task's reviewer is the adoption's reviewer, and its implementer the plan's low tier, else the
33
+ implementer of the run's first task.
30
34
 
31
35
  Each fix task gets at most GROUP_CAP findings; --max (default DEFAULT_MAX) caps the tasks, worst
32
36
  severity first. Its implementer is the plan's low tier (the first spec of --dwarf-low, else of
@@ -67,6 +71,7 @@ REASONS = {
67
71
  'group-cap': 'over the %d findings one fix task takes' % GROUP_CAP,
68
72
  'over-max': 'over --sweep-max fix tasks',
69
73
  'no-model': 'no implementer or reviewer to give its fix task',
74
+ 'accepted': 'a person kept it over the review (accept, or adopt --approved): theirs to triage',
70
75
  }
71
76
 
72
77
  _ISSUES = None
@@ -218,13 +223,19 @@ def triage(ctx: Context, found: list, severity: str, plausible: bool) -> tuple:
218
223
  kept, dropped, seen = [], [], {}
219
224
  tip_text = {}
220
225
  for f in sorted(found, key=lambda f: SEVERITIES.index(f['severity'])):
221
- if f['origin'] not in origins or not f.get('task') or is_sweep_task(ctx.plan, f['task']):
226
+ if not f.get('task') or is_sweep_task(ctx.plan, f['task']):
227
+ continue
228
+ if f['origin'] not in origins and f['origin'] != 'accepted':
222
229
  continue
223
230
  f = dict(f, key=mod.finding_key(f))
224
231
 
225
232
  def drop(reason, **detail):
226
233
  dropped.append(dict(f, reason=reason, detail=detail))
227
234
 
235
+ if f['origin'] == 'accepted':
236
+ drop('accepted')
237
+ continue
238
+
228
239
  if SEVERITIES.index(f['severity']) > cut:
229
240
  drop('below-severity')
230
241
  continue
@@ -279,18 +290,22 @@ def pools(plan: Path) -> dict:
279
290
  return data if isinstance(data, dict) else {}
280
291
 
281
292
 
282
- def models(plan: Path, source: 'list | None') -> tuple:
283
- """(dwarf, qa) for a fix task whose worst finding came from the task with row `source` (None when
284
- that task is not in tasks.tsv); an empty string where there is no spec to use."""
293
+ def models(plan: Path, source: 'list | None', finding: 'dict | None' = None, table: list = ()) -> tuple:
294
+ """(dwarf, qa) for a fix task whose worst finding came from the task with row `source`; an empty string
295
+ where there is no spec to use. Without a row (an adopted range, #131) the reviewer is the finding's own
296
+ (the adoption's spec) and the implementer, below the low tier, the run's first task's."""
285
297
  def usable(spec):
286
298
  return spec if isinstance(spec, str) and spec not in ('', '-', 'UNASSIGNED') else ''
287
- qa = usable(source[5]) if source else ''
299
+ qa = usable(source[5]) if source else usable((finding or {}).get('reviewer'))
288
300
  routing = pools(plan)
289
301
  for tier in ('low', 'any'):
290
302
  specs = routing.get(tier)
291
303
  if isinstance(specs, list) and specs and usable(specs[0]):
292
304
  return specs[0], qa
293
- return (usable(source[4]) if source else ''), qa
305
+ if source:
306
+ return usable(source[4]), qa
307
+ first = next((row for row in table if len(row) > 4 and not is_sweep_task(plan, row[0])), None)
308
+ return (usable(first[4]) if first else ''), qa
294
309
 
295
310
 
296
311
  def free_ids(taken: set, count: int) -> list:
@@ -368,7 +383,7 @@ def cmd_plan(args) -> int:
368
383
  run_id = read(plan / 'run_id') or plan.name
369
384
  tasks, new_rows = [], []
370
385
  for path, items in list(chosen):
371
- if not all(models(plan, by_id.get(items[0]['task']))):
386
+ if not all(models(plan, by_id.get(items[0]['task']), items[0], table)):
372
387
  chosen.remove((path, items))
373
388
  dropped += [dict(f, reason='no-model', detail={}) for f in items]
374
389
  for ident, (path, items) in zip(ids, chosen):
@@ -376,7 +391,7 @@ def cmd_plan(args) -> int:
376
391
  origin=f['origin'], task=f['task'], file=f['file'], line=f.get('line'), path=path,
377
392
  location=location(f, path), text=f['text'], raw=f['raw'])
378
393
  for n, f in enumerate(items, 1)]
379
- dwarf, qa = models(plan, by_id.get(items[0]['task']))
394
+ dwarf, qa = models(plan, by_id.get(items[0]['task']), items[0], table)
380
395
  title = 'Fix %d review finding%s in %s' % (len(entries), '' if len(entries) == 1 else 's', path)
381
396
  root = plan / 'tasks' / ident
382
397
  root.mkdir(parents=True, exist_ok=True)
@@ -41,6 +41,16 @@ forge_ui_register() {
41
41
  return 0
42
42
  }
43
43
 
44
+ # forge_storage_check RUN_DIR REPO — at run start (#139): warn on stderr when this repository's forge
45
+ # files (run dirs and worktrees) passed storage.warn-gb when they were last measured, and start the
46
+ # background compaction of its idle runs (storage.compact auto), never RUN_DIR itself. Never blocks
47
+ # or fails the run; callers skip it in a --dry-run. FORGE_STORAGE_COMPACT=off and
48
+ # FORGE_STORAGE_WARN_GB=off turn either part off.
49
+ forge_storage_check() {
50
+ python3 -I "$SKILL_DIR/scripts/forge-runs-compact.py" --start-check --repo "$2" --exclude "$1" </dev/null >/dev/null || true
51
+ return 0
52
+ }
53
+
44
54
  # forge_repo_identity CHECKOUT DIR — write DIR/repo.identity, the repository CHECKOUT belongs to:
45
55
  # {"root", "worktree", "branch"}. root is the main working tree, the same for the main checkout
46
56
  # and every linked worktree; worktree is CHECKOUT's physical path when it differs from root, else