fix: close what an independent review found in the trial 2 fixes

- The pre-compact hook read only a checkpoint that started with `git commit`,
  so every plan in the new `git add … && git commit` form rebuilt nothing, and
  an empty match also skipped the session-state refresh. It now finds the
  commit anywhere in the span and always refreshes; first test for the hook.
- A sub-bullet that carries its own command stays a criterion (folding it
  left the command unrun); the shallowest bullet sets the base indent.
- Only a MINOR/SUGGESTION /code-review finding outside the range is released
  from forbidding ALLOW: a MAJOR one may be a break cited at an unchanged
  caller.
- `reuse` is an improvement category; the session-spec template stages too;
  a negated bash 3.2 constraint, an env prefix and `bash -c` are handled.
- Stale comment, Declined-to-Judge wording and rule-key counts brought in line.

Tests fail on 7c11c2a first (9 of 24).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-08 15:21:56 +02:00
commit b0d96a2d53
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
13 changed files with 194 additions and 54 deletions

View file

@ -63,7 +63,10 @@ function readPlanCheckpointPatterns(planPath) {
const text = readFileSync(planPath, 'utf-8');
const map = new Map();
const stepRe = /^### Step (\d+):/gm;
const checkpointRe = /\*\*Checkpoint:\*\*\s+`git commit -m "([^"]+)"`/;
// The commit may follow a `git add … &&` inside the same span (plan template
// since lekerepo trial 2, 2026-10-08); the old pattern matched only a span
// that STARTED with `git commit` and so read every new plan as empty.
const checkpointRe = /\*\*Checkpoint:\*\*\s+`[^`]*?\bgit commit -m "([^"]+)"[^`]*`/;
const headings = [];
let m;
while ((m = stepRe.exec(text)) !== null) {
@ -150,14 +153,12 @@ for (const { projDir, progPath, planPath } of progressFiles) {
const repoRoot = repoRootOf(projDir);
if (!repoRoot) continue;
// No recognisable checkpoint or no start sha means nothing to derive, but the
// session-state refresh below still runs: it is independent of the step.
const plan = readPlanCheckpointPatterns(planPath);
if (plan.size === 0) continue;
const sessionStart = progress.session_start_sha;
if (!sessionStart) continue;
const commits = gitLog(repoRoot, sessionStart);
const derivedStep = deriveCurrentStep(progress, plan, commits);
const commits = plan.size > 0 && sessionStart ? gitLog(repoRoot, sessionStart) : [];
const derivedStep = commits.length > 0 ? deriveCurrentStep(progress, plan, commits) : null;
if (derivedStep !== null && derivedStep > (progress.current_step || 0)) {
progress.current_step = derivedStep;