fix(story-mode): a bare repository with flags first is no new project repository, and an error is no empty answer

`git init -q --bare ../origin.git` (flags before --bare) counted as Claude
starting the project's repository. And a last step that printed a usage
message or an error (`error: unknown option`, `grep: x: No such file`)
read as "the last check finds nothing"; it now fails, as it did.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-18 16:48:38 +02:00
1 parent 2ec74273f0
commit 1dd167ebe0
2 files changed
+16 -3

No files matched your search

+8 -2
View File
@@ -2307,7 +2307,13 @@ function checkName(e: StoryEvent | undefined): string {
const EMPTY_ANSWER_STEP = /(?:^|[;&|]\s*)(?:e?grep|fgrep|rg|git config|test|\[|which|command -v)\s[^;&|]*$/;
const emptyAnswer = (e: StoryEvent): boolean => {
const out = e.output ?? '';
return e.ok === false && /^Exit code 1\n\s*\S/.test(out) && EMPTY_ANSWER_STEP.test(e.label.trim());
// A usage message or an error is a step that went wrong, not an empty answer.
return (
e.ok === false &&
/^Exit code 1\n\s*\S/.test(out) &&
!/^\s*(usage|error|fatal|grep):/im.test(out) &&
EMPTY_ANSWER_STEP.test(e.label.trim())
);
};
/** One or two files by name ("calc.py and test_calc.py"), more by count ("3 files"). */
@@ -2717,7 +2723,7 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
const earlier = events.slice(0, firstAt);
const startsRepo =
!earlier.some((e) => (e.commits ?? 0) > 0) &&
[...earlier, ...evs].some((e) => e.tool === 'Bash' && /\bgit init\b(?!\s+--bare)/.test(e.label));
[...earlier, ...evs].some((e) => e.tool === 'Bash' && /\bgit init\b(?![^;&|\n]*\s--bare\b)/.test(e.label));
const lead = [
startsRepo ? 'starts a git repository' : '',
wrote.length ? `writes ${fileWords(wrote)}` : '',