Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
import * as os from 'os';
|
|
import { execSync } from 'child_process';
|
|
|
|
describe('E2E: Capture → Restore Flow', () => {
|
|
let testDir: string;
|
|
let cliPath: string;
|
|
|
|
beforeEach(() => {
|
|
testDir = fs.mkdtempSync(path.join(os.tmpdir(), 'aitm-e2e-'));
|
|
cliPath = path.join(process.cwd(), 'lib/cli-v2.js');
|
|
});
|
|
|
|
afterEach(() => {
|
|
fs.rmSync(testDir, { recursive: true, force: true });
|
|
});
|
|
|
|
const run = (cmd: string) => execSync(`node ${cliPath} ${cmd}`, {
|
|
cwd: testDir,
|
|
encoding: 'utf-8',
|
|
env: { ...process.env, HOME: testDir }
|
|
});
|
|
|
|
it('full capture → modify → restore flow', () => {
|
|
// 1. Create initial files
|
|
fs.writeFileSync(path.join(testDir, 'file1.txt'), 'original content');
|
|
fs.writeFileSync(path.join(testDir, 'file2.txt'), 'file two');
|
|
|
|
// 2. Initialize and capture
|
|
const initOutput = run('init');
|
|
expect(initOutput).toContain('initialized');
|
|
|
|
// 3. Get the timepoint ID
|
|
const listOutput = run('list');
|
|
const match = listOutput.match(/tp_\d+/);
|
|
expect(match).toBeTruthy();
|
|
const tpId = match![0];
|
|
|
|
// 4. Modify files
|
|
fs.writeFileSync(path.join(testDir, 'file1.txt'), 'MODIFIED content');
|
|
fs.writeFileSync(path.join(testDir, 'file3.txt'), 'new file');
|
|
fs.unlinkSync(path.join(testDir, 'file2.txt'));
|
|
|
|
// 5. Verify modifications
|
|
expect(fs.readFileSync(path.join(testDir, 'file1.txt'), 'utf-8')).toBe('MODIFIED content');
|
|
expect(fs.existsSync(path.join(testDir, 'file2.txt'))).toBe(false);
|
|
expect(fs.existsSync(path.join(testDir, 'file3.txt'))).toBe(true);
|
|
|
|
// 6. Preview restore
|
|
const previewOutput = run(`preview ${tpId}`);
|
|
expect(previewOutput).toContain('file3.txt'); // file3 will be deleted
|
|
|
|
// 7. Restore
|
|
const restoreOutput = run(`restore ${tpId} --yes`);
|
|
expect(restoreOutput).toContain('Restored');
|
|
|
|
// 8. Verify restoration
|
|
expect(fs.readFileSync(path.join(testDir, 'file1.txt'), 'utf-8')).toBe('original content');
|
|
expect(fs.readFileSync(path.join(testDir, 'file2.txt'), 'utf-8')).toBe('file two');
|
|
expect(fs.existsSync(path.join(testDir, 'file3.txt'))).toBe(false);
|
|
});
|
|
|
|
it('checkpoint and search', () => {
|
|
fs.writeFileSync(path.join(testDir, 'app.ts'), 'const auth = true;');
|
|
|
|
run('init');
|
|
run('checkpoint "Added authentication feature"');
|
|
|
|
const searchOutput = run('search auth');
|
|
expect(searchOutput.toLowerCase()).toMatch(/auth|found/);
|
|
});
|
|
});
|