import commentary from './commentary.ts' import getSeries from './series.ts' import { listCommentaries } from './storage.ts' const STORIES: Array<{ prefix: string; label: string; narrative: string }> = [ { prefix: 'b449da5', label: 'Search + execute', narrative: 'The factory loop lands as two primitives: search to find a capability, execute to run it. Almost every later Kody surface is an expansion of this pair.', }, { prefix: 'a81baf9', label: 'Capabilities get domains', narrative: 'Capabilities are regrouped by domain (email, jobs, packages, …) so search can rank a neighborhood instead of a flat tool list.', }, { prefix: '53953b7', label: 'UI save combined', narrative: 'Separate generated-UI save paths collapse into one upsert capability. A small net change that removes a primitive fork in the API.', }, { prefix: 'af4b327', label: 'Cursor MCP leaves core', narrative: 'Built-in Cursor MCP capabilities are deleted from kody itself. Agents pick them up through a connected MCP server instead of a first-party bundle.', }, { prefix: '64f1ab0', label: 'GitHub MCP leaves core', narrative: 'Same extraction for GitHub: the mock server and built-in GitHub capabilities leave the repo so GitHub work goes through the integration/package lane.', }, { prefix: 'd3f6f61', label: 'Style primitives combined', narrative: 'Shared client style primitives are extracted and auth UI styling is consolidated. Lines drop because duplicated presentation code is folded together.', }, { prefix: '87a495a', label: 'Agent-turn primitives', narrative: 'Generic agent-turn primitives are added so hosted chat can run a turn without baking a vendor agent into the core.', }, { prefix: '8d2a07d', label: 'Repo-backed source', narrative: 'Package source becomes a git-backed primitive. Saved packages can live as real repos instead of only inlined file blobs.', }, { prefix: 'bfe1457', label: 'page-to-markdown removed', narrative: 'The page-to-markdown capability is deleted after it proved the wrong primitive for fetching the web. Later work uses focused fetch helpers instead.', }, { prefix: 'fd2bc77', label: 'Package-first split', narrative: 'Architecture foundations move durable work into packages. A large deletion as monolith helpers are carved out of the core worker.', }, { prefix: 'f008b29', label: 'Package realtime', narrative: 'A websocket primitive for package apps. Hosted UIs can push live events without each package inventing its own channel.', }, { prefix: '2cd81f7', label: 'Agent turns removed', narrative: 'Built-in agent-turn primitives come back out. The earlier add was useful for learning the shape; the remove keeps vendor agent loops out of core.', }, { prefix: 'ed933a5', label: 'Community packages', narrative: 'Public listings, forks, ratings, and moderation become first-class. Packages stop being only a private account primitive.', }, { prefix: '8d7b77b', label: 'Generated UI runtime gone', narrative: 'open_generated_ui and its runtime are removed. Hosted package apps replace the generated-UI primitive as the thing you open in a browser.', }, { prefix: '8a68e67', label: 'OpenAPI bindings', narrative: 'Spec summarize, client scaffold, and curated provider bindings land. Third-party HTTP APIs become a reusable integration primitive.', }, { prefix: 'f8803a0', label: 'OAuth as tables', narrative: 'OAuth apps and connections become first-class storage instead of ad-hoc secrets. Integrations get a real primitive instead of a convention.', }, { prefix: 'd93cc2e', label: 'Package codemods', narrative: 'A formal migration system for user package source. When a primitive changes shape, existing packages can be rewritten on publish.', }, { prefix: 'b2da6f7', label: 'Remote connectors removed', narrative: 'Remote connectors leave the repo. Home devices talk outbound MCP instead of Kody hosting inbound connector primitives.', }, { prefix: '8b9e6f7', label: 'Package services removed', narrative: 'The package-services primitive is deleted. Durable work stays on jobs, storage, and app fetch — one less overlapping runtime to explain.', }, ] /** * Attach narratives for primitive add / remove / combine commits. * Safe to re-run: existing SHAs keep their current commentary. * * @returns Newly written story labels * * @example * import seedPrimitiveStory from 'kody:@kentcdodds/lineage/seed-primitive-story' * * const seeded = await seedPrimitiveStory() */ export default async function seedPrimitiveStory() { const existing = new Set((await listCommentaries()).map((item) => item.sha)) const series = await getSeries({ mode: 'net' }) const seeded = [] for (const story of STORIES) { const point = series.points.find((item) => item.sha.startsWith(story.prefix)) if (!point || existing.has(point.sha)) continue await commentary({ sha: point.sha, label: story.label, narrative: `${story.narrative} ${point.message} (${point.net >= 0 ? '+' : ''}${point.net} countable lines).`, }) seeded.push({ sha: point.sha, label: story.label }) existing.add(point.sha) } return { ok: true, seeded, remaining: STORIES.length - seeded.length } }