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>
75 lines
2.1 KiB
TypeScript
75 lines
2.1 KiB
TypeScript
export interface AitmChangeStory {
|
|
title?: string;
|
|
checkpointId: string;
|
|
fromCheckpointId?: string;
|
|
aitmProjectId?: string;
|
|
diffAdded: number;
|
|
diffRemoved: number;
|
|
diffModified: number;
|
|
changedFiles: string[];
|
|
}
|
|
|
|
const START = '[AITM_CHANGE_STORY]';
|
|
const END = '[/AITM_CHANGE_STORY]';
|
|
|
|
export function parseAitmChangeStoryBlock(content: string): { story: AitmChangeStory | null; cleanContent: string } {
|
|
if (!content || !content.includes(START) || !content.includes(END)) {
|
|
return { story: null, cleanContent: content || '' };
|
|
}
|
|
|
|
const startIdx = content.indexOf(START);
|
|
const endIdx = content.indexOf(END, startIdx);
|
|
if (startIdx < 0 || endIdx < 0) {
|
|
return { story: null, cleanContent: content };
|
|
}
|
|
|
|
const blockBody = content
|
|
.slice(startIdx + START.length, endIdx)
|
|
.split('\n')
|
|
.map((line) => line.trim())
|
|
.filter(Boolean);
|
|
|
|
const kv: Record<string, string> = {};
|
|
for (const line of blockBody) {
|
|
const eq = line.indexOf('=');
|
|
if (eq <= 0) continue;
|
|
const key = line.slice(0, eq).trim();
|
|
const value = line.slice(eq + 1).trim();
|
|
kv[key] = value;
|
|
}
|
|
|
|
if (!kv.checkpointId) {
|
|
return {
|
|
story: null,
|
|
cleanContent: (content.slice(0, startIdx) + content.slice(endIdx + END.length)).trim(),
|
|
};
|
|
}
|
|
|
|
let files: string[] = [];
|
|
if (kv.changedFiles) {
|
|
try {
|
|
const parsed = JSON.parse(kv.changedFiles);
|
|
if (Array.isArray(parsed)) {
|
|
files = parsed.map((f) => String(f)).filter(Boolean);
|
|
}
|
|
} catch {
|
|
files = kv.changedFiles.split(',').map((f) => f.trim()).filter(Boolean);
|
|
}
|
|
}
|
|
|
|
const story: AitmChangeStory = {
|
|
title: kv.title || undefined,
|
|
checkpointId: kv.checkpointId,
|
|
fromCheckpointId: kv.fromCheckpointId || undefined,
|
|
aitmProjectId: kv.aitmProjectId || undefined,
|
|
diffAdded: Number(kv.diffAdded || 0),
|
|
diffRemoved: Number(kv.diffRemoved || 0),
|
|
diffModified: Number(kv.diffModified || 0),
|
|
changedFiles: files,
|
|
};
|
|
|
|
const cleanContent = (content.slice(0, startIdx) + content.slice(endIdx + END.length)).trim();
|
|
return { story, cleanContent };
|
|
}
|
|
|