@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.
- package/CHANGELOG.md +61 -0
- package/README.md +19 -12
- package/SKILL.md +137 -216
- package/VERSION +1 -1
- package/docs/README.md +2 -3
- package/docs/add-ons.md +5 -3
- package/docs/artifacts.md +17 -2
- package/docs/commands.md +85 -63
- package/docs/decomposed-runs.md +195 -21
- package/docs/development.md +11 -9
- package/docs/forge-ui.md +33 -4
- package/docs/install.md +37 -5
- package/docs/memory.md +6 -1
- package/docs/models.md +36 -10
- package/docs/reviews.md +44 -25
- package/docs/safety.md +27 -2
- package/docs/troubleshooting.md +7 -10
- package/forge +25 -4
- package/package.json +2 -1
- package/references/dataset.md +10 -9
- package/references/decompose-integration.md +337 -0
- package/references/decompose-opt-in.md +527 -0
- package/references/decompose-recovery.md +569 -0
- package/references/decompose-review.md +256 -0
- package/references/decompose.md +99 -1606
- package/references/findings.md +68 -0
- package/references/harnesses.md +7 -12
- package/references/memory.md +13 -2
- package/references/planning.md +48 -18
- package/references/ripwire.md +38 -13
- package/references/runtime.md +22 -33
- package/references/setup.md +90 -0
- package/references/solo.md +13 -42
- package/references/ui.md +12 -5
- package/registry.tsv +40 -22
- package/scripts/forge-artifact.sh +143 -12
- package/scripts/forge-compare.py +5 -15
- package/scripts/forge-config.py +14 -1
- package/scripts/forge-contract.py +216 -53
- package/scripts/forge-control.py +777 -54
- package/scripts/forge-dispatch.sh +95 -12
- package/scripts/forge-du.py +13 -3
- package/scripts/forge-handoff.py +221 -39
- package/scripts/forge-install-ripwire.sh +100 -24
- package/scripts/forge-install.sh +18 -32
- package/scripts/forge-issues.py +6 -4
- package/scripts/forge-jev-options.sh +3 -5
- package/scripts/forge-lib-adopt.sh +169 -5
- package/scripts/forge-lib-attribute.sh +10 -3
- package/scripts/forge-lib-decompose.sh +454 -0
- package/scripts/forge-lib-env.sh +21 -0
- package/scripts/forge-lib-group.sh +4 -1
- package/scripts/forge-lib-plans.sh +30 -18
- package/scripts/forge-lib-review.sh +28 -8
- package/scripts/forge-lib-task.sh +225 -56
- package/scripts/forge-lib-verify.sh +59 -10
- package/scripts/forge-memory.sh +81 -4
- package/scripts/forge-metrics.sh +4 -2
- package/scripts/forge-parallel-options.sh +23 -4
- package/scripts/forge-parallel.sh +447 -175
- package/scripts/forge-plan-check.py +71 -8
- package/scripts/forge-planner.py +303 -17
- package/scripts/forge-pr.py +9 -1
- package/scripts/forge-prompt.py +2 -2
- package/scripts/forge-review-links.py +248 -0
- package/scripts/forge-ripwire.py +234 -16
- package/scripts/forge-route.py +19 -27
- package/scripts/forge-runs-rm.py +92 -21
- package/scripts/forge-runs.py +46 -5
- package/scripts/forge-runtime.py +37 -12
- package/scripts/forge-schedule.py +124 -33
- package/scripts/forge-setup-stale.py +236 -0
- package/scripts/forge-setup.py +804 -0
- package/scripts/forge-shadow.py +2 -20
- package/scripts/forge-solo-lock.py +46 -0
- package/scripts/forge-solo.sh +33 -56
- package/scripts/forge-sweep.py +2 -1
- package/scripts/forge-ui.py +8 -1
- package/scripts/forge-update.sh +2 -2
- package/scripts/forge-verify.py +16 -1
- package/scripts/forge-version.py +13 -1
- package/scripts/forge-watch.py +7 -2
- package/scripts/forge_dataset/__init__.py +1 -1
- package/scripts/forge_dataset/capture.py +0 -34
- package/scripts/forge_dataset/checks.py +0 -1
- package/scripts/forge_dataset/cli.py +5 -1
- package/scripts/forge_dataset/export.py +28 -6
- package/scripts/forge_dataset/facts.py +1 -2
- package/scripts/forge_dataset/forecast.py +1 -1
- package/scripts/forge_dataset/harvest.py +107 -7
- package/scripts/forge_dataset/importer.py +3 -2
- package/scripts/forge_dataset/pairs.py +3 -3
- package/scripts/forge_dataset/reviewers.py +4 -3
- package/scripts/forge_dataset/routing.py +6 -3
- package/scripts/forge_dataset/tiers.py +1 -1
- package/scripts/forge_decide/__init__.py +1 -1
- package/scripts/forge_decide/profiles.py +11 -14
- package/scripts/forge_decompose.py +987 -0
- package/scripts/forge_groups/review.py +6 -1
- package/scripts/forge_jev/__init__.py +1 -1
- package/scripts/forge_jev/cli.py +10 -1
- package/scripts/forge_jev/gates.py +10 -1
- package/scripts/forge_jev/verify.py +10 -2
- package/scripts/forge_legacy.py +86 -0
- package/scripts/forge_memory_home.py +57 -0
- package/scripts/forge_models.py +151 -0
- package/scripts/forge_prefs.py +138 -0
- package/scripts/forge_side/__init__.py +10 -0
- package/scripts/forge_storage.py +28 -15
- package/ui/README.md +22 -10
- package/ui/docs/api.md +121 -99
- package/ui/forge_ui/control.py +46 -14
- package/ui/forge_ui/export.py +0 -10
- package/ui/forge_ui/models.py +15 -2
- package/ui/forge_ui/projects.py +4 -1
- package/ui/forge_ui/reader.py +456 -59
- package/ui/forge_ui/server.py +0 -10
- package/ui/forge_ui/static/app.js +28 -9
- package/ui/forge_ui/static/checksview.js +12 -3
- package/ui/forge_ui/static/controls.js +147 -11
- package/ui/forge_ui/static/convo.js +5 -2
- package/ui/forge_ui/static/diffview.js +4 -5
- package/ui/forge_ui/static/panel.js +180 -77
- package/ui/forge_ui/static/projectsview.js +16 -2
- package/ui/forge_ui/static/runmodel.js +18 -4
- package/ui/forge_ui/static/scene3d.js +29 -29
- package/ui/forge_ui/static/settings.js +1 -1
- package/ui/forge_ui/static/storageview.js +2 -2
- package/ui/forge_ui/static/style.css +23 -6
- package/ui/forge_ui/static/worktreesview.js +8 -4
- package/ui/forge_ui/transcripts.py +6 -0
- package/ui/forge_ui/worktrees.py +13 -1
- package/docs/fractal.md +0 -181
- package/references/fractal-dashboard.md +0 -21
- package/references/fractal.md +0 -307
- package/scripts/forge-fractal-dispatch.sh +0 -4
- package/scripts/forge-fractal-options.sh +0 -54
- package/scripts/forge-fractal.py +0 -6
- package/scripts/forge-install-fractal.sh +0 -4
- package/scripts/forge_fractal/__init__.py +0 -88
- package/scripts/forge_fractal/bridge.py +0 -46
- package/scripts/forge_fractal/cli.py +0 -224
- package/scripts/forge_fractal/dashboard.css +0 -138
- package/scripts/forge_fractal/dashboard.html +0 -41
- package/scripts/forge_fractal/dashboard.js +0 -687
- package/scripts/forge_fractal/decomposition.py +0 -262
- package/scripts/forge_fractal/execution.py +0 -659
- package/scripts/forge_fractal/inspection.py +0 -261
- package/scripts/forge_fractal/install.py +0 -158
- package/scripts/forge_fractal/invocation.py +0 -95
- package/scripts/forge_fractal/pipeline.py +0 -125
- package/scripts/forge_fractal/selection.py +0 -180
- package/ui/forge_ui/fractal.py +0 -582
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Track worktree setup commits and detect stale generated inputs before verify."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import fnmatch
|
|
8
|
+
import posixpath
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
DEFAULT_LOCKFILES = frozenset(
|
|
14
|
+
{
|
|
15
|
+
"package-lock.json",
|
|
16
|
+
"pnpm-lock.yaml",
|
|
17
|
+
"yarn.lock",
|
|
18
|
+
"bun.lock",
|
|
19
|
+
"bun.lockb",
|
|
20
|
+
"npm-shrinkwrap.json",
|
|
21
|
+
"poetry.lock",
|
|
22
|
+
"uv.lock",
|
|
23
|
+
"Pipfile.lock",
|
|
24
|
+
"Cargo.lock",
|
|
25
|
+
"go.sum",
|
|
26
|
+
"Gemfile.lock",
|
|
27
|
+
"composer.lock",
|
|
28
|
+
"Package.resolved",
|
|
29
|
+
"Podfile.lock",
|
|
30
|
+
"mix.lock",
|
|
31
|
+
"pubspec.lock",
|
|
32
|
+
"flake.lock",
|
|
33
|
+
"gradle.lockfile",
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _git_stdout(checkout: Path, *args: str) -> bytes | None:
|
|
39
|
+
res = subprocess.run(
|
|
40
|
+
["git", "-C", str(checkout), *args],
|
|
41
|
+
stdout=subprocess.PIPE,
|
|
42
|
+
stderr=subprocess.DEVNULL,
|
|
43
|
+
check=False,
|
|
44
|
+
)
|
|
45
|
+
if res.returncode != 0:
|
|
46
|
+
return None
|
|
47
|
+
return res.stdout
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _git_text(checkout: Path, *args: str) -> str:
|
|
51
|
+
raw = _git_stdout(checkout, *args)
|
|
52
|
+
if raw is None:
|
|
53
|
+
return ""
|
|
54
|
+
return raw.decode("utf-8", "surrogateescape").strip()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _git_dir(checkout: Path) -> Path | None:
|
|
58
|
+
gdir = _git_text(checkout, "rev-parse", "--git-dir")
|
|
59
|
+
if not gdir:
|
|
60
|
+
return None
|
|
61
|
+
p = Path(gdir)
|
|
62
|
+
if not p.is_absolute():
|
|
63
|
+
p = checkout / p
|
|
64
|
+
return p
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _write_lf(path: Path, text: str) -> None:
|
|
68
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
69
|
+
path.write_bytes(text.encode("utf-8", "surrogateescape"))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def cmd_record_commit(args: argparse.Namespace) -> int:
|
|
73
|
+
checkout = Path(args.checkout)
|
|
74
|
+
head = _git_text(checkout, "rev-parse", "HEAD")
|
|
75
|
+
if not head:
|
|
76
|
+
return 0
|
|
77
|
+
gdir = _git_dir(checkout)
|
|
78
|
+
if gdir is not None:
|
|
79
|
+
_write_lf(gdir / "forge-setup-commit", head + "\n")
|
|
80
|
+
if args.out:
|
|
81
|
+
_write_lf(Path(args.out), head + "\n")
|
|
82
|
+
return 0
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _strip_dot_slash(path: str) -> str:
|
|
86
|
+
while path.startswith("./"):
|
|
87
|
+
path = path[2:]
|
|
88
|
+
return path
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _load_setup_inputs(wt: Path, repo: Path) -> list[str] | None:
|
|
92
|
+
for candidate in (wt / ".forge" / "setup-inputs", repo / ".forge" / "setup-inputs"):
|
|
93
|
+
if candidate.is_file():
|
|
94
|
+
raw = candidate.read_bytes().decode("utf-8", "surrogateescape")
|
|
95
|
+
patterns: list[str] = []
|
|
96
|
+
for line in raw.splitlines():
|
|
97
|
+
stripped = line.strip()
|
|
98
|
+
if stripped and not stripped.startswith("#"):
|
|
99
|
+
patterns.append(_strip_dot_slash(stripped.replace("\\", "/")))
|
|
100
|
+
return patterns
|
|
101
|
+
return None
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _matches_pattern(rel_path: str, pattern: str) -> bool:
|
|
105
|
+
rel_path = _strip_dot_slash(rel_path.replace("\\", "/"))
|
|
106
|
+
if not pattern:
|
|
107
|
+
return False
|
|
108
|
+
if pattern.endswith("/"):
|
|
109
|
+
return rel_path.startswith(pattern)
|
|
110
|
+
if pattern.endswith("/**"):
|
|
111
|
+
prefix = pattern[:-3].rstrip("/")
|
|
112
|
+
return rel_path == prefix or rel_path.startswith(prefix + "/")
|
|
113
|
+
has_glob = any(ch in pattern for ch in "*?[")
|
|
114
|
+
if has_glob:
|
|
115
|
+
if "/" in pattern:
|
|
116
|
+
return fnmatch.fnmatch(rel_path, pattern)
|
|
117
|
+
return fnmatch.fnmatch(rel_path, pattern) or fnmatch.fnmatch(
|
|
118
|
+
posixpath.basename(rel_path), pattern
|
|
119
|
+
)
|
|
120
|
+
if "/" in pattern:
|
|
121
|
+
return rel_path == pattern or rel_path.startswith(pattern + "/")
|
|
122
|
+
return (
|
|
123
|
+
rel_path == pattern
|
|
124
|
+
or rel_path.startswith(pattern + "/")
|
|
125
|
+
or posixpath.basename(rel_path) == pattern
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _changed_files(wt: Path, base_commit: str, head_commit: str) -> list[str]:
|
|
130
|
+
raw = _git_stdout(
|
|
131
|
+
wt, "diff", "--name-only", "-z", base_commit, head_commit, "--", "."
|
|
132
|
+
)
|
|
133
|
+
if not raw:
|
|
134
|
+
return []
|
|
135
|
+
items = [p.decode("utf-8", "surrogateescape") for p in raw.split(b"\x00") if p]
|
|
136
|
+
return [p.replace("\\", "/") for p in items]
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def _resolve_setup_commit(wt: Path, override_path: str | None) -> str:
|
|
140
|
+
if override_path:
|
|
141
|
+
p = Path(override_path)
|
|
142
|
+
if p.is_file():
|
|
143
|
+
val = p.read_bytes().decode("utf-8", "surrogateescape").strip()
|
|
144
|
+
if val:
|
|
145
|
+
return val
|
|
146
|
+
gdir = _git_dir(wt)
|
|
147
|
+
if gdir is not None:
|
|
148
|
+
marker = gdir / "forge-setup-commit"
|
|
149
|
+
if marker.is_file():
|
|
150
|
+
val = marker.read_bytes().decode("utf-8", "surrogateescape").strip()
|
|
151
|
+
if val:
|
|
152
|
+
return val
|
|
153
|
+
return ""
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def _emit(status: str, matched: list[str]) -> int:
|
|
157
|
+
summary = ", ".join(matched[:5])
|
|
158
|
+
if len(matched) > 5:
|
|
159
|
+
summary += f" (+{len(matched) - 5} more)"
|
|
160
|
+
line = f"{status}\t{summary}\n"
|
|
161
|
+
sys.stdout.buffer.write(line.encode("utf-8", "surrogateescape"))
|
|
162
|
+
return 0
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def cmd_check(args: argparse.Namespace) -> int:
|
|
166
|
+
plan = Path(args.plan)
|
|
167
|
+
wt = Path(args.wt)
|
|
168
|
+
repo = Path(args.repo)
|
|
169
|
+
|
|
170
|
+
setup_commit = _resolve_setup_commit(wt, args.setup_commit)
|
|
171
|
+
if not setup_commit:
|
|
172
|
+
# No successful setup on record (it failed, or the worktree predates the record):
|
|
173
|
+
# with the flag on that is the case a re-run helps most.
|
|
174
|
+
if (plan / "setup_before_verify").is_file():
|
|
175
|
+
return _emit("RERUN", ["no successful setup recorded for this checkout"])
|
|
176
|
+
return _emit("OK", [])
|
|
177
|
+
head_commit = _git_text(wt, "rev-parse", "HEAD")
|
|
178
|
+
if not head_commit or setup_commit == head_commit:
|
|
179
|
+
return _emit("OK", [])
|
|
180
|
+
|
|
181
|
+
changed = _changed_files(wt, setup_commit, head_commit)
|
|
182
|
+
if not changed:
|
|
183
|
+
return _emit("OK", [])
|
|
184
|
+
|
|
185
|
+
patterns = _load_setup_inputs(wt, repo)
|
|
186
|
+
setup_before_verify = (plan / "setup_before_verify").is_file()
|
|
187
|
+
|
|
188
|
+
if setup_before_verify:
|
|
189
|
+
if patterns is not None:
|
|
190
|
+
matched = [
|
|
191
|
+
p
|
|
192
|
+
for p in changed
|
|
193
|
+
if p in (".forge/setup", ".forge/setup-inputs")
|
|
194
|
+
or any(_matches_pattern(p, pat) for pat in patterns)
|
|
195
|
+
]
|
|
196
|
+
if matched:
|
|
197
|
+
return _emit("RERUN", matched)
|
|
198
|
+
return _emit("OK", [])
|
|
199
|
+
return _emit("RERUN", changed)
|
|
200
|
+
|
|
201
|
+
matched_stale: list[str] = []
|
|
202
|
+
for p in changed:
|
|
203
|
+
base = posixpath.basename(p)
|
|
204
|
+
is_lock = base in DEFAULT_LOCKFILES
|
|
205
|
+
is_declared = patterns is not None and any(
|
|
206
|
+
_matches_pattern(p, pat) for pat in patterns
|
|
207
|
+
)
|
|
208
|
+
if is_lock or is_declared or p == ".forge/setup":
|
|
209
|
+
matched_stale.append(p)
|
|
210
|
+
if matched_stale:
|
|
211
|
+
return _emit("STALE", matched_stale)
|
|
212
|
+
return _emit("OK", [])
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def main(argv: list[str] | None = None) -> int:
|
|
216
|
+
parser = argparse.ArgumentParser(description="Check or record setup commit staleness.")
|
|
217
|
+
sub = parser.add_subparsers(dest="cmd", required=True)
|
|
218
|
+
|
|
219
|
+
p_rec = sub.add_parser("record-commit")
|
|
220
|
+
p_rec.add_argument("checkout")
|
|
221
|
+
p_rec.add_argument("--out", default=None)
|
|
222
|
+
p_rec.set_defaults(func=cmd_record_commit)
|
|
223
|
+
|
|
224
|
+
p_chk = sub.add_parser("check")
|
|
225
|
+
p_chk.add_argument("plan")
|
|
226
|
+
p_chk.add_argument("wt")
|
|
227
|
+
p_chk.add_argument("repo")
|
|
228
|
+
p_chk.add_argument("--setup-commit", default=None)
|
|
229
|
+
p_chk.set_defaults(func=cmd_check)
|
|
230
|
+
|
|
231
|
+
args = parser.parse_args(argv)
|
|
232
|
+
return args.func(args)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
if __name__ == "__main__":
|
|
236
|
+
raise SystemExit(main())
|