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
fix(open): register an initialized project missing from the registry
Eren18016de0f4a2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9a19c1f..49a1022 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Fixed+- `open` adds an initialized project that is missing from the global registry (for example one set up inside a sandbox with its own home) back before serving it; the local map server only shows registered projects, so such a map returned "not found". When the registry cannot be written, `open` opens the file instead.+## [0.6.0] - 2026-10-23### Added- Live map server: `codelineage open` makes sure one background server per user runs on `127.0.0.1:<serverPort>` (new setting `serverPort`, default 4747) and opens the map or the panel through it, returning at once. A served page refreshes its data when the map is rebuilt without losing open topics, selection, zoom or scroll, and the panel's links point at those live maps; over `file://` nothing changes. The server serves only registered projects' maps and the panel, rejects a foreign `Host` header (DNS rebinding), binds loopback only and exits after 30 idle minutes. When the port is taken or the server cannot start, `open` opens the file as before and prints one line saying so.diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.tsindex cd69ddf..8ebb49a 100644--- a/packages/cli/src/commands/init.ts+++ b/packages/cli/src/commands/init.ts@@ -118,7 +118,7 @@ async function askLanguage(io: Io, opts: InitOptions): Promise<void> {);}-async function register(io: Io, root: string, name: string): Promise<void> {+export async function register(io: Io, root: string, name: string): Promise<void> {await bestEffort(io, "could not register the project in the global panel", () =>updateRegistry((r) =>diff --git a/packages/cli/src/commands/open.ts b/packages/cli/src/commands/open.tsindex 5db8456..5048c56 100644--- a/packages/cli/src/commands/open.ts+++ b/packages/cli/src/commands/open.ts@@ -3,8 +3,10 @@ import type { Io } from "../io.js";import { ensureServer, mapPageUrl } from "../server.js";import { globalPaths, projectPaths } from "../store/paths.js";import { resolveProjectRoot } from "../store/root.js";+import { loadProject, loadRegistry } from "../store/stores.js";import { buildPanel } from "../view/panel.js";import { buildProject } from "./build.js";+import { register } from "./init.js";export interface OpenOptions {io: Io;@@ -90,7 +92,15 @@ export async function openProject(opts: OpenProjectOptions): Promise<void> {io,...(opts.templateHtml === undefined ? {} : { templateHtml: opts.templateHtml }),});- const base = await (opts.server ?? defaultServer)(io.env);+ // The server shows registered projects only; an initialized project missing from+ // the registry (written elsewhere, e.g. from a sandbox with its own home) is added back.+ const project = await loadProject(root);+ if (project.found && project.ok) await register(io, root, project.data.name);+ const listed = await loadRegistry(io.env).then(+ (r) => r.found && r.ok && r.data.projects.some((p) => p.path === root),+ () => false,+ );+ const base = listed ? await (opts.server ?? defaultServer)(io.env) : null;if (base) {await openTarget(mapPageUrl(base, root), opts);return;diff --git a/packages/cli/test/open.test.ts b/packages/cli/test/open.test.tsindex 1cf81d3..a38555f 100644--- a/packages/cli/test/open.test.ts+++ b/packages/cli/test/open.test.ts@@ -1,5 +1,5 @@import { EventEmitter } from "node:events";-import { mkdir, rm } from "node:fs/promises";+import { mkdir, readFile, rm, writeFile } from "node:fs/promises";import { join } from "node:path";import { beforeEach, describe, expect, it } from "vitest";import { init } from "../src/commands/init.js";@@ -105,6 +105,49 @@ describe("openProject", () => {expect(io.warnings).toEqual([]);});+ it("adds an initialized project missing from the registry back before serving it", async () => {+ const registry = join(dir, "home", "projects.json");+ await writeFile(registry, JSON.stringify({ schema: 1, projects: [] }));+ const launched: string[] = [];+ await openProject({+ dir: root,+ io,+ templateHtml: TEMPLATE,+ server: async () => "http://127.0.0.1:4747",+ launch: async (target) => {+ launched.push(target);+ return true;+ },+ });+ expect(launched).toEqual([`http://127.0.0.1:4747/map?dir=${encodeURIComponent(root)}`]);+ expect(JSON.parse(await readFile(registry, "utf8")).projects).toEqual([+ expect.objectContaining({ path: root, name: "proj" }),+ ]);+ });++ it("opens the file when the project cannot be registered, without asking for a server", async () => {+ // A directory where the registry file should be: it can be neither read nor written.+ await rm(join(dir, "home", "projects.json"), { force: true });+ await mkdir(join(dir, "home", "projects.json"));+ let asked = false;+ const launched: string[] = [];+ await openProject({+ dir: root,+ io,+ templateHtml: TEMPLATE,+ server: async () => {+ asked = true;+ return "http://127.0.0.1:4747";+ },+ launch: async (target) => {+ launched.push(target);+ return true;+ },+ });+ expect(asked).toBe(false);+ expect(launched).toEqual([projectPaths(root).html]);+ });+it("falls back to the file when no server can start", async () => {const launched: string[] = [];await openProject({