pulled store art never goes into the app repo: art pull --write, init and onboard add the renders folder (relative to the repo root, e.g. /store/renders/) to the repo's .gitignore when git check-ignore says it is not ignored yet, with one line saying so; tests

This commit is contained in:
CRTkafa 2026-10-14 04:31:55 +08:00
parent 81915651bd
commit fb3a7c186b
6 changed files with 69 additions and 3 deletions

View file

@ -285,6 +285,33 @@ describe('art pull against recorded store shapes', () => {
});
});
describe('pulled art stays out of the app repo', () => {
const sh = (cwd: string, ...a: string[]) => Bun.spawnSync(['git', ...a], { cwd });
test('art pull --write in a repo adds /store/renders/ to the repo root .gitignore once; a subfolder app gets its path', async () => {
const p = setup({ 'app/.keep': '', '.gitignore': 'node_modules\n' });
sh(p.root, 'init', '-q');
stores();
const r = await artPull(p.ctx(['--write']), { write: true, force: false, quiet: true });
expect(r.gitignored).toBe('/store/renders/');
expect(readFileSync(join(p.root, '.gitignore'), 'utf8')).toBe('node_modules\n# storebound: store art (rendered or pulled from the stores), never committed\n/store/renders/\n');
expect(sh(p.root, 'check-ignore', '-q', 'store/renders/en/ios69/01.png').exitCode).toBe(0);
stores();
expect((await artPull(p.ctx(['--write']), { write: true, force: false, quiet: true })).gitignored).toBeNull();
// an app folder inside a bigger repo: the path relative to the repo root
const { ignoreInRepo } = await import('../cli/lib/git-ignore');
expect(ignoreInRepo(join(p.root, 'app', 'store', 'renders'), 'x', true)).toBe('/app/store/renders/');
});
test('no repo: nothing written; the dry run writes nothing either', async () => {
const p = setup();
stores();
const dry = await artPull(p.ctx([]), { write: false, force: false, quiet: true });
expect(dry.gitignored).toBeUndefined();
stores();
expect((await artPull(p.ctx(['--write']), { write: true, force: false, quiet: true })).gitignored).toBeNull();
expect(existsSync(join(p.root, '.gitignore'))).toBe(false);
});
});
describe('MCP / desktop', () => {
test('art_pull is a dry run unless dry_run is false; --write only then, never --force', () => {
const t = TOOLS.find(x => x.name === 'art_pull')!;