@soleur/opencode 3.401.1 → 3.402.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/agents/engineering/review/observability-coverage-reviewer.md +1 -1
- package/package.json +1 -1
- package/scripts/affected-tests.sh +6 -6
- package/scripts/affected-tests.test.sh +35 -1
- package/scripts/spec-kit-intake.sh +457 -0
- package/skills/brainstorm/SKILL.md +5 -2
- package/skills/constraint-scaffold/references/fix-constraints-stage-a.emitted.sha256 +1 -0
- package/skills/constraint-scaffold/references/fix-constraints-stage-a.template +1 -1
- package/skills/frontend-anti-slop/scripts/tier1-scan.ts +39 -19
- package/skills/one-shot/SKILL.md +1 -1
- package/skills/plan/SKILL.md +1 -7
- package/skills/plan/references/spec-kit-intake.md +13 -0
- package/skills/review/references/risk-tier-and-fix-rounds.md +7 -4
- package/skills/ship/SKILL.md +21 -29
- package/skills/ship/references/adr-ordinal-collision.md +8 -1
- package/skills/ship/references/counsel-review-clo-attestation.md +4 -2
- package/skills/ship/references/settle-then-admin-merge.md +4 -4
- package/skills/ship/scripts/pr-overlap-preflight.sh +4 -4
|
@@ -26,7 +26,7 @@ You verify that every new surface is debuggable from a keyboard without SSH or `
|
|
|
26
26
|
|
|
27
27
|
### Step 1: Diff inventory
|
|
28
28
|
|
|
29
|
-
Run `
|
|
29
|
+
Run `bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD` and partition its list into (exit 2/127 = inventory unknown: treat every category below as in scope, never as an empty diff):
|
|
30
30
|
|
|
31
31
|
- **Inngest functions**: any file under `apps/web-platform/server/inngest/functions/cron-*.ts` or `*-on-*.ts`
|
|
32
32
|
- **Server routes / handlers**: `app/api/**/route.ts`, `server/**/*.ts`
|
package/package.json
CHANGED
|
@@ -672,8 +672,8 @@ affected_resolve_base || {
|
|
|
672
672
|
fi
|
|
673
673
|
}
|
|
674
674
|
|
|
675
|
-
# Changed set: committed-vs-base ∪ staged ∪ unstaged ∪ untracked. Rename-
|
|
676
|
-
# (-
|
|
675
|
+
# Changed set: committed-vs-base ∪ staged ∪ unstaged ∪ untracked. Rename-free
|
|
676
|
+
# (--no-renames: a rename lists its OLD path too, so a code file moved under docs is not inert; --ignore-submodules=none lists a gitlink hidden by ignore=all). The committed arm is the one that
|
|
677
677
|
# can fail outright (unresolvable base) — it is captured ONCE: its rc is the
|
|
678
678
|
# fail-closed probe and its stdout the first leg of the union, so a bad --base
|
|
679
679
|
# refuses rather than reading as an empty diff and no diff runs twice.
|
|
@@ -682,12 +682,12 @@ affected_mktemp changed || finish 4 none mktemp-failed - "$CI_NAME" - - -; CHANG
|
|
|
682
682
|
_base_rc=0
|
|
683
683
|
# -c core.quotePath=false: without it git emits non-ASCII paths C-quoted
|
|
684
684
|
# ("dir/\303\251.txt"), which never matches a glob and misses the file system.
|
|
685
|
-
_base_diff="$(git -c core.quotePath=false diff --name-only -
|
|
685
|
+
_base_diff="$(git -c core.quotePath=false diff --name-only --no-renames --ignore-submodules=none "${BASE}...HEAD" -- 2>/dev/null)" || _base_rc=$?
|
|
686
686
|
if (( _base_rc != 0 )); then
|
|
687
687
|
if [[ "$(git rev-parse --is-shallow-repository 2>/dev/null || true)" == "true" ]]; then
|
|
688
688
|
affected_timeout 60 git fetch --no-tags --deepen=200 >/dev/null 2>&1 || true
|
|
689
689
|
_base_rc=0
|
|
690
|
-
_base_diff="$(git -c core.quotePath=false diff --name-only -
|
|
690
|
+
_base_diff="$(git -c core.quotePath=false diff --name-only --no-renames --ignore-submodules=none "${BASE}...HEAD" -- 2>/dev/null)" || _base_rc=$?
|
|
691
691
|
fi
|
|
692
692
|
if (( _base_rc != 0 )); then
|
|
693
693
|
finish 4 none no-base-ref - "$CI_NAME" - - -
|
|
@@ -700,9 +700,9 @@ fi
|
|
|
700
700
|
# (reason=census-degraded), the same contract as an empty diff — never a silent
|
|
701
701
|
# narrow, never a refusal for a recoverable shape.
|
|
702
702
|
_census_rc=0
|
|
703
|
-
_leg_staged="$(git -c core.quotePath=false diff --name-only --cached -
|
|
703
|
+
_leg_staged="$(git -c core.quotePath=false diff --name-only --cached --no-renames --ignore-submodules=none -- 2>/dev/null)" \
|
|
704
704
|
|| _census_rc=$?
|
|
705
|
-
_leg_unstaged="$(git -c core.quotePath=false diff --name-only -
|
|
705
|
+
_leg_unstaged="$(git -c core.quotePath=false diff --name-only --no-renames --ignore-submodules=none -- 2>/dev/null)" \
|
|
706
706
|
|| _census_rc=$?
|
|
707
707
|
_leg_untracked="$(git -c core.quotePath=false ls-files --others --exclude-standard 2>/dev/null)" \
|
|
708
708
|
|| _census_rc=$?
|
|
@@ -1164,6 +1164,40 @@ want_rc 0 "D2: mixed diff exits 0 via real selection"
|
|
|
1164
1164
|
want_no_out "D2: mixed diff is never inert" 'NO_TESTS_AFFECTED'
|
|
1165
1165
|
want_call "D2: the code file was selected" 'related.*util\.ts'
|
|
1166
1166
|
|
|
1167
|
+
# D2r [rename-away]: `git mv src/a.ts docs/a.md` under default rename detection lists
|
|
1168
|
+
# only the destination (inert docs) and exits NO_TESTS_AFFECTED although a code file
|
|
1169
|
+
# left the tree; --no-renames lists the OLD path too, so the diff is no longer inert.
|
|
1170
|
+
R_RENC="$(mk_repo rename-away-committed)"; seed_js "$R_RENC"; seal_base "$R_RENC"
|
|
1171
|
+
mkdir -p "$R_RENC/docs"
|
|
1172
|
+
assert_fixture_dir "$R_RENC"; git -C "$R_RENC" mv src/a.ts docs/a.md
|
|
1173
|
+
git -C "$R_RENC" commit -q -m "move code under docs"
|
|
1174
|
+
reset_fakes; run_gate "$R_RENC" gate
|
|
1175
|
+
want_no_out "D2r: a committed code->docs rename is never inert" 'NO_TESTS_AFFECTED'
|
|
1176
|
+
R_RENS="$(mk_repo rename-away-staged)"; seed_js "$R_RENS"; seal_base "$R_RENS"
|
|
1177
|
+
mkdir -p "$R_RENS/docs"
|
|
1178
|
+
assert_fixture_dir "$R_RENS"; git -C "$R_RENS" mv src/a.ts docs/a.md
|
|
1179
|
+
reset_fakes; run_gate "$R_RENS" gate
|
|
1180
|
+
want_no_out "D2r: a staged code->docs rename is never inert" 'NO_TESTS_AFFECTED'
|
|
1181
|
+
|
|
1182
|
+
# D2g [hidden gitlink]: under a .gitmodules `ignore = all` a plain diff omits a gitlink
|
|
1183
|
+
# change, so README.md + a bumped submodule pointer read as docs-only and exit
|
|
1184
|
+
# NO_TESTS_AFFECTED. --ignore-submodules=none lists the gitlink, so the diff is not inert.
|
|
1185
|
+
R_GL="$(mk_repo gitlink-hidden)"; seed_js "$R_GL"; seal_base "$R_GL"
|
|
1186
|
+
assert_fixture_dir "$R_GL"
|
|
1187
|
+
printf '[submodule "sub"]\n\tpath = sub\n\turl = ./nowhere\n\tignore = all\n' > "$R_GL/.gitmodules"
|
|
1188
|
+
printf 'readme\n' > "$R_GL/README.md"
|
|
1189
|
+
git -C "$R_GL" add .gitmodules README.md
|
|
1190
|
+
git -C "$R_GL" update-index --add --cacheinfo 160000,1111111111111111111111111111111111111111,sub
|
|
1191
|
+
git -C "$R_GL" commit -q -m "gitlink base"
|
|
1192
|
+
git -C "$R_GL" update-ref refs/remotes/origin/main HEAD
|
|
1193
|
+
mkdir -p "$R_GL/sub"
|
|
1194
|
+
printf 'readme two\n' > "$R_GL/README.md"
|
|
1195
|
+
git -C "$R_GL" add README.md
|
|
1196
|
+
git -C "$R_GL" update-index --cacheinfo 160000,2222222222222222222222222222222222222222,sub
|
|
1197
|
+
git -C "$R_GL" commit -q -m "bump sub and readme"
|
|
1198
|
+
reset_fakes; run_gate "$R_GL" gate
|
|
1199
|
+
want_no_out "D2g: README.md plus a hidden gitlink bump is never inert" 'NO_TESTS_AFFECTED'
|
|
1200
|
+
|
|
1167
1201
|
# D3 [G1-1]: the native selector returns nothing for a code diff → full fallback,
|
|
1168
1202
|
# never a zero-test green. rc 0 is acceptable ONLY with mode=full and a named
|
|
1169
1203
|
# reason; rc 4 is an acceptable loud refusal.
|
|
@@ -2478,6 +2512,6 @@ unset _kind _rc _of _xfail _badword
|
|
|
2478
2512
|
|
|
2479
2513
|
# Floor = the full count less a little slack for the rows that
|
|
2480
2514
|
# depend on a host binary (jq): it is a floor, so a deleted block of rows reddens it.
|
|
2481
|
-
print_results "${AFFECTED_TESTS_MIN_ASSERTIONS:-
|
|
2515
|
+
print_results "${AFFECTED_TESTS_MIN_ASSERTIONS:-499}"
|
|
2482
2516
|
|
|
2483
2517
|
|
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Read-only intake of a specs/<prefix>-<short-name>/ directory. Writes nothing.
|
|
3
|
+
exec python3 - "$@" <<'PY'
|
|
4
|
+
import errno
|
|
5
|
+
import hashlib
|
|
6
|
+
import os
|
|
7
|
+
import re
|
|
8
|
+
import stat
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
CAP = 1048576
|
|
12
|
+
DIR_FLAGS = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_NONBLOCK
|
|
13
|
+
FILE_FLAGS = os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK
|
|
14
|
+
CLOSED_NEVER = ("research.md", "data-model.md", "contracts", "quickstart.md")
|
|
15
|
+
MARKERS = ("--- side-evidence ---", "--- projected ---")
|
|
16
|
+
READ_NAMES = ("spec.md", "plan.md", "tasks.md")
|
|
17
|
+
LEAF_TS = re.compile(r"[0-9]{8}-[0-9]{6}-[A-Za-z0-9][A-Za-z0-9_-]*\Z")
|
|
18
|
+
LEAF_NUM = re.compile(r"[0-9]{3}-[A-Za-z0-9][A-Za-z0-9_-]*\Z")
|
|
19
|
+
ATX = re.compile(r"^#{1,6}[ \t]+(.+?)[ \t]*\Z")
|
|
20
|
+
USER_STORY = re.compile(r"(?<![A-Za-z0-9])user\s+story(?![A-Za-z0-9])", re.IGNORECASE)
|
|
21
|
+
PRIORITY = re.compile(r"\bP[123]\b")
|
|
22
|
+
FENCE = re.compile(r"^( {0,3})(`{3,}|~{3,})(.*)\Z")
|
|
23
|
+
LABEL_LINE = re.compile(r"(?:moved|unmapped|never-read):")
|
|
24
|
+
DIGEST_LINE = re.compile(
|
|
25
|
+
r"(?:spec|plan|tasks)\.md (?:absent|[0-9]+ [0-9a-f]{64}(?: not-requirements)?)\Z"
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def refuse(reason):
|
|
30
|
+
sys.stdout.write("intake: %s\n" % reason)
|
|
31
|
+
raise SystemExit(1)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def valid_leaf(name):
|
|
35
|
+
return LEAF_TS.fullmatch(name) is not None or LEAF_NUM.fullmatch(name) is not None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def resolve(cwd, dire):
|
|
39
|
+
if dire.startswith("/"):
|
|
40
|
+
return dire
|
|
41
|
+
if not cwd:
|
|
42
|
+
refuse("not-a-directory")
|
|
43
|
+
if cwd.endswith("/"):
|
|
44
|
+
return cwd + dire
|
|
45
|
+
return cwd + "/" + dire
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def parts_of(path):
|
|
49
|
+
if not path.startswith("/"):
|
|
50
|
+
refuse("not-a-directory")
|
|
51
|
+
parts = [p for p in path.split("/") if p and p != "."]
|
|
52
|
+
if any(p == ".." for p in parts):
|
|
53
|
+
refuse("not-a-directory")
|
|
54
|
+
if len(parts) < 2 or parts[-2] != "specs" or not valid_leaf(parts[-1]):
|
|
55
|
+
refuse("not-a-directory")
|
|
56
|
+
return parts
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def open_dir_component(parent, name):
|
|
60
|
+
"""O_DIRECTORY plus O_NOFOLLOW reports a symlink as ENOTDIR.
|
|
61
|
+
|
|
62
|
+
A second open without O_DIRECTORY still sets O_NOFOLLOW, so a symlink
|
|
63
|
+
returns ELOOP and is not followed. A non-directory is not-a-directory.
|
|
64
|
+
"""
|
|
65
|
+
try:
|
|
66
|
+
return os.open(name, DIR_FLAGS, dir_fd=parent)
|
|
67
|
+
except OSError as err:
|
|
68
|
+
if err.errno == errno.ELOOP:
|
|
69
|
+
refuse("symlink-escape")
|
|
70
|
+
if err.errno != errno.ENOTDIR:
|
|
71
|
+
refuse("not-a-directory")
|
|
72
|
+
try:
|
|
73
|
+
probed = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=parent)
|
|
74
|
+
except OSError as err:
|
|
75
|
+
if err.errno == errno.ELOOP:
|
|
76
|
+
refuse("symlink-escape")
|
|
77
|
+
refuse("not-a-directory")
|
|
78
|
+
os.close(probed)
|
|
79
|
+
refuse("not-a-directory")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def walk(parts):
|
|
83
|
+
try:
|
|
84
|
+
fd = os.open("/", DIR_FLAGS)
|
|
85
|
+
except OSError:
|
|
86
|
+
refuse("not-a-directory")
|
|
87
|
+
try:
|
|
88
|
+
for name in parts:
|
|
89
|
+
nxt = open_dir_component(fd, name)
|
|
90
|
+
os.close(fd)
|
|
91
|
+
fd = nxt
|
|
92
|
+
owned = fd
|
|
93
|
+
fd = -1
|
|
94
|
+
return owned
|
|
95
|
+
finally:
|
|
96
|
+
if fd >= 0:
|
|
97
|
+
os.close(fd)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def hostile(name):
|
|
101
|
+
if name in MARKERS:
|
|
102
|
+
return True
|
|
103
|
+
for ch in name:
|
|
104
|
+
code = ord(ch)
|
|
105
|
+
if code < 32 and code != 9:
|
|
106
|
+
return True
|
|
107
|
+
if code in (127, 0x85, 0x2028, 0x2029):
|
|
108
|
+
return True
|
|
109
|
+
return False
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def load_file(dir_fd, name):
|
|
113
|
+
try:
|
|
114
|
+
fd = os.open(name, FILE_FLAGS, dir_fd=dir_fd)
|
|
115
|
+
except OSError as err:
|
|
116
|
+
if err.errno == errno.ENOENT:
|
|
117
|
+
return "absent", None
|
|
118
|
+
if err.errno == errno.ELOOP:
|
|
119
|
+
return "symlink-escape", None
|
|
120
|
+
return "unreadable", None
|
|
121
|
+
try:
|
|
122
|
+
st = os.fstat(fd)
|
|
123
|
+
if stat.S_ISLNK(st.st_mode):
|
|
124
|
+
return "symlink-escape", None
|
|
125
|
+
if not stat.S_ISREG(st.st_mode):
|
|
126
|
+
return "not-a-regular-file", None
|
|
127
|
+
if st.st_size > CAP:
|
|
128
|
+
return "over-cap", None
|
|
129
|
+
size = st.st_size
|
|
130
|
+
data = b""
|
|
131
|
+
while len(data) < size:
|
|
132
|
+
chunk = os.read(fd, size - len(data))
|
|
133
|
+
if not chunk:
|
|
134
|
+
break
|
|
135
|
+
data += chunk
|
|
136
|
+
st2 = os.fstat(fd)
|
|
137
|
+
if st2.st_size != size or len(data) != size:
|
|
138
|
+
return "over-cap", None
|
|
139
|
+
return "ok", data
|
|
140
|
+
finally:
|
|
141
|
+
os.close(fd)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def strip_once(data):
|
|
145
|
+
out = bytearray()
|
|
146
|
+
i = 0
|
|
147
|
+
n = len(data)
|
|
148
|
+
while i < n:
|
|
149
|
+
b = data[i]
|
|
150
|
+
if b == 0xC2 and i + 1 < n and data[i + 1] == 0x85:
|
|
151
|
+
i += 2
|
|
152
|
+
continue
|
|
153
|
+
if b == 0xE2 and i + 2 < n and data[i + 1] == 0x80 and data[i + 2] in (0xA8, 0xA9):
|
|
154
|
+
i += 3
|
|
155
|
+
continue
|
|
156
|
+
if b < 32 and b not in (9, 10):
|
|
157
|
+
i += 1
|
|
158
|
+
continue
|
|
159
|
+
if b == 127:
|
|
160
|
+
i += 1
|
|
161
|
+
continue
|
|
162
|
+
out.append(b)
|
|
163
|
+
i += 1
|
|
164
|
+
return bytes(out)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def strip_controls(data):
|
|
168
|
+
cur = data
|
|
169
|
+
for _ in range(len(data) + 1):
|
|
170
|
+
nxt = strip_once(cur)
|
|
171
|
+
if nxt == cur:
|
|
172
|
+
break
|
|
173
|
+
if len(nxt) >= len(cur):
|
|
174
|
+
refuse("unreadable")
|
|
175
|
+
cur = nxt
|
|
176
|
+
else:
|
|
177
|
+
refuse("unreadable")
|
|
178
|
+
try:
|
|
179
|
+
text = cur.decode("utf-8")
|
|
180
|
+
except UnicodeDecodeError:
|
|
181
|
+
refuse("unreadable")
|
|
182
|
+
return text.translate({0x85: None, 0x2028: None, 0x2029: None})
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def heading_text(raw):
|
|
186
|
+
return re.sub(r"[ \t]+#+\Z", "", raw)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def fence_marks(line):
|
|
190
|
+
match = FENCE.match(line)
|
|
191
|
+
if match is None:
|
|
192
|
+
return None
|
|
193
|
+
marks = match.group(2)
|
|
194
|
+
rest = match.group(3)
|
|
195
|
+
if marks[0] == "`" and "`" in rest:
|
|
196
|
+
return None
|
|
197
|
+
return marks[0], len(marks), rest
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def fence_closer(line, char, length):
|
|
201
|
+
found = fence_marks(line)
|
|
202
|
+
if found is None:
|
|
203
|
+
return False
|
|
204
|
+
mark, size, rest = found
|
|
205
|
+
return mark == char and size >= length and rest.strip(" \t") == ""
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def is_delim(line):
|
|
209
|
+
return line.startswith("---") and line[3:].strip(" \t") == ""
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def parse_sections(text):
|
|
213
|
+
if text.startswith("\ufeff"):
|
|
214
|
+
text = text[1:]
|
|
215
|
+
lines = text.split("\n")
|
|
216
|
+
opener = None
|
|
217
|
+
closer = None
|
|
218
|
+
fence = None
|
|
219
|
+
for idx, line in enumerate(lines):
|
|
220
|
+
if fence is not None:
|
|
221
|
+
if fence_closer(line, fence[0], fence[1]):
|
|
222
|
+
fence = None
|
|
223
|
+
continue
|
|
224
|
+
opened = fence_marks(line)
|
|
225
|
+
if opened is not None:
|
|
226
|
+
fence = (opened[0], opened[1])
|
|
227
|
+
continue
|
|
228
|
+
if not is_delim(line):
|
|
229
|
+
continue
|
|
230
|
+
if opener is None:
|
|
231
|
+
opener = idx
|
|
232
|
+
continue
|
|
233
|
+
closer = idx
|
|
234
|
+
break
|
|
235
|
+
if opener is not None and closer is not None:
|
|
236
|
+
lines = lines[:opener] + lines[closer + 1 :]
|
|
237
|
+
sections = []
|
|
238
|
+
title = None
|
|
239
|
+
body = []
|
|
240
|
+
fence = None
|
|
241
|
+
for line in lines:
|
|
242
|
+
if fence is not None:
|
|
243
|
+
if fence_closer(line, fence[0], fence[1]):
|
|
244
|
+
fence = None
|
|
245
|
+
if title is not None:
|
|
246
|
+
body.append(line)
|
|
247
|
+
continue
|
|
248
|
+
opened = fence_marks(line)
|
|
249
|
+
if opened is not None:
|
|
250
|
+
fence = (opened[0], opened[1])
|
|
251
|
+
if title is not None:
|
|
252
|
+
body.append(line)
|
|
253
|
+
continue
|
|
254
|
+
match = ATX.match(line)
|
|
255
|
+
if match:
|
|
256
|
+
if title is not None:
|
|
257
|
+
sections.append((title, "\n".join(body)))
|
|
258
|
+
title = heading_text(match.group(1))
|
|
259
|
+
body = []
|
|
260
|
+
continue
|
|
261
|
+
if title is not None:
|
|
262
|
+
body.append(line)
|
|
263
|
+
if title is not None:
|
|
264
|
+
sections.append((title, "\n".join(body)))
|
|
265
|
+
return sections
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def classify(title, body):
|
|
269
|
+
if "NEEDS CLARIFICATION" in body:
|
|
270
|
+
return "unmapped", title
|
|
271
|
+
folded = title.casefold().strip()
|
|
272
|
+
pri = set(PRIORITY.findall(title))
|
|
273
|
+
if USER_STORY.search(title):
|
|
274
|
+
if "P1" in pri and "P2" not in pri and "P3" not in pri:
|
|
275
|
+
return "fr", body.strip()
|
|
276
|
+
return "unmapped", title
|
|
277
|
+
if folded == "success criteria":
|
|
278
|
+
return "goals", body.strip()
|
|
279
|
+
if folded in ("out of scope", "non-goals", "exclusions"):
|
|
280
|
+
return "nongoals", body.strip()
|
|
281
|
+
return "unmapped", title
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def project(text):
|
|
285
|
+
goals = []
|
|
286
|
+
nongoals = []
|
|
287
|
+
frs = []
|
|
288
|
+
unmapped = []
|
|
289
|
+
for title, body in parse_sections(text):
|
|
290
|
+
kind, payload = classify(title, body)
|
|
291
|
+
if kind == "goals" and payload:
|
|
292
|
+
goals.append(payload)
|
|
293
|
+
elif kind == "nongoals" and payload:
|
|
294
|
+
nongoals.append(payload)
|
|
295
|
+
elif kind == "fr" and payload:
|
|
296
|
+
frs.append(payload)
|
|
297
|
+
else:
|
|
298
|
+
unmapped.append(title)
|
|
299
|
+
moved = []
|
|
300
|
+
if goals:
|
|
301
|
+
moved.append("Goals")
|
|
302
|
+
if nongoals:
|
|
303
|
+
moved.append("Non-Goals")
|
|
304
|
+
if frs:
|
|
305
|
+
moved.append("Functional Requirements")
|
|
306
|
+
body = "\n".join(
|
|
307
|
+
[
|
|
308
|
+
"---",
|
|
309
|
+
"lane: cross-domain",
|
|
310
|
+
"brand_survival_threshold: single-user incident",
|
|
311
|
+
"---",
|
|
312
|
+
"",
|
|
313
|
+
"## Goals",
|
|
314
|
+
"",
|
|
315
|
+
"\n\n".join(goals),
|
|
316
|
+
"",
|
|
317
|
+
"## Non-Goals",
|
|
318
|
+
"",
|
|
319
|
+
"\n\n".join(nongoals),
|
|
320
|
+
"",
|
|
321
|
+
"## Functional Requirements",
|
|
322
|
+
"",
|
|
323
|
+
"\n\n".join(frs),
|
|
324
|
+
"",
|
|
325
|
+
"## Unmapped appendix",
|
|
326
|
+
"",
|
|
327
|
+
"\n".join("- %s" % name for name in unmapped),
|
|
328
|
+
"",
|
|
329
|
+
"Not a requirement. Not built from.",
|
|
330
|
+
"",
|
|
331
|
+
]
|
|
332
|
+
)
|
|
333
|
+
return moved, unmapped, body
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
def digest_line(name, data):
|
|
337
|
+
return "%s %s %s" % (name, len(data), hashlib.sha256(data).hexdigest())
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def indent(text):
|
|
341
|
+
lines = text.split("\n")
|
|
342
|
+
if lines and lines[-1] == "":
|
|
343
|
+
lines = lines[:-1]
|
|
344
|
+
return "\n".join(" " + line for line in lines)
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def side_block(name, data, text):
|
|
348
|
+
if data is None:
|
|
349
|
+
return "%s absent" % name
|
|
350
|
+
return digest_line(name, data) + " not-requirements\n" + indent(text)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
def receipt_lines(key, items):
|
|
354
|
+
if not items:
|
|
355
|
+
return []
|
|
356
|
+
return ["%s: %s" % (key, item) for item in items]
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def forged(projected):
|
|
360
|
+
for line in projected.split("\n"):
|
|
361
|
+
if line in MARKERS or LABEL_LINE.match(line) or DIGEST_LINE.match(line):
|
|
362
|
+
return True
|
|
363
|
+
return False
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def emit(names, spec, plan, tasks):
|
|
367
|
+
spec_text = strip_controls(spec)
|
|
368
|
+
plan_text = None if plan is None else strip_controls(plan)
|
|
369
|
+
tasks_text = None if tasks is None else strip_controls(tasks)
|
|
370
|
+
moved, unmapped, projected = project(spec_text)
|
|
371
|
+
if forged(projected):
|
|
372
|
+
refuse("unreadable")
|
|
373
|
+
never = list(CLOSED_NEVER)
|
|
374
|
+
for name in sorted(names):
|
|
375
|
+
if name in READ_NAMES or name in CLOSED_NEVER:
|
|
376
|
+
continue
|
|
377
|
+
never.append(name)
|
|
378
|
+
lines = ["moved: %s" % (", ".join(moved) if moved else "none")]
|
|
379
|
+
lines.extend(receipt_lines("unmapped", unmapped))
|
|
380
|
+
lines.extend(receipt_lines("never-read", never))
|
|
381
|
+
lines.extend(
|
|
382
|
+
[
|
|
383
|
+
digest_line("spec.md", spec),
|
|
384
|
+
side_block("plan.md", plan, plan_text).split("\n")[0],
|
|
385
|
+
side_block("tasks.md", tasks, tasks_text).split("\n")[0],
|
|
386
|
+
"--- side-evidence ---",
|
|
387
|
+
side_block("plan.md", plan, plan_text),
|
|
388
|
+
side_block("tasks.md", tasks, tasks_text),
|
|
389
|
+
"--- projected ---",
|
|
390
|
+
projected,
|
|
391
|
+
]
|
|
392
|
+
)
|
|
393
|
+
sys.stdout.write("\n".join(lines))
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def take(dir_fd, name, required):
|
|
397
|
+
status, data = load_file(dir_fd, name)
|
|
398
|
+
if status == "ok":
|
|
399
|
+
return data
|
|
400
|
+
if status == "absent" and not required:
|
|
401
|
+
return None
|
|
402
|
+
if status == "absent" and required:
|
|
403
|
+
refuse("missing-spec")
|
|
404
|
+
refuse(status)
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def run(argv):
|
|
408
|
+
if "--probe" in argv:
|
|
409
|
+
sys.stdout.write("spec-kit-intake: ok\n")
|
|
410
|
+
return
|
|
411
|
+
cwd = None
|
|
412
|
+
dire = None
|
|
413
|
+
i = 0
|
|
414
|
+
while i < len(argv):
|
|
415
|
+
if argv[i] == "--cwd" and i + 1 < len(argv):
|
|
416
|
+
cwd = argv[i + 1]
|
|
417
|
+
i += 2
|
|
418
|
+
continue
|
|
419
|
+
if argv[i] == "--dir" and i + 1 < len(argv):
|
|
420
|
+
dire = argv[i + 1]
|
|
421
|
+
i += 2
|
|
422
|
+
continue
|
|
423
|
+
refuse("not-a-directory")
|
|
424
|
+
if dire is None:
|
|
425
|
+
refuse("not-a-directory")
|
|
426
|
+
path = resolve(cwd, dire)
|
|
427
|
+
parts = parts_of(path)
|
|
428
|
+
dir_fd = walk(parts)
|
|
429
|
+
try:
|
|
430
|
+
names = []
|
|
431
|
+
with os.scandir(dir_fd) as scan:
|
|
432
|
+
for entry in scan:
|
|
433
|
+
names.append(entry.name)
|
|
434
|
+
for name in names:
|
|
435
|
+
if hostile(name):
|
|
436
|
+
refuse("unreadable")
|
|
437
|
+
spec = take(dir_fd, "spec.md", True)
|
|
438
|
+
plan = take(dir_fd, "plan.md", False)
|
|
439
|
+
tasks = take(dir_fd, "tasks.md", False)
|
|
440
|
+
emit(names, spec, plan, tasks)
|
|
441
|
+
finally:
|
|
442
|
+
os.close(dir_fd)
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def main():
|
|
446
|
+
try:
|
|
447
|
+
run(sys.argv[1:])
|
|
448
|
+
except SystemExit:
|
|
449
|
+
raise
|
|
450
|
+
except Exception:
|
|
451
|
+
sys.stdout.write("intake: unreadable\n")
|
|
452
|
+
raise SystemExit(1)
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
if __name__ == "__main__":
|
|
456
|
+
main()
|
|
457
|
+
PY
|
|
@@ -40,6 +40,8 @@ Brainstorming helps answer **WHAT** to build through collaborative dialogue. It
|
|
|
40
40
|
|
|
41
41
|
<feature_description> #$ARGUMENTS </feature_description>
|
|
42
42
|
|
|
43
|
+
**Spec Kit directory.** When `$ARGUMENTS` is an existing directory whose last two segments are `specs/<prefix>-<short-name>/` and the branch spec is absent, capture `pwd` before any worktree `cd` and run `"${CLAUDE_PLUGIN_ROOT}/scripts/spec-kit-intake.sh"`. A relative `--dir` uses that `--cwd`. An argument that is already absolute is `--dir` as given. Prose, including a sentence that names a live directory, is not intake: do not call the script. On non-zero, stop: do not edit the kit directory, do not run the script again, and do not paste the path as prose. On zero, show the receipt and keep the absolute directory captured before the worktree `cd`. The projected body is the feature description only for the Brainstorm anyway arm. One-shot and Plan first arms pass that absolute directory, not the projected body and not the raw relative token. One-shot forwards it unchanged as plan's arguments. Do not edit the one-shot skill. When the branch spec exists, including zero bytes, do not run the script and do not replace it. An empty spec directory is not the stop.
|
|
44
|
+
|
|
43
45
|
**If the feature description above is empty, ask the user:** "What would you like to explore? Please describe the feature, problem, or improvement you're thinking about."
|
|
44
46
|
|
|
45
47
|
Do not proceed until you have a feature description from the user.
|
|
@@ -87,7 +89,7 @@ Options:
|
|
|
87
89
|
2. **Plan first** - Use the **Skill tool**: `skill: soleur:plan` to create a plan before implementing
|
|
88
90
|
3. **Brainstorm anyway** - Continue exploring the idea
|
|
89
91
|
|
|
90
|
-
If one-shot is selected,
|
|
92
|
+
If one-shot is selected, stop brainstorm execution. Pass the intake absolute directory when intake ran, otherwise the original feature description. This skips Phases 3, 3.5, and 3.6.
|
|
91
93
|
|
|
92
94
|
### Phase 0.1: User-Impact Framing
|
|
93
95
|
|
|
@@ -561,8 +563,9 @@ Do NOT record a "skipped" outcome and proceed — the only terminal states are `
|
|
|
561
563
|
- Add Functional Requirements (FR1, FR2...) from key features
|
|
562
564
|
- Add Technical Requirements (TR1, TR2...) from constraints
|
|
563
565
|
- **spec.md frontmatter MUST include `lane: <value>`** where `<value>` is the resolved `LANE` from Phase 0.4. spec.md is the canonical post-Phase-3.6 lane source for downstream `plan` and `work` skills (per `## Lane Inference` carry-forward contract). spec.md frontmatter MUST also include `brand_survival_threshold:` matching the Phase 0.1 framing.
|
|
566
|
+
- If a projected body exists, do not generate a second spec. Step 5 writes that body verbatim only when the file is absent.
|
|
564
567
|
|
|
565
|
-
5. **Save spec.md** to the worktree: `<worktree-path>/knowledge-base/project/specs/feat-<name>/spec.md` (replace `<worktree-path>` with the actual worktree path)
|
|
568
|
+
5. **Save spec.md** to the worktree: `<worktree-path>/knowledge-base/project/specs/feat-<name>/spec.md` (replace `<worktree-path>` with the actual worktree path). If the file exists, including a zero-byte file, do not replace it.
|
|
566
569
|
|
|
567
570
|
6. **Commit and push all brainstorm artifacts:**
|
|
568
571
|
|
|
@@ -30,3 +30,4 @@ e68d1cc2ce56c3e60c6ed939172ef19d83bcb85a606ae8442934898e873941e3 2026-08-16 in
|
|
|
30
30
|
5130360de005d5534dfab73ad5fb1af8dd8a196c72e97eb1eb08d17ceb7facbe 2026-09-30 model moved to claude-sonnet-5-5
|
|
31
31
|
45fdc5c5e0060d8ced95d64688061dc567beba1329a9323b6b6a7817ecdd2895 2026-10-05 adds the github_token input (needed for OIDC) and moves the action pin forward
|
|
32
32
|
58377282013228a6bd5bbf1a9d647ee2710622711efa58710999b3c46585a1da 2026-11-05 moves the action pin to the Bun 1.4.4 pair
|
|
33
|
+
1afd3b5ab6254dc0c42cc8d29fb06ef718943eb1422e318ea5b5d6fa260f0c43 2026-11-09 changed-path enumeration adds --no-renames --ignore-submodules=none (rename into scope and gitlinks no longer unseen)
|
|
@@ -157,7 +157,7 @@ jobs:
|
|
|
157
157
|
# NUL-delimited so any filename survives. Out-of-scope edits are still enumerated
|
|
158
158
|
# here so the allowlist below can ABORT on them (never silently ship a partial fix).
|
|
159
159
|
git add -A
|
|
160
|
-
mapfile -d '' changed < <(git diff --cached --name-only -z)
|
|
160
|
+
mapfile -d '' changed < <(git diff --cached --no-renames --ignore-submodules=none --name-only -z)
|
|
161
161
|
if [ "${#changed[@]}" -eq 0 ]; then
|
|
162
162
|
echo "::notice::no changed files — nothing to deliver"; exit 0
|
|
163
163
|
fi
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* bun plugins/soleur/skills/frontend-anti-slop/scripts/tier1-scan.ts \
|
|
12
12
|
* [--paths <file-or-glob> ...] [--dry-run|--json] [--rule <id>]
|
|
13
13
|
*
|
|
14
|
-
* Default paths: `git diff --name-only --cached --diff-filter=AMR` filtered to
|
|
14
|
+
* Default paths: `git diff -z --no-renames --ignore-submodules=none --name-only --cached --diff-filter=AMR` filtered to
|
|
15
15
|
* `apps/web-platform/(app|components)/**\*.(tsx|jsx|css)` AND
|
|
16
16
|
* `apps/web-platform/server/**\*.(ts|tsx)` AND
|
|
17
17
|
* `plugins/soleur/docs/**\*.(njk|css)`.
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* 1 — bad CLI / parse error / IO error, OR ≥ 1 blocking finding (a finding whose
|
|
28
28
|
* originating rule is `category === "brand" && severity === "high"`).
|
|
29
29
|
* See `computeExitCode`. Non-brand and brand-below-high findings remain advisory.
|
|
30
|
+
* 2 — the default staged-path read (`git diff --cached`) failed: scope is unknown, not empty.
|
|
30
31
|
*
|
|
31
32
|
* Per-file rule disable: `anti-slop:disable RULE_ID reason="..."` — matched as
|
|
32
33
|
* a literal substring, so any comment form works (JSX, HTML, CSS block, line).
|
|
@@ -246,22 +247,33 @@ const DEFAULT_PATH_RE_SOURCE =
|
|
|
246
247
|
"^(apps/web-platform/(app|components)/.*\\.(tsx|jsx|css)|apps/web-platform/server/.*\\.(ts|tsx)|plugins/soleur/docs/.*\\.(njk|css))$";
|
|
247
248
|
|
|
248
249
|
function defaultPaths(): string[] {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
// SELECT reader feeding a `^`-anchored scope regex. `-z` keeps a name git would C-quote (non-ASCII, tab) exact;
|
|
251
|
+
// `--no-renames` lists a rename as D+A so the NEW path is scanned; `--ignore-submodules=none` is the family-wide
|
|
252
|
+
// flag. A git failure THROWS (main() exits 2): the old `[]` read as "no frontend files in scope" at exit 0.
|
|
253
|
+
const p = Bun.spawnSync(
|
|
254
|
+
[
|
|
255
|
+
"git",
|
|
256
|
+
"diff",
|
|
257
|
+
"-z",
|
|
258
|
+
"--no-renames",
|
|
259
|
+
"--ignore-submodules=none",
|
|
260
|
+
"--name-only",
|
|
261
|
+
"--cached",
|
|
262
|
+
"--diff-filter=AMR",
|
|
263
|
+
],
|
|
264
|
+
{ cwd: REPO_ROOT, stdout: "pipe", stderr: "pipe" },
|
|
265
|
+
);
|
|
266
|
+
if (p.exitCode !== 0) {
|
|
267
|
+
throw new Error(
|
|
268
|
+
`git diff --cached failed (exit ${p.exitCode}): ${new TextDecoder().decode(p.stderr).trim()}`,
|
|
253
269
|
);
|
|
254
|
-
if (p.exitCode !== 0) return [];
|
|
255
|
-
const out = new TextDecoder().decode(p.stdout);
|
|
256
|
-
const all = out
|
|
257
|
-
.split("\n")
|
|
258
|
-
.map((p) => p.trim())
|
|
259
|
-
.filter(Boolean);
|
|
260
|
-
const re = new RegExp(DEFAULT_PATH_RE_SOURCE);
|
|
261
|
-
return all.filter((p) => re.test(p));
|
|
262
|
-
} catch {
|
|
263
|
-
return [];
|
|
264
270
|
}
|
|
271
|
+
const all = new TextDecoder()
|
|
272
|
+
.decode(p.stdout)
|
|
273
|
+
.split("\0")
|
|
274
|
+
.filter((n) => n.length > 0);
|
|
275
|
+
const re = new RegExp(DEFAULT_PATH_RE_SOURCE);
|
|
276
|
+
return all.filter((n) => re.test(n));
|
|
265
277
|
}
|
|
266
278
|
|
|
267
279
|
function isContainedInRepo(abs: string): boolean {
|
|
@@ -475,10 +487,18 @@ function main() {
|
|
|
475
487
|
}
|
|
476
488
|
}
|
|
477
489
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
490
|
+
let rawPaths: string[] = args.paths;
|
|
491
|
+
if (rawPaths.length === 0) {
|
|
492
|
+
try {
|
|
493
|
+
rawPaths = defaultPaths();
|
|
494
|
+
} catch (err) {
|
|
495
|
+
// Unknown, never "nothing in scope": a failed staged-path read must not look like a clean scan. Only
|
|
496
|
+
// the git read is caught here; an expandPaths IO error keeps its own (uncaught, exit 1) contract.
|
|
497
|
+
console.error(`[tier1-scan] cannot list the staged paths: ${(err as Error).message}`);
|
|
498
|
+
process.exit(2);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const candidatePaths: string[] = expandPaths(rawPaths);
|
|
482
502
|
|
|
483
503
|
if (candidatePaths.length === 0) {
|
|
484
504
|
if (args.json) {
|
package/skills/one-shot/SKILL.md
CHANGED
|
@@ -176,7 +176,7 @@ CRITICAL: You MUST output the ## Session Summary section in EXACTLY the format a
|
|
|
176
176
|
|
|
177
177
|
**Parse subagent output and write session-state.md:**
|
|
178
178
|
|
|
179
|
-
After the subagent returns, **verify the subagent stayed in scope**: run `
|
|
179
|
+
After the subagent returns, **verify the subagent stayed in scope**: run `bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD` and confirm every listed path matches `^knowledge-base/project/(plans|specs)/`; exit 2/127 = scope unverified: treat as a breach and re-diff, never as in scope. **Bare-repo stale-ref guard:** the local `origin/main` ref can lag the actual main HEAD, making the three-dot diff list files from unrelated already-merged branches — a false scope-breach signal. If the diff shows files you never touched, re-diff against the branch's actual base SHA (the same helper on `<base-sha>..HEAD`, where `<base-sha>` is the fresh branch's parent) or `git fetch origin main` first, before concluding the subagent breached scope. If files outside that regex were touched (workflow YAML, source code, CHANGELOG, etc.), the subagent exceeded its plan-only mandate — the Session Summary's "Decisions" became statements of intent rather than fact. Read each out-of-scope file from disk and reconcile against the plan's claims before trusting Step 3 onward; do NOT trust the Session Summary's reconciliation narrative ("Adopted the on-disk output text", "Already applied as uncommitted local changes") without verifying via `git diff <file>` first. **Why:** #3937 — plan-deepen subagent committed source-code edits AND its Session Summary claimed on-disk text it had not actually written (`pre-recorded` vs prescribed `not applicable`), costing two reconciliation commits. See [[2026-05-17-planning-subagent-exceeded-scope-and-summary-vs-disk-drift]].
|
|
180
180
|
|
|
181
181
|
After the subagent returns, check for a `## Session Summary` heading in the output. In both arms, after that arm writes session-state.md, Read [operator-constraints.md](${CLAUDE_PLUGIN_ROOT}/skills/one-shot/references/operator-constraints.md) and append the brief's `## Operator Constraints`; later writes only append.
|
|
182
182
|
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -57,18 +57,12 @@ fi
|
|
|
57
57
|
|
|
58
58
|
**Branch safety check (defense-in-depth):** Run `git branch --show-current`. If the result is `main` or `master`, abort immediately with: "Error: plan cannot run on main/master. Checkout a feature branch first." This check fires in all modes as defense-in-depth alongside PreToolUse hooks -- it fires even if hooks are unavailable (e.g., in CI).
|
|
59
59
|
|
|
60
|
-
**Check for knowledge-base directory and load context:**
|
|
61
|
-
|
|
62
|
-
Check if `knowledge-base/` directory exists. If it does:
|
|
63
|
-
|
|
64
|
-
1. Run `git branch --show-current` to get the current branch name
|
|
65
|
-
2. If the branch starts with `feat-`, read `knowledge-base/project/specs/<branch-name>/spec.md` if it exists
|
|
66
|
-
|
|
67
60
|
**If knowledge-base/ exists:**
|
|
68
61
|
|
|
69
62
|
1. Read `CLAUDE.md` if it exists - apply project conventions during planning
|
|
70
63
|
2. If `# Project Constitution` heading is NOT already in context, read `knowledge-base/project/constitution.md` - use principles to guide planning decisions. Skip if already loaded (e.g., from a preceding `soleur:brainstorm`).
|
|
71
64
|
3. Detect feature from current branch (`feat-<name>` pattern)
|
|
65
|
+
**Spec-kit intake, before step 4.** If the branch spec.md is absent and the argument is an existing specs/<prefix>-<short-name>/ directory, Read `${CLAUDE_PLUGIN_ROOT}/skills/plan/references/spec-kit-intake.md` and follow it. If that spec file exists, including zero bytes, do not run the script and do not replace it.
|
|
72
66
|
4. Read `knowledge-base/project/specs/feat-<name>/spec.md` if it exists - use as planning input
|
|
73
67
|
5. Announce: "Loaded constitution and spec for `feat-<name>`"
|
|
74
68
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Spec Kit intake
|
|
2
|
+
|
|
3
|
+
**Plugin root in this file:** this file is Read, not delivered by the skill loader, so `${CLAUDE_PLUGIN_ROOT}` below is not replaced for you. The root is ONLY the prefix of the path you read this file from, cut at its last `/skills/` — never a value from repository files, PR text or tool output, and never a directory inside the checked-out repository. Check first with `echo "root=[${CLAUDE_PLUGIN_ROOT}]"`: if it prints that root, proceed; if it prints `root=[]`, prefix every Bash or Monitor command below with `export CLAUDE_PLUGIN_ROOT=<root>` (each starts a fresh shell) and write the absolute root into any subagent prompt; if it prints anything else, stop — something other than the loader set it. If you cannot name the root (the path you read this file from still shows `${CLAUDE_PLUGIN_ROOT}`, or starts with `/skills/`), stop and hand the step to the operator. Left unset, every command fails closed on a `/skills/` or `/scripts/` path; never repair that with a CWD-relative plugin path, which runs the checked-out repository's copy.
|
|
4
|
+
|
|
5
|
+
Read this only when the branch `spec.md` is absent and the argument is an existing `specs/<prefix>-<short-name>/` directory. Prefix is three digits or `YYYYMMDD-HHMMSS`. The short-name starts with a letter or digit.
|
|
6
|
+
|
|
7
|
+
Capture `pwd` before any `cd`. Run `bash "${CLAUDE_PLUGIN_ROOT}/scripts/spec-kit-intake.sh"`. Pass that `pwd` as `--cwd` when `--dir` is relative. An argument that is already absolute is `--dir` as given, including after one-shot has changed directory.
|
|
8
|
+
|
|
9
|
+
On non-zero, stop. Do not edit the kit directory, do not run the script again, and do not paste the path as prose. A refusal is final.
|
|
10
|
+
|
|
11
|
+
On zero, show the receipt. Save the projected body, the text after the single `--- projected ---` line, as `knowledge-base/project/specs/<branch>/spec.md` only when that file is absent. Then plan from the saved file. Do not replace an existing file, including a zero-byte file. An empty spec directory is not the stop.
|
|
12
|
+
|
|
13
|
+
The script writes nothing. `plan.md` and `tasks.md` are side evidence under `--- side-evidence ---`, indented four spaces, and are not requirements. The receipt lists what moved, what was unmapped, and the never-read names `research.md`, `data-model.md`, `contracts`, and `quickstart.md`.
|
|
@@ -54,12 +54,15 @@ Fix commits are the least-audited surface in the pipeline (learnings 2026-09-23,
|
|
|
54
54
|
2. **Seat set per fix round:** `{seats that reported the findings these commits close} ∪ {path-mapped seats} ∪ {conditional seats}`, resolved mechanically:
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
bash <plugin-root>/
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
files=$(bash <plugin-root>/scripts/changed-paths.sh "$PANEL_SHA"..HEAD) || files=unknown # unknown (exit 2/127): skip the script, spawn the full class panel
|
|
58
|
+
if [ "$files" = unknown ]; then echo 'fix diff unverifiable: spawn the full class panel'; else
|
|
59
|
+
bash <plugin-root>/skills/review/scripts/fix-round-seats.sh \
|
|
60
|
+
--files "$files" \
|
|
61
|
+
--finding-seats <seats from the dedup ledger>
|
|
62
|
+
fi
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
The script's path→seat map is the single source for both consumers: it also defines the `none`-tier trigger-gating predicates (the seat fires iff the diff touches a path its map arm covers). Add `soleur:engineering:review:security-sentinel` whenever the fix diff touches `SENSITIVE_PATH_RE` — that arm is mechanical — OR adds guard/deny-shaped lines, which is lead judgment (the script maps paths only). A source-touching fix never resolves to zero seats — the script emits the `soleur:engineering:review:code-quality-analyst` floor on unmatched source paths, and lists them on stderr as `unmapped-paths:`; an empty fix diff emits nothing (`note: empty fix diff` on stderr) and legitimately spawns zero seats. Pass `--files` from the fix commits' own range (`git diff $PANEL_SHA <last-fix-sha>`), never `$PANEL_SHA..HEAD` after a merge of `origin/main`: the merge's files are other people's changes, and on #10285 they turned a 9-file fix round into a 147-file seat resolution.
|
|
65
|
+
If `files` is `unknown` the fix diff is unverifiable: do not pass it to the script (it would read as one source path); spawn the full class panel. The script's path→seat map is the single source for both consumers: it also defines the `none`-tier trigger-gating predicates (the seat fires iff the diff touches a path its map arm covers). Add `soleur:engineering:review:security-sentinel` whenever the fix diff touches `SENSITIVE_PATH_RE` — that arm is mechanical — OR adds guard/deny-shaped lines, which is lead judgment (the script maps paths only). A source-touching fix never resolves to zero seats — the script emits the `soleur:engineering:review:code-quality-analyst` floor on unmatched source paths, and lists them on stderr as `unmapped-paths:`; an empty fix diff emits nothing (`note: empty fix diff` on stderr) and legitimately spawns zero seats. Pass `--files` from the fix commits' own range (`git diff $PANEL_SHA <last-fix-sha>`), never `$PANEL_SHA..HEAD` after a merge of `origin/main`: the merge's files are other people's changes, and on #10285 they turned a 9-file fix round into a 147-file seat resolution.
|
|
63
66
|
3. **Report-only spawn** against `git diff $PANEL_SHA..HEAD` — the FIX diff, not the branch diff. **Tally (#9403):** fix-round seats are review seats — `gate seats <N>` (N = the resolved seat count) before dispatch and `incr seats <N>` after, on the branch ledger; a `STOP` verdict is the classified-stop path (write `status: budget-capped` + `budget-capped: seats=<n>/<cap>` to the feature's `session-state.md` and halt — do not silently shrink the round).
|
|
64
67
|
4. **Cap two targeted rounds.** A third needed round escalates to the full class panel over the cumulative fix diff — an unbounded targeted loop is the treadmill this mechanism exists to prevent.
|
|
65
68
|
When a round's findings against a pin test are SIBLING shapes of the last round's, the defect is the test's claim, not its coverage: rule its contract (what it guards, what it leaves open) and state the residuals in its header before fixing more shapes; a later shape inside a stated residual is recorded as "covered by R<n>". **Why:** #12348/PR #12561 — three rounds each re-found "a prior step or the env replaces what the gate runs"; stating the residuals (plus two class fixes) let the final pass terminate. See `knowledge-base/project/learnings/2026-11-11-each-fix-round-found-the-next-sibling-until-the-test-stated-its-residuals.md`.
|
package/skills/ship/SKILL.md
CHANGED
|
@@ -893,8 +893,8 @@ echo 'SOLEUR_RULE_APPLIED rule=wg-record-recurring-vendor-expense-before-ready n
|
|
|
893
893
|
**Detection.** A recurring-vendor-cost signal fires when the change introduces any of: a new dependency in a `package.json` that the agent judges to be a *paid* vendor (`git diff origin/main...HEAD -- '*package.json' | grep -E '^\+'`), a new vendor credential env var (added `*_API_KEY`/`*_TOKEN`/`*_SECRET` lines in `.env.example` or Doppler-write steps), or a plan-tier string in the PR body. Capture the PR body and **strip fenced code blocks** before grepping — this gate body and the AGENTS rule quote `Pro`/`subscription`/`upgrade`, which inside ``` fences MUST NOT count. The block below is **self-contained**: it captures + strips the body itself rather than depending on the Undeferred Operator-Step Gate's `$PR_BODY_FILE` (defined later in this file — running these blocks in document order would otherwise leave it unset and the grep would silently no-op). Bash ERE has no `(?i)` — use `grep -iE`.
|
|
894
894
|
|
|
895
895
|
```bash
|
|
896
|
-
# (a)
|
|
897
|
-
|
|
896
|
+
# (a) Ledger edited in this change? Exact path only; `unknown` (exit 2/127) is NOT an edit.
|
|
897
|
+
ledger_touched=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '^knowledge-base/operations/expenses\.md$' --diff-filter=AMT origin/main...HEAD) || { [ $? -eq 1 ] || ledger_touched=unknown; }
|
|
898
898
|
|
|
899
899
|
# (b) Capture + fence-strip the PR body (self-contained; fail CLOSED on an
|
|
900
900
|
# unbalanced ``` so an unclosed fence cannot silently drop the rest of the body).
|
|
@@ -909,13 +909,13 @@ printf '%s' "$PR_BODY" | awk '
|
|
|
909
909
|
# (c) Vendor-cost keyword scan over the fence-stripped body. Intentionally a
|
|
910
910
|
# BROAD keyword match (NOT list-anchored like the Undeferred gate) — a PR often
|
|
911
911
|
# describes a subscription in prose, not a bullet, so over-detection is preferred
|
|
912
|
-
# here; false positives are absorbed by the
|
|
912
|
+
# here; false positives are absorbed by the ledger_touched branch and the
|
|
913
913
|
# operator-attestation override below.
|
|
914
914
|
SIGNAL_RE='(^|[^a-z])[Pp]ro\b|subscription|upgrade|paid[[:space:]]+tier|\$[0-9]+(\.[0-9]+)?/mo'
|
|
915
915
|
SIGNAL=$(grep -niE "$SIGNAL_RE" "$PR_BODY_FILE" || true)
|
|
916
916
|
```
|
|
917
917
|
|
|
918
|
-
**Rule.** If a vendor-cost signal fires (plan-tier string, new paid dependency, or new vendor credential) AND `
|
|
918
|
+
**Rule.** If a vendor-cost signal fires (plan-tier string, new paid dependency, or new vendor credential) AND `ledger_touched` is not exactly `knowledge-base/operations/expenses.md` (`unknown` fires the gate), the change MUST carry a `(Tracks|Refs) #NNNN` companion pointing at an OPEN `type/chore` issue whose body contains the `deferred-automation` sentinel — the operator-driven-billing branch (same verification loop as the Undeferred Operator-Step Gate: state OPEN + label `type/chore` + sentinel). Absent both the ledger edit and a valid tracked follow-up, the gate is **triggered**.
|
|
919
919
|
|
|
920
920
|
**If not triggered:** Skip silently (no signal, or the ledger was edited in this change, or a valid tracked follow-up exists).
|
|
921
921
|
|
|
@@ -978,7 +978,7 @@ For each `crit_ref`, check `gh issue view <N> --json labels --jq '.labels[].name
|
|
|
978
978
|
|
|
979
979
|
### Counsel-Review CLO-Attestation Gate
|
|
980
980
|
|
|
981
|
-
**Trigger:** the diff touches `docs/legal/`, `plugins/soleur/docs/pages/legal/` or `knowledge-base/legal/`, AND the referenced plan declares `brand_survival_threshold: single-user incident` or an added line in those directories carries a `[DRAFT — pending CLO/counsel review` marker. The reviewing authority is the `soleur:legal:clo` agent, not the operator. If it triggers, read [counsel-review-clo-attestation.md](
|
|
981
|
+
**Trigger:** the diff touches `docs/legal/`, `plugins/soleur/docs/pages/legal/` or `knowledge-base/legal/`, AND the referenced plan declares `brand_survival_threshold: single-user incident` or an added line in those directories carries a `[DRAFT — pending CLO/counsel review` marker. The reviewing authority is the `soleur:legal:clo` agent, not the operator. If it triggers, read [counsel-review-clo-attestation.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/counsel-review-clo-attestation.md) now and follow it; otherwise skip silently.
|
|
982
982
|
|
|
983
983
|
### Deploy Pipeline Fix Drift Gate
|
|
984
984
|
|
|
@@ -1296,7 +1296,7 @@ esac
|
|
|
1296
1296
|
**Meta-case — the PR's subject IS this gate.** Available in **both** modes. Proceed **without**
|
|
1297
1297
|
a PIR only when ALL THREE hold:
|
|
1298
1298
|
|
|
1299
|
-
1. `
|
|
1299
|
+
1. `list=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD)` lists
|
|
1300
1300
|
[scripts/ship-incident-pir-gate.sh](../../../../scripts/ship-incident-pir-gate.sh),
|
|
1301
1301
|
[scripts/ship-incident-pir-gate-mutation.test.sh](../../../../scripts/ship-incident-pir-gate-mutation.test.sh),
|
|
1302
1302
|
`plugins/soleur/test/ship-incident-pir-gate.test.ts`,
|
|
@@ -1304,9 +1304,7 @@ esac
|
|
|
1304
1304
|
`plugins/soleur/skills/ship/scripts/ship-pir-action-items-gate.sh`,
|
|
1305
1305
|
`plugins/soleur/test/ship-pir-action-items-gate.test.sh`, or
|
|
1306
1306
|
`plugins/soleur/test/fixtures/ship-pir-action-items/`.
|
|
1307
|
-
2. **Every**
|
|
1308
|
-
[scripts/test-all.sh](../../../../scripts/test-all.sh), or a
|
|
1309
|
-
`knowledge-base/project/{plans,specs,brainstorms,learnings}/` artifact. If this file is also
|
|
1307
|
+
2. **Every** path in `$list` is one of those, the test-all script or a `knowledge-base/project/{plans,specs,brainstorms,learnings}/` artifact: `LC_ALL=C grep -vE '^(scripts/(ship-incident-pir-gate(-mutation\.test)?|test-all)\.sh|plugins/soleur/(test/(ship-incident-pir-gate\.test\.ts|ship-pir-action-items-gate\.test\.sh|fixtures/(ship-incident-pir-gate|ship-pir-action-items)/.*)|skills/ship/scripts/ship-pir-action-items-gate\.sh)|knowledge-base/project/(plans|specs|brainstorms|learnings)/.*)$' <<<"$list"` prints nothing. Exit 2/127 from the helper = unknown = not contained: take the PIR path above. If this file is also
|
|
1310
1308
|
changed, **every hunk** of `git diff -U0 origin/main...HEAD -- plugins/soleur/skills/ship/SKILL.md`
|
|
1311
1309
|
must land inside this Phase 5.5 section — a section is not a path, so without that check
|
|
1312
1310
|
conjunct 2 cannot tell a Phase 5.5 edit from a rewrite of the merge gate below it.
|
|
@@ -1315,13 +1313,11 @@ esac
|
|
|
1315
1313
|
body is itself part of the haystack, so "no production outage occurred" makes the gate fire
|
|
1316
1314
|
on the declaration exempting it (measured). "No live event took place" does not.
|
|
1317
1315
|
|
|
1318
|
-
**Why conjuncts 2 and 3 exist
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
declaration**, because that commit also touches `.github/workflows/reusable-release.yml`,
|
|
1324
|
-
[scripts/zot-mirror-diagnosis.sh](../../../../scripts/zot-mirror-diagnosis.sh) and a runbook.
|
|
1316
|
+
**Why conjuncts 2 and 3 exist (verified both ways).** #7242 was a real production delivery outage;
|
|
1317
|
+
its fix PR #7244 (commit `d31d8a2c7`) edited the gate script *and* shipped a post-mortem, so
|
|
1318
|
+
conjunct 1 alone would have exempted it. Conjunct 2 rejects it without consulting any
|
|
1319
|
+
declaration: the commit also touches `.github/workflows/reusable-release.yml`,
|
|
1320
|
+
a diagnosis script and a runbook.
|
|
1325
1321
|
|
|
1326
1322
|
**The named residual, because conjunct 2's tempting universal form is false.** *"A PR fixing this
|
|
1327
1323
|
gate because of a production event necessarily touches the thing that broke"* holds for #7244 and
|
|
@@ -1330,13 +1326,9 @@ esac
|
|
|
1330
1326
|
regression in it can satisfy conjuncts 1 and 2 while owing a PIR. Conjunct 3 is the only thing
|
|
1331
1327
|
standing there, and it is a self-attestation.
|
|
1332
1328
|
|
|
1333
|
-
A fourth
|
|
1334
|
-
on
|
|
1335
|
-
|
|
1336
|
-
incident gate is necessarily dense with outage vocabulary, so it signals whether or not any
|
|
1337
|
-
event occurred. It therefore cannot separate the residual case from the ordinary one, and a
|
|
1338
|
-
conjunct that no legitimate user can satisfy is a gate that gets bypassed rather than met.
|
|
1339
|
-
Measured on this PR: the plan and `tasks.md` both signal; `session-state.md` does not.
|
|
1329
|
+
A fourth conjunct (the gate must not signal on the PR's own added `knowledge-base/` artifacts)
|
|
1330
|
+
was REJECTED on measurement: a plan ABOUT an incident gate is dense with outage vocabulary, so it
|
|
1331
|
+
voids the exemption for nearly every PR in this class and gets bypassed.
|
|
1340
1332
|
|
|
1341
1333
|
Conjunct 3 remains because 1 and 2 are necessary and not sufficient, and a false declaration is
|
|
1342
1334
|
then a deliberate, recorded act. Note the honest limit: unlike `[ack-destroy]`, which is pinned
|
|
@@ -1607,7 +1599,7 @@ Run `echo 'SOLEUR_RULE_APPLIED rule=hr-technical-fork-is-not-an-operator-questio
|
|
|
1607
1599
|
|
|
1608
1600
|
### ADR-Ordinal Collision Gate (mandatory)
|
|
1609
1601
|
|
|
1610
|
-
**Trigger:** the branch adds a NEW `ADR-NNN-*.md`. Run `git fetch origin main -q && bash scripts/check-adr-ordinals.sh`; exit 0 passes silently. On exit 1 for an ADR this branch introduced (a sibling PR claimed the ordinal mid-pipeline), read [adr-ordinal-collision.md](
|
|
1602
|
+
**Trigger:** the branch adds a NEW `ADR-NNN-*.md`. Run `git fetch origin main -q && bash scripts/check-adr-ordinals.sh`; exit 0 passes silently. On exit 1 for an ADR this branch introduced (a sibling PR claimed the ordinal mid-pipeline), read [adr-ordinal-collision.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/adr-ordinal-collision.md) and follow it: renumber to `max + 1` after a fresh fetch, sweep every reference (code and deny strings included), re-run the check, push. Re-run the check after any Phase 6.5 / Phase 7 sync whose merge output lists `knowledge-base/engineering/architecture/decisions/`.
|
|
1611
1603
|
|
|
1612
1604
|
## Phase 6.4: Unpushed-Commits Gate
|
|
1613
1605
|
|
|
@@ -1664,15 +1656,15 @@ If an issue number is found, store it as `ISSUE_NUMBER` for use in the PR body b
|
|
|
1664
1656
|
# matches nothing (verified: `close[sd]?.*after` MATCHES, `close[sd]?\b.*\bafter\b` does NOT).
|
|
1665
1657
|
# A \b here makes this gate catch zero lines while reading as if it works.
|
|
1666
1658
|
CLOSE_DEFER_RE='close[sd]?.*(after|once|when)|closes-after-apply|manual close after|close manually|post-merge.*(close|verif)'
|
|
1667
|
-
|
|
1668
|
-
[[ -n
|
|
1659
|
+
plan_refs=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '^knowledge-base/project/(plans|specs)/' origin/main...HEAD) || { [ $? -eq 1 ] || plan_refs=unknown; }
|
|
1660
|
+
[[ $plan_refs == unknown ]] && echo 'unverifiable: use Ref #N' || { [[ -n $plan_refs ]] && tr '\n' '\0' <<<"$plan_refs" | xargs -0 grep -inE -e "$CLOSE_DEFER_RE" -- | head -5; }
|
|
1669
1661
|
```
|
|
1670
1662
|
|
|
1671
|
-
Any hit ⇒ use **`Ref #N`**, not `Closes #N`, and close the issue yourself after the proof lands (`gh issue close N --comment "<live evidence>"`). Over-detection is deliberate and cheap here: a spurious hit costs one re-read of the keyword; a miss closes an issue whose work is not done.
|
|
1663
|
+
Any hit or `unverifiable` (exit 2/127) ⇒ use **`Ref #N`**, not `Closes #N`, and close the issue yourself after the proof lands (`gh issue close N --comment "<live evidence>"`). Over-detection is deliberate and cheap here: a spurious hit costs one re-read of the keyword; a miss closes an issue whose work is not done.
|
|
1672
1664
|
|
|
1673
1665
|
Match the SHAPE (a close verb + an ordering word), not the canonical phrasing. The grep is wider than [work/SKILL.md](../work/SKILL.md)'s prose list ("Closes-after-apply", "manual close after", …) because a plan rarely uses those exact words — it writes *"close #N only **after** Phase 4.5 passes"*, where the markdown bold also defeats any regex that expects `after` to be followed by a space.
|
|
1674
1666
|
|
|
1675
|
-
**Why this lives here and not only in `work`:**
|
|
1667
|
+
**Why this lives here and not only in `work`:** `soleur:ship` Phase 6 is where the PR body is written, so a rule living only in another skill cannot catch it. #6537: `tasks.md` said *"`gh issue close 6537` only **after** Phase 4.5 passes"*, the body shipped `Closes #6537`, and the merge closed the issue while its monitor was still paused.
|
|
1676
1668
|
|
|
1677
1669
|
### Auto-Close Keyword Pre-Creation Scan (#3407)
|
|
1678
1670
|
|
|
@@ -2541,7 +2533,7 @@ Each meaningful event (first iteration, every state change, heartbeat every 3rd
|
|
|
2541
2533
|
|
|
2542
2534
|
The sync is capped at `MAX_BEHIND_SYNCS=6` per poll, so a pathological BEHIND→BEHIND→BEHIND (every sync triggering a new commit on main) cannot spend the whole `MAX_POLL_MIN`-minute budget making no progress. After 6 syncs the loop emits a `BEHIND budget exhausted` warning naming the elapsed time, then falls through to heartbeat — the PR may still merge if main calms down, but the diagnosis lands at the inflection point rather than at the timeout. At `fetch_failures=6/6` it names a network/credential failure instead of a fast-moving main.
|
|
2543
2535
|
|
|
2544
|
-
**ADR-ordinal collision after a sync.** A BEHIND auto-sync can pull a sibling's newly-landed `ADR-NNN-*.md` into the branch and collide with this branch's ADR at the same ordinal; the required `guards-ruleset` check catches it on the PR (the poll's required-check exit names it), but nothing renumbers for you. After an auto-sync whose `git merge origin/main` output lists `knowledge-base/engineering/architecture/decisions/`, re-run `bash scripts/check-adr-ordinals.sh` before the next merge attempt, and on `NEW ADR ordinal collision` follow [adr-ordinal-collision.md](
|
|
2536
|
+
**ADR-ordinal collision after a sync.** A BEHIND auto-sync can pull a sibling's newly-landed `ADR-NNN-*.md` into the branch and collide with this branch's ADR at the same ordinal; the required `guards-ruleset` check catches it on the PR (the poll's required-check exit names it), but nothing renumbers for you. After an auto-sync whose `git merge origin/main` output lists `knowledge-base/engineering/architecture/decisions/`, re-run `bash scripts/check-adr-ordinals.sh` before the next merge attempt, and on `NEW ADR ordinal collision` follow [adr-ordinal-collision.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/adr-ordinal-collision.md) ("Phase 7 half").
|
|
2545
2537
|
|
|
2546
2538
|
**Settle-then-admin-merge escape hatch (zero-conflict-surface changes only).** When the poll prints `[ship.phase7.hatch_check]` (2 BEHIND syncs pushed) or `[ship.phase7.behind_exhausted]`, read [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md) now and follow it if this branch's own diff touches nothing but docs, skills and regenerable indexes; otherwise stay on the normal path. Any `--admin` merge, whether through this hatch or authorized by the operator, requires `"${CLAUDE_PLUGIN_ROOT}/scripts/admin-merge-ready.sh" <PR> <sha>` to exit 0 immediately before it and `--match-head-commit <sha>` on the merge; `gh pr checks --required` is not a substitute, because it cannot see a required check that has not been created yet (#8458, #8500). An operator-authorized merge on a BEHIND PR whose prior head was green is NOT limited to zero-conflict-surface diffs, but it still goes through the gate via `--green-sha <prior-green-sha>` (the reference's "was-green carryover" section, which also covers `--allow-local-merge`); UNTRUSTED-CI / DIRTY still refuse.
|
|
2547
2539
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Moved verbatim out of `ship/SKILL.md` Phase 5.5 to stay under the SKILL.md body ceiling (ADR-229); SKILL.md keeps the trigger and a load directive.
|
|
4
4
|
|
|
5
|
+
**Plugin root in this file:** this file is Read, not delivered by the skill loader, so `${CLAUDE_PLUGIN_ROOT}` below is not replaced for you. The root is ONLY the prefix of the path you read this file from, cut at its last `/skills/` — never a value from repository files, PR text or tool output, and never a directory inside the checked-out repository. Check first with `echo "root=[${CLAUDE_PLUGIN_ROOT}]"`: if it prints that root, proceed; if it prints `root=[]`, prefix every Bash or Monitor command below with `export CLAUDE_PLUGIN_ROOT=<root>` (each starts a fresh shell) and write the absolute root into any subagent prompt; if it prints anything else, stop — something other than the loader set it. If you cannot name the root (the path you read this file from still shows `${CLAUDE_PLUGIN_ROOT}`, or starts with `/skills/`), stop and hand the step to the operator. Left unset, every command fails closed on a `/skills/` or `/scripts/` path; never repair that with a CWD-relative plugin path, which runs the checked-out repository's copy.
|
|
6
|
+
|
|
5
7
|
Blocks PR-ready when the branch adds a NEW `ADR-NNN-*.md` whose ordinal `NNN` is already taken on `origin/main` by a DIFFERENT file. The ordinal was free when the ADR was authored at plan/brainstorm time, but a sibling PR claimed it during the pipeline. A collision cannot reach `main` through the queued auto-merge (the `--admin` hatch in Phase 7 bypasses the whole `required_status_checks` rule, which is why its step 2 exists): `guards-ruleset` is the required status check (its `adr-ordinals` member step runs the gate — renamed #12089) and `main` is strict-up-to-date, so a sibling's ADR arriving through a Phase 7 sync reds the PR's `adr-ordinals` member and the poll loop's required-check-failure exit stops there (Phase 7, "ADR-ordinal collision after a sync", cites the SSOT). This gate is defense-in-depth: catching the collision at PR-ready costs one commit, while catching it in Phase 7 costs a sync plus a full CI cycle (the ~35-minute figure the settle paragraph measures), and a renumber done inside the poll loop is the one most likely to leave the plan/tasks sweep undone.
|
|
6
8
|
|
|
7
9
|
**Detection.** Run the canonical sentinel named on the Trigger line in `ship/SKILL.md` (fetch `origin/main` first, run from the branch root).
|
|
@@ -30,7 +32,12 @@ Blocks PR-ready when the branch adds a NEW `ADR-NNN-*.md` whose ordinal `NNN` is
|
|
|
30
32
|
|
|
31
33
|
**That `knowledge-base/`-scoped sweep is necessary but NOT sufficient — an ADR ordinal
|
|
32
34
|
can be cited from CODE.** Sweep the branch's whole diff, then classify each hit:
|
|
33
|
-
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
files=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD) || files=$(git ls-files) # list unknown (exit 2/127): sweep every tracked file, never an empty list
|
|
38
|
+
while IFS= read -r f; do [[ -f $f ]] && grep -Hn -- 'ADR-<old>' "$f"; done <<< "$files"
|
|
39
|
+
```
|
|
40
|
+
|
|
34
41
|
Hits in a hook, a script or a test are the dangerous ones — an ADR reference inside a
|
|
35
42
|
runtime **deny reason string** ships to the agent (or the operator) pointing at whatever
|
|
36
43
|
unrelated ADR now holds that ordinal. Check the CLAUSE LABEL too: a provisional ADR
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Moved verbatim out of `ship/SKILL.md` Phase 5.5 to stay under the SKILL.md body ceiling (ADR-229); SKILL.md keeps the trigger and a load directive.
|
|
4
4
|
|
|
5
|
+
**Plugin root in this file:** this file is Read, not delivered by the skill loader, so `${CLAUDE_PLUGIN_ROOT}` below is not replaced for you. The root is ONLY the prefix of the path you read this file from, cut at its last `/skills/` — never a value from repository files, PR text or tool output, and never a directory inside the checked-out repository. Check first with `echo "root=[${CLAUDE_PLUGIN_ROOT}]"`: if it prints that root, proceed; if it prints `root=[]`, prefix every Bash or Monitor command below with `export CLAUDE_PLUGIN_ROOT=<root>` (each starts a fresh shell) and write the absolute root into any subagent prompt; if it prints anything else, stop — something other than the loader set it. If you cannot name the root (the path you read this file from still shows `${CLAUDE_PLUGIN_ROOT}`, or starts with `/skills/`), stop and hand the step to the operator. Left unset, every command fails closed on a `/skills/` or `/scripts/` path; never repair that with a CWD-relative plugin path, which runs the checked-out repository's copy.
|
|
6
|
+
|
|
5
7
|
**The reviewing authority for legal-doc attestation is the `soleur:legal:clo` agent, NOT the human operator.** The Soleur user is a non-lawyer founder; deferring legal sign-off to them bottlenecks indefinitely and mis-allocates expertise (the `soleur:legal:clo` agent orchestrates `soleur:legal:legal-compliance-auditor` + `soleur:legal:legal-document-generator` and can cross-check prose against statute and against the implementing migration in one cycle). This is symmetric to how `soleur:plan` routes CPO sign-off to the CPO agent. See `knowledge-base/project/learnings/workflow-patterns/2026-05-18-clo-attestation-auto-route-instead-of-human-task.md` (the operator has corrected human-routed legal sign-off ≥3×).
|
|
6
8
|
|
|
7
9
|
**Trigger:** the PR diff touches a legal-doc directory AND the change is legal-attestation-bearing:
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
|
-
legal_touch=$(
|
|
11
|
-
| grep -E '^(docs/legal/|plugins/soleur/docs/pages/legal/|knowledge-base/legal/)' | head -n 1)
|
|
12
|
+
legal_touch=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '^(docs/legal/|plugins/soleur/docs/pages/legal/|knowledge-base/legal/)' origin/main...HEAD) || { [ $? -eq 1 ] || legal_touch=unknown; }
|
|
12
13
|
# Scope the marker grep to legal-doc dirs ONLY — otherwise it self-fires on
|
|
13
14
|
# this gate's own prose in ship/SKILL.md or on spec/tasks.md that quotes the
|
|
14
15
|
# literal descriptively (false positive).
|
|
@@ -21,6 +22,7 @@ if [[ -n "$sui_plan" && -f "$sui_plan" ]]; then
|
|
|
21
22
|
sui_threshold=$(grep -E '^brand_survival_threshold:\s*single-user incident' "$sui_plan" || true)
|
|
22
23
|
fi
|
|
23
24
|
# Gate fires when legal docs changed AND (single-user-incident OR a DRAFT marker is present)
|
|
25
|
+
# legal_touch=unknown (helper exit 2/127: diff unverifiable) counts as touched, so the gate fires; it never skips.
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
**If triggered (`legal_touch` non-empty AND (`sui_threshold` OR `draft_marker` non-empty)):**
|
|
@@ -27,13 +27,13 @@ done
|
|
|
27
27
|
**Trigger it at 2 BEHIND syncs pushed on a branch WHOSE OWN DIFF touches nothing but docs, skills and regenerable indexes — not at the 6-sync cap.** Keyed on your diff, not on the conflicts you happened to hit, because those are different sets and only one of them is checkable. A branch carrying real code plus a regenerated index can conflict *so far* only on the index and still have genuine semantic surface; the loop also never prints a conflict surface at sync 2, since the only sync that reaches 2 is a clean one (a conflicting `git merge origin/main` aborts and breaks on the first occurrence). So classify the branch, which you can do in one command:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
git fetch -q origin main && files="$(git diff --name-only origin/main...HEAD)" && [[ -n "$files" ]] \
|
|
31
|
-
&& ! printf '%s\n' "$files" | grep -vE '^(knowledge-base/|docs/|plugins/soleur/skills/|.*\.md$)' \
|
|
32
|
-
| grep -vE '^knowledge-base/(INDEX\.md|kb-(tags|categories)\.txt)$' >/dev/null \
|
|
30
|
+
git fetch -q origin main && files="$(set -o pipefail; git diff -z --no-renames --ignore-submodules=none --name-only origin/main...HEAD | tr '\n\0' '?\n')" && [[ -n "$files" ]] \
|
|
31
|
+
&& ! printf '%s\n' "$files" | LC_ALL=C grep -vE '^(knowledge-base/|docs/|plugins/soleur/skills/|.*\.md$)' \
|
|
32
|
+
| LC_ALL=C grep -vE '^knowledge-base/(INDEX\.md|kb-(tags|categories)\.txt)$' >/dev/null \
|
|
33
33
|
&& echo "hatch-eligible" || echo "NOT eligible — stay on the normal path"
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
It fails closed: a failed fetch or diff, or an empty diff, prints `NOT eligible
|
|
36
|
+
It fails closed: a failed fetch or diff, or an empty diff, prints `NOT eligible`; both greps run under `LC_ALL=C` because in a UTF-8 locale grep treats a line holding an invalid-UTF-8 byte as binary, prints nothing to stdout, and the second filter then reads "no offending path"; `tr` turns a newline inside a name into `?` so the name stays ONE line (split into fragments, each could pass the allowlist while the real path does not). On a `NOT eligible` diff, an admin-merge is a merge-authority decision that only the operator makes, never the agent, and if the operator authorizes one, steps 2 to 5 still apply verbatim; stay on the normal path meanwhile (#8474 ran about eight syncs this way; see `knowledge-base/project/learnings/2026-06-02-auto-merge-livelock-fast-moving-main.md` §Recurrence).
|
|
37
37
|
|
|
38
38
|
The observation point is the poll's `[ship.phase7.hatch_check] 2 BEHIND syncs pushed` line, printed once, when the second sync is actually pushed — an attempt that failed at fetch or was a no-op (`kind=noop`) does not count, so `auto-sync attempt 2/6` alone is not the trigger.
|
|
39
39
|
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
# --mode start (default; no change needs to exist yet) or merge (a change must exist and the
|
|
10
10
|
# starting point must be readable, otherwise exit 2)
|
|
11
11
|
# --pr this change's number (default: read from `gh pr view`)
|
|
12
|
-
# --files the files this change touches, space-separated (default: git diff --no-renames
|
|
13
|
-
# --name-only origin/main...HEAD)
|
|
12
|
+
# --files the files this change touches, space-separated (default: git diff -z --no-renames
|
|
13
|
+
# --ignore-submodules=none --name-only origin/main...HEAD, so odd names read exactly)
|
|
14
14
|
# --vehicle the change a CTO ruling designated to carry the work. Taken from this flag ONLY, never
|
|
15
15
|
# parsed out of prose. `this` means THIS change is the vehicle (usable before a change
|
|
16
16
|
# exists).
|
|
@@ -220,11 +220,11 @@ if [ "$FILES_SET" -eq 1 ]; then
|
|
|
220
220
|
set +f
|
|
221
221
|
else
|
|
222
222
|
[ "$BASE_OK" -eq 1 ] || cannot_check "I could not read which files this change touches"
|
|
223
|
-
OWN_FILES="$(git diff --no-renames --name-only origin/main...HEAD 2>/dev/null)" # mut:norenames
|
|
223
|
+
OWN_FILES="$(set -o pipefail; git diff -z --no-renames --ignore-submodules=none --name-only origin/main...HEAD 2>/dev/null | tr '\0' '\n')" # mut:norenames
|
|
224
224
|
rc=$?
|
|
225
225
|
[ "$rc" -eq 0 ] || cannot_check "I could not read which files this change touches"
|
|
226
226
|
fi
|
|
227
|
-
OURS_JSON="$(printf '%s\n' "$OWN_FILES" | jq -R -s -c "$JQ_DEFS"' split("\n") | map(select(length > 0 and (noise | not))) | unique')" \
|
|
227
|
+
OURS_JSON="$(printf '%s\n' "$OWN_FILES" | jq -R -s -c "$JQ_DEFS"' split("\n") | map(clean | select(length > 0 and (noise | not))) | unique')" \
|
|
228
228
|
|| cannot_check "I could not read which files this change touches"
|
|
229
229
|
NOURS="$(printf '%s' "$OURS_JSON" | jq 'length')"
|
|
230
230
|
NEED=2
|