Skip to content

Commit 80dc7cb

Browse files
test(demo): fixture demonstrates unpushed (↑N) + nested org/repo for QA
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 27e4e88 commit 80dc7cb

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

scripts/demo-fixture.mjs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const user = (text) => JSON.stringify({ type: 'user', message: { content: text }
3939
// stale days chosen for a balanced traffic-light spread (fresh<1, neutral<3, warn<7, else neglected).
4040
// usageDaysAgo clustered in the last week for a clean Usage chart (decoupled from deck staleness).
4141
const PROJECTS = [
42-
{ name: 'acme-dashboard', branch: 'main', stale: 0, dirty: 3,
42+
{ name: 'acme-dashboard', branch: 'main', stale: 0, dirty: 3, ahead: 2,
4343
commit: 'feat(ui): dark mode toggle + theme persistence',
4444
sessions: [{ first: 'scaffold the settings page', cue: 'add a dark mode toggle to the settings page', model: 'claude-opus-4-8', usageDaysAgo: [0, 1] }] },
4545
{ name: 'payments-api', branch: 'feat/refunds', stale: 0, dirty: 1,
@@ -76,6 +76,17 @@ for (const p of PROJECTS) {
7676
git(repo, ['add', '-A'], d);
7777
git(repo, ['commit', '-m', p.commit], d);
7878
if (p.branch !== 'main') git(repo, ['checkout', '-b', p.branch], d);
79+
// simulate unpushed commits: set an upstream ref at the current HEAD, then commit ahead of it
80+
if (p.ahead) {
81+
git(repo, ['remote', 'add', 'origin', 'https://example.invalid/repo.git'], d); // sets remote.origin.fetch refspec
82+
git(repo, ['update-ref', `refs/remotes/origin/${p.branch}`, 'HEAD'], d);
83+
git(repo, ['branch', `--set-upstream-to=origin/${p.branch}`, p.branch], d);
84+
for (let i = 0; i < p.ahead; i++) {
85+
writeFileSync(join(repo, `local_${i}.js`), `// local work ${i}\n`);
86+
git(repo, ['add', '-A'], d);
87+
git(repo, ['commit', '-m', `feat: local work ${i}`], d);
88+
}
89+
}
7990
// leave N uncommitted changes
8091
for (let i = 0; i < p.dirty; i++) writeFileSync(join(repo, `wip_${i}.txt`), `work in progress ${i}\n`);
8192

@@ -94,5 +105,20 @@ for (const p of PROJECTS) {
94105
});
95106
}
96107

97-
console.log('projects:', PROJECTS.length, '| sessions:', sid);
108+
// nested org/repo (depth 2) to exercise nested scanning: acme-labs/ is a non-repo dir holding a repo
109+
const np = join(REPOS, 'acme-labs', 'prototype');
110+
const nd = iso(3);
111+
mkdirSync(np, { recursive: true });
112+
git(np, ['-c', 'init.defaultBranch=main', 'init'], nd);
113+
writeFileSync(join(np, 'README.md'), '# prototype\n');
114+
git(np, ['add', '-A'], nd);
115+
git(np, ['commit', '-m', 'init prototype scaffold'], nd);
116+
const nsd = join(CLAUDE, encode(np));
117+
mkdirSync(nsd, { recursive: true });
118+
const nf = join(nsd, uuid(sid++) + '.jsonl');
119+
writeFileSync(nf, [user('scaffold the prototype'), asst('claude-sonnet-4-6', iso(3, 11), 30000, 5000, 80000), user('wire up the auth flow')].join('\n'));
120+
const nms = NOW - 3 * DAY;
121+
utimesSync(nf, new Date(nms), new Date(nms));
122+
123+
console.log('projects:', PROJECTS.length + 1, '| sessions:', sid);
98124
console.log(HOME);

0 commit comments

Comments
 (0)