mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-17 19:59:33 +01:00
fix(story-mode): git lookups right after a save read "Claude checks what it saved"
From both round-11 readers: `git --git-dir=origin.git log -1 master; git status -sb | head -1` after a push read "Claude looks around the project", so a reader could not tell the save was verified. A look made only of git lookups (log, status, show, ls-remote, …, piped to head or tail) after a save in the same turn now reads "Claude checks what it saved." Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
84c4be2d77
commit
1a66dbabfb
4 files changed
+31
-4
No files matched your search
+9
-1
@@ -2434,6 +2434,10 @@ function touchedBefore(file: string, before: StoryEvent[]): boolean {
|
|||||||
return before.some((e) => editsOf(e).some((d) => d.file === file));
|
return before.some((e) => editsOf(e).some((d) => d.file === file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A command made only of git lookups ("git log --oneline; git status -sb", "git -C origin.git log"). */
|
||||||
|
const GIT_LOOK =
|
||||||
|
/^(?:(?:git (?:-C \S+ |--git-dir=\S+ )?(?:log|status|show|ls-remote|branch|remote|describe|rev-parse|diff)\b[^;&|\n]*|(?:echo|head|tail|wc|sort)\b[^;&|\n]*)\s*(?:&&|\|\||;|\||\n|$)\s*)+$/;
|
||||||
|
|
||||||
/** One or two files by name ("calc.py and test_calc.py"), more by count ("3 files"). */
|
/** One or two files by name ("calc.py and test_calc.py"), more by count ("3 files"). */
|
||||||
const fileWords = (files: string[], noun = 'file'): string =>
|
const fileWords = (files: string[], noun = 'file'): string =>
|
||||||
files.length && files.length <= 2 ? files.map((f) => basename(f)).join(' and ') : plural(files.length, noun);
|
files.length && files.length <= 2 ? files.map((f) => basename(f)).join(' and ') : plural(files.length, noun);
|
||||||
@@ -2543,6 +2547,8 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
|
|||||||
const shown = files.filter((f) => !/(^|\/)\.codeman[-.]/.test(f));
|
const shown = files.filter((f) => !/(^|\/)\.codeman[-.]/.test(f));
|
||||||
// A file or two by name; in a turn a report started, reading is checking what came back.
|
// A file or two by name; in a turn a report started, reading is checking what came back.
|
||||||
const checking = turn.origin === 'task' || turn.origin === 'peer';
|
const checking = turn.origin === 'task' || turn.origin === 'peer';
|
||||||
|
// Only git lookups (log, status, ls-remote) after a save in this turn: Claude checks its save.
|
||||||
|
const savedBefore = events.slice(0, Math.min(...draft.events)).some((e) => (e.commits ?? 0) > 0 || !!e.ships);
|
||||||
const named = shown.map((f) => basename(f));
|
const named = shown.map((f) => basename(f));
|
||||||
story = evs.every((e) => e.tool === 'ToolSearch')
|
story = evs.every((e) => e.tool === 'ToolSearch')
|
||||||
? evs.some((e) => /PlanMode/.test(e.label))
|
? evs.some((e) => /PlanMode/.test(e.label))
|
||||||
@@ -2554,7 +2560,9 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
|
|||||||
? `Claude reads ${plural(shown.length, 'file')} to find its way around.`
|
? `Claude reads ${plural(shown.length, 'file')} to find its way around.`
|
||||||
: evs.every((e) => e.intent === 'search')
|
: evs.every((e) => e.intent === 'search')
|
||||||
? 'Claude searches the code.'
|
? 'Claude searches the code.'
|
||||||
: 'Claude looks around the project.';
|
: savedBefore && evs.every((e) => e.tool === 'Bash' && GIT_LOOK.test(e.label.trim()))
|
||||||
|
? 'Claude checks what it saved.'
|
||||||
|
: 'Claude looks around the project.';
|
||||||
// A tool lookup's query (`select:EnterPlanMode,ExitPlanMode`) means nothing to a reader.
|
// A tool lookup's query (`select:EnterPlanMode,ExitPlanMode`) means nothing to a reader.
|
||||||
if (evs.every((e) => e.tool === 'ToolSearch')) panel.notes = [];
|
if (evs.every((e) => e.tool === 'ToolSearch')) panel.notes = [];
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -205,7 +205,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "investigate",
|
"kind": "investigate",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude looks around the project.",
|
"story": "Claude checks what it saved.",
|
||||||
"unaskedSave": false,
|
"unaskedSave": false,
|
||||||
"director": "Bash · git --git-dir=origin.git log --oneline master; git status -…",
|
"director": "Bash · git --git-dir=origin.git log --oneline master; git status -…",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
@@ -298,7 +298,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "investigate",
|
"kind": "investigate",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude looks around the project.",
|
"story": "Claude checks what it saved.",
|
||||||
"unaskedSave": false,
|
"unaskedSave": false,
|
||||||
"director": "Bash · git --git-dir=origin.git log --oneline -1 master; git statu…",
|
"director": "Bash · git --git-dir=origin.git log --oneline -1 master; git statu…",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
|
|||||||
@@ -313,7 +313,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "investigate",
|
"kind": "investigate",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude looks around the project.",
|
"story": "Claude checks what it saved.",
|
||||||
"unaskedSave": false,
|
"unaskedSave": false,
|
||||||
"director": "Bash · git log --oneline",
|
"director": "Bash · git log --oneline",
|
||||||
"balloon": "Step 16:",
|
"balloon": "Step 16:",
|
||||||
|
|||||||
@@ -1084,6 +1084,25 @@ describe('buildStoryPage', () => {
|
|||||||
expect(page.panels.map((p) => p.caption.story)).toContain('Claude changes run.sh; the tests pass.');
|
expect(page.panels.map((p) => p.caption.story)).toContain('Claude changes run.sh; the tests pass.');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('git lookups after a save are Claude checking its save, and stay fast on a crafted command', () => {
|
||||||
|
const look = (saveFirst: boolean, command: string) =>
|
||||||
|
pageOf([
|
||||||
|
prompt('go'),
|
||||||
|
...(saveFirst ? bash('b0', 'git commit -qm "add a"', 'Commit', '') : []),
|
||||||
|
...bash('b1', command, 'Look', 'ok'),
|
||||||
|
end(1000),
|
||||||
|
]).panels.find((p) => p.kind === 'investigate')?.caption.story;
|
||||||
|
expect(look(true, 'git --git-dir=origin.git log --oneline -1 master; git status -sb | head -1')).toBe(
|
||||||
|
'Claude checks what it saved.'
|
||||||
|
);
|
||||||
|
expect(look(false, 'git log --oneline; git status -sb | head -1')).toBe('Claude looks around the project.');
|
||||||
|
// The wording reads the event's display label (clipped), so a long command costs nothing; the
|
||||||
|
// panel's kind still comes from the whole command.
|
||||||
|
const start = performance.now();
|
||||||
|
expect(look(true, `git log ${'a '.repeat(100_000)}&& cat x`)).toBeTypeOf('string');
|
||||||
|
expect(performance.now() - start).toBeLessThan(1500);
|
||||||
|
});
|
||||||
|
|
||||||
it('a short ending keeps the sentence that leaves something open', () => {
|
it('a short ending keeps the sentence that leaves something open', () => {
|
||||||
const page = pageOf([
|
const page = pageOf([
|
||||||
prompt('run them'),
|
prompt('run them'),
|
||||||
|
|||||||
Reference in new issue
Block a user