3.3 KiB
CONTRACT — rules-h3-extract
- date: 2026-10-27 | flow: feat | branch: feature/rules-h3-extract (off develop
925dafa) - status: active
REQUEST (verbatim — IMMUTABLE)
lib/project-rules.sh: extract accepts a ### heading (the section ends at the next heading of the same or higher level, outside a fence; ## behaviour unchanged), sections gains --depth 3 listing ### subsections with their sizes (default stays ## only), tests in lib/tests/project-rules.test.sh, and the /onboard split S4 text names the ### option. Needed before the phase 0b split of faunosteo, whose path-bound content (12.6 KB) sits in ### subsections of the always-on ## Project conventions.
(user, same turn: "ok merge it et enchaine sur les feat"; earlier gate answer: "Oui, /feat d'abord" to "extract accepte un titre ###, sections --depth 3; faunosteo passe ensuite".)
CLARIFICATIONS
(pass A: none — request complete)
Q: how does a row or an extract call name a ### section? / A: the heading argument carries its prefix ('### Supabase'; a bare heading still means ##), no --level flag [gated 2026-10-27]
Q: sections --depth 3, a ## parent's size? / A: whole section, children included (same number as depth 2) [gated 2026-10-27]
ACCEPTANCE CRITERIA
extract <file> '### <title>' <out> <globs>moves the###section: the rule holds# <title>+ its body, the source loses exactly that section, the parent##and the next heading of level ≤ 3 stay. CHECK: bash lib/tests/project-rules.test.sh | tail -1 EXPECT: FAIL=0 EVIDENCE: MET exit=0 marker-found :: PASS=116 FAIL=0- A
###section ends at the next#,##or###heading outside a fence; a####line or a fenced###line never ends it. - A bare heading argument still means
##(every existing extract test unchanged); a heading argument of level 1 or ≥ 4 is rc 2 with nothing written. sections <file>output is unchanged (##only);sections --depth 3 <file>adds one<chars>\t<line>\t### <title>line per subsection, lines in file order;--depthother than 2 or 3 is rc 2.lib/project-rules.shstays shellcheck clean, every line ≤ 80 chars, functions ≤ 25 logic lines and ≤ 5 locals. CHECK: shellcheck lib/project-rules.sh lib/tests/project-rules.test.sh && [ -z "$(awk 'length > 80' lib/project-rules.sh)" ] && echo WIDTH-OK EXPECT: WIDTH-OK EVIDENCE: MET exit=0 marker-found :: WIDTH-OKskills/onboard/SKILL.md§ SPLIT MODE S4 namessections --depth 3and the### <title>row form;agents/onboarder.mdMODE: split S0/S1 accept a###row (uniqueness checked at depth 3, the prefix passed toextractas is).make testall GREEN (doctrine-citers, routing locks, project-rules). CHECK: make test 2>&1 | tail -1 EXPECT: all suites green EVIDENCE: MET exit=0 marker-found :: all suites greenbash lib/project-rules.sh checkstill prints4 rule(s) okon this repo andsections CLAUDE.mdstill lists 2 sections. CHECK: bash lib/project-rules.sh check | tail -1 && [ "$(bash lib/project-rules.sh sections CLAUDE.md | wc -l)" = 2 ] && echo SECTIONS-OK EXPECT: SECTIONS-OK EVIDENCE: MET exit=0 marker-found :: project-rules: 4 rule(s) ok SECTIONS-OK
FILE SCOPE
lib/project-rules.sh, lib/tests/project-rules.test.sh, skills/onboard/SKILL.md (§ SPLIT MODE S4/S5), agents/onboarder.md (§ MODE: split S0, S1)