Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.
JavaScript ai-codingclaudeclaude-codeclaude-code-pluginclicoding-agentsdeveloper-toolsgitllmtypescript
feat(cli): rename codelineage to cogit
Eren422839ba13aa
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex d086203..a6afc02 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -1,11 +1,11 @@{- "name": "codelineage",- "description": "codelineage: the lineage of your AI coding sessions.",+ "name": "cogit",+ "description": "cogit: Cogito, ergo commit. Git remembers what changed. cogit remembers why.","owner": { "name": "Eren Sertkaya" },"plugins": [{- "name": "codelineage",- "source": { "source": "npm", "package": "codelineage" },+ "name": "cogit",+ "source": { "source": "npm", "package": "cogit" },"description": "Records what each session decided and why, and renders it as a static map."}]diff --git a/.gitignore b/.gitignoreindex 0e79e9a..2ef5a1f 100644--- a/.gitignore+++ b/.gitignore@@ -56,5 +56,5 @@ ss//qa/releasecoverage/-# codelineage-/.codelineage/+# cogit+/.cogit/diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 16ff48d..6237e28 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).## [Unreleased]+### Changed+- Renamed the product to **cogit** (*Cogito, ergo commit.*): the npm package and `cogit` bin, the Claude Code plugin and its `cogit:record` skill, the project dir `.cogit/`, the global dir `~/.config/cogit`, the env vars `COGIT_HOME` / `COGIT_DISABLE` (the old names still work for one minor version), the map file `map.html` and the page titles. The first cogit command or hook migrates silently: it renames an existing `.codelineage/`, moves `~/.config/codelineage` and fixes the `.gitignore` lines, or leaves both in place and warns once when both directories exist.## [0.10.0] - 2026-10-26### Addeddiff --git a/README.md b/README.mdindex 56c1ae6..c3474e8 100644--- a/README.md+++ b/README.md@@ -1,4 +1,8 @@-# codelineage+# cogit++**Cogito, ergo commit.**++Git remembers what changed. cogit remembers why.The lineage of your AI coding sessions: every user message hangs from the messageit reacts to, and the map draws each session as a git graph you can zoom into.@@ -6,9 +10,9 @@ it reacts to, and the map draws each session as a git graph you can zoom into.## Quick start```bash-npm install -g codelineage-codelineage init # answer the setup questions in the project you work in-codelineage open # open the map in the browser+npm install -g cogit+cogit init # answer the setup questions in the project you work in+cogit open # open the map in the browser````init` also installs the Claude Code side: the lineage skill updates the record as@@ -20,10 +24,10 @@ you work, the hooks rebuild the map after each turn and at the end of a session.titles and summaries only.- The map's Conversation panel needs the real turns, so `build` reads them fromClaude Code's local transcript and keeps a copy in- `.codelineage/conversations/<sessionId>.jsonl.gz`. This store lets the panel keep+ `.cogit/conversations/<sessionId>.jsonl.gz`. This store lets the panel keepworking after Claude Code deletes the transcript.-- That copy never goes into git: `init` writes `.codelineage/.gitignore` with- `conversations/`, even when you chose to commit `.codelineage/`, and every build+- That copy never goes into git: `init` writes `.cogit/.gitignore` with+ `conversations/`, even when you chose to commit `.cogit/`, and every buildmakes sure the line is there.- Both the page and the conversation store go through the same redaction pass(common key and token patterns) before anything is written.diff --git a/package-lock.json b/package-lock.jsonindex 98cf3ac..0ac65dd 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,10 +1,10 @@{- "name": "codelineage-monorepo",+ "name": "cogit-monorepo","lockfileVersion": 3,"requires": true,"packages": {"": {- "name": "codelineage-monorepo",+ "name": "cogit-monorepo","workspaces": ["packages/*"],@@ -2547,7 +2547,7 @@"node": ">= 12"}},- "node_modules/codelineage": {+ "node_modules/cogit": {"resolved": "packages/cli","link": true},@@ -4037,11 +4037,11 @@}},"packages/cli": {- "name": "codelineage",- "version": "0.7.0",+ "name": "cogit",+ "version": "0.10.0","license": "MIT","bin": {- "codelineage": "dist/cli.js"+ "cogit": "dist/cli.js"},"devDependencies": {"@inquirer/prompts": "^8.7.4",diff --git a/package.json b/package.jsonindex 7358d7f..8e46690 100644--- a/package.json+++ b/package.json@@ -1,5 +1,5 @@{- "name": "codelineage-monorepo",+ "name": "cogit-monorepo","private": true,"type": "module","workspaces": [@@ -9,7 +9,7 @@"node": ">=22.13.0"},"scripts": {- "build": "npm run build -w template && npm run build -w codelineage",+ "build": "npm run build -w template && npm run build -w cogit","dev:template": "npm run dev -w template","lint": "biome check .","format": "biome check --write .",diff --git a/packages/cli/.claude-plugin/plugin.json b/packages/cli/.claude-plugin/plugin.jsonindex e834fb4..5f8a08d 100644--- a/packages/cli/.claude-plugin/plugin.json+++ b/packages/cli/.claude-plugin/plugin.json@@ -1,8 +1,8 @@{- "name": "codelineage",- "displayName": "codelineage",+ "name": "cogit",+ "displayName": "cogit","version": "0.10.0",- "description": "The lineage of your AI coding sessions: records what each session decided and why, and renders it as a static map.",+ "description": "Git remembers what changed. cogit remembers why.","author": {"name": "Eren Sertkaya"},diff --git a/packages/cli/package.json b/packages/cli/package.jsonindex 933fee1..f4f5cf8 100644--- a/packages/cli/package.json+++ b/packages/cli/package.json@@ -1,11 +1,11 @@{- "name": "codelineage",+ "name": "cogit","version": "0.10.0",- "description": "The lineage of your AI coding sessions.",+ "description": "Git remembers what changed. cogit remembers why.","license": "MIT","type": "module","bin": {- "codelineage": "dist/cli.js"+ "cogit": "dist/cli.js"},"files": ["dist",diff --git a/packages/cli/skills/lineage/SKILL.md b/packages/cli/skills/record/SKILL.mdsimilarity index 93%rename from packages/cli/skills/lineage/SKILL.mdrename to packages/cli/skills/record/SKILL.mdindex 34daec7..57e6658 100644--- a/packages/cli/skills/lineage/SKILL.md+++ b/packages/cli/skills/record/SKILL.md@@ -1,19 +1,19 @@----name: lineage-description: Record or update this session's lineage for codelineage, one node per user message with what came of it, each hanging from the earlier message it reacts to, with a summary at each branch start, plus the goal, open items and what comes next. Use it when the user asks to record the session or its lineage, or when a codelineage hook asks for an update.-allowed-tools: Bash(node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" *) Edit(/${CLAUDE_PROJECT_DIR}/.codelineage/inbox/**)+name: record+description: Record or update this session's lineage for cogit, one node per user message with what came of it, each hanging from the earlier message it reacts to, with a summary at each branch start, plus the goal, open items and what comes next. Use it when the user asks to record the session or its lineage, or when a cogit hook asks for an update.+allowed-tools: Bash(node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" *) Edit(/${CLAUDE_PROJECT_DIR}/.cogit/inbox/**)---# Record this session's lineage-This is the current record for this session (the output of `codelineage session show`):+This is the current record for this session (the output of `cogit session show`):!`node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" session show "${CLAUDE_SESSION_ID}" -C "${CLAUDE_PROJECT_DIR}"`## First, check the record- If `initialized` is `false`, reply with exactly this line and stop:- "codelineage is not set up in this project yet; run `npx codelineage init` here first."+ "cogit is not set up in this project yet; run `npx cogit init` here first."- If `sessionError` is set, tell the user the session record is unreadable andquote the error. Then stop. Never write over it.- If `newMessages` is empty and nothing else changed since the record was lastdiff --git a/packages/cli/src/claude-settings.ts b/packages/cli/src/claude-settings.tsindex 9de6b0b..289eb36 100644--- a/packages/cli/src/claude-settings.ts+++ b/packages/cli/src/claude-settings.ts@@ -29,7 +29,7 @@ export async function readRetention(env: NodeJS.ProcessEnv): Promise<number | un}/** Lets the agent run the lineage skill without a permission prompt each time. */-export const SKILL_RULE = "Skill(codelineage:lineage)";+export const SKILL_RULE = "Skill(cogit:record)";function allowList(settings: Record<string, unknown>): unknown[] | undefined {const permissions = settings.permissions ?? {};@@ -62,7 +62,7 @@ async function updateSettings(const next = fn(settings, file);let backup: string | undefined;if (Object.keys(settings).length > 0) {- backup = `${file}.codelineage-bak-${stamp.replace(/[:.]/g, "-")}`;+ backup = `${file}.cogit-bak-${stamp.replace(/[:.]/g, "-")}`;await copyFile(file, backup, constants.COPYFILE_EXCL).catch((err: NodeJS.ErrnoException) => {if (err.code !== "EEXIST") throw err;});diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.tsindex 3f01399..5f4ccaf 100644--- a/packages/cli/src/cli.ts+++ b/packages/cli/src/cli.ts@@ -1,3 +1,8 @@import { createProgram } from "./program.js";+import { migrateGlobal, takeMigrationWarnings } from "./store/migrate.js";++// Silent, idempotent: a `~/.config/codelineage` from before the rename becomes `cogit`.+await migrateGlobal();+for (const line of takeMigrationWarnings()) process.stderr.write(`warning: ${line}\n`);await createProgram().parseAsync(process.argv);diff --git a/packages/cli/src/commands/backfill.ts b/packages/cli/src/commands/backfill.tsindex ea2a90f..0bf6f3f 100644--- a/packages/cli/src/commands/backfill.ts+++ b/packages/cli/src/commands/backfill.ts@@ -43,7 +43,7 @@ function recordPart(record: Session | undefined): string {function rules(language: string, messageSummaries: boolean): string {const writing = language === "auto" ? "the conversation's language" : language;return [- "Rules (from the codelineage lineage skill):",+ "Rules (from the cogit lineage skill):",'- Send one "message" node for every message below, with the id exactly as given; skip none, even a short "ok".',`- kind is "message". title: a few words in the user's own wording.${messageSummaries ? " summary: one or two sentences on what came of it." : ""@@ -70,7 +70,7 @@ export function catchUpPrompt(messageSummaries = false,): string {return [- "You add the missing part of a codelineage lineage record, a map of the user's messages.",+ "You add the missing part of a cogit lineage record, a map of the user's messages.","Below are the user's messages that have no node yet, each followed by the agent's written replies and a count of its tool calls.","",rules(language, messageSummaries),@@ -118,7 +118,7 @@ export function agentRecord(text: string): Record<string, unknown> {/** The headless agent must not fire our own hooks or leave a transcript. */export function headlessEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {- return { ...process.env, ...env, CODELINEAGE_DISABLE: "1" };+ return { ...process.env, ...env, COGIT_DISABLE: "1" };}function claudeBin(): string {@@ -185,7 +185,7 @@ async function missingTurns(}/**- * `codelineage backfill <session-id> --tail`: records the user messages a session+ * `cogit backfill <session-id> --tail`: records the user messages a session* never got to, by running the agent headless with the skill's rules and passing* its answer through `session write` (validation, redaction, stamping, build).* A busy session lock means another catch-up already runs, which is not an error.@@ -193,8 +193,7 @@ async function missingTurns(export async function backfillTail(dir: string, sessionId: string, io: Io): Promise<void> {const { root } = await resolveProjectRoot(dir);const project = await loadProject(root);- if (!project.found)- throw new CliError(`${root} is not initialized; run \`codelineage init\` first`);+ if (!project.found) throw new CliError(`${root} is not initialized; run \`cogit init\` first`);if (!project.ok) throw new CliError(project.error);let turns: ChatTurn[] | undefined;diff --git a/packages/cli/src/commands/blame.ts b/packages/cli/src/commands/blame.tsindex 83fd578..4171101 100644--- a/packages/cli/src/commands/blame.ts+++ b/packages/cli/src/commands/blame.ts@@ -9,7 +9,7 @@ import { loadAllSessions, loadProject } from "../store/stores.js";import { buildMessages } from "../view/lineage.js";/**- * `codelineage blame` (Story 8.8): git knows which commit wrote a line, the+ * `cogit blame` (Story 8.8): git knows which commit wrote a line, the* records know which user message that commit carried out, so the command walks* commits → messages and points back at the map.*/@@ -68,8 +68,7 @@ export async function blame(opts: BlameOptions): Promise<BlameHit[]> {const { io } = opts;const { root } = await resolveProjectRoot(opts.dir);const project = await loadProject(root);- if (!project.found)- throw new CliError(`${root} is not initialized; run \`codelineage init\` first`);+ if (!project.found) throw new CliError(`${root} is not initialized; run \`cogit init\` first`);if (!project.ok) throw new CliError(project.error);const gitRoot = await findGitRoot(root);diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.tsindex 803a422..d9879ff 100644--- a/packages/cli/src/commands/build.ts+++ b/packages/cli/src/commands/build.ts@@ -228,7 +228,7 @@ async function commitInfo(root: string, sessions: Session[]): Promise<CommitInfo}/**- * Rebuilds `.codelineage/lineage.html` from `project.json` and every session file,+ * Rebuilds `.cogit/map.html` from `project.json` and every session file,* then refreshes the global panel. One unreadable session is a warning, never a* failed build; an unwritable global directory only skips the panel.*/@@ -236,8 +236,7 @@ export async function buildProject(opts: BuildOptions): Promise<LineageViewModelconst { io } = opts;const { root } = await resolveProjectRoot(opts.dir);const project = await loadProject(root);- if (!project.found)- throw new CliError(`${root} is not initialized; run \`codelineage init\` first`);+ if (!project.found) throw new CliError(`${root} is not initialized; run \`cogit init\` first`);if (!project.ok) throw new CliError(project.error);for (const warning of project.warnings) io.warn(warning);@@ -247,7 +246,7 @@ export async function buildProject(opts: BuildOptions): Promise<LineageViewModeltry {await ensureConversationGitignore(root);} catch (err) {- io.warn(`could not update .codelineage/.gitignore: ${(err as Error).message}`);+ io.warn(`could not update .cogit/.gitignore: ${(err as Error).message}`);}// The map's switcher (8.12) and the panel read the same project list; collect// it once. A broken registry is a warning: it must never fail the map.diff --git a/packages/cli/src/commands/epoch.ts b/packages/cli/src/commands/epoch.tsindex 0e33b8a..9bf4f0c 100644--- a/packages/cli/src/commands/epoch.ts+++ b/packages/cli/src/commands/epoch.ts@@ -9,8 +9,7 @@ export async function epochAdd(dir: string, id: string, title: string, io: Io):throw new CliError(`invalid epoch id "${id}": use letters, digits, _ . -`);}const project = await loadProject(root);- if (!project.found)- throw new CliError(`${root} is not initialized; run \`codelineage init\` first`);+ if (!project.found) throw new CliError(`${root} is not initialized; run \`cogit init\` first`);if (!project.ok) throw new CliError(project.error);let added = false;diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.tsindex 09b9d1b..bf54c90 100644--- a/packages/cli/src/commands/init.ts+++ b/packages/cli/src/commands/init.ts@@ -16,6 +16,7 @@ import {} from "../git.js";import { CliError, type Io } from "../io.js";import { readJson } from "../store/fs.js";+import { migrateProject } from "../store/migrate.js";import { globalPaths, projectPaths } from "../store/paths.js";import {loadConfig,@@ -137,6 +138,9 @@ export async function register(io: Io, root: string, name: string): Promise<voidexport async function init(dir: string, opts: InitOptions, io: Io): Promise<void> {const root = resolve(dir);+ // `init` does not go through `resolveProjectRoot`; migrate here so a+ // pre-rename project is recognized instead of initialized a second time.+ await migrateProject(root);const existing = await loadProject(root);if (existing.found) {if (!existing.ok) throw new CliError(`${projectPaths(root).project}: ${existing.error}`);@@ -156,7 +160,7 @@ export async function init(dir: string, opts: InitOptions, io: Io): Promise<void(await io.prompt.select<GitPolicy>("This is a git repository. Commit the lineage records?",[- { value: "ignore", name: "No, keep .codelineage/ out of git (private)" },+ { value: "ignore", name: "No, keep .cogit/ out of git (private)" },{ value: "commit", name: "Yes, commit session records (local state stays ignored)" },],fallback,@@ -171,14 +175,14 @@ export async function init(dir: string, opts: InitOptions, io: Io): Promise<voidawait updateProject(root, (cur) => cur ?? { schema: 1, name, epochs: [] });await mkdir(projectPaths(root).sessions, { recursive: true });- await bestEffort(io, "could not write .codelineage/.gitignore", () =>+ await bestEffort(io, "could not write .cogit/.gitignore", () =>ensureConversationGitignore(root),);await register(io, root, name);io.out(- "Conversations are stored in .codelineage/conversations/ (kept out of git, even with the commit policy).",+ "Conversations are stored in .cogit/conversations/ (kept out of git, even with the commit policy).",);io.out(`Initialized ${name} in ${projectPaths(root).base}`);- io.out("Next: install the Claude Code plugin, then run `codelineage open` after a session.");+ io.out("Next: install the Claude Code plugin, then run `cogit open` after a session.");}diff --git a/packages/cli/src/commands/log.ts b/packages/cli/src/commands/log.tsindex 74c6cd8..2329fb5 100644--- a/packages/cli/src/commands/log.ts+++ b/packages/cli/src/commands/log.ts@@ -10,7 +10,7 @@ import { buildMessages } from "../view/lineage.js";import type { ViewFile, ViewNode } from "../view/model.js";/**- * `codelineage log` and `codelineage show` (Story 8.10): the CLI's read verbs,+ * `cogit log` and `cogit show` (Story 8.10): the CLI's read verbs,* modelled on `git log` and `git show`. The agent is the main reader, so the* output is plain text by default and JSON on request; neither command writes.*@@ -55,8 +55,7 @@ export async function loadEffectiveSessions(root: string, io: Io): Promise<Effecexport async function openProject(dir: string): Promise<string> {const { root } = await resolveProjectRoot(dir);const project = await loadProject(root);- if (!project.found)- throw new CliError(`${root} is not initialized; run \`codelineage init\` first`);+ if (!project.found) throw new CliError(`${root} is not initialized; run \`cogit init\` first`);if (!project.ok) throw new CliError(project.error);return root;}@@ -634,7 +633,7 @@ export interface LogCommandOptions extends LogOptions {json?: boolean;}-/** `codelineage log [dir]`. */+/** `cogit log [dir]`. */export async function log(opts: LogCommandOptions): Promise<LogModel> {const root = await openProject(opts.dir);const sessions = await loadEffectiveSessions(root, opts.io);@@ -684,7 +683,7 @@ export interface FileLogOptions {}/**- * `codelineage log --file <path>`: the recorded messages that touched a file,+ * `cogit log --file <path>`: the recorded messages that touched a file,* newest first — the CLI side of the map's files view (Story 8.15). Files come* from each message's own `files` plus the files of its commits read from git.*/diff --git a/packages/cli/src/commands/search.ts b/packages/cli/src/commands/search.tsindex ed7cb39..6ee8ccc 100644--- a/packages/cli/src/commands/search.ts+++ b/packages/cli/src/commands/search.ts@@ -8,7 +8,7 @@ import {import { loadEffectiveSessions, openProject, selectSessions, shortHash, stamp } from "./log.js";/**- * `codelineage search <text>` (Story 8.14): a linear, case- and accent-sensitive+ * `cogit search <text>` (Story 8.14): a linear, case- and accent-sensitive* scan over the records and the stored conversation. No model and no index* file; the same matcher backs the map's search box (`view/search.ts`).*/@@ -46,13 +46,11 @@ export function formatSearch(model: SearchModel): string[] {});}-/** `codelineage search [dir]`; returns the model for tests and JSON callers. */+/** `cogit search [dir]`; returns the model for tests and JSON callers. */export async function search(opts: SearchOptions): Promise<SearchModel> {const query = opts.text.replace(/\s+/g, " ").trim();if (normalizeQuery(opts.text) === "")- throw new CliError(- 'search needs some text, e.g. `codelineage search "where did we discuss X"`',- );+ throw new CliError('search needs some text, e.g. `cogit search "where did we discuss X"`');const root = await openProject(opts.dir);const sessions = await loadEffectiveSessions(root, opts.io);const selected = opts.session === undefined ? sessions : selectSessions(sessions, opts.session);diff --git a/packages/cli/src/commands/session.ts b/packages/cli/src/commands/session.tsindex 8f36771..28f2f33 100644--- a/packages/cli/src/commands/session.ts+++ b/packages/cli/src/commands/session.ts@@ -54,8 +54,7 @@ export async function sessionWrite(): Promise<void> {const { root, worktree } = await resolveProjectRoot(opts.dir);const project = await loadProject(root);- if (!project.found)- throw new CliError(`${root} is not initialized; run \`codelineage init\` first`);+ if (!project.found) throw new CliError(`${root} is not initialized; run \`cogit init\` first`);if (!project.ok) throw new CliError(project.error);const text = opts.file ? await readFile(opts.file, "utf8") : await stdin();@@ -81,7 +80,7 @@ export async function sessionWrite(if (count > 0) io.warn(`redacted ${count} secret-looking value(s)`);if (input.epoch && !project.data.epochs.some((e) => e.id === input.epoch)) {io.warn(- `epoch "${input.epoch}" is not in project.json; the session shows as unassigned until you run \`codelineage epoch add ${input.epoch} <title>\``,+ `epoch "${input.epoch}" is not in project.json; the session shows as unassigned until you run \`cogit epoch add ${input.epoch} <title>\``,);}@@ -122,7 +121,7 @@ export async function sessionWrite(try {await buildProject({ dir: root, io, quiet: true });} catch (err) {- io.warn(`could not build lineage.html: ${(err as Error).message}`);+ io.warn(`could not build map.html: ${(err as Error).message}`);}}diff --git a/packages/cli/src/git.ts b/packages/cli/src/git.tsindex d25c2e5..9f8519c 100644--- a/packages/cli/src/git.ts+++ b/packages/cli/src/git.ts@@ -22,18 +22,13 @@ export async function findGitRoot(dir: string): Promise<string | undefined> {}}-const HEADER = "# codelineage";+const HEADER = "# cogit";/** Machine-local data that must never be committed, whatever the policy. */-const ALWAYS = [- "/.codelineage/state/",- "/.codelineage/locks/",- "/.codelineage/inbox/",- "/.codelineage/lineage.html",-];+const ALWAYS = ["/.cogit/state/", "/.cogit/locks/", "/.cogit/inbox/", "/.cogit/map.html"];export function gitignoreLines(policy: GitPolicy): string[] {- return policy === "ignore" ? ["/.codelineage/"] : ALWAYS;+ return policy === "ignore" ? ["/.cogit/"] : ALWAYS;}/** Appends the policy's lines to `<root>/.gitignore`, skipping lines already there. */@@ -50,12 +45,12 @@ export async function ensureGitignore(root: string, policy: GitPolicy): Promise<}/**- * `.codelineage/.gitignore` keeps the conversation store out of git, even when- * the user chose to commit `.codelineage/`: the raw chat stays on this machine.+ * `.cogit/.gitignore` keeps the conversation store out of git, even when+ * the user chose to commit `.cogit/`: the raw chat stays on this machine.* Returns true when the line had to be added; a second call changes nothing.*/export async function ensureConversationGitignore(root: string): Promise<boolean> {- const file = join(root, ".codelineage", ".gitignore");+ const file = join(root, ".cogit", ".gitignore");const text = await readFile(file, "utf8").catch(() => "");const present = new Set(text.split(/\r?\n/).map((l) => l.trim()));if (present.has("conversations/")) return false;diff --git a/packages/cli/src/hooks/run.ts b/packages/cli/src/hooks/run.tsindex 3562607..5f1de69 100644--- a/packages/cli/src/hooks/run.ts+++ b/packages/cli/src/hooks/run.ts@@ -3,7 +3,7 @@ import { existsSync } from "node:fs";import { fileURLToPath } from "node:url";import { z } from "zod";import { Slug } from "../schema/common.js";-import { projectPaths } from "../store/paths.js";+import { captureDisabled, projectPaths } from "../store/paths.js";import { resolveProjectRoot } from "../store/root.js";import { onSessionEnd } from "./sessionend.js";import { onSessionStart } from "./sessionstart.js";@@ -22,9 +22,9 @@ export type HookInput = z.infer<typeof HookInput>;export interface HookContext {input: HookInput;sessionId: string;- /** Where `.codelineage/` lives: `CLAUDE_PROJECT_DIR`, else the hook's `cwd`, mapped out of a worktree. */+ /** Where `.cogit/` lives: `CLAUDE_PROJECT_DIR`, else the hook's `cwd`, mapped out of a worktree. */root: string;- /** Whether `.codelineage/project.json` exists; only SessionStart runs without it. */+ /** Whether `.cogit/project.json` exists; only SessionStart runs without it. */initialized: boolean;env: NodeJS.ProcessEnv;now: string;@@ -58,7 +58,7 @@ export function spawnDetachedProcess(cli: string, args: string[], env: NodeJS.Prspawn(process.execPath, [cli, ...args], {detached: true,stdio: "ignore",- env: { ...env, CODELINEAGE_DISABLE: "1" },+ env: { ...env, COGIT_DISABLE: "1" },}).unref();}@@ -76,7 +76,7 @@ export async function runHook(deps: HookDeps = {},): Promise<string | undefined> {try {- if (env.CODELINEAGE_DISABLE === "1") return undefined;+ if (captureDisabled(env)) return undefined;const handler = HANDLERS[event];if (!handler) return undefined;const input = HookInput.parse(JSON.parse(stdin));@@ -101,7 +101,7 @@ export async function runHook(});return out === undefined ? undefined : JSON.stringify(out);} catch (err) {- debug(`codelineage ${event} hook: ${(err as Error).message}`);+ debug(`cogit ${event} hook: ${(err as Error).message}`);return undefined;}}diff --git a/packages/cli/src/hooks/sessionstart.ts b/packages/cli/src/hooks/sessionstart.tsindex e4d2b6d..cc2985a 100644--- a/packages/cli/src/hooks/sessionstart.ts+++ b/packages/cli/src/hooks/sessionstart.ts@@ -7,8 +7,8 @@ import { buildMessages } from "../view/lineage.js";import type { HookContext, HookOutput } from "./run.js";export const COMPACT_REQUEST =- "codelineage: this session was compacted and some of its user messages are not in the " +- "lineage record yet. Run the /codelineage:lineage skill now; `session show` lists the " ++ "cogit: this session was compacted and some of its user messages are not in the " ++ "lineage record yet. Run the /cogit:record skill now; `session show` lists the " +"messages that have no node. It records only what is missing and replies " +'"up to date" when nothing is; do not mention this request otherwise.';@@ -30,15 +30,15 @@ function cli(ctx: HookContext): string {}/**- * The setup offer for a project without `.codelineage/`. It only reaches the agent:+ * The setup offer for a project without `.cogit/`. It only reaches the agent:* nothing is set up or registered unless the user asks for it.*/export function setupHint(ctx: HookContext): string {return (- "codelineage is not set up in this project, so no lineage map is recorded here. " ++ "cogit is not set up in this project, so no lineage map is recorded here. " +"Say this once, in one line, and do not repeat it in later turns. If the user asks " +"you to set it up, ask the install questions in the chat (whether to commit " +- ".codelineage/, whether to keep transcripts longer, whether the lineage skill may run " ++ ".cogit/, whether to keep transcripts longer, whether the lineage skill may run " +"without asking, and the summary language), then run " +`${cli(ctx)} init --yes --git <ignore|commit> --retention <days|keep> --language <lang>` +" (add --allow-skill when the user agreed). Never run init or register the project on " +@@ -108,7 +108,7 @@ function clip(text: string, max: number): string {async function startupContext(ctx: HookContext): Promise<string> {const command = cli(ctx);const header =- `codelineage records this project's lineage (one node per user message, hanging from the ` ++ `cogit records this project's lineage (one node per user message, hanging from the ` +`message it reacts to, grouped in sessions with branch summaries). Read it with ` +`\`${command} log -C "${ctx.root}"\`, find where something was discussed with ` +`\`${command} search "<text>" -C "${ctx.root}"\`, and one message with ` +diff --git a/packages/cli/src/hooks/stop.ts b/packages/cli/src/hooks/stop.tsindex 794fd61..3130cc1 100644--- a/packages/cli/src/hooks/stop.ts+++ b/packages/cli/src/hooks/stop.ts@@ -6,8 +6,8 @@ import { loadConfig, loadSession, updateState } from "../store/stores.js";import type { HookContext, HookOutput } from "./run.js";export const UPDATE_REQUEST =- "codelineage: several turns have passed since this session's lineage record was last updated. " +- "Run the /codelineage:lineage skill now. It records only what changed and replies " ++ "cogit: several turns have passed since this session's lineage record was last updated. " ++ "Run the /cogit:record skill now. It records only what changed and replies " +'"up to date" when nothing did; do not mention this request otherwise.';/** One Stop: count the turn and decide whether to ask for a record update. */diff --git a/packages/cli/src/program.ts b/packages/cli/src/program.tsindex cf63b00..3ede126 100644--- a/packages/cli/src/program.ts+++ b/packages/cli/src/program.ts@@ -20,6 +20,7 @@ import { readStdin, sessionShow, sessionWrite } from "./commands/session.js";import { runHook } from "./hooks/run.js";import { CliError, type Io, processIo } from "./io.js";import { startMapServer } from "./server.js";+import { takeMigrationWarnings } from "./store/migrate.js";import { loadConfig } from "./store/stores.js";export type IoFactory = (interactive: boolean) => Io;@@ -49,10 +50,7 @@ export function positiveCount(value: string): number {}export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps = {}): Command {- const program = new Command()- .name("codelineage")- .description(pkg.description)- .version(pkg.version);+ const program = new Command().name("cogit").description(pkg.description).version(pkg.version);/** Errors meant for the user print as one line and set exit code 1. */const run =@@ -63,16 +61,19 @@ export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps =} catch (err) {if (!(err instanceof CliError)) throw err;program.error(`error: ${err.message}`, { exitCode: 1 });+ } finally {+ // The 9.1 migration is silent; only a two-directory conflict speaks.+ for (const line of takeMigrationWarnings()) makeIo(false).warn(line);}};program.command("init")- .description("set up .codelineage/ in a project and register it")+ .description("set up .cogit/ in a project and register it").argument("[dir]", "project directory", ".").option("--name <name>", "project name").addOption(- new Option("--git <policy>", "commit or ignore .codelineage/").choices(["ignore", "commit"]),+ new Option("--git <policy>", "commit or ignore .cogit/").choices(["ignore", "commit"]),).option("--language <lang>", 'summary language: "auto" or a language').option("--retention <days>", 'Claude Code transcript retention, or "keep"', retention)@@ -90,7 +91,7 @@ export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps =program.command("build")- .description("regenerate .codelineage/lineage.html")+ .description("regenerate .cogit/map.html").argument("[dir]", "project directory", ".").option("--quiet", "write the map without printing a success line").action(@@ -288,7 +289,7 @@ export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps =run(async (sessionId: string, opts: { dir: string; tail?: boolean }) => {if (opts.tail !== true)throw new CliError(- "backfill of past sessions is not available yet; run `codelineage backfill <session-id> --tail`",+ "backfill of past sessions is not available yet; run `cogit backfill <session-id> --tail`",);await backfillTail(opts.dir, sessionId, makeIo(false));}),@@ -326,7 +327,7 @@ export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps =.description("session records (used by the agent skill)");session.command("write")- .description("merge session JSON from stdin into .codelineage/sessions/")+ .description("merge session JSON from stdin into .cogit/sessions/").option("-C, --dir <dir>", "project directory", ".").option("-f, --file <file>", "read JSON from a file instead of stdin").option("--consume", "delete the file once the record is saved")diff --git a/packages/cli/src/schema/state.ts b/packages/cli/src/schema/state.tsindex dfade5a..bf78a55 100644--- a/packages/cli/src/schema/state.ts+++ b/packages/cli/src/schema/state.ts@@ -4,7 +4,7 @@ import { IsoDate } from "./common.js";export const STATE_SCHEMA = 1;/**- * Per-session hook state in `.codelineage/state/<id>.json`. It is derived and+ * Per-session hook state in `.cogit/state/<id>.json`. It is derived and* machine-local: losing it only restarts the turn count.*/export const HookState = z.object({diff --git a/packages/cli/src/server.ts b/packages/cli/src/server.tsindex 528cdfd..03be558 100644--- a/packages/cli/src/server.ts+++ b/packages/cli/src/server.ts@@ -30,7 +30,7 @@ const HOST = "127.0.0.1";const LIVE_META = `<meta name="${LIVE_META_NAME}" content="1">`;/** Header a settings write must carry, with the token from the panel page. */-export const CONFIG_TOKEN_HEADER = "x-codelineage-token";+export const CONFIG_TOKEN_HEADER = "x-cogit-token";/** A settings write is a tiny JSON object; anything larger is not ours. */export const CONFIG_BODY_LIMIT = 4096;@@ -412,7 +412,7 @@ export async function startMapServer(opts: MapServerOptions): Promise<MapServer>"content-type": "application/json","cache-control": "no-store",});- res.end(JSON.stringify({ ok: true, name: "codelineage", home: globalPaths(env).base }));+ res.end(JSON.stringify({ ok: true, name: "cogit", home: globalPaths(env).base }));return;}const target = await pageTarget(env, url);@@ -498,15 +498,15 @@ interface HealthBody {}/**- * True when a codelineage server for this user's home answers on the port. The- * home check keeps two users (or two `CODELINEAGE_HOME`s) apart on one port.+ * True when a cogit server for this user's home answers on the port. The+ * home check keeps two users (or two `COGIT_HOME`s) apart on one port.*/export async function checkHealth(url: string, env: NodeJS.ProcessEnv): Promise<boolean> {try {const response = await fetch(`${url}/health`, { signal: AbortSignal.timeout(500) });if (!response.ok) return false;const body = (await response.json()) as HealthBody;- return body.name === "codelineage" && body.home === globalPaths(env).base;+ return body.name === "cogit" && body.home === globalPaths(env).base;} catch {return false;}@@ -526,7 +526,7 @@ export function spawnServerProcess(spawnFn(process.execPath, [cli, "serve", "--port", String(port)], {detached: true,stdio: "ignore",- env: { ...env, CODELINEAGE_DISABLE: "1" },+ env: { ...env, COGIT_DISABLE: "1" },}).unref();}diff --git a/packages/cli/src/store/migrate.ts b/packages/cli/src/store/migrate.tsnew file mode 100644index 0000000..5323b24--- /dev/null+++ b/packages/cli/src/store/migrate.ts@@ -0,0 +1,144 @@+import { existsSync } from "node:fs";+import { readFile, rename, stat } from "node:fs/promises";+import { join, resolve, sep } from "node:path";+import { atomicWrite, atomicWriteJson } from "./fs.js";+import {+ CONFIG_DIR_NAME,+ configuredHome,+ DIR_NAME,+ defaultConfigBase,+ OLD_CONFIG_DIR_NAME,+ OLD_DIR_NAME,+} from "./paths.js";++/**+ * The codelineage → cogit rename (Story 9.1) must be invisible to the user and+ * must never lose a record. A migration runs on the first command or hook that+ * needs a project or the global config: rename only, no copy, and nothing is+ * touched when both the old and the new name exist (one warning instead).+ */++const checkedProjects = new Set<string>();+const checkedGlobals = new Set<string>();+const pendingWarnings: string[] = [];++/** Warnings collected by the migrations so far; the caller prints and clears them. */+export function takeMigrationWarnings(): string[] {+ return pendingWarnings.splice(0, pendingWarnings.length);+}++function warn(line: string): void {+ if (!pendingWarnings.includes(line)) pendingWarnings.push(line);+}++/** `# codelineage` and `/.codelineage/…` become their cogit spellings. */+export function renameGitignoreLines(text: string): string {+ return text+ .split("\n")+ .map((line) => {+ if (line.trim() === "# codelineage") return line.replace("# codelineage", "# cogit");+ return line.replace(/^(\s*)\/\.codelineage(?=\/|$)/, "$1/.cogit");+ })+ .join("\n");+}++async function isDirectory(path: string): Promise<boolean> {+ return stat(path).then(+ (info) => info.isDirectory(),+ () => false,+ );+}++/** Renames a directory; false (never a throw) when the filesystem refuses. */+async function moveDir(from: string, to: string): Promise<boolean> {+ try {+ await rename(from, to);+ return true;+ } catch {+ return false;+ }+}++/**+ * Renames `<root>/.codelineage` to `<root>/.cogit` and fixes the project's+ * `.gitignore`. Idempotent and best-effort: a failure leaves the old dir for the+ * next command and never turns into an error.+ */+export async function migrateProject(root: string): Promise<boolean> {+ const dir = resolve(root);+ if (checkedProjects.has(dir)) return false;+ checkedProjects.add(dir);++ const oldDir = join(dir, OLD_DIR_NAME);+ const newDir = join(dir, DIR_NAME);+ const oldIsDir = await isDirectory(oldDir);+ if (!oldIsDir) return false;+ if (existsSync(newDir)) {+ warn(+ `both ${OLD_DIR_NAME}/ and ${DIR_NAME}/ exist in ${dir}; using ${DIR_NAME}/ and leaving ` ++ `the old directory untouched`,+ );+ return false;+ }+ // A read-only dir or a race: the next command tries again in a new process.+ if (!(await moveDir(oldDir, newDir))) return false;+ const gitignore = join(dir, ".gitignore");+ const text = await readFile(gitignore, "utf8").catch(() => undefined);+ if (text !== undefined) {+ const next = renameGitignoreLines(text);+ if (next !== text) await atomicWrite(gitignore, next).catch(() => undefined);+ }+ return true;+}++interface RegistryFile {+ projects?: { path?: unknown }[];+}++/** Points registry entries that lived under the moved global dir at the new one. */+async function rewriteRegistryPaths(file: string, oldBase: string, newBase: string): Promise<void> {+ const text = await readFile(file, "utf8").catch(() => undefined);+ if (text === undefined) return;+ let json: RegistryFile;+ try {+ json = JSON.parse(text) as RegistryFile;+ } catch {+ return;+ }+ if (!Array.isArray(json.projects)) return;+ let changed = false;+ for (const project of json.projects) {+ if (typeof project.path !== "string") continue;+ if (project.path !== oldBase && !project.path.startsWith(`${oldBase}${sep}`)) continue;+ project.path = `${newBase}${project.path.slice(oldBase.length)}`;+ changed = true;+ }+ if (changed) await atomicWriteJson(file, json).catch(() => undefined);+}++/**+ * Moves `~/.config/codelineage` to `~/.config/cogit` (only when no explicit home+ * is configured) and rewrites registry paths that pointed into it. Idempotent.+ */+export async function migrateGlobal(env: NodeJS.ProcessEnv = process.env): Promise<boolean> {+ const key = `${env.XDG_CONFIG_HOME ?? ""}\0${env.COGIT_HOME ?? ""}\0${env.CODELINEAGE_HOME ?? ""}`;+ if (checkedGlobals.has(key)) return false;+ checkedGlobals.add(key);+ // An explicit home is the user's choice and keeps working as a fallback.+ if (configuredHome(env) !== undefined) return false;++ const oldBase = defaultConfigBase(OLD_CONFIG_DIR_NAME, env);+ const newBase = defaultConfigBase(CONFIG_DIR_NAME, env);+ const oldIsDir = await isDirectory(oldBase);+ if (!oldIsDir) return false;+ if (existsSync(newBase)) {+ warn(+ `both ${oldBase} and ${newBase} exist; using ${newBase} and leaving the old directory ` ++ "untouched",+ );+ return false;+ }+ if (!(await moveDir(oldBase, newBase))) return false;+ await rewriteRegistryPaths(join(newBase, "projects.json"), oldBase, newBase);+ return true;+}diff --git a/packages/cli/src/store/paths.ts b/packages/cli/src/store/paths.tsindex d8be727..b787efa 100644--- a/packages/cli/src/store/paths.ts+++ b/packages/cli/src/store/paths.ts@@ -1,7 +1,21 @@import { homedir } from "node:os";import { join } from "node:path";-export const DIR_NAME = ".codelineage";+export const DIR_NAME = ".cogit";+/** The name cogit used before Story 9.1; still read so a record is never lost. */+export const OLD_DIR_NAME = ".codelineage";+export const CONFIG_DIR_NAME = "cogit";+export const OLD_CONFIG_DIR_NAME = "codelineage";++/** `COGIT_HOME`, still accepting `CODELINEAGE_HOME` for one minor version. */+export function configuredHome(env: NodeJS.ProcessEnv = process.env): string | undefined {+ return env.COGIT_HOME ?? env.CODELINEAGE_HOME;+}++/** Hooks are off when either the current or the legacy switch is set. */+export function captureDisabled(env: NodeJS.ProcessEnv = process.env): boolean {+ return env.COGIT_DISABLE === "1" || env.CODELINEAGE_DISABLE === "1";+}export function projectPaths(root: string) {const base = join(root, DIR_NAME);@@ -22,14 +36,18 @@ export function projectPaths(root: string) {/** Where the skill drops session JSON for `session write --file`. */inbox: (id: string) => join(base, "inbox", `${id}.json`),lock: (name: string) => join(base, "locks", `${name}.lock`),- html: join(base, "lineage.html"),+ html: join(base, "map.html"),};}-/** `CODELINEAGE_HOME` > `$XDG_CONFIG_HOME/codelineage` > `~/.config/codelineage`. */+/** `$XDG_CONFIG_HOME/<name>` > `~/.config/<name>`. */+export function defaultConfigBase(name: string, env: NodeJS.ProcessEnv = process.env): string {+ return join(env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), name);+}++/** `COGIT_HOME` > `CODELINEAGE_HOME` > `$XDG_CONFIG_HOME/cogit` > `~/.config/cogit`. */export function globalPaths(env: NodeJS.ProcessEnv = process.env) {- const base =- env.CODELINEAGE_HOME ?? join(env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "codelineage");+ const base = configuredHome(env) ?? defaultConfigBase(CONFIG_DIR_NAME, env);return {base,config: join(base, "config.json"),diff --git a/packages/cli/src/store/root.ts b/packages/cli/src/store/root.tsindex 3edc9d2..3bc2b44 100644--- a/packages/cli/src/store/root.ts+++ b/packages/cli/src/store/root.ts@@ -1,6 +1,7 @@import { existsSync } from "node:fs";import { readFile, stat } from "node:fs/promises";import { dirname, join, relative, resolve } from "node:path";+import { migrateProject } from "./migrate.js";import { projectPaths } from "./paths.js";/** The linked git worktree a directory belongs to. */@@ -12,7 +13,7 @@ export interface WorktreeInfo {}export interface ProjectRoot {- /** Where `.codelineage/` lives for this directory. */+ /** Where `.cogit/` lives for this directory. */root: string;/** Set when the directory is inside a linked worktree. */worktree?: WorktreeInfo;@@ -43,9 +44,9 @@ async function readBranch(gitdir: string): Promise<string | null> {}/**- * Finds the `.codelineage/` for a directory. A linked git worktree has no copy of- * a git-ignored `.codelineage/`, so it shares the main checkout's, the same way- * Claude Code keeps worktree state in the main checkout. With `.codelineage/`+ * Finds the `.cogit/` for a directory. A linked git worktree has no copy of+ * a git-ignored `.cogit/`, so it shares the main checkout's, the same way+ * Claude Code keeps worktree state in the main checkout. With `.cogit/`* committed, the worktree has its own copy and keeps it. Only files are read* (`.git` → `gitdir` → `commondir`), so git itself is never needed.*/@@ -53,12 +54,18 @@ export async function resolveProjectRoot(dir: string): Promise<ProjectRoot> {const start = resolve(dir);try {const linked = await findLinkedWorktree(start);- if (!linked) return { root: start };+ if (!linked) {+ await migrateProject(start);+ return { root: start };+ }const worktree = { path: linked.top, branch: await readBranch(linked.gitdir) };+ await migrateProject(start);if (existsSync(projectPaths(start).project)) return { root: start, worktree };const common = (await readFile(join(linked.gitdir, "commondir"), "utf8")).trim();const mainTop = dirname(resolve(linked.gitdir, common));- return { root: join(mainTop, relative(linked.top, start)), worktree };+ const root = join(mainTop, relative(linked.top, start));+ await migrateProject(root);+ return { root, worktree };} catch {// An unreadable or odd `.git` layout falls back to the directory itself.return { root: start };diff --git a/packages/cli/src/view/files.ts b/packages/cli/src/view/files.tsindex f7d8c5d..d01c4f4 100644--- a/packages/cli/src/view/files.ts+++ b/packages/cli/src/view/files.ts@@ -3,7 +3,7 @@ import type { LineageViewModel, ViewFile, ViewFileHit, ViewNode } from "./model./*** File history (Story 8.15): which recorded messages touched a file, built from* the `files` the agent listed on a message plus the files of the message's- * commits read from git at build time. `codelineage log --file` and the map's+ * commits read from git at build time. `cogit log --file` and the map's* files view read the same model.*/diff --git a/packages/cli/src/view/model.ts b/packages/cli/src/view/model.tsindex a1a9419..ff7031d 100644--- a/packages/cli/src/view/model.ts+++ b/packages/cli/src/view/model.ts@@ -1,21 +1,21 @@import type { BranchSummary, NodeKind } from "../schema/session.js";/**- * Serialized contract between `codelineage build` and the HTML template. The+ * Serialized contract between `cogit build` and the HTML template. The* builder fills this shape, JSON-serializes it into the page's data element and* the React app in `packages/template` renders it. Keep this file free of runtime* dependencies so both sides can import it.*//** Id of the `<script type="application/json">` that carries the model. */-export const DATA_ELEMENT_ID = "codelineage-data";+export const DATA_ELEMENT_ID = "cogit-data";/*** Meta tag the local map server injects into the pages it serves. The page* subscribes to rebuild events only when it is present, so a `file://` page or* the Vite dev server never tries to reach a server that is not there.*/-export const LIVE_META_NAME = "codelineage-live";+export const LIVE_META_NAME = "cogit-live";/*** Meta tag the local map server puts in every page it serves: a random token@@ -23,11 +23,11 @@ export const LIVE_META_NAME = "codelineage-live";* cannot read it, so they cannot post a change even when the host check is* bypassed. A `file://` page has no token and its settings stay read-only.*/-export const TOKEN_META_NAME = "codelineage-token";+export const TOKEN_META_NAME = "cogit-token";/*** Settings the panel may change over the local server (Story 8.9). The rest are- * setup-time or security-adjacent and stay on `codelineage config set`.+ * setup-time or security-adjacent and stay on `cogit config set`.*/export const PANEL_EDITABLE_KEYS = ["messageSummaries",@@ -249,7 +249,7 @@ export interface LineageViewModel {/*** One message that touched a file (Story 8.15): the file view's row on the map- * and what `codelineage log --file` prints. `commits` are the commits that+ * and what `cogit log --file` prints. `commits` are the commits that* touched this file; a commit git no longer knows leaves an empty list.*/export interface ViewFileHit {@@ -309,7 +309,7 @@ export interface PanelSettings {/*** The subset `GET /api/config` returns and a settings modal may change- * (Story 8.13). Everything else stays on `codelineage config set`.+ * (Story 8.13). Everything else stays on `cogit config set`.*/export type PanelEditableSettings = Pick<PanelSettings, PanelEditableKey>;diff --git a/packages/cli/src/view/panel.ts b/packages/cli/src/view/panel.tsindex 09e255c..f0e68b3 100644--- a/packages/cli/src/view/panel.ts+++ b/packages/cli/src/view/panel.ts@@ -32,7 +32,7 @@ export interface PanelOptions {*/export type CollectedProject = SwitcherSource;-const PANEL_TITLE = "<title>codelineage — panel</title>";+const PANEL_TITLE = "<title>cogit — panel</title>";/*** The settings both pages embed (Stories 8.9, 8.13). The map needs them for thediff --git a/packages/cli/src/view/search.ts b/packages/cli/src/view/search.tsindex cf8e0c3..9de3ea5 100644--- a/packages/cli/src/view/search.ts+++ b/packages/cli/src/view/search.ts@@ -2,7 +2,7 @@ import type { LineageViewModel, ViewChatTurn, ViewNode, ViewStatus } from "./mod/*** Lineage search (Story 8.14). The CLI and the map read the same data and use- * this one matcher, so `codelineage search <text>` and the map's search box+ * this one matcher, so `cogit search <text>` and the map's search box* return the same hits in the same order. No index file and no model: a linear* scan over the records and the stored conversation is enough at this size.*diff --git a/packages/cli/src/view/settings.ts b/packages/cli/src/view/settings.tsindex 8fc2a53..a4d26c8 100644--- a/packages/cli/src/view/settings.ts+++ b/packages/cli/src/view/settings.ts@@ -75,13 +75,13 @@ const READ_ONLY: FieldSpec[] = [{key: "gitPolicy",label: "Git policy",- help: "Whether captures are committed to git; change it per project with `codelineage config set`.",+ help: "Whether captures are committed to git; change it per project with `cogit config set`.",kind: "text",},{key: "agents",label: "Agents",- help: "Which agents record lineage; change it with `codelineage config set`.",+ help: "Which agents record lineage; change it with `cogit config set`.",kind: "text",},];diff --git a/packages/cli/src/view/template.ts b/packages/cli/src/view/template.tsindex e492008..981c863 100644--- a/packages/cli/src/view/template.ts+++ b/packages/cli/src/view/template.ts@@ -1,6 +1,6 @@/*** The built template is embedded into the CLI bundle as text by tsup's loader- * (see `tsup.config.ts`), so `codelineage build` needs no asset files next to+ * (see `tsup.config.ts`), so `cogit build` needs no asset files next to* `dist/cli.js`.*/import templateHtml from "../../../template/dist/index.html";diff --git a/packages/cli/test/backfill.test.ts b/packages/cli/test/backfill.test.tsindex 5932354..f0d012d 100644--- a/packages/cli/test/backfill.test.ts+++ b/packages/cli/test/backfill.test.ts@@ -145,7 +145,7 @@ describe("headless output", () => {it("turns capture off in the headless run", () => {expect(headlessEnv({ PATH: "/bin" })).toMatchObject({PATH: "/bin",- CODELINEAGE_DISABLE: "1",+ COGIT_DISABLE: "1",});});});@@ -239,8 +239,8 @@ describe("backfill --tail", () => {it("refuses an uninitialized or unreadable project", async () => {const env = envFor(dir);await expect(backfillTail(root, "s1", fakeIo(env))).rejects.toThrow(/not initialized/);- await mkdir(join(root, ".codelineage"), { recursive: true });- await writeFile(join(root, ".codelineage", "project.json"), "{nope");+ await mkdir(join(root, ".cogit"), { recursive: true });+ await writeFile(join(root, ".cogit", "project.json"), "{nope");await expect(backfillTail(root, "s1", fakeIo(env))).rejects.toThrow(/invalid JSON/);});diff --git a/packages/cli/test/blame.test.ts b/packages/cli/test/blame.test.tsindex 9842c91..e07160c 100644--- a/packages/cli/test/blame.test.ts+++ b/packages/cli/test/blame.test.ts@@ -36,7 +36,7 @@ describe("parseBlameTarget", () => {});});-describe("codelineage blame", () => {+describe("cogit blame", () => {let dir: string;let root: string;let io: FakeIo;diff --git a/packages/cli/test/build.test.ts b/packages/cli/test/build.test.tsindex 3ca8aeb..e1074fb 100644--- a/packages/cli/test/build.test.ts+++ b/packages/cli/test/build.test.ts@@ -409,7 +409,7 @@ describe("embedViewModel", () => {});});-describe("codelineage build", () => {+describe("cogit build", () => {let dir: string;let root: string;let io: FakeIo;@@ -826,9 +826,7 @@ describe("codelineage build", () => {const model = await buildProject({ dir: root, io, templateHtml: TEMPLATE, quiet: true });expect(model.epochs[0]?.id).toBe("e1");expect(io.warnings).toEqual(- expect.arrayContaining([- expect.stringMatching(/^could not update \.codelineage\/\.gitignore: /),- ]),+ expect.arrayContaining([expect.stringMatching(/^could not update \.cogit\/\.gitignore: /)]),);});@@ -950,8 +948,8 @@ describe("codelineage build", () => {await expect(buildProject({ dir: empty, io, templateHtml: TEMPLATE })).rejects.toThrow(/not initialized/,);- await mkdir(join(empty, ".codelineage"));- await writeFile(join(empty, ".codelineage", "project.json"), "{}");+ await mkdir(join(empty, ".cogit"));+ await writeFile(join(empty, ".cogit", "project.json"), "{}");await expect(buildProject({ dir: empty, io, templateHtml: TEMPLATE })).rejects.toThrow(/schema version/,);@@ -977,7 +975,7 @@ describe("codelineage build", () => {await mkdir(paths().html);await sessionWrite({ dir: root }, io, async () => JSON.stringify({ sessionId: "s1" }));expect(io.lines).toEqual(["Saved session s1 (0 nodes)"]);- expect(io.warnings.join("\n")).toMatch(/could not build lineage\.html/);+ expect(io.warnings.join("\n")).toMatch(/could not build map\.html/);expect(existsSync(paths().session("s1"))).toBe(true);});});diff --git a/packages/cli/test/config-epoch.test.ts b/packages/cli/test/config-epoch.test.tsindex 07227fc..fa2ae7f 100644--- a/packages/cli/test/config-epoch.test.ts+++ b/packages/cli/test/config-epoch.test.ts@@ -143,8 +143,8 @@ describe("epoch add", () => {it("rejects bad ids and uninitialized or corrupt projects", async () => {await expect(epochAdd(root, "../x", "t", fakeIo(env))).rejects.toThrow(/invalid epoch id/);await expect(epochAdd(root, "e1", "t", fakeIo(env))).rejects.toThrow(/not initialized/);- await mkdir(join(root, ".codelineage"));- await writeFile(join(root, ".codelineage", "project.json"), '{"schema":1}');+ await mkdir(join(root, ".cogit"));+ await writeFile(join(root, ".cogit", "project.json"), '{"schema":1}');await expect(epochAdd(root, "e1", "t", fakeIo(env))).rejects.toThrow(/name/);});});diff --git a/packages/cli/test/files.test.ts b/packages/cli/test/files.test.tsindex 6d37989..eeee71e 100644--- a/packages/cli/test/files.test.ts+++ b/packages/cli/test/files.test.ts@@ -177,7 +177,7 @@ describe("projectFiles", () => {});});-describe("codelineage log --file", () => {+describe("cogit log --file", () => {let dir: string;let root: string;let io: FakeIo;diff --git a/packages/cli/test/helpers.ts b/packages/cli/test/helpers.tsindex e704449..63151e3 100644--- a/packages/cli/test/helpers.ts+++ b/packages/cli/test/helpers.ts@@ -6,7 +6,7 @@ import type { Io, Prompter } from "../src/io.js";export const T0 = "2026-10-21T10:00:00.000Z";export async function tempDir(): Promise<string> {- return mkdtemp(join(tmpdir(), "codelineage-"));+ return mkdtemp(join(tmpdir(), "cogit-"));}export interface FakeIo extends Io {@@ -49,5 +49,5 @@ export function fakeIo(env: NodeJS.ProcessEnv, answers: string[] = [], strict =}export function envFor(dir: string): NodeJS.ProcessEnv {- return { CODELINEAGE_HOME: join(dir, "home"), CLAUDE_CONFIG_DIR: join(dir, "claude") };+ return { COGIT_HOME: join(dir, "home"), CLAUDE_CONFIG_DIR: join(dir, "claude") };}diff --git a/packages/cli/test/hooks.test.ts b/packages/cli/test/hooks.test.tsindex 6776019..49f6249 100644--- a/packages/cli/test/hooks.test.ts+++ b/packages/cli/test/hooks.test.ts@@ -135,23 +135,23 @@ describe("runHook", () => {const startup = JSON.parse((await sessionStart("startup")) ?? "");expect(startup.hookSpecificOutput.hookEventName).toBe("SessionStart");expect(startup.hookSpecificOutput.additionalContext).toContain(- "codelineage is not set up in this project",+ "cogit is not set up in this project",);expect(startup.hookSpecificOutput.additionalContext).toContain('"${CLAUDE_PLUGIN_ROOT}/dist/cli.js" init --yes',);const known = JSON.parse(- (await sessionStart("resume", { ...env, CLAUDE_PLUGIN_ROOT: "/plugins/codelineage" })) ?? "",+ (await sessionStart("resume", { ...env, CLAUDE_PLUGIN_ROOT: "/plugins/cogit" })) ?? "",);expect(known.hookSpecificOutput.additionalContext).toContain(- '"/plugins/codelineage/dist/cli.js" init --yes',+ '"/plugins/cogit/dist/cli.js" init --yes',);expect(await sessionStart("clear")).toBeUndefined();- expect(await sessionStart("startup", { ...env, CODELINEAGE_DISABLE: "1" })).toBeUndefined();+ expect(await sessionStart("startup", { ...env, COGIT_DISABLE: "1" })).toBeUndefined();expect(JSON.parse((await sessionStart("startup")) ?? "").hookSpecificOutput.additionalContext,).not.toContain("records this project's lineage");- expect(existsSync(join(root, ".codelineage"))).toBe(false);+ expect(existsSync(join(root, ".cogit"))).toBe(false);});it("replaces the setup offer with the lineage handoff after init", async () => {@@ -161,7 +161,7 @@ describe("runHook", () => {return out.hookSpecificOutput.additionalContext as string;};// No earlier session yet: only the "how to read it" line.- expect(await context("startup")).toContain("codelineage records this project's lineage");+ expect(await context("startup")).toContain("cogit records this project's lineage");expect(await context("resume")).toContain(`log -C "${root}"`);expect(await context("clear")).toContain("run show before answering");});@@ -282,7 +282,7 @@ describe("runHook", () => {it("does nothing before init and creates nothing", async () => {expect(await stop()).toBeUndefined();- expect(existsSync(join(root, ".codelineage"))).toBe(false);+ expect(existsSync(join(root, ".cogit"))).toBe(false);expect(debug).toEqual([]);});@@ -296,6 +296,12 @@ describe("runHook", () => {expect(await stop()).toBeUndefined();});+ it("names cogit and its record skill in every message the agent sees", () => {+ expect(UPDATE_REQUEST).toContain("cogit:");+ expect(UPDATE_REQUEST).toContain("/cogit:record");+ expect(COMPACT_REQUEST).toContain("/cogit:record");+ });+it("rebuilds the map after every turn, detached", async () => {await initialized(10);expect(await stop()).toBeUndefined();@@ -338,7 +344,7 @@ describe("runHook", () => {it("replaces an unreadable state file instead of failing every turn", async () => {await initialized(1);- await mkdir(join(root, ".codelineage", "state"));+ await mkdir(join(root, ".cogit", "state"));await writeFile(projectPaths(root).state("s1"), "{nope");expect(await stop()).toBeDefined();expect(JSON.parse(await readFile(projectPaths(root).state("s1"), "utf8"))).toMatchObject({@@ -383,7 +389,7 @@ describe("runHook", () => {expect(await sessionStart("compact")).toBeUndefined();await transcript([typed("first", 1)]);expect(await sessionStart("elsewhere")).toBeUndefined();- expect(await sessionStart("compact", { ...env, CODELINEAGE_DISABLE: "1" })).toBeUndefined();+ expect(await sessionStart("compact", { ...env, COGIT_DISABLE: "1" })).toBeUndefined();});it("stays quiet when the transcript cannot be read", async () => {@@ -398,7 +404,7 @@ describe("runHook", () => {it("stays quiet before init even when the transcript has unrecorded messages", async () => {await transcript([typed("first", 1)]);expect(await sessionStart("compact")).toBeUndefined();- expect(existsSync(join(root, ".codelineage"))).toBe(false);+ expect(existsSync(join(root, ".cogit"))).toBe(false);});it("ignores transcript lines that are not messages", async () => {@@ -469,10 +475,12 @@ describe("runHook", () => {it("stays silent when disabled, for unknown events and for bad input", async () => {await initialized(1);+ expect(await stop({}, { ...env, COGIT_DISABLE: "1" })).toBeUndefined();+ // The pre-rename switch keeps working for one minor version.expect(await stop({}, { ...env, CODELINEAGE_DISABLE: "1" })).toBeUndefined();expect(await runHook("nope", "{}", env, T0, (l) => debug.push(l))).toBeUndefined();expect(await stop({ session_id: "../x" })).toBeUndefined();expect(await runHook("stop", "not json", env, T0, (l) => debug.push(l))).toBeUndefined();- expect(debug).toEqual([expect.stringMatching(/^codelineage stop hook: /)]);+ expect(debug).toEqual([expect.stringMatching(/^cogit stop hook: /)]);});});diff --git a/packages/cli/test/init.test.ts b/packages/cli/test/init.test.tsindex 4139844..268fe61 100644--- a/packages/cli/test/init.test.ts+++ b/packages/cli/test/init.test.ts@@ -1,3 +1,4 @@+import { existsSync } from "node:fs";import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";import { basename, join } from "node:path";import { beforeEach, describe, expect, it } from "vitest";@@ -27,11 +28,26 @@ const settingsFile = () => join(dir, "claude", "settings.json");const readText = (f: string) => readFile(f, "utf8");describe("init", () => {+ it("recognizes a pre-rename .codelineage project and renames it", async () => {+ await mkdir(join(root, ".codelineage"), { recursive: true });+ await writeFile(+ join(root, ".codelineage", "project.json"),+ `${JSON.stringify({ schema: 1, name: "old", epochs: [] })}\n`,+ );+ const io = fakeIo(env);++ await init(root, { retention: "keep" }, io);++ expect(io.lines[0]).toBe(`Already initialized: old (${root})`);+ expect(await loadProject(root)).toMatchObject({ ok: true, data: { name: "old" } });+ expect(existsSync(join(root, ".codelineage"))).toBe(false);+ });+it("creates the project with defaults and registers it", async () => {const io = fakeIo(env);await init(root, {}, io);expect(await loadProject(root)).toMatchObject({ ok: true, data: { name: "proj", epochs: [] } });- expect(await readdir(join(root, ".codelineage"))).toContain("sessions");+ expect(await readdir(join(root, ".cogit"))).toContain("sessions");expect(await loadRegistry(env)).toMatchObject({ok: true,data: { projects: [{ path: root, name: "proj" }] },@@ -42,17 +58,17 @@ describe("init", () => {expect(await readSkillAllowed(env)).toBe(true);expect(io.lines.at(-2)).toMatch(/^Initialized proj/);// The conversation store stays out of git even when records are committed.- expect(await readText(join(root, ".codelineage", ".gitignore"))).toBe("conversations/\n");+ expect(await readText(join(root, ".cogit", ".gitignore"))).toBe("conversations/\n");expect(io.lines).toContain(- "Conversations are stored in .codelineage/conversations/ (kept out of git, even with the commit policy).",+ "Conversations are stored in .cogit/conversations/ (kept out of git, even with the commit policy).",);});it("adds the conversation ignore line once", async () => {- await mkdir(join(root, ".codelineage"));+ await mkdir(join(root, ".cogit"));expect(await ensureConversationGitignore(root)).toBe(true);expect(await ensureConversationGitignore(root)).toBe(false);- expect(await readText(join(root, ".codelineage", ".gitignore"))).toBe("conversations/\n");+ expect(await readText(join(root, ".cogit", ".gitignore"))).toBe("conversations/\n");});it("asks nothing when every answer is given as an option", async () => {@@ -64,15 +80,15 @@ describe("init", () => {io,);expect((await loadConfig(env)).language).toBe("Turkish");- expect(await readText(join(root, ".gitignore"))).toContain("/.codelineage/state/");+ expect(await readText(join(root, ".gitignore"))).toContain("/.cogit/state/");});it("asks for the git policy in a repo and writes .gitignore", async () => {await mkdir(join(root, ".git"));const io = fakeIo(env, ["proj", "ignore"]);await init(root, {}, io);- expect(await readText(join(root, ".gitignore"))).toBe("# codelineage\n/.codelineage/\n");- expect(io.lines).toContain("Added to .gitignore: /.codelineage/");+ expect(await readText(join(root, ".gitignore"))).toBe("# cogit\n/.cogit/\n");+ expect(io.lines).toContain("Added to .gitignore: /.cogit/");});it("raises transcript retention when asked, keeping other settings", async () => {@@ -87,7 +103,7 @@ describe("init", () => {});// two changes in one run keep a single backup holding the originalconst backups = (await readdir(join(dir, "claude"))).filter((f) =>- f.startsWith("settings.json.codelineage-bak-"),+ f.startsWith("settings.json.cogit-bak-"),);expect(backups).toHaveLength(1);expect(JSON.parse(await readText(join(dir, "claude", backups[0] as string)))).toEqual({@@ -125,9 +141,7 @@ describe("init", () => {const io = fakeIo(env);await init(root, {}, io);expect(io.warnings[0]).toMatch(/retention left unchanged/);- expect(io.warnings[1]).toMatch(- /add Skill\(codelineage:lineage\) to permissions.allow yourself/,- );+ expect(io.warnings[1]).toMatch(/add Skill\(cogit:record\) to permissions.allow yourself/);expect(await readText(settingsFile())).toBe("{oops");});@@ -197,8 +211,8 @@ describe("init", () => {});it("refuses a corrupt project.json", async () => {- await mkdir(join(root, ".codelineage"));- await writeFile(join(root, ".codelineage", "project.json"), "[]");+ await mkdir(join(root, ".cogit"));+ await writeFile(join(root, ".cogit", "project.json"), "[]");await expect(init(root, {}, fakeIo(env))).rejects.toThrow(/not a JSON object/);});@@ -228,10 +242,10 @@ describe("git helpers", () => {await writeFile(gi, "node_modules/");expect(await ensureGitignore(root, "commit")).toHaveLength(4);expect(await ensureGitignore(root, "commit")).toEqual([]);- expect(await ensureGitignore(root, "ignore")).toEqual(["/.codelineage/"]);+ expect(await ensureGitignore(root, "ignore")).toEqual(["/.cogit/"]);const text = await readText(gi);- expect(text.startsWith("node_modules/\n# codelineage\n")).toBe(true);- expect(text.match(/# codelineage/g)).toHaveLength(1);+ expect(text.startsWith("node_modules/\n# cogit\n")).toBe(true);+ expect(text.match(/# cogit/g)).toHaveLength(1);expect(basename(gi)).toBe(".gitignore");});});diff --git a/packages/cli/test/log.test.ts b/packages/cli/test/log.test.tsindex a936620..55290a3 100644--- a/packages/cli/test/log.test.ts+++ b/packages/cli/test/log.test.ts@@ -40,7 +40,7 @@ function session(over: Partial<Session> & { sessionId: string }): Session {};}-describe("codelineage log and show", () => {+describe("cogit log and show", () => {let dir: string;let root: string;let io: FakeIo;diff --git a/packages/cli/test/migrate.test.ts b/packages/cli/test/migrate.test.tsnew file mode 100644index 0000000..d49f1d2--- /dev/null+++ b/packages/cli/test/migrate.test.ts@@ -0,0 +1,156 @@+import { existsSync } from "node:fs";+import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";+import { join } from "node:path";+import { describe, expect, it } from "vitest";+import { atomicWriteJson } from "../src/store/fs.js";+import {+ migrateGlobal,+ migrateProject,+ renameGitignoreLines,+ takeMigrationWarnings,+} from "../src/store/migrate.js";+import { resolveProjectRoot } from "../src/store/root.js";+import { tempDir } from "./helpers.js";++describe("migrateProject", () => {+ it("renames .codelineage to .cogit and fixes the .gitignore lines", async () => {+ const root = await tempDir();+ await mkdir(join(root, ".codelineage", "sessions"), { recursive: true });+ await writeFile(join(root, ".codelineage", "sessions", "s1.json"), '{"kept":true}\n');+ await writeFile(+ join(root, ".gitignore"),+ "node_modules/\n# codelineage\n/.codelineage/\n/.codelineage/state/\n/.cogit/other\n",+ );++ expect(await migrateProject(root)).toBe(true);+ expect(existsSync(join(root, ".codelineage"))).toBe(false);+ expect(await readFile(join(root, ".cogit", "sessions", "s1.json"), "utf8")).toBe(+ '{"kept":true}\n',+ );+ expect(await readFile(join(root, ".gitignore"), "utf8")).toBe(+ "node_modules/\n# cogit\n/.cogit/\n/.cogit/state/\n/.cogit/other\n",+ );++ // Idempotent: the second run has nothing left to do.+ expect(await migrateProject(root)).toBe(false);+ });++ it("leaves the old dir alone when the filesystem refuses the rename", async () => {+ const root = await tempDir();+ await mkdir(join(root, ".codelineage"), { recursive: true });+ await chmod(root, 0o555);+ try {+ expect(await migrateProject(root)).toBe(false);+ expect(existsSync(join(root, ".codelineage"))).toBe(true);+ } finally {+ await chmod(root, 0o755);+ }+ });++ it("touches nothing when both directories exist and warns once", async () => {+ const root = await tempDir();+ await mkdir(join(root, ".codelineage"), { recursive: true });+ await mkdir(join(root, ".cogit"), { recursive: true });+ await writeFile(join(root, ".gitignore"), "/.codelineage/\n");++ expect(await migrateProject(root)).toBe(false);+ expect(await migrateProject(root)).toBe(false);+ expect(existsSync(join(root, ".codelineage"))).toBe(true);+ expect(await readFile(join(root, ".gitignore"), "utf8")).toBe("/.codelineage/\n");+ const warnings = takeMigrationWarnings();+ expect(warnings).toHaveLength(1);+ expect(warnings[0]).toContain("both .codelineage/ and .cogit/ exist");+ });++ it("runs from resolveProjectRoot, so every command and hook picks it up", async () => {+ const root = await tempDir();+ await mkdir(join(root, ".codelineage"), { recursive: true });+ await atomicWriteJson(join(root, ".codelineage", "project.json"), {+ schema: 1,+ name: "p",+ epochs: [],+ });++ const resolved = await resolveProjectRoot(root);+ expect(resolved.root).toBe(root);+ expect(existsSync(join(root, ".cogit", "project.json"))).toBe(true);+ expect(existsSync(join(root, ".codelineage"))).toBe(false);+ });++ it("only rewrites whole path segments in .gitignore", () => {+ expect(renameGitignoreLines("/.codelineage/x\n/.cogitx/\n")).toBe("/.cogit/x\n/.cogitx/\n");+ });+});++describe("migrateGlobal", () => {+ it("moves the default config dir and rewrites registry paths inside it", async () => {+ const dir = await tempDir();+ const xdg = join(dir, "xdg");+ const oldBase = join(xdg, "codelineage");+ const newBase = join(xdg, "cogit");+ await mkdir(oldBase, { recursive: true });+ await atomicWriteJson(join(oldBase, "projects.json"), {+ schema: 1,+ projects: [+ { path: join(oldBase, "a-project"), name: "a", addedAt: "2026-10-21T10:00:00.000Z" },+ ],+ });+ const env = { XDG_CONFIG_HOME: xdg };++ expect(await migrateGlobal(env)).toBe(true);+ expect(existsSync(oldBase)).toBe(false);+ const registry = JSON.parse(await readFile(join(newBase, "projects.json"), "utf8"));+ expect(registry.projects[0].path).toBe(join(newBase, "a-project"));+ expect(await migrateGlobal(env)).toBe(false);+ });++ it("moves a registry it cannot parse without touching the file", async () => {+ const dir = await tempDir();+ const xdg = join(dir, "bad");+ await mkdir(join(xdg, "codelineage"), { recursive: true });+ await writeFile(join(xdg, "codelineage", "projects.json"), "not json\n");++ expect(await migrateGlobal({ XDG_CONFIG_HOME: xdg })).toBe(true);+ expect(await readFile(join(xdg, "cogit", "projects.json"), "utf8")).toBe("not json\n");+ });++ it("leaves registry entries outside the moved dir alone", async () => {+ const dir = await tempDir();+ const xdg = join(dir, "outside");+ await mkdir(join(xdg, "codelineage"), { recursive: true });+ const entries = [+ { path: "/elsewhere", name: "x" },+ { path: 7, name: "y" },+ ];+ await writeFile(+ join(xdg, "codelineage", "projects.json"),+ `${JSON.stringify({ schema: 1, projects: entries })}\n`,+ );++ expect(await migrateGlobal({ XDG_CONFIG_HOME: xdg })).toBe(true);+ const registry = JSON.parse(await readFile(join(xdg, "cogit", "projects.json"), "utf8"));+ expect(registry.projects).toEqual(entries);+ });++ it("keeps an explicit CODELINEAGE_HOME working and moves no default dir", async () => {+ const dir = await tempDir();+ const xdg = join(dir, "xdg");+ await mkdir(join(xdg, "codelineage"), { recursive: true });+ const env = { XDG_CONFIG_HOME: xdg, CODELINEAGE_HOME: join(dir, "custom") };++ expect(await migrateGlobal(env)).toBe(false);+ expect(existsSync(join(xdg, "codelineage"))).toBe(true);+ });++ it("warns instead of merging when both default dirs exist", async () => {+ const dir = await tempDir();+ const xdg = join(dir, "both");+ await mkdir(join(xdg, "codelineage"), { recursive: true });+ await mkdir(join(xdg, "cogit"), { recursive: true });++ expect(await migrateGlobal({ XDG_CONFIG_HOME: xdg })).toBe(false);+ const warnings = takeMigrationWarnings();+ expect(warnings).toHaveLength(1);+ expect(warnings[0]).toContain("both");+ });+});diff --git a/packages/cli/test/open.test.ts b/packages/cli/test/open.test.tsindex a38555f..a1c792e 100644--- a/packages/cli/test/open.test.ts+++ b/packages/cli/test/open.test.ts@@ -47,17 +47,17 @@ function fakeSpawn(describe("openerCommand", () => {it("picks the opener each platform ships with", () => {- expect(openerCommand("darwin", "/p/lineage.html")).toEqual({+ expect(openerCommand("darwin", "/p/map.html")).toEqual({command: "open",- args: ["/p/lineage.html"],+ args: ["/p/map.html"],});- expect(openerCommand("win32", "/p/lineage.html")).toEqual({+ expect(openerCommand("win32", "/p/map.html")).toEqual({command: "cmd",- args: ["/c", "start", "", "/p/lineage.html"],+ args: ["/c", "start", "", "/p/map.html"],});- expect(openerCommand("linux", "/p/lineage.html")).toEqual({+ expect(openerCommand("linux", "/p/map.html")).toEqual({command: "xdg-open",- args: ["/p/lineage.html"],+ args: ["/p/map.html"],});});});@@ -65,13 +65,13 @@ describe("openerCommand", () => {describe("launchFile", () => {it("resolves true once the opener starts", async () => {const calls: string[][] = [];- expect(await launchFile("/p/lineage.html", fakeSpawn("spawn", calls))).toBe(true);- const { command } = openerCommand(process.platform, "/p/lineage.html");- expect(calls).toEqual([[command, "/p/lineage.html"]]);+ expect(await launchFile("/p/map.html", fakeSpawn("spawn", calls))).toBe(true);+ const { command } = openerCommand(process.platform, "/p/map.html");+ expect(calls).toEqual([[command, "/p/map.html"]]);});it("resolves false when the opener binary is missing", async () => {- expect(await launchFile("/p/lineage.html", fakeSpawn("error", []))).toBe(false);+ expect(await launchFile("/p/map.html", fakeSpawn("error", []))).toBe(false);});});diff --git a/packages/cli/test/panel.test.ts b/packages/cli/test/panel.test.tsindex a97df2e..92e2f62 100644--- a/packages/cli/test/panel.test.ts+++ b/packages/cli/test/panel.test.ts@@ -12,7 +12,7 @@ import { DATA_ELEMENT_ID, type PanelViewModel } from "../src/view/model.js";import { buildPanel } from "../src/view/panel.js";import { envFor, fakeIo, T0, tempDir } from "./helpers.js";-const TEMPLATE = `<!doctype html><html><head><title>codelineage — lineage</title></head><body>+const TEMPLATE = `<!doctype html><html><head><title>cogit — lineage</title></head><body><div id="root"></div><script id="${DATA_ELEMENT_ID}" type="application/json"></script></body></html>`;@@ -111,7 +111,7 @@ describe("buildPanel", () => {});const html = await readFile(globalPaths(env).panel, "utf8");- expect(html).toContain("<title>codelineage — panel</title>");+ expect(html).toContain("<title>cogit — panel</title>");expect(embedded(html)).toEqual(model);});@@ -184,7 +184,7 @@ describe("panel refresh from build", () => {it("turns an unwritable global directory into a warning, not a failed build", async () => {const home = join(dir, "home-file");await writeFile(home, "not a directory");- const badEnv = { ...env, CODELINEAGE_HOME: home };+ const badEnv = { ...env, COGIT_HOME: home };const root = join(dir, "proj");await initProject(root, badEnv);diff --git a/packages/cli/test/plugin-manifest.test.ts b/packages/cli/test/plugin-manifest.test.tsindex e5fe94c..13e792c 100644--- a/packages/cli/test/plugin-manifest.test.ts+++ b/packages/cli/test/plugin-manifest.test.ts@@ -6,7 +6,7 @@ const read = async (path: string) =>describe("plugin packaging", () => {it("writes a message summary only when the setting is on", async () => {- const skill = await readFile(new URL("../skills/lineage/SKILL.md", import.meta.url), "utf8");+ const skill = await readFile(new URL("../skills/record/SKILL.md", import.meta.url), "utf8");// Story 8.9: the branch summary is the outer layer; the per-message summary// is off unless the user turns it on, and the skill has to say so.expect(skill).toContain("`messageSummaries`");diff --git a/packages/cli/test/program-commands.test.ts b/packages/cli/test/program-commands.test.tsindex d050170..b394f26 100644--- a/packages/cli/test/program-commands.test.ts+++ b/packages/cli/test/program-commands.test.ts@@ -135,15 +135,15 @@ describe("commands through the CLI", () => {it("builds the map through the CLI", async () => {await cli("init", root, "--yes", "--retention", "keep");await cli("build", root);- expect(io.lines.at(-1)).toMatch(/^Wrote .*lineage\.html$/);- expect(existsSync(join(root, ".codelineage", "lineage.html"))).toBe(true);+ expect(io.lines.at(-1)).toMatch(/^Wrote .*map\.html$/);+ expect(existsSync(join(root, ".cogit", "map.html"))).toBe(true);});it("open builds then launches the map, and the panel without a directory", async () => {await cli("init", root, "--yes", "--retention", "keep");await cli("open", root);- expect(launched).toEqual([join(root, ".codelineage", "lineage.html")]);- expect(io.lines.at(-1)).toMatch(/^Opened .*lineage\.html$/);+ expect(launched).toEqual([join(root, ".cogit", "map.html")]);+ expect(io.lines.at(-1)).toMatch(/^Opened .*map\.html$/);expect(interactive).toEqual([false, false]);await cli("open");expect(launched).toHaveLength(2);diff --git a/packages/cli/test/program.test.ts b/packages/cli/test/program.test.tsindex 93e7a97..530a7fd 100644--- a/packages/cli/test/program.test.ts+++ b/packages/cli/test/program.test.ts@@ -21,6 +21,6 @@ describe("createProgram", () => {});it("names the binary in help", () => {- expect(run(["--help"])).toContain("Usage: codelineage");+ expect(run(["--help"])).toContain("Usage: cogit");});});diff --git a/packages/cli/test/search.test.ts b/packages/cli/test/search.test.tsindex 649511b..2e4aff6 100644--- a/packages/cli/test/search.test.ts+++ b/packages/cli/test/search.test.ts@@ -281,7 +281,7 @@ describe("hash jump", () => {});});-describe("codelineage search", () => {+describe("cogit search", () => {let dir: string;let root: string;let io: FakeIo;diff --git a/packages/cli/test/server.test.ts b/packages/cli/test/server.test.tsindex e98b5f7..8c176c6 100644--- a/packages/cli/test/server.test.ts+++ b/packages/cli/test/server.test.ts@@ -28,7 +28,7 @@ import { loadConfig, updateConfig } from "../src/store/stores.js";import { DATA_ELEMENT_ID, LIVE_META_NAME, TOKEN_META_NAME } from "../src/view/model.js";import { envFor, fakeIo, tempDir } from "./helpers.js";-const TEMPLATE = `<!doctype html><html><head><title>codelineage</title></head><body><div id="root"></div>+const TEMPLATE = `<!doctype html><html><head><title>cogit</title></head><body><div id="root"></div><script id="${DATA_ELEMENT_ID}" type="application/json"></script></body></html>`;const servers: MapServer[] = [];@@ -121,7 +121,7 @@ function postConfig(/** The token the panel page carries; every settings write needs it. */async function panelToken(server: MapServer): Promise<string> {const page = await request(`${server.url}/`);- const match = /<meta name="codelineage-token" content="([^"]+)">/.exec(page.body);+ const match = /<meta name="cogit-token" content="([^"]+)">/.exec(page.body);if (!match?.[1]) throw new Error("panel page has no token");return match[1];}@@ -267,7 +267,7 @@ describe("map server", () => {expect(reply.status).toBe(200);expect(JSON.parse(reply.body)).toEqual({ok: true,- name: "codelineage",+ name: "cogit",home: globalPaths(env).base,});});@@ -542,7 +542,7 @@ describe("spawnServerProcess", () => {expect(calls[0]?.[2]).toMatchObject({detached: true,stdio: "ignore",- env: { XDG_CONFIG_HOME: "/home/x", CODELINEAGE_DISABLE: "1" },+ env: { XDG_CONFIG_HOME: "/home/x", COGIT_DISABLE: "1" },});});});@@ -565,7 +565,7 @@ describe("ensureServer", () => {it("gives up when the port answers as something else", async () => {const other = createHttpServer((_req, res) => {res.writeHead(404);- res.end("not codelineage");+ res.end("not cogit");});const port = await listen(other);await updateConfig((config) => ({ ...config, serverPort: port }), env);diff --git a/packages/cli/test/session.test.ts b/packages/cli/test/session.test.tsindex 1c520d8..73d67bd 100644--- a/packages/cli/test/session.test.ts+++ b/packages/cli/test/session.test.ts@@ -166,9 +166,9 @@ describe("session write", () => {});it("refuses a message of a session that started later", async () => {- await mkdir(join(root, ".codelineage", "sessions"), { recursive: true });+ await mkdir(join(root, ".cogit", "sessions"), { recursive: true });await writeFile(- join(root, ".codelineage", "sessions", "late.json"),+ join(root, ".cogit", "sessions", "late.json"),JSON.stringify({schema: 1,sessionId: "late",@@ -206,8 +206,8 @@ describe("session write", () => {await sessionWrite({ dir: root, file: f }, io);expect(io.lines).toEqual(["Saved session s2 (0 nodes)"]);await expect(sessionWrite({ dir: dir, file: f }, io)).rejects.toThrow(/not initialized/);- await mkdir(join(dir, ".codelineage"));- await writeFile(join(dir, ".codelineage", "project.json"), "{}");+ await mkdir(join(dir, ".cogit"));+ await writeFile(join(dir, ".cogit", "project.json"), "{}");await expect(sessionWrite({ dir: dir, file: f }, io)).rejects.toThrow(/schema version/);});@@ -235,8 +235,8 @@ describe("session show", () => {});it("reports a corrupt project.json without failing", async () => {- await mkdir(join(root, ".codelineage"));- await writeFile(join(root, ".codelineage", "project.json"), "{nope");+ await mkdir(join(root, ".cogit"));+ await writeFile(join(root, ".cogit", "project.json"), "{nope");await sessionShow(root, "s1", io);expect(shown()).toMatchObject({ initialized: false, error: expect.stringMatching(/JSON/) });});@@ -255,7 +255,7 @@ describe("session show", () => {session: null,newMessages: null,lastMessages: [],- inbox: join(root, ".codelineage", "inbox", "s1.json"),+ inbox: join(root, ".cogit", "inbox", "s1.json"),});await sessionWrite({ dir: root }, fakeIo(envFor(dir)), async () =>@@ -538,15 +538,15 @@ ${line("second", 2)}it("flags an unreadable record instead of hiding it", async () => {await init(root, { name: "p", retention: "keep", language: "auto" }, fakeIo(envFor(dir)));- await writeFile(join(root, ".codelineage", "sessions", "s1.json"), "{nope");+ await writeFile(join(root, ".cogit", "sessions", "s1.json"), "{nope");await sessionShow(root, "s1", io);expect(shown()).toMatchObject({ session: null, sessionError: expect.stringMatching(/JSON/) });});it("consumes the inbox file after a successful write and keeps it after a failed one", async () => {await init(root, { name: "p", retention: "keep", language: "auto" }, fakeIo(envFor(dir)));- const file = join(root, ".codelineage", "inbox", "s1.json");- await mkdir(join(root, ".codelineage", "inbox"));+ const file = join(root, ".cogit", "inbox", "s1.json");+ await mkdir(join(root, ".cogit", "inbox"));await writeFile(file, "{nope");await expect(sessionWrite({ dir: root, file, consume: true }, io)).rejects.toThrow(/JSON/);expect(existsSync(file)).toBe(true);diff --git a/packages/cli/test/store.test.ts b/packages/cli/test/store.test.tsindex 0c4b760..31cd97b 100644--- a/packages/cli/test/store.test.ts+++ b/packages/cli/test/store.test.ts@@ -4,7 +4,7 @@ import { join } from "node:path";import { beforeEach, describe, expect, it } from "vitest";import { atomicWrite, atomicWriteJson, readJson } from "../src/store/fs.js";import { isLockHeld, LockBusyError, withLock } from "../src/store/lock.js";-import { globalPaths, projectPaths } from "../src/store/paths.js";+import { captureDisabled, globalPaths, projectPaths } from "../src/store/paths.js";import {loadConfig,loadProject,@@ -19,25 +19,33 @@ import {let dir: string;let env: NodeJS.ProcessEnv;beforeEach(async () => {- dir = await mkdtemp(join(tmpdir(), "codelineage-"));- env = { CODELINEAGE_HOME: join(dir, "home") };+ dir = await mkdtemp(join(tmpdir(), "cogit-"));+ env = { COGIT_HOME: join(dir, "home") };});const T0 = "2026-10-21T10:00:00.000Z";describe("paths", () => {it("resolves the global dir from env", () => {- expect(globalPaths({ CODELINEAGE_HOME: "/x" }).config).toBe("/x/config.json");- expect(globalPaths({ XDG_CONFIG_HOME: "/xdg" }).base).toBe("/xdg/codelineage");- expect(globalPaths({}).base).toMatch(/\.config\/codelineage$/);+ expect(globalPaths({ COGIT_HOME: "/x" }).config).toBe("/x/config.json");+ expect(globalPaths({ XDG_CONFIG_HOME: "/xdg" }).base).toBe("/xdg/cogit");+ expect(globalPaths({}).base).toMatch(/\.config\/cogit$/);+ });++ it("still reads the pre-rename names for one minor version", () => {+ expect(globalPaths({ CODELINEAGE_HOME: "/old" }).config).toBe("/old/config.json");+ expect(globalPaths({ COGIT_HOME: "/new", CODELINEAGE_HOME: "/old" }).base).toBe("/new");+ expect(captureDisabled({ CODELINEAGE_DISABLE: "1" })).toBe(true);+ expect(captureDisabled({ COGIT_DISABLE: "1" })).toBe(true);+ expect(captureDisabled({ CODELINEAGE_DISABLE: "0", COGIT_DISABLE: "0" })).toBe(false);});it("lays out the project dir", () => {const p = projectPaths("/r");- expect(p.session("s1")).toBe("/r/.codelineage/sessions/s1.json");- expect(p.state("s1")).toBe("/r/.codelineage/state/s1.json");- expect(p.lock("project")).toBe("/r/.codelineage/locks/project.lock");- expect(p.html).toBe("/r/.codelineage/lineage.html");+ expect(p.session("s1")).toBe("/r/.cogit/sessions/s1.json");+ expect(p.state("s1")).toBe("/r/.cogit/state/s1.json");+ expect(p.lock("project")).toBe("/r/.cogit/locks/project.lock");+ expect(p.html).toBe("/r/.cogit/map.html");});});diff --git a/packages/cli/test/switcher.test.ts b/packages/cli/test/switcher.test.tsindex 069e59f..2080925 100644--- a/packages/cli/test/switcher.test.ts+++ b/packages/cli/test/switcher.test.ts@@ -16,7 +16,7 @@ import {} from "../src/view/switcher.js";import { envFor, fakeIo, tempDir } from "./helpers.js";-const TEMPLATE = `<!doctype html><html><head><title>codelineage — lineage</title></head><body>+const TEMPLATE = `<!doctype html><html><head><title>cogit — lineage</title></head><body><div id="root"></div><script id="${DATA_ELEMENT_ID}" type="application/json"></script></body></html>`;@@ -39,7 +39,7 @@ function collected(overrides: Partial<CollectedProject> & { name: string; path:missing: false,lastActivity: null,needsUserCount: 0,- lineageUrl: `file://${overrides.path}/.codelineage/lineage.html`,+ lineageUrl: `file://${overrides.path}/.cogit/map.html`,leftOff: "",...overrides,};@@ -107,7 +107,7 @@ describe("switcherEntries", () => {path: "/work/current",lastActivity: "2026-10-24T10:00:00.000Z",leftOff: "Where we left off.",- lineageUrl: "file:///work/current/.codelineage/lineage.html",+ lineageUrl: "file:///work/current/.cogit/map.html",current: true,});expect(entries[1]?.current).toBe(false);@@ -161,8 +161,8 @@ describe("filterSwitcherProjects", () => {const projects = switcherEntries([collected({- name: "codelineage",- path: "/work/codelineage",+ name: "cogit",+ path: "/work/cogit",lastActivity: "2026-10-24T10:00:00.000Z",leftOff: "Add the project switcher.",}),@@ -173,11 +173,11 @@ describe("filterSwitcherProjects", () => {leftOff: "Write the push commands.",}),],- "/work/codelineage",+ "/work/cogit",);it("matches name, path and the left-off line, case-insensitively", () => {- expect(filterSwitcherProjects(projects, "CODE").map((p) => p.name)).toEqual(["codelineage"]);+ expect(filterSwitcherProjects(projects, "COG").map((p) => p.name)).toEqual(["cogit"]);expect(filterSwitcherProjects(projects, "start-project").map((p) => p.name)).toEqual(["start-project",]);diff --git a/packages/cli/test/view-model.test.ts b/packages/cli/test/view-model.test.tsindex 818f8cb..c7d533a 100644--- a/packages/cli/test/view-model.test.ts+++ b/packages/cli/test/view-model.test.ts@@ -3,7 +3,7 @@ import { DATA_ELEMENT_ID, VIEW_SCHEMA } from "../src/view/model.js";describe("view model contract", () => {it("pins the data element id the template reads", () => {- expect(DATA_ELEMENT_ID).toBe("codelineage-data");+ expect(DATA_ELEMENT_ID).toBe("cogit-data");});it("pins the serialized schema version", () => {diff --git a/packages/cli/test/worktree.test.ts b/packages/cli/test/worktree.test.tsindex b75d0f3..6a92500 100644--- a/packages/cli/test/worktree.test.ts+++ b/packages/cli/test/worktree.test.ts@@ -52,9 +52,9 @@ describe("resolveProjectRoot", () => {expect((await resolveProjectRoot(join(wt, "src"))).root).toBe(join(main, "src"));});- it("keeps a worktree that has its own committed .codelineage/", async () => {+ it("keeps a worktree that has its own committed .cogit/", async () => {const { wt } = await gitLayout(dir);- await mkdir(join(wt, ".codelineage"));+ await mkdir(join(wt, ".cogit"));await writeFile(projectPaths(wt).project, "{}");expect(await resolveProjectRoot(wt)).toEqual({root: wt,@@ -95,7 +95,7 @@ describe("commands in a worktree", () => {it("writes the record to the main checkout and keeps the worktree on it", async () => {await sessionWrite({ dir: wt }, fakeIo(env), async () => '{"sessionId":"s1","title":"a"}');- expect(existsSync(join(wt, ".codelineage"))).toBe(false);+ expect(existsSync(join(wt, ".cogit"))).toBe(false);const first = await loadSession(main, "s1");expect(first.found && first.ok && first.data.worktree).toEqual({ path: wt, branch: "feature" });diff --git a/packages/template/index.html b/packages/template/index.htmlindex dacc859..58b37a5 100644--- a/packages/template/index.html+++ b/packages/template/index.html@@ -3,12 +3,12 @@<head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" />- <title>codelineage — lineage</title>+ <title>cogit — map</title></head><body><div id="root"></div>- <!-- `codelineage build` replaces the empty element with the JSON view model. -->- <script id="codelineage-data" type="application/json"></script>+ <!-- `cogit build` replaces the empty element with the JSON view model. -->+ <script id="cogit-data" type="application/json"></script><script type="module" src="/src/main.tsx"></script></body></html>diff --git a/packages/template/src/Graph.tsx b/packages/template/src/Graph.tsxindex c3cb208..565dfaf 100644--- a/packages/template/src/Graph.tsx+++ b/packages/template/src/Graph.tsx@@ -142,7 +142,7 @@ const nodeTypes: NodeTypes = {/*** The place a URL asks for. `#s=<sessionId>&m=<messageId>` (Story 8.8:- * `codelineage blame` prints such a URL) opens that session and message;+ * `cogit blame` prints such a URL) opens that session and message;* `#focus=head` is what the project switcher uses (8.12) — the newest message,* i.e. where the work left off. The session opens and the message's drill-down* is shown; a message id the record no longer holds opens the session.diff --git a/packages/template/src/Panel.tsx b/packages/template/src/Panel.tsxindex ca2b429..2e34d42 100644--- a/packages/template/src/Panel.tsx+++ b/packages/template/src/Panel.tsx@@ -18,7 +18,7 @@ export function Panel({ model }: { model: PanelViewModel }) {<header className="project"><div><h1>Projects</h1>- <p className="muted">Every project codelineage knows about.</p>+ <p className="muted">Every project cogit knows about.</p></div><div className="page-actions"><SettingsButton settings={model.settings} />@@ -32,7 +32,7 @@ export function Panel({ model }: { model: PanelViewModel }) {</header>{model.projects.length === 0 ? (- <p className="empty">No projects registered yet. Run `codelineage init` in a project.</p>+ <p className="empty">No projects registered yet. Run `cogit init` in a project.</p>) : (<ul className="panel-grid">{model.projects.map((project) => {diff --git a/packages/template/src/SettingsModal.tsx b/packages/template/src/SettingsModal.tsxindex ddd123f..60107ad 100644--- a/packages/template/src/SettingsModal.tsx+++ b/packages/template/src/SettingsModal.tsx@@ -191,7 +191,7 @@ function SettingsDialog({<p className="muted">{canEdit? "A change here applies to new builds and chats."- : "Read-only. Open this page with `codelineage open` to change settings, or use `codelineage config set <key> <value>`."}+ : "Read-only. Open this page with `cogit open` to change settings, or use `cogit config set <key> <value>`."}</p>{loading ? <p className="settings-help">Reading the current settings…</p> : null}{loadError ? <p className="setting-error">{loadError}</p> : null}diff --git a/packages/template/src/SidePanel.tsx b/packages/template/src/SidePanel.tsxindex 418fb3e..0c2d52c 100644--- a/packages/template/src/SidePanel.tsx+++ b/packages/template/src/SidePanel.tsx@@ -77,12 +77,12 @@ type CopyState = "idle" | "copied" | "failed";/*** The message's stable hash with a copy button (Story 8.10): the user pastes it- * to the agent, which runs `codelineage show <hash>` for the full record.+ * to the agent, which runs `cogit show <hash>` for the full record.*/function MessageHash({ value }: { value: string }) {const [state, setState] = useState<CopyState>("idle");const code = useRef<HTMLElement>(null);- const title = `Ask your agent: codelineage show ${value}`;+ const title = `Ask your agent: cogit show ${value}`;const copy = (): void => {setState("idle");diff --git a/packages/template/src/data.ts b/packages/template/src/data.tsindex 77957dd..a1e7742 100644--- a/packages/template/src/data.ts+++ b/packages/template/src/data.ts@@ -12,13 +12,13 @@ export function parseViewModel(text: string): PageModel {try {value = JSON.parse(text);} catch {- throw new Error("The embedded codelineage data is not valid JSON.");+ throw new Error("The embedded cogit data is not valid JSON.");}if (typeof value !== "object" || value === null || !("kind" in value)) {- throw new Error("The embedded codelineage data is not a view model.");+ throw new Error("The embedded cogit data is not a view model.");}if (value.kind !== "lineage" && value.kind !== "panel") {- throw new Error(`Unsupported codelineage view: ${String(value.kind)}`);+ throw new Error(`Unsupported cogit view: ${String(value.kind)}`);}return value as PageModel;}@@ -34,7 +34,7 @@ export async function loadViewModel(doc: Document = document): Promise<PageModelconst { fixture } = await import("./fixture.js");return fixture;}- throw new Error("No codelineage data in this page. Run `codelineage build`.");+ throw new Error("No cogit data in this page. Run `cogit build`.");}/**@@ -65,7 +65,7 @@ export function pageToken(doc: Document = document): string | null {*/export async function loadSettings(token: string): Promise<Partial<PanelSettings>> {const response = await fetch("/api/config", {- headers: { "x-codelineage-token": token },+ headers: { "x-cogit-token": token },cache: "no-store",});if (!response.ok) {@@ -84,7 +84,7 @@ export async function saveSetting(): Promise<PanelSettings[keyof PanelSettings]> {const response = await fetch("/api/config", {method: "POST",- headers: { "content-type": "application/json", "x-codelineage-token": token },+ headers: { "content-type": "application/json", "x-cogit-token": token },body: JSON.stringify({ key, value }),});if (!response.ok) {diff --git a/packages/template/src/fixture.ts b/packages/template/src/fixture.tsindex c18ce44..904790a 100644--- a/packages/template/src/fixture.ts+++ b/packages/template/src/fixture.ts@@ -29,7 +29,7 @@ const session = (});/**- * Dev-only sample data (`npm run dev -w template`). Mirrors the shape `codelineage+ * Dev-only sample data (`npm run dev -w template`). Mirrors the shape `cogit* build` produces: two epochs, three sessions (one unassigned), a branch that* folds, a return link and an unrecorded message at the end of a chain.*/@@ -37,8 +37,8 @@ export const fixture: LineageViewModel = {kind: "lineage",schema: 1,project: {- name: "codelineage",- path: "/home/dev/codelineage",+ name: "cogit",+ path: "/home/dev/cogit",generatedAt: "2026-10-24T12:00:00.000Z",},status: {@@ -312,11 +312,11 @@ export const fixture: LineageViewModel = {// Story 8.12: the switcher's data, as `build` collects it from the registry.switcher: [{- name: "codelineage",- path: "/home/dev/codelineage",+ name: "cogit",+ path: "/home/dev/cogit",lastActivity: "2026-10-24T11:42:00.000Z",leftOff: "Render the fixture through the template and check the single-file build.",- lineageUrl: "file:///home/dev/codelineage/.codelineage/lineage.html",+ lineageUrl: "file:///home/dev/cogit/.cogit/map.html",current: true,},{@@ -324,7 +324,7 @@ export const fixture: LineageViewModel = {path: "/home/dev/start-project",lastActivity: "2026-10-23T18:05:00.000Z",leftOff: "Write the push commands for the release notes.",- lineageUrl: "file:///home/dev/start-project/.codelineage/lineage.html",+ lineageUrl: "file:///home/dev/start-project/.cogit/map.html",current: false,},],diff --git a/packages/template/src/graph.ts b/packages/template/src/graph.tsindex 21d77dd..4eb0e19 100644--- a/packages/template/src/graph.ts+++ b/packages/template/src/graph.ts@@ -89,7 +89,7 @@ export function isMessageHash(id: string): boolean {return /^h[0-9a-f]{12}$/.test(id);}-/** `h3f2a1b8`: what the panel shows and `codelineage show` accepts. */+/** `h3f2a1b8`: what the panel shows and `cogit show` accepts. */export function shortHash(id: string): string {return isMessageHash(id) ? id.slice(0, 8) : id;}diff --git a/vitest.config.ts b/vitest.config.tsindex 3d6fbea..4ecb720 100644--- a/vitest.config.ts+++ b/vitest.config.ts@@ -7,7 +7,7 @@ import { defineConfig } from "vitest/config";* import to its page plugin, so tests load the same file as a string module.*/const templateAsText: Plugin = {- name: "codelineage-template-as-text",+ name: "cogit-template-as-text",enforce: "pre",load(id) {const file = id.split("?")[0] ?? "";