mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-20 13:09:33 +01:00
fix(story-mode): name the files, say when a repository is new, and when a push stayed on this computer
From review round 9 (a newcomer to the project): - One or two files are named, not counted: "Claude writes .gitignore and saves the work", "Claude changes rename_by_date.sh.", "Claude writes the new files mathx.py and test_mathx.py." Three or more are counted. - The first save in a folder Claude turned into a repository says so: "Claude starts a git repository and saves the work: …". A `git init --bare` (the push target) does not count, nor a folder that already had commits. - A push to a repository in a folder on this computer (`To ./origin.git`) is a copy, not an upload: "then copies it to origin.git, a folder on this computer", and the final chip reads "copied to origin.git". - A tool lookup for plan mode reads "Claude gets ready to plan." Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a80638308b
commit
70b1ebcc19
16 files changed
+148
-67
No files matched your search
+45
-12
@@ -2289,6 +2289,10 @@ function checkName(e: StoryEvent | undefined): string {
|
|||||||
return 'another check';
|
return 'another check';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** One or two files by name ("calc.py and test_calc.py"), more by count ("3 files"). */
|
||||||
|
const fileWords = (files: string[], noun = 'file'): string =>
|
||||||
|
files.length && files.length <= 2 ? files.map((f) => basename(f)).join(' and ') : plural(files.length, noun);
|
||||||
|
|
||||||
/** You asked for a failing run first (test first), or Claude said the failure was expected. */
|
/** You asked for a failing run first (test first), or Claude said the failure was expected. */
|
||||||
const PLANNED_IN_PROMPT =
|
const PLANNED_IN_PROMPT =
|
||||||
/\b(test[- ]first|tdd|fail(s|ing)? (first|on purpose)|failing tests? first|on purpose|red first|before (the )?(code|module|function|implementation) exists)\b/i;
|
/\b(test[- ]first|tdd|fail(s|ing)? (first|on purpose)|failing tests? first|on purpose|red first|before (the )?(code|module|function|implementation) exists)\b/i;
|
||||||
@@ -2374,7 +2378,9 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
|
|||||||
const checking = turn.origin === 'task' || turn.origin === 'peer';
|
const checking = turn.origin === 'task' || turn.origin === 'peer';
|
||||||
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')
|
||||||
? 'Claude gets the tools it needs ready.'
|
? evs.some((e) => /PlanMode/.test(e.label))
|
||||||
|
? 'Claude gets ready to plan.'
|
||||||
|
: 'Claude gets the tools it needs ready.'
|
||||||
: shown.length && shown.length <= 2
|
: shown.length && shown.length <= 2
|
||||||
? `Claude ${checking ? 'checks' : 'reads'} ${named.join(' and ')}.`
|
? `Claude ${checking ? 'checks' : 'reads'} ${named.join(' and ')}.`
|
||||||
: shown.length
|
: shown.length
|
||||||
@@ -2452,11 +2458,13 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
|
|||||||
edits.length > 0 && edits.every((d) => d.created || d.hunks.every((h) => !h.oldStart && !h.oldLines));
|
edits.length > 0 && edits.every((d) => d.created || d.hunks.every((h) => !h.oldStart && !h.oldLines));
|
||||||
story =
|
story =
|
||||||
created && created === files.length
|
created && created === files.length
|
||||||
? `Claude writes ${plural(created, 'new file')}.`
|
? files.length <= 2
|
||||||
|
? `Claude writes the new ${files.length === 1 ? 'file' : 'files'} ${fileWords(files)}.`
|
||||||
|
: `Claude writes ${plural(created, 'new file')}.`
|
||||||
: whole && files.length
|
: whole && files.length
|
||||||
? `Claude writes ${plural(files.length, 'file')}.`
|
? `Claude writes ${fileWords(files)}.`
|
||||||
: files.length
|
: files.length
|
||||||
? `Claude changes ${plural(files.length, 'file')}.`
|
? `Claude changes ${fileWords(files)}.`
|
||||||
: 'Claude changes a file.';
|
: 'Claude changes a file.';
|
||||||
const perFile = files.slice(0, 3).map((f) => {
|
const perFile = files.slice(0, 3).map((f) => {
|
||||||
const mine = edits.filter((e) => e.file === f);
|
const mine = edits.filter((e) => e.file === f);
|
||||||
@@ -2571,8 +2579,8 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
|
|||||||
tests.errors ? `, ${plural(tests.errors, 'error')}` : ''
|
tests.errors ? `, ${plural(tests.errors, 'error')}` : ''
|
||||||
}`;
|
}`;
|
||||||
if (edits.length) director += ` · writes ${plural(unique(edits.map((d) => d.file)).length, 'file')}`;
|
if (edits.length) director += ` · writes ${plural(unique(edits.map((d) => d.file)).length, 'file')}`;
|
||||||
const written = unique(edits.map((d) => d.file)).length;
|
const written = unique(edits.map((d) => d.file));
|
||||||
if (written) story = `Claude writes ${plural(written, 'file')}; ${story[0].toLowerCase()}${story.slice(1)}`;
|
if (written.length) story = `Claude writes ${fileWords(written)}; ${story[0].toLowerCase()}${story.slice(1)}`;
|
||||||
const saved = checks.reduce((n, e) => n + (e.commits ?? 0), 0);
|
const saved = checks.reduce((n, e) => n + (e.commits ?? 0), 0);
|
||||||
if (saved) {
|
if (saved) {
|
||||||
director += ` · ${plural(saved, 'commit')}`;
|
director += ` · ${plural(saved, 'commit')}`;
|
||||||
@@ -2627,6 +2635,13 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
|
|||||||
const inCommits = commits > 1 ? ` in ${commits} commits` : '';
|
const inCommits = commits > 1 ? ` in ${commits} commits` : '';
|
||||||
// A push of commits made earlier: nothing is saved here, only uploaded.
|
// A push of commits made earlier: nothing is saved here, only uploaded.
|
||||||
const uploadOnly = ships === 'push' && !commits;
|
const uploadOnly = ships === 'push' && !commits;
|
||||||
|
// A push to a folder on this computer (a repository beside the project, `To ./origin.git`) is a
|
||||||
|
// copy, not an upload: nothing left the machine.
|
||||||
|
const target = /^To (\S+)/m.exec(evs.map((e) => e.output ?? '').join('\n'))?.[1];
|
||||||
|
const localTarget =
|
||||||
|
target && (/^file:\/\//.test(target) || !/:/.test(target)) ? basename(target.replace(/\/+$/, '')) : '';
|
||||||
|
const uploads = (what: string) =>
|
||||||
|
localTarget ? `copies ${what} to ${localTarget}, a folder on this computer` : `uploads ${what}`;
|
||||||
// One commit: its message says what was saved.
|
// One commit: its message says what was saved.
|
||||||
const subject = commits === 1 ? evs.find((e) => e.subject)?.subject : undefined;
|
const subject = commits === 1 ? evs.find((e) => e.subject)?.subject : undefined;
|
||||||
// Its conventional prefix (`feat:`, `chore(deps):`) is for git, not for the reader.
|
// Its conventional prefix (`feat:`, `chore(deps):`) is for git, not for the reader.
|
||||||
@@ -2634,9 +2649,9 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
|
|||||||
const said = plainSubject ? `: "${clip(plainSubject, 60).replace(/[.]$/, '')}"` : '';
|
const said = plainSubject ? `: "${clip(plainSubject, 60).replace(/[.]$/, '')}"` : '';
|
||||||
story = savedAnyway
|
story = savedAnyway
|
||||||
? uploadOnly
|
? uploadOnly
|
||||||
? 'Claude uploads the work, but a step after that fails.'
|
? `Claude ${uploads('the work')}, but a step after that fails.`
|
||||||
: ships === 'push'
|
: ships === 'push'
|
||||||
? `Claude saves the work${inCommits} and uploads it, but a step after that fails.`
|
? `Claude saves the work${inCommits} and ${uploads('it')}, but a step after that fails.`
|
||||||
: `Claude saves the work${inCommits}, but a step after that fails.`
|
: `Claude saves the work${inCommits}, but a step after that fails.`
|
||||||
: panel.ok === false
|
: panel.ok === false
|
||||||
? ships === 'pr'
|
? ships === 'pr'
|
||||||
@@ -2647,12 +2662,30 @@ function decorate(draft: DraftPanel, events: StoryEvent[], turn: StoryTurn, inde
|
|||||||
: ships === 'pr'
|
: ships === 'pr'
|
||||||
? 'Claude opens a pull request.'
|
? 'Claude opens a pull request.'
|
||||||
: uploadOnly
|
: uploadOnly
|
||||||
? 'Claude uploads the work.'
|
? `Claude ${uploads('the work')}.`
|
||||||
: ships === 'push'
|
: ships === 'push'
|
||||||
? `Claude saves the work${inCommits} and uploads it${said}.`
|
? localTarget && said
|
||||||
|
? `Claude saves the work${said}, then ${uploads('it')}.`
|
||||||
|
: `Claude saves the work${inCommits} and ${uploads('it')}${said}.`
|
||||||
: `Claude saves the work${inCommits}${said}.`;
|
: `Claude saves the work${inCommits}${said}.`;
|
||||||
const wrote = unique(edits.map((d) => d.file)).length;
|
const wrote = unique(edits.map((d) => d.file));
|
||||||
if (wrote && story.startsWith('Claude ')) story = `Claude writes ${plural(wrote, 'file')} and ${story.slice(7)}`;
|
const firstAt = Math.min(...draft.events);
|
||||||
|
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));
|
||||||
|
const lead = [
|
||||||
|
startsRepo ? 'starts a git repository' : '',
|
||||||
|
wrote.length ? `writes ${fileWords(wrote)}` : '',
|
||||||
|
].filter(Boolean);
|
||||||
|
if (lead.length && story.startsWith('Claude ')) {
|
||||||
|
// "starts a git repository, saves the work and uploads it": never "and … and".
|
||||||
|
const rest = story.slice(7);
|
||||||
|
story =
|
||||||
|
lead.length === 2
|
||||||
|
? `Claude ${lead.join(', ')}, and ${rest}`
|
||||||
|
: `Claude ${lead[0]}${rest.split('"')[0].includes(' and ') ? ',' : ' and'} ${rest}`;
|
||||||
|
}
|
||||||
director = `${evs.map(shortCommand).slice(0, 2).join(' · ')}${errors ? ` · ${plural(errors, 'error')}` : ''}${
|
director = `${evs.map(shortCommand).slice(0, 2).join(' · ')}${errors ? ` · ${plural(errors, 'error')}` : ''}${
|
||||||
edits.length ? ` · writes ${plural(unique(edits.map((d) => d.file)).length, 'file')}` : ''
|
edits.length ? ` · writes ${plural(unique(edits.map((d) => d.file)).length, 'file')}` : ''
|
||||||
}`;
|
}`;
|
||||||
|
|||||||
@@ -2544,9 +2544,21 @@ Object.assign(CodemanApp.prototype, {
|
|||||||
const shipped = page.events.some(
|
const shipped = page.events.some(
|
||||||
(e) => e.ships === 'push' && (e.ok !== false || /\[new branch\]|\S+\.\.\S+\s+\S+\s+->/.test(e.output || ''))
|
(e) => e.ships === 'push' && (e.ok !== false || /\[new branch\]|\S+\.\.\S+\s+\S+\s+->/.test(e.output || ''))
|
||||||
);
|
);
|
||||||
|
// A push to a folder on this computer (`To ./origin.git`) is a copy: nothing left the machine.
|
||||||
|
const target = /^To (\S+)/m.exec(
|
||||||
|
page.events
|
||||||
|
.filter((e) => e.ships === 'push')
|
||||||
|
.map((e) => e.output || '')
|
||||||
|
.join('\n')
|
||||||
|
)?.[1];
|
||||||
|
const copiedTo =
|
||||||
|
target && (/^file:\/\//.test(target) || !target.includes(':')) ? target.split('/').filter(Boolean).pop() : '';
|
||||||
if (commits || shipped)
|
if (commits || shipped)
|
||||||
items.push({
|
items.push({
|
||||||
text: [commits ? `${commits} commit${commits === 1 ? '' : 's'}` : '', shipped ? 'uploaded' : '']
|
text: [
|
||||||
|
commits ? `${commits} commit${commits === 1 ? '' : 's'}` : '',
|
||||||
|
shipped ? (copiedTo ? `copied to ${copiedTo}` : 'uploaded') : '',
|
||||||
|
]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(', '),
|
.join(', '),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude writes 2 new files.",
|
"story": "Claude writes the new files wordcount.py and test_basic.py.",
|
||||||
"director": "Write ×2 · wordcount.py +23 · test_basic.py +21",
|
"director": "Write ×2 · wordcount.py +23 · test_basic.py +21",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude changes 2 files.",
|
"story": "Claude changes rename_by_date.sh and -dash.jpg.",
|
||||||
"director": "Write · Edit ×3 · Bash · rename_by_date.sh +95 −3 · -dash.jpg +1",
|
"director": "Write · Edit ×3 · Bash · rename_by_date.sh +95 −3 · -dash.jpg +1",
|
||||||
"balloon": "Now I'll create the samples and run the dry run.",
|
"balloon": "Now I'll create the samples and run the dry run.",
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude changes 1 file.",
|
"story": "Claude changes rename_by_date.sh.",
|
||||||
"director": "Edit ×3 · rename_by_date.sh +21 −6",
|
"director": "Edit ×3 · rename_by_date.sh +21 −6",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude changes 1 file.",
|
"story": "Claude changes README.md.",
|
||||||
"director": "Edit ×3 · README.md +18 −2",
|
"director": "Edit ×3 · README.md +18 −2",
|
||||||
"balloon": "All passing.",
|
"balloon": "All passing.",
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude writes 2 new files.",
|
"story": "Claude writes the new files mathx.py and test_mathx.py.",
|
||||||
"director": "Write ×2 · mathx.py +11 · test_mathx.py +26 · after 1 second opinion",
|
"director": "Write ×2 · mathx.py +11 · test_mathx.py +26 · after 1 second opinion",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude saves the work: \"add clamp() with pytest coverage\".",
|
"story": "Claude starts a git repository and saves the work: \"add clamp() with pytest coverage\".",
|
||||||
"director": "git commit -q -F -",
|
"director": "git commit -q -F -",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "investigate",
|
"kind": "investigate",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude gets the tools it needs ready.",
|
"story": "Claude gets ready to plan.",
|
||||||
"director": "ToolSearch",
|
"director": "ToolSearch",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude changes 2 files.",
|
"story": "Claude changes mathx.py and test_mathx.py.",
|
||||||
"director": "Edit ×3 · mathx.py +11 · test_mathx.py +20 −1",
|
"director": "Edit ×3 · mathx.py +11 · test_mathx.py +20 −1",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude writes 1 new file.",
|
"story": "Claude writes the new file test_calc_stats.py.",
|
||||||
"director": "Write · test_calc_stats.py +55",
|
"director": "Write · test_calc_stats.py +55",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude writes 1 file and saves the work: \"add failing tests for calc_stats mean/median\".",
|
"story": "Claude writes .gitignore and saves the work: \"add failing tests for calc_stats mean/median\".",
|
||||||
"director": "git commit -q -F - · writes 1 file",
|
"director": "git commit -q -F - · writes 1 file",
|
||||||
"balloon": "Red as expected: collection error, exit code 2.",
|
"balloon": "Red as expected: collection error, exit code 2.",
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude writes 1 new file.",
|
"story": "Claude writes the new file calc_stats.py.",
|
||||||
"director": "Write · calc_stats.py +24",
|
"director": "Write · calc_stats.py +24",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude saves the work and uploads it: \"add calc_stats.mode with smallest-value tie-breaking\".",
|
"story": "Claude saves the work: \"add calc_stats.mode with smallest-value tie-breaking\", then copies it to origin.git, a folder on this computer.",
|
||||||
"director": "git commit -q -F - · git push -u origin HEAD",
|
"director": "git commit -q -F - · git push -u origin HEAD",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -243,7 +243,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude writes 1 file.",
|
"story": "Claude writes NOTES.md.",
|
||||||
"director": "Bash · NOTES.md +2",
|
"director": "Bash · NOTES.md +2",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -268,7 +268,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude saves the work and uploads it, but a step after that fails.",
|
"story": "Claude saves the work and copies it to origin.git, a folder on this computer, but a step after that fails.",
|
||||||
"director": "git commit -q -F - · git push · 1 error",
|
"director": "git commit -q -F - · git push · 1 error",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude saves the work: \"add slugify module with node:test suite\".",
|
"story": "Claude starts a git repository and saves the work: \"add slugify module with node:test suite\".",
|
||||||
"director": "git commit -q -F -",
|
"director": "git commit -q -F -",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude writes 1 new file.",
|
"story": "Claude writes the new file README.md.",
|
||||||
"director": "Write · README.md +79",
|
"director": "Write · README.md +79",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude saves the work in 6 commits.",
|
"story": "Claude starts a git repository and saves the work in 6 commits.",
|
||||||
"director": "git commit -q -m \"chore: scaffold inventory package\" -m \"Ad…",
|
"director": "git commit -q -m \"chore: scaffold inventory package\" -m \"Ad…",
|
||||||
"balloon": "Commits are in.",
|
"balloon": "Commits are in.",
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -243,7 +243,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "fix",
|
"kind": "fix",
|
||||||
"ok": null,
|
"ok": null,
|
||||||
"story": "Claude changes 1 file.",
|
"story": "Claude changes CHANGELOG.md.",
|
||||||
"director": "Edit · CHANGELOG.md +2",
|
"director": "Edit · CHANGELOG.md +2",
|
||||||
"balloon": "Step 12:",
|
"balloon": "Step 12:",
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude writes 1 file and saves the work: \"ignore Python and pytest caches\".",
|
"story": "Claude writes .gitignore and saves the work: \"ignore Python and pytest caches\".",
|
||||||
"director": "git commit -q -m \"chore: ignore Python and pytest caches · writes 1 file",
|
"director": "git commit -q -m \"chore: ignore Python and pytest caches · writes 1 file",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude saves the work and uploads it, but a step after that fails.",
|
"story": "Claude starts a git repository, saves the work and copies it to remote.git, a folder on this computer, but a step after that fails.",
|
||||||
"director": "git commit -q -F - · git push -u origin main · 1 error",
|
"director": "git commit -q -F - · git push -u origin main · 1 error",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude writes 2 files and saves the work: \"add package.json and index.js with add and slugify\".",
|
"story": "Claude starts a git repository, writes package.json and index.js, and saves the work: \"add package.json and index.js with add and slugify\".",
|
||||||
"director": "git commit -q -m \"feat: add package.json and index.js with… · writes 2 files · after 1 second opinion",
|
"director": "git commit -q -m \"feat: add package.json and index.js with… · writes 2 files · after 1 second opinion",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "check",
|
"kind": "check",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude writes 1 file; the tests pass.",
|
"story": "Claude writes index.test.mjs; the tests pass.",
|
||||||
"director": "node --test index.test.mjs → ok · 8 passed · writes 1 file",
|
"director": "node --test index.test.mjs → ok · 8 passed · writes 1 file",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": {
|
"tests": {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "check",
|
"kind": "check",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude writes 2 files; the tests pass, and Claude saves the work.",
|
"story": "Claude writes test_csvstat.py and pyproject.toml; the tests pass, and Claude saves the work.",
|
||||||
"director": "python3 -m pytest -q 2>&1 → ok ×2 · 17 passed · writes 2 files · 1 commit",
|
"director": "python3 -m pytest -q 2>&1 → ok ×2 · 17 passed · writes 2 files · 1 commit",
|
||||||
"balloon": "Code and tests are committed.",
|
"balloon": "Code and tests are committed.",
|
||||||
"tests": {
|
"tests": {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
{
|
{
|
||||||
"kind": "save",
|
"kind": "save",
|
||||||
"ok": true,
|
"ok": true,
|
||||||
"story": "Claude saves the work: \"add pomodoro timer with tests\".",
|
"story": "Claude starts a git repository and saves the work: \"add pomodoro timer with tests\".",
|
||||||
"director": "git commit -q -m \"feat: add pomodoro timer with tests\" -m \"… · then 1 second opinion",
|
"director": "git commit -q -m \"feat: add pomodoro timer with tests\" -m \"… · then 1 second opinion",
|
||||||
"balloon": null,
|
"balloon": null,
|
||||||
"tests": null,
|
"tests": null,
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ describe('Story Mode on real sessions', () => {
|
|||||||
|
|
||||||
it('a commit at the end of a test one-liner is kept, and a background helper reports back in 9 s', () => {
|
it('a commit at the end of a test one-liner is kept, and a background helper reports back in 9 s', () => {
|
||||||
expect(panel('text-plan-dry-run-helper', 0, 'check')?.story).toBe(
|
expect(panel('text-plan-dry-run-helper', 0, 'check')?.story).toBe(
|
||||||
'Claude writes 2 files; the tests pass, and Claude saves the work.'
|
'Claude writes test_csvstat.py and pyproject.toml; the tests pass, and Claude saves the work.'
|
||||||
);
|
);
|
||||||
expect(panel('text-plan-dry-run-helper', 0, 'plan')?.story).toBe('Claude writes a plan: 4 steps.');
|
expect(panel('text-plan-dry-run-helper', 0, 'plan')?.story).toBe('Claude writes a plan: 4 steps.');
|
||||||
expect(pagesOf('text-plan-dry-run-helper')[1]).toMatchObject({ origin: 'task', durationMs: 9008 });
|
expect(pagesOf('text-plan-dry-run-helper')[1]).toMatchObject({ origin: 'task', durationMs: 9008 });
|
||||||
@@ -125,7 +125,9 @@ describe('Story Mode on real sessions', () => {
|
|||||||
expect(panel('question-tests-first-push', 0, 'save')).toMatchObject({
|
expect(panel('question-tests-first-push', 0, 'save')).toMatchObject({
|
||||||
ok: true,
|
ok: true,
|
||||||
// One commit, then a push in a command of its own: one commit, not two.
|
// One commit, then a push in a command of its own: one commit, not two.
|
||||||
story: 'Claude saves the work and uploads it, but a step after that fails.',
|
// The folder had no repository: the first save starts one, and the reader is told.
|
||||||
|
story:
|
||||||
|
'Claude starts a git repository, saves the work and copies it to remote.git, a folder on this computer, but a step after that fails.',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -137,10 +139,10 @@ describe('Story Mode on real sessions', () => {
|
|||||||
roundsOk: [false, true],
|
roundsOk: [false, true],
|
||||||
});
|
});
|
||||||
expect(second.panels.find((p) => p.kind === 'save')?.story).toBe(
|
expect(second.panels.find((p) => p.kind === 'save')?.story).toBe(
|
||||||
'Claude saves the work and uploads it: "add calc_stats.mode with smallest-value tie-breaking".'
|
'Claude saves the work: "add calc_stats.mode with smallest-value tie-breaking", then copies it to origin.git, a folder on this computer.'
|
||||||
);
|
);
|
||||||
expect(third.panels.find((p) => p.kind === 'save')?.story).toBe(
|
expect(third.panels.find((p) => p.kind === 'save')?.story).toBe(
|
||||||
'Claude saves the work and uploads it, but a step after that fails.'
|
'Claude saves the work and copies it to origin.git, a folder on this computer, but a step after that fails.'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -184,10 +186,10 @@ describe('Story Mode on real sessions', () => {
|
|||||||
expect(pagesOf('background-helpers-reports')[0].finishedLater).toBe(2);
|
expect(pagesOf('background-helpers-reports')[0].finishedLater).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('a lookup of tools reads as getting them ready, without their names', () => {
|
it('a lookup of tools reads as getting them ready, without their names; for plan mode, as getting ready to plan', () => {
|
||||||
const panel = pagesOf('compact-then-plan-mode')
|
const panel = pagesOf('compact-then-plan-mode')
|
||||||
.flatMap((p) => p.panels)
|
.flatMap((p) => p.panels)
|
||||||
.find((p) => p.story === 'Claude gets the tools it needs ready.');
|
.find((p) => p.story === 'Claude gets ready to plan.');
|
||||||
expect(panel).toBeTruthy();
|
expect(panel).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+23
-19
@@ -887,25 +887,29 @@ describe('story-mode.js overlay', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('the final panel counts the commits of the whole turn, and says when the work was uploaded', async () => {
|
it('the final panel counts the commits of the whole turn, and says when the work was uploaded', async () => {
|
||||||
boot(
|
const chipsFor = async (to: string) => {
|
||||||
storyOf([
|
boot(
|
||||||
prompt('ship it'),
|
storyOf([
|
||||||
...edit('e1', '/work/demo-shop/a.py', ['+a = 1']),
|
prompt('ship it'),
|
||||||
...bash('b1', 'pytest -q && git commit -qam "fix: a"', 'Test and commit', '3 passed in 0.1s'),
|
...edit('e1', '/work/demo-shop/a.py', ['+a = 1']),
|
||||||
...bash(
|
...bash('b1', 'pytest -q && git commit -qam "fix: a"', 'Test and commit', '3 passed in 0.1s'),
|
||||||
'b2',
|
...bash(
|
||||||
'git commit -qam "docs: b" && git push',
|
'b2',
|
||||||
'Commit and push',
|
'git commit -qam "docs: b" && git push',
|
||||||
'To ./origin.git\n 1a2b3c4..5d6e7f8 main -> main'
|
'Commit and push',
|
||||||
),
|
`To ${to}\n 1a2b3c4..5d6e7f8 main -> main`
|
||||||
end(1000),
|
),
|
||||||
])
|
end(1000),
|
||||||
);
|
])
|
||||||
app.openStoryMode(SID);
|
);
|
||||||
await settle();
|
app.openStoryMode(SID);
|
||||||
expect($$('.story-panel[data-kind="complete"] .story-chips li').map((li) => li.textContent)).toContain(
|
await settle();
|
||||||
'2 commits, uploaded'
|
return $$('.story-panel[data-kind="complete"] .story-chips li').map((li) => li.textContent);
|
||||||
);
|
};
|
||||||
|
expect(await chipsFor('git@github.com:me/shop.git')).toContain('2 commits, uploaded');
|
||||||
|
app.closeStoryMode?.();
|
||||||
|
// A folder on this computer: a copy, named.
|
||||||
|
expect(await chipsFor('./origin.git')).toContain('2 commits, copied to origin.git');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('a chip that opened the drawer takes focus back, even when the page was redrawn meanwhile', async () => {
|
it('a chip that opened the drawer takes focus back, even when the page was redrawn meanwhile', async () => {
|
||||||
|
|||||||
+35
-5
@@ -929,7 +929,7 @@ describe('buildStoryPage', () => {
|
|||||||
const check = page.panels.find((p) => p.kind === 'check')!;
|
const check = page.panels.find((p) => p.kind === 'check')!;
|
||||||
expect(check.caption.director).toBe('node --test → ok · 3 passed · writes 1 file · 1 commit');
|
expect(check.caption.director).toBe('node --test → ok · 3 passed · writes 1 file · 1 commit');
|
||||||
// The commit at the end of the test one-liner is not lost, nor the file written: the check says both.
|
// The commit at the end of the test one-liner is not lost, nor the file written: the check says both.
|
||||||
expect(check.caption.story).toBe('Claude writes 1 file; the tests pass, and Claude saves the work.');
|
expect(check.caption.story).toBe('Claude writes index.js; the tests pass, and Claude saves the work.');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('one-line printf/echo writes and the files Claude Code says a command changed are edits', () => {
|
it('one-line printf/echo writes and the files Claude Code says a command changed are edits', () => {
|
||||||
@@ -962,20 +962,50 @@ describe('buildStoryPage', () => {
|
|||||||
|
|
||||||
it('a commit then a push in its own command is one commit, named; a push alone only uploads', () => {
|
it('a commit then a push in its own command is one commit, named; a push alone only uploads', () => {
|
||||||
const save = (lines: unknown[]) => pageOf(lines).panels.find((p) => p.kind === 'save')!.caption.story;
|
const save = (lines: unknown[]) => pageOf(lines).panels.find((p) => p.kind === 'save')!.caption.story;
|
||||||
expect(
|
const ship = (to: string) =>
|
||||||
save([
|
save([
|
||||||
prompt('ship it'),
|
prompt('ship it'),
|
||||||
...bash('b1', 'git commit -qm "feat: add mode()"', 'Commit', ''),
|
...bash('b1', 'git commit -qm "feat: add mode()"', 'Commit', ''),
|
||||||
...bash('b2', 'git push origin main', 'Push', 'To ./origin.git\n f80bb31..3e0fb80 main -> main'),
|
...bash('b2', 'git push origin main', 'Push', `To ${to}\n f80bb31..3e0fb80 main -> main`),
|
||||||
end(1000),
|
end(1000),
|
||||||
])
|
]);
|
||||||
).toBe('Claude saves the work and uploads it: "add mode()".');
|
expect(ship('github.com:me/shop.git')).toBe('Claude saves the work and uploads it: "add mode()".');
|
||||||
|
expect(ship('https://example.com/me/shop.git')).toBe('Claude saves the work and uploads it: "add mode()".');
|
||||||
|
// A repository in a folder on this computer: a copy, and nothing left the machine.
|
||||||
|
expect(ship('./origin.git')).toBe(
|
||||||
|
'Claude saves the work: "add mode()", then copies it to origin.git, a folder on this computer.'
|
||||||
|
);
|
||||||
|
expect(ship('/srv/git/shop.git/')).toBe(
|
||||||
|
'Claude saves the work: "add mode()", then copies it to shop.git, a folder on this computer.'
|
||||||
|
);
|
||||||
expect(save([prompt('push'), ...bash('b1', 'git push', 'Push', 'Everything up-to-date'), end(1000)])).toBe(
|
expect(save([prompt('push'), ...bash('b1', 'git push', 'Push', 'Everything up-to-date'), end(1000)])).toBe(
|
||||||
'Claude uploads the work.'
|
'Claude uploads the work.'
|
||||||
);
|
);
|
||||||
expect(pageOf([prompt('c'), ...bash('b1', 'git commit -qm x', 'Commit', ''), end(1000)]).events[1].commits).toBe(1);
|
expect(pageOf([prompt('c'), ...bash('b1', 'git commit -qm x', 'Commit', ''), end(1000)]).events[1].commits).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('the first save in a folder Claude made a repository says so; a bare copy target does not count', () => {
|
||||||
|
const save = (lines: unknown[]) => pageOf(lines).panels.find((p) => p.kind === 'save')!.caption.story;
|
||||||
|
expect(
|
||||||
|
save([
|
||||||
|
prompt('start'),
|
||||||
|
...bash('b1', 'git init -q', 'Init', ''),
|
||||||
|
...edit('e1', '/w/a.py', ['+a = 1']),
|
||||||
|
...bash('b2', 'git add -A && git commit -qm "add a"', 'Commit', ''),
|
||||||
|
end(1000),
|
||||||
|
])
|
||||||
|
).toBe('Claude starts a git repository and saves the work: "add a".');
|
||||||
|
// `git init --bare` makes the push target, not the project's repository.
|
||||||
|
expect(
|
||||||
|
save([
|
||||||
|
prompt('start'),
|
||||||
|
...bash('b1', 'git init --bare ../origin.git', 'Remote', ''),
|
||||||
|
...bash('b2', 'git commit -qm "add a"', 'Commit', ''),
|
||||||
|
end(1000),
|
||||||
|
])
|
||||||
|
).toBe('Claude saves the work: "add a".');
|
||||||
|
});
|
||||||
|
|
||||||
it('crafted agent text never takes seconds: every helper stays linear on its worst shapes', () => {
|
it('crafted agent text never takes seconds: every helper stays linear on its worst shapes', () => {
|
||||||
// Each shape took one to several seconds before (a lazy regex rescanning per opener, or a
|
// Each shape took one to several seconds before (a lazy regex rescanning per opener, or a
|
||||||
// backtracking one over a long one-liner); a single call blocks the whole server.
|
// backtracking one over a long one-liner); a single call blocks the whole server.
|
||||||
|
|||||||
Reference in new issue
Block a user