@giamme/forge 0.21.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 (165) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/README.md +25 -15
  3. package/SKILL.md +137 -216
  4. package/VERSION +1 -1
  5. package/bin/forge.js +104 -0
  6. package/docs/README.md +2 -3
  7. package/docs/add-ons.md +5 -3
  8. package/docs/artifacts.md +17 -2
  9. package/docs/commands.md +85 -63
  10. package/docs/decomposed-runs.md +195 -21
  11. package/docs/development.md +12 -10
  12. package/docs/forge-ui.md +33 -4
  13. package/docs/install.md +127 -6
  14. package/docs/memory.md +6 -1
  15. package/docs/models.md +36 -10
  16. package/docs/reviews.md +50 -29
  17. package/docs/safety.md +27 -2
  18. package/docs/troubleshooting.md +8 -11
  19. package/forge +29 -4
  20. package/forge.cmd +56 -0
  21. package/package.json +6 -3
  22. package/references/dataset.md +10 -9
  23. package/references/decompose-integration.md +337 -0
  24. package/references/decompose-opt-in.md +527 -0
  25. package/references/decompose-recovery.md +569 -0
  26. package/references/decompose-review.md +256 -0
  27. package/references/decompose.md +99 -1606
  28. package/references/findings.md +68 -0
  29. package/references/harnesses.md +7 -12
  30. package/references/memory.md +13 -2
  31. package/references/planning.md +48 -18
  32. package/references/ripwire.md +38 -13
  33. package/references/runtime.md +22 -33
  34. package/references/setup.md +90 -0
  35. package/references/solo.md +13 -42
  36. package/references/ui.md +12 -5
  37. package/registry.tsv +40 -22
  38. package/scripts/forge-artifact.sh +148 -13
  39. package/scripts/forge-compare.py +5 -15
  40. package/scripts/forge-config.py +14 -1
  41. package/scripts/forge-contract.py +216 -53
  42. package/scripts/forge-control.py +781 -51
  43. package/scripts/forge-dispatch.sh +202 -42
  44. package/scripts/forge-du.py +13 -3
  45. package/scripts/forge-guard.py +137 -6
  46. package/scripts/forge-handoff.py +221 -39
  47. package/scripts/forge-install-ripwire.sh +100 -24
  48. package/scripts/forge-install.sh +100 -41
  49. package/scripts/forge-issues.py +6 -4
  50. package/scripts/forge-jev-options.sh +3 -5
  51. package/scripts/forge-lib-adopt.sh +169 -5
  52. package/scripts/forge-lib-attribute.sh +10 -3
  53. package/scripts/forge-lib-decompose.sh +454 -0
  54. package/scripts/forge-lib-env.sh +179 -0
  55. package/scripts/forge-lib-group.sh +9 -6
  56. package/scripts/forge-lib-plans.sh +38 -21
  57. package/scripts/forge-lib-review.sh +28 -8
  58. package/scripts/forge-lib-task.sh +263 -69
  59. package/scripts/forge-lib-verify.sh +59 -10
  60. package/scripts/forge-memory.sh +83 -4
  61. package/scripts/forge-metrics.sh +10 -3
  62. package/scripts/forge-parallel-options.sh +23 -4
  63. package/scripts/forge-parallel.sh +602 -217
  64. package/scripts/forge-plan-check.py +71 -8
  65. package/scripts/forge-planner.py +303 -17
  66. package/scripts/forge-pr.py +9 -1
  67. package/scripts/forge-prompt.py +2 -2
  68. package/scripts/forge-review-links.py +248 -0
  69. package/scripts/forge-ripwire.py +234 -16
  70. package/scripts/forge-route.py +19 -27
  71. package/scripts/forge-runs-rm.py +92 -21
  72. package/scripts/forge-runs.py +46 -5
  73. package/scripts/forge-runtime.py +39 -14
  74. package/scripts/forge-schedule.py +141 -33
  75. package/scripts/forge-setup-stale.py +236 -0
  76. package/scripts/forge-setup.py +804 -0
  77. package/scripts/forge-shadow.py +2 -20
  78. package/scripts/forge-solo-lock.py +46 -0
  79. package/scripts/forge-solo.sh +39 -58
  80. package/scripts/forge-sweep.py +3 -2
  81. package/scripts/forge-ui.py +8 -1
  82. package/scripts/forge-update.sh +8 -3
  83. package/scripts/forge-verify.py +17 -1
  84. package/scripts/forge-version.py +13 -1
  85. package/scripts/forge-watch.py +7 -2
  86. package/scripts/forge-win.sh +156 -0
  87. package/scripts/forge_brief/__init__.py +6 -1
  88. package/scripts/forge_brief/proposals.py +6 -1
  89. package/scripts/forge_dataset/__init__.py +1 -1
  90. package/scripts/forge_dataset/capture.py +0 -34
  91. package/scripts/forge_dataset/checks.py +0 -1
  92. package/scripts/forge_dataset/cli.py +5 -1
  93. package/scripts/forge_dataset/export.py +28 -6
  94. package/scripts/forge_dataset/facts.py +1 -2
  95. package/scripts/forge_dataset/forecast.py +1 -1
  96. package/scripts/forge_dataset/harvest.py +107 -7
  97. package/scripts/forge_dataset/importer.py +3 -2
  98. package/scripts/forge_dataset/pairs.py +3 -3
  99. package/scripts/forge_dataset/reviewers.py +4 -3
  100. package/scripts/forge_dataset/routing.py +6 -3
  101. package/scripts/forge_dataset/tiers.py +1 -1
  102. package/scripts/forge_decide/__init__.py +1 -1
  103. package/scripts/forge_decide/budget.py +12 -7
  104. package/scripts/forge_decide/profiles.py +11 -14
  105. package/scripts/forge_decide/replay.py +9 -4
  106. package/scripts/forge_decompose.py +987 -0
  107. package/scripts/forge_flock.py +17 -2
  108. package/scripts/forge_groups/review.py +6 -1
  109. package/scripts/forge_jev/__init__.py +1 -1
  110. package/scripts/forge_jev/cli.py +10 -1
  111. package/scripts/forge_jev/gates.py +10 -1
  112. package/scripts/forge_jev/verify.py +10 -2
  113. package/scripts/forge_legacy.py +86 -0
  114. package/scripts/forge_memory_home.py +57 -0
  115. package/scripts/forge_models.py +151 -0
  116. package/scripts/forge_posix.py +17 -0
  117. package/scripts/forge_prefs.py +138 -0
  118. package/scripts/forge_proc.py +108 -0
  119. package/scripts/forge_registry.py +2 -2
  120. package/scripts/forge_side/__init__.py +23 -4
  121. package/scripts/forge_storage.py +28 -15
  122. package/ui/README.md +22 -10
  123. package/ui/docs/api.md +121 -99
  124. package/ui/forge_ui/control.py +53 -16
  125. package/ui/forge_ui/export.py +0 -10
  126. package/ui/forge_ui/models.py +15 -2
  127. package/ui/forge_ui/projects.py +4 -1
  128. package/ui/forge_ui/reader.py +462 -60
  129. package/ui/forge_ui/server.py +0 -10
  130. package/ui/forge_ui/static/app.js +28 -9
  131. package/ui/forge_ui/static/checksview.js +12 -3
  132. package/ui/forge_ui/static/controls.js +147 -11
  133. package/ui/forge_ui/static/convo.js +5 -2
  134. package/ui/forge_ui/static/diffview.js +4 -5
  135. package/ui/forge_ui/static/panel.js +180 -77
  136. package/ui/forge_ui/static/projectsview.js +16 -2
  137. package/ui/forge_ui/static/runmodel.js +18 -4
  138. package/ui/forge_ui/static/scene3d.js +52 -31
  139. package/ui/forge_ui/static/settings.js +1 -1
  140. package/ui/forge_ui/static/storageview.js +2 -2
  141. package/ui/forge_ui/static/style.css +23 -6
  142. package/ui/forge_ui/static/worktreesview.js +8 -4
  143. package/ui/forge_ui/transcripts.py +6 -0
  144. package/ui/forge_ui/worktrees.py +13 -1
  145. package/docs/fractal.md +0 -181
  146. package/references/fractal-dashboard.md +0 -21
  147. package/references/fractal.md +0 -307
  148. package/scripts/forge-fractal-dispatch.sh +0 -4
  149. package/scripts/forge-fractal-options.sh +0 -54
  150. package/scripts/forge-fractal.py +0 -6
  151. package/scripts/forge-install-fractal.sh +0 -4
  152. package/scripts/forge_fractal/__init__.py +0 -88
  153. package/scripts/forge_fractal/bridge.py +0 -46
  154. package/scripts/forge_fractal/cli.py +0 -224
  155. package/scripts/forge_fractal/dashboard.css +0 -138
  156. package/scripts/forge_fractal/dashboard.html +0 -41
  157. package/scripts/forge_fractal/dashboard.js +0 -687
  158. package/scripts/forge_fractal/decomposition.py +0 -262
  159. package/scripts/forge_fractal/execution.py +0 -659
  160. package/scripts/forge_fractal/inspection.py +0 -261
  161. package/scripts/forge_fractal/install.py +0 -158
  162. package/scripts/forge_fractal/invocation.py +0 -95
  163. package/scripts/forge_fractal/pipeline.py +0 -125
  164. package/scripts/forge_fractal/selection.py +0 -180
  165. package/ui/forge_ui/fractal.py +0 -582
@@ -1,52 +1,128 @@
1
1
  #!/usr/bin/env bash
2
- # Optional pinned upstream installer. No network activity before consent.
2
+ # Optional Ripwire install or update, from upstream's release installer. No network activity
3
+ # before consent.
4
+ #
5
+ # forge-install-ripwire.sh [--yes] [--dry-run] [--upgrade] [--version TAG]
6
+ #
7
+ # --yes do not ask (the caller already has the user's consent)
8
+ # --dry-run say what would happen; never downloads
9
+ # --upgrade replace ~/.local/bin/ripwire, the binary forge installs. A Ripwire installed
10
+ # anywhere else is reported and never replaced.
11
+ # --version TAG install this release (e.g. v0.6.10) instead of the latest one; also
12
+ # FORGE_RIPWIRE_VERSION.
13
+ #
14
+ # What is verified: the release tag is resolved through the GitHub releases API (Intel Macs stop
15
+ # at v0.6.1, the last release with a binary for them), and upstream's scripts/install.sh is
16
+ # fetched AT THAT TAG over HTTPS. That installer refuses a release without a checksum, checks the
17
+ # archive's SHA-256, runs the binary's --version before installing it and again after. What is
18
+ # not verified: the installer script's own bytes. A moving version cannot be pinned by hash, so
19
+ # forge only checks it is upstream's release installer before running it.
3
20
  set -uo pipefail
4
- YES=0; DRY=0
5
- for arg in "$@"; do
6
- case "$arg" in
21
+ YES=0; DRY=0; UPGRADE=0; TAG="${FORGE_RIPWIRE_VERSION:-}"
22
+ SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23
+ while [ $# -gt 0 ]; do
24
+ case "$1" in
7
25
  --yes) YES=1 ;;
8
26
  --dry-run) DRY=1 ;;
9
- *) echo "forge: unknown installation option: $arg" >&2; exit 2 ;;
27
+ --upgrade) UPGRADE=1 ;;
28
+ --version)
29
+ [ $# -ge 2 ] || { echo 'forge: --version needs a release tag, e.g. v0.6.10' >&2; exit 2; }
30
+ TAG="$2"; shift ;;
31
+ -h|--help) sed -n '2,13p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
32
+ *) echo "forge: unknown installation option: $1" >&2; exit 2 ;;
10
33
  esac
34
+ shift
11
35
  done
36
+ case "$TAG" in
37
+ ''|v[0-9]*.[0-9]*.[0-9]*) ;;
38
+ [0-9]*.[0-9]*.[0-9]*) TAG="v$TAG" ;;
39
+ *) echo "forge: --version must be a release tag such as v0.6.10, not '$TAG'" >&2; exit 2 ;;
40
+ esac
12
41
  [ "${FORGE_RIPWIRE:-}" != off ] || exit 0
13
- DEST="$HOME/.local/bin/ripwire"
14
- if command -v ripwire >/dev/null 2>&1 || [ -e "$DEST" ] || [ -L "$DEST" ]; then
15
- echo 'forge: preserving existing Ripwire installation' >&2
42
+ # `forge setup` answered "never offer it" (ripwire never): a run's offer stays silent. Asking for
43
+ # it by name (--yes, from forge ripwire install or update) still installs.
44
+ if [ "$YES" = 0 ] && [ "$UPGRADE" = 0 ] && [ "$DRY" = 0 ] \
45
+ && [ "$(python3 "$SCRIPTS/forge_prefs.py" get ripwire 2>/dev/null)" = never ]; then
16
46
  exit 0
17
47
  fi
18
- printf 'forge: Ripwire v0.4.0 -> %s\n' "$DEST" >&2
48
+ DEST="$HOME/.local/bin/ripwire"
49
+ FOUND="$(command -v ripwire 2>/dev/null || true)"
50
+ same_file() { [ -e "$1" ] && [ -e "$2" ] && [ "$(cd -P "$(dirname "$1")" && pwd)/$(basename "$1")" = "$(cd -P "$(dirname "$2")" && pwd)/$(basename "$2")" ]; }
51
+ have=''
52
+ if [ "$UPGRADE" = 0 ]; then
53
+ if [ -n "$FOUND" ] || [ -e "$DEST" ] || [ -L "$DEST" ]; then
54
+ echo 'forge: preserving existing Ripwire installation' >&2
55
+ exit 0
56
+ fi
57
+ else
58
+ if [ -n "$FOUND" ] && ! same_file "$FOUND" "$DEST"; then
59
+ # Never replace a binary forge did not install, and do not install a second one behind it.
60
+ echo "forge: Ripwire at $FOUND was not installed by forge; update it the way you installed it" >&2
61
+ exit 0
62
+ fi
63
+ if [ -L "$DEST" ]; then
64
+ echo "forge: $DEST is a symlink, so forge did not install it; not replacing it" >&2
65
+ exit 0
66
+ fi
67
+ [ -f "$DEST" ] && have="$("$DEST" --version 2>/dev/null | head -1)"
68
+ fi
69
+ if [ -n "$TAG" ]; then want="Ripwire $TAG"; else want='the latest Ripwire release'; fi
70
+ printf 'forge: %s -> %s\n' "$want" "$DEST" >&2
19
71
  [ "$DRY" = 0 ] || exit 0
20
72
  if [ "$YES" = 0 ]; then
73
+ if [ -n "$have" ]; then question="Update Ripwire ($have) to $want? [Y/n] "
74
+ else question='Ripwire is missing. Install it now? [Y/n] '; fi
21
75
  # Open the controlling terminal, never task stdin (which may be a pipe/FIFO).
22
76
  if { exec 3<> /dev/tty; } 2>/dev/null && [ -t 3 ]; then
23
- printf 'Ripwire is missing. Install it now? [Y/n] ' >&3
77
+ printf '%s' "$question" >&3
24
78
  reply=''
25
79
  if ! IFS= read -r reply <&3; then exec 3>&-; exit 0; fi
26
80
  exec 3>&-
27
81
  case "$reply" in ''|y|Y|yes|YES) ;; *) exit 0 ;; esac
28
82
  else
29
- printf 'forge: optional install: bash %q --yes\n' "${BASH_SOURCE[0]}" >&2
83
+ printf 'forge: optional install: bash %q --yes%s\n' "${BASH_SOURCE[0]}" "$([ "$UPGRADE" = 1 ] && printf ' --upgrade')" >&2
30
84
  exit 0
31
85
  fi
32
86
  fi
87
+ if [ -z "$TAG" ]; then
88
+ TAG="$(python3 "$SCRIPTS/forge-ripwire.py" --latest)" || { echo 'forge: Ripwire installation skipped; Forge can continue' >&2; exit 1; }
89
+ fi
90
+ if [ -n "$have" ] && [ "$(python3 -c 'import re,sys
91
+ v=lambda t: tuple(map(int, re.search(r"(\d+)\.(\d+)\.(\d+)", t).groups()))
92
+ print(int(v(sys.argv[1]) >= v(sys.argv[2])))' "$have" "$TAG" 2>/dev/null)" = 1 ]; then
93
+ echo "forge: Ripwire is already at ${have##* } (release $TAG); nothing to update" >&2
94
+ exit 0
95
+ fi
33
96
  work="$(mktemp -d "${TMPDIR:-/tmp}/forge-install-ripwire.XXXXXX")" || exit 1
34
97
  trap 'rm -rf "$work"' EXIT
35
98
  curl -fLSs --connect-timeout 10 --max-time 60 \
36
- https://raw.githubusercontent.com/redhat-et/ripwire/v0.4.0/scripts/install.sh \
99
+ "https://raw.githubusercontent.com/redhat-et/ripwire/$TAG/scripts/install.sh" \
37
100
  -o "$work/install.sh" || { echo 'forge: Ripwire installer download failed' >&2; exit 1; }
38
- # Pin the installer bytes as well as the release; never execute a changed tag.
39
- python3 - "$work/install.sh" <<'PYHASH'
40
- import hashlib, pathlib, sys
41
- expected = '7290f90775d333798ec9d7f1193c5950516dd0f1fea6ce5faea3923b1f60ff01'
42
- if hashlib.sha256(pathlib.Path(sys.argv[1]).read_bytes()).hexdigest() != expected:
43
- sys.exit('forge: Ripwire installer checksum mismatch')
44
- PYHASH
45
- [ "$?" = 0 ] || exit 1
46
- # The upstream installer verifies archive checksums and the binary version.
47
- RIPWIRE_REPO=redhat-et/ripwire RIPWIRE_VERSION=v0.4.0 \
101
+ # Not a hash pin (see the header): only that this is upstream's release installer.
102
+ if ! head -1 "$work/install.sh" | grep -q '^#!/usr/bin/env bash' \
103
+ || ! grep -q 'RIPWIRE_REPO' "$work/install.sh" || ! grep -q 'sha256' "$work/install.sh"; then
104
+ echo 'forge: the downloaded file is not the Ripwire release installer; nothing was run' >&2
105
+ exit 1
106
+ fi
107
+ # The upstream installer verifies archive checksums and the binary version, and replaces an
108
+ # existing binary by rename. Its skills and hooks are never activated.
109
+ RIPWIRE_REPO=redhat-et/ripwire RIPWIRE_VERSION="$TAG" \
48
110
  RIPWIRE_INSTALL_PREFIX="$HOME/.local" RIPWIRE_INSTALL_YES=1 RIPWIRE_NO_ACTIVATE=1 \
49
111
  /bin/bash "$work/install.sh"
50
112
  rc=$?
51
- [ "$rc" = 0 ] || echo "forge: Ripwire installation failed (exit $rc); Forge can continue" >&2
52
- exit "$rc"
113
+ if [ "$rc" != 0 ]; then
114
+ echo "forge: Ripwire installation failed (exit $rc); Forge can continue" >&2
115
+ exit "$rc"
116
+ fi
117
+ python3 - "$DEST" <<'PYCHECK'
118
+ import re, subprocess, sys
119
+ try:
120
+ out = subprocess.run([sys.argv[1], '--version'], capture_output=True, text=True, timeout=10).stdout
121
+ except (OSError, subprocess.SubprocessError):
122
+ out = ''
123
+ found = re.search(r'(\d+)\.(\d+)\.(\d+)', out)
124
+ if not found or tuple(map(int, found.groups())) < (0, 6, 0):
125
+ print('forge: the installed Ripwire (%s) is older than 0.6, so forge will not use it' % (out.strip() or '?'),
126
+ file=sys.stderr)
127
+ PYCHECK
128
+ exit 0
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # forge-install.sh — make /forge reachable from codex, claude, openclaude and opencode.
2
+ # forge-install.sh — make /forge reachable from codex, claude, openclaude, opencode, antigravity and grok.
3
3
  #
4
4
  # This skill directory stays the single source of truth.
5
5
  #
@@ -13,7 +13,9 @@
13
13
  # forge-install.sh [--dry-run]
14
14
  set -uo pipefail
15
15
 
16
- SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
16
+ SKILL_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
17
+ source "$SKILL_DIR/scripts/forge-lib-env.sh"
18
+ forge_ensure_python3
17
19
  RESULT=0
18
20
  DRY=0
19
21
  # `forge install --help` must never install; nor may a mistyped --dry-run.
@@ -28,16 +30,33 @@ say() { printf '%s\n' "$*"; }
28
30
  do_() { if [ "$DRY" = 1 ]; then say " would: $*"; else "$@"; fi; }
29
31
 
30
32
  link_dir() { # link_dir <target-parent> <label>
31
- local parent="$1" label="$2" dest="$1/forge"
33
+ local parent="$1" label="$2" dest="$1/forge" target=""
32
34
  if [ ! -d "$parent" ]; then say "$label: skipped ($parent does not exist)"; return; fi
33
35
  if [ "$dest" = "$SKILL_DIR" ]; then say "$label: is the source directory"; return; fi
34
- if [ -L "$dest" ] && [ "$(readlink "$dest")" = "$SKILL_DIR" ]; then
35
- say "$label: already linked"; return
36
+ if [ -L "$dest" ]; then
37
+ # Canonicalize physically so /tmp mounts, 8.3 short names, and relative symlinks match SKILL_DIR.
38
+ target="$(cd -P -- "$dest" 2>/dev/null && pwd -P || true)"
39
+ if [ -n "$target" ] && [ "$target" = "$SKILL_DIR" ]; then
40
+ say "$label: already linked"; return
41
+ fi
36
42
  fi
37
43
  if [ -e "$dest" ] && [ ! -L "$dest" ]; then
38
44
  # Never clobber a real directory the user may have edited in place.
39
45
  say "$label: SKIPPED — $dest exists and is not a symlink; move it aside first"; return 1
40
46
  fi
47
+ if forge_is_windows; then
48
+ if [ "$DRY" = 1 ]; then
49
+ say " would: mklink /J $(forge_win_path "$dest") $(forge_win_path "$SKILL_DIR")"
50
+ say "$label: linked -> $dest"
51
+ return 0
52
+ fi
53
+ if forge_link_dir "$SKILL_DIR" "$dest"; then
54
+ say "$label: linked (junction) -> $dest"
55
+ else
56
+ cp -R "$SKILL_DIR" "$dest" && say "$label: copied -> $dest (re-run forge install after editing)"
57
+ fi
58
+ return $?
59
+ fi
41
60
  do_ ln -sfn "$SKILL_DIR" "$dest" && say "$label: linked -> $dest"
42
61
  }
43
62
 
@@ -51,6 +70,35 @@ report_opencode() {
51
70
  say "opencode : auto-detected from ~/.claude/skills (no install needed)"
52
71
  }
53
72
 
73
+ copy_skill_dir() { # copy_skill_dir <target-parent> <label> — real directory copy for scanners that ignore junctions
74
+ local parent="$1" label="$2" dest="$1/forge" item stage
75
+ if [ ! -d "$parent" ]; then say "$label: skipped ($parent does not exist)"; return; fi
76
+ if [ "$dest" = "$SKILL_DIR" ]; then say "$label: is the source directory"; return; fi
77
+ if [ "$DRY" = 1 ]; then
78
+ say " would: copy skill files to $dest"
79
+ say "$label: copied -> $dest (re-run forge install after editing)"
80
+ return 0
81
+ fi
82
+ if [ -L "$dest" ]; then
83
+ rmdir "$dest" 2>/dev/null || rm -f "$dest" 2>/dev/null || rm -rf "$dest"
84
+ elif [ -e "$dest" ] && [ ! -f "$dest/.forge-installed" ]; then
85
+ say "$label: SKIPPED — $dest exists and is not managed by forge; move it aside first"; return 1
86
+ fi
87
+ stage="$dest.tmp.$$"
88
+ rm -rf "$stage"
89
+ mkdir -p "$stage" || return 1
90
+ for item in SKILL.md VERSION LICENSE package.json forge forge.cmd bin scripts references ui; do
91
+ if [ -e "$SKILL_DIR/$item" ]; then
92
+ cp -R "$SKILL_DIR/$item" "$stage/$item" || { rm -rf "$stage"; return 1; }
93
+ fi
94
+ done
95
+ find "$stage" -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
96
+ : > "$stage/.forge-installed"
97
+ rm -rf "$dest"
98
+ mv "$stage" "$dest" || { rm -rf "$stage"; return 1; }
99
+ say "$label: copied -> $dest (re-run forge install after editing)"
100
+ }
101
+
54
102
  # Antigravity loads skills only as part of a plugin — a loose directory under
55
103
  # ~/.gemini/skills is ignored (agy cannot see skills placed there at all). So forge
56
104
  # is wrapped in a minimal plugin whose skills/ entry points back at this directory.
@@ -60,32 +108,61 @@ report_opencode() {
60
108
  # not track edits to this directory automatically: re-run this installer after
61
109
  # changing the skill, or agy keeps running the version it copied.
62
110
  install_antigravity() {
63
- local label="antigravity" wrapper="$HOME/.gemini/forge-plugin"
64
- if ! command -v agy >/dev/null 2>&1; then
111
+ local label="antigravity" gemini_home="$HOME/.gemini" wrapper agy_skills has_agy=0 rc=0
112
+ if forge_is_windows && [ ! -d "$gemini_home" ] && [ -n "${USERPROFILE:-}" ]; then
113
+ gemini_home="$(forge_posix_path "$USERPROFILE")/.gemini"
114
+ fi
115
+ wrapper="$gemini_home/forge-plugin"
116
+ agy_skills="$gemini_home/config/skills"
117
+ if command -v agy >/dev/null 2>&1; then
118
+ has_agy=1
119
+ fi
120
+ if forge_is_windows && [ -d "$agy_skills" ]; then
121
+ # Windows only. Electron/Node scanners check dirent.isDirectory(), which is false for Windows
122
+ # junctions, and Antigravity loads skills directly from ~/.gemini/config/skills without
123
+ # `agy plugin install` (which hits Access is denied on Windows while Antigravity.exe watches
124
+ # ~/.gemini/config/plugins). macOS and Linux keep the plugin below.
125
+ copy_skill_dir "$agy_skills" "antigravity" || rc=1
126
+ return "$rc"
127
+ fi
128
+ if [ "$has_agy" = 0 ]; then
65
129
  say "$label: skipped (agy not on PATH)"; return
66
130
  fi
67
131
  if [ "$DRY" = 1 ]; then
68
132
  say " would: write plugin wrapper $wrapper"
69
133
  say " would: agy plugin install $wrapper"
70
- say "$label: plugin -> $wrapper"; return
134
+ say "$label: plugin -> $wrapper"; return "$rc"
71
135
  fi
72
136
  mkdir -p "$wrapper/skills" || return 1
137
+ # The plugin's version is forge's own (VERSION), not a fixed placeholder.
138
+ local version=""
139
+ read -r version < "$SKILL_DIR/VERSION" 2>/dev/null || true
140
+ [ -n "$version" ] || version="0"
73
141
  cat > "$wrapper/plugin.json" <<EOF
74
142
  {
75
143
  "name": "forge",
76
- "description": "Dispatch a coding task to a dwarf model to implement, then an independent qa model to review its actual diff, across codex/claude/openclaude/opencode/antigravity.",
77
- "version": "1.0.0",
144
+ "description": "Dispatch a coding task to a dwarf model to implement, then an independent qa model to review its actual diff, across codex/claude/openclaude/opencode/antigravity/grok.",
145
+ "version": "$version",
78
146
  "author": { "name": "forge" }
79
147
  }
80
148
  EOF
81
149
  [ "$?" = 0 ] || return 1
82
- ln -sfn "$SKILL_DIR" "$wrapper/skills/forge" || return 1
83
- if agy plugin install "$wrapper"; then
150
+ local agy_wrapper
151
+ if forge_is_windows; then
152
+ # `agy plugin install` on Windows rejects junctions/symlinks inside the plugin bundle.
153
+ copy_skill_dir "$wrapper/skills" "antigravity" >/dev/null || return 1
154
+ agy_wrapper="$(forge_win_path "$wrapper")"
155
+ else
156
+ forge_link_dir "$SKILL_DIR" "$wrapper/skills/forge" || return 1
157
+ agy_wrapper="$wrapper"
158
+ fi
159
+ if agy plugin install "$agy_wrapper"; then
84
160
  say "$label: plugin installed (copied — re-run this script after editing the skill)"
85
161
  else
86
162
  say "$label: FAILED — try: agy plugin install $wrapper"
87
163
  return 1
88
164
  fi
165
+ return "$rc"
89
166
  }
90
167
 
91
168
  say "forge source: $SKILL_DIR"
@@ -100,36 +177,18 @@ report_opencode
100
177
  say
101
178
  say "Verify with: bash $SKILL_DIR/scripts/forge-dispatch.sh doctor"
102
179
 
103
- # Optional context engine; failure never prevents Forge setup.
104
- if [ "$DRY" = 1 ]; then
105
- /bin/bash "$SKILL_DIR/scripts/forge-install-ripwire.sh" --dry-run
106
- else
107
- /bin/bash "$SKILL_DIR/scripts/forge-install-ripwire.sh" || true
108
- fi
109
-
110
- # Optional runtime; installing never activates it for a run.
180
+ # What a first run needs (models, reviews, forge-ui, memory, Ripwire, decision models),
181
+ # asked once on a terminal and saved as defaults (#162). `forge update` re-runs this installer with
182
+ # FORGE_SETUP=off: an update never asks again. Setup failing never fails the install.
111
183
  if [ "$DRY" = 1 ]; then
112
- /bin/bash "$SKILL_DIR/scripts/forge-install-fractal.sh" --dry-run
113
- elif [ -t 0 ]; then
114
- printf 'Install optional Fractal execution support? [y/N] '
115
- read -r fractal_answer
116
- if [ "$fractal_answer" = y ] || [ "$fractal_answer" = Y ]; then
117
- /bin/bash "$SKILL_DIR/scripts/forge-install-fractal.sh" --with-prerequisites || true
118
- fi
119
- fi
120
- say "Fractal CLI: $SKILL_DIR/forge fractal --help (repository-local; existing forge commands are preserved)"
121
-
122
- # Optional advisory judgments; sends task/diff/test/memory excerpts to an external
123
- # API. Off unless configured and enabled. Failure never prevents Forge setup.
124
- if [ "$DRY" = 1 ]; then
125
- say " would: offer optional Jev setup (sends data to an external API; declined by default)"
126
- elif [ -t 0 ]; then
127
- printf 'Set up optional Jev advisory judgments? Sends task/diff excerpts to an external API. [y/N] '
128
- read -r jev_answer
129
- if [ "$jev_answer" = y ] || [ "$jev_answer" = Y ]; then
130
- python3 "$SKILL_DIR/scripts/forge-jev.py" setup || true
131
- fi
184
+ say " would: run forge setup on a terminal (models, reviews, forge-ui, memory, Ripwire; skipped once done)"
185
+ elif [ "${FORGE_SETUP:-}" = off ]; then
186
+ :
187
+ elif [ -t 0 ] && [ -t 1 ]; then
188
+ say
189
+ python3 "$SKILL_DIR/scripts/forge-setup.py" --after-install || true
190
+ elif ! python3 "$SKILL_DIR/scripts/forge_prefs.py" done 2>/dev/null; then
191
+ say "Next: forge setup (models, reviews and add-ons, asked once), or forge setup --defaults"
132
192
  fi
133
- say "Jev CLI: $SKILL_DIR/forge jev --help (optional; disabled until configured)"
134
193
 
135
194
  exit "$RESULT"
@@ -25,8 +25,9 @@ A finding a run's finding sweep (`run --sweep`) fixed stays listed, with `swept`
25
25
  otherwise), and is never drafted: the sweep task that merged and whose reviewer marked it FIXED is its record.
26
26
  One the sweep did not fix is drafted as before.
27
27
 
28
- --json lists every finding in `findings` (fp, severity, origin, plan, task, text, `filed`, `review`, `swept`, ...). --offline never
29
- runs `gh` (no filed state, publication of commits judged from local refs only). --only FP[,FP] keeps those
28
+ --json lists every finding in `findings` (fp, severity, origin, plan, task, text, `filed`, `review`, `swept`, ...), and
29
+ `online`: true when GitHub was asked for the filed state. --offline never runs `gh` (no filed state, publication of
30
+ commits judged from local refs only), and neither does a repository with no GitHub name; both list with `online` false. --only FP[,FP] keeps those
30
31
  fingerprints. --all-runs reads <run> as a repository (or a plan dir naming one) and collects every run of that
31
32
  repository, whichever checkout started it (the main working tree, a linked worktree, one that is removed), the newest
32
33
  plan winning for a finding present in several. --to-file keeps only the findings whose record status is `to-file`. A caller filing an explicit selection
@@ -75,7 +76,6 @@ from __future__ import annotations
75
76
 
76
77
  import argparse
77
78
  import contextlib
78
- import errno
79
79
  import hashlib
80
80
  import importlib.util
81
81
  import json
@@ -1516,7 +1516,9 @@ def list_and_file(args, meta, found, notes, repo_path, slug, warnings, ident):
1516
1516
  if any(f["fp"] in gates for f in items):
1517
1517
  drafts[-1]["gate"] = draft_gate([gates[f["fp"]] for f in items if f["fp"] in gates])
1518
1518
  drafts.sort(key=lambda d: SEVERITIES.index(d["severity"]))
1519
- out = {"repo": slug, "plan": meta["plan"], "notes": notes, "warnings": warnings,
1519
+ # `online`: GitHub was asked which issues exist. False under --offline and when the repository has no GitHub
1520
+ # name, where a listing without --offline still asks nothing (forge-ui says so instead of "read from GitHub").
1521
+ out = {"repo": slug, "online": not offline, "plan": meta["plan"], "notes": notes, "warnings": warnings,
1520
1522
  "summary": {"findings": len(seen), "already_filed": len(already),
1521
1523
  "dismissed": sum(1 for e in entries if e["dismissed"]),
1522
1524
  **{name: sum(1 for e in entries if e["status"] == status)
@@ -293,9 +293,8 @@ print(json.dumps(dict(gates=gates, no_gates=no_gates == "1", budget=budget), sor
293
293
 
294
294
  # forge_jev_record <run-dir> — freeze the resolved selection into
295
295
  # <run-dir>/jev-selection.json. A resumed or retried run must make the same
296
- # decisions as the original run, the same reason fractal-selection.json is
297
- # frozen for Fractal: settings must not silently drift between the first
298
- # attempt and a later resume/retry of the same run directory.
296
+ # decisions as the original run: settings must not silently drift between the
297
+ # first attempt and a later resume/retry of the same run directory.
299
298
  forge_jev_record() {
300
299
  local run="$1" caps_json="{}" entry cap val first=1
301
300
  for entry in ${JEV_CAPS[@]+"${JEV_CAPS[@]}"}; do
@@ -395,8 +394,7 @@ EOF
395
394
  # forge_jev_settle <plan-dir> — what `run` and `retry` do about Jev.
396
395
  #
397
396
  # `plan` is the command that makes the choice and freezes it. A later run or retry of
398
- # the same plan must make the same decisions, for the reason fractal-selection.json is
399
- # frozen: a resumed run that quietly changed its mind about whether a judgment may act
397
+ # the same plan must make the same decisions: a resumed run that quietly changed its mind about whether a judgment may act
400
398
  # is a run nobody can reason about afterwards.
401
399
  #
402
400
  # So a frozen selection wins over a flag passed here, and saying so out loud beats