@graph-tl/graph 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ if (args[0] === "activate") {
6
6
  const { activate } = await import("./activate-DSDTR2EJ.js");
7
7
  activate(args[1]);
8
8
  } else if (args[0] === "init") {
9
- const { init } = await import("./init-74TF4PX3.js");
9
+ const { init } = await import("./init-324GHJOK.js");
10
10
  init();
11
11
  } else {
12
12
  const { startServer } = await import("./server-XSKUM3G5.js");
@@ -71,7 +71,7 @@ This project uses Graph for task tracking across sessions. Start every session w
71
71
  `;
72
72
  if (existsSync(claudeMdPath)) {
73
73
  const current = readFileSync(claudeMdPath, "utf8");
74
- if (current.includes("graph_onboard")) {
74
+ if (current.includes("Graph workflow") || current.includes("graph_onboard")) {
75
75
  console.log("\u2713 CLAUDE.md \u2014 graph workflow instructions already present");
76
76
  } else {
77
77
  appendFileSync(claudeMdPath, graphSection, "utf8");
@@ -99,4 +99,4 @@ ${graphSection}`, "utf8");
99
99
  export {
100
100
  init
101
101
  };
102
- //# sourceMappingURL=init-74TF4PX3.js.map
102
+ //# sourceMappingURL=init-324GHJOK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/init.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync, mkdirSync, appendFileSync } from \"fs\";\nimport { join, dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { handleAgentConfig } from \"./tools/agent-config.js\";\n\n// [sl:hy8oXisWnrZN1BfkonUqd] npx @graph-tl/graph init — zero friction onboarding\n\nlet PKG_VERSION = \"0.0.0\";\ntry {\n const __dirname = dirname(fileURLToPath(import.meta.url));\n const pkg = JSON.parse(readFileSync(join(__dirname, \"..\", \"package.json\"), \"utf-8\"));\n PKG_VERSION = pkg.version;\n} catch {}\n\nconst MCP_CONFIG = {\n command: \"npx\",\n args: [\"-y\", \"@graph-tl/graph\"],\n env: {\n GRAPH_AGENT: \"claude-code\",\n },\n};\n\nexport function init(): void {\n const cwd = process.cwd();\n let wrote = false;\n\n // 1. Write .mcp.json\n const configPath = join(cwd, \".mcp.json\");\n if (existsSync(configPath)) {\n try {\n const config = JSON.parse(readFileSync(configPath, \"utf8\"));\n if (config.mcpServers?.graph) {\n console.log(\"✓ .mcp.json — graph already configured\");\n } else {\n config.mcpServers = config.mcpServers ?? {};\n config.mcpServers.graph = MCP_CONFIG;\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\", \"utf8\");\n console.log(\"✓ .mcp.json — added graph server\");\n wrote = true;\n }\n } catch {\n console.error(`✗ .mcp.json exists but is not valid JSON — skipping`);\n }\n } else {\n const config = { mcpServers: { graph: MCP_CONFIG } };\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\", \"utf8\");\n console.log(\"✓ .mcp.json — created with graph server\");\n wrote = true;\n }\n\n // 2. Write .claude/agents/graph.md\n const agentPath = join(cwd, \".claude\", \"agents\", \"graph.md\");\n const { agent_file } = handleAgentConfig(PKG_VERSION);\n if (existsSync(agentPath)) {\n const current = readFileSync(agentPath, \"utf8\");\n if (current === agent_file) {\n console.log(\"✓ .claude/agents/graph.md — already up to date\");\n } else {\n writeFileSync(agentPath, agent_file, \"utf8\");\n console.log(\"✓ .claude/agents/graph.md — updated\");\n wrote = true;\n }\n } else {\n mkdirSync(dirname(agentPath), { recursive: true });\n writeFileSync(agentPath, agent_file, \"utf8\");\n console.log(\"✓ .claude/agents/graph.md — created graph workflow agent\");\n wrote = true;\n }\n\n // 3. Append graph workflow instructions to CLAUDE.md\n // [sl:qPxNQTKru6q3nPzsNWlfe] Ensure default agent follows graph workflow\n const claudeMdPath = join(cwd, \"CLAUDE.md\");\n const graphSection = `\n## Graph workflow\n\nThis project uses Graph for task tracking across sessions. Start every session with \\`graph_onboard\\` to see project state, actionable tasks, and continuity confidence. Follow the claim-work-resolve loop: \\`graph_next\\` (claim) → do work → \\`graph_update\\` (resolve with evidence). Don't execute ad-hoc work — add it to the graph first via \\`graph_plan\\`.\n`;\n\n if (existsSync(claudeMdPath)) {\n const current = readFileSync(claudeMdPath, \"utf8\");\n if (current.includes(\"graph_onboard\")) {\n console.log(\"✓ CLAUDE.md — graph workflow instructions already present\");\n } else {\n appendFileSync(claudeMdPath, graphSection, \"utf8\");\n console.log(\"✓ CLAUDE.md — appended graph workflow instructions\");\n wrote = true;\n }\n } else {\n writeFileSync(claudeMdPath, `# CLAUDE.md\\n\\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\\n${graphSection}`, \"utf8\");\n console.log(\"✓ CLAUDE.md — created with graph workflow instructions\");\n wrote = true;\n }\n\n // 4. Summary\n console.log(\"\");\n if (wrote) {\n console.log(\"Graph is ready. Restart Claude Code to load the MCP server.\");\n console.log(\"\");\n console.log(\"Then try:\");\n console.log(' \"Use graph to plan building a REST API with auth and tests.\"');\n } else {\n console.log(\"Graph is already set up — nothing to do.\");\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAc,eAAe,YAAY,WAAW,sBAAsB;AACnF,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAK9B,IAAI,cAAc;AAClB,IAAI;AACF,QAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,QAAM,MAAM,KAAK,MAAM,aAAa,KAAK,WAAW,MAAM,cAAc,GAAG,OAAO,CAAC;AACnF,gBAAc,IAAI;AACpB,QAAQ;AAAC;AAET,IAAM,aAAa;AAAA,EACjB,SAAS;AAAA,EACT,MAAM,CAAC,MAAM,iBAAiB;AAAA,EAC9B,KAAK;AAAA,IACH,aAAa;AAAA,EACf;AACF;AAEO,SAAS,OAAa;AAC3B,QAAM,MAAM,QAAQ,IAAI;AACxB,MAAI,QAAQ;AAGZ,QAAM,aAAa,KAAK,KAAK,WAAW;AACxC,MAAI,WAAW,UAAU,GAAG;AAC1B,QAAI;AACF,YAAM,SAAS,KAAK,MAAM,aAAa,YAAY,MAAM,CA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AAc,cAAc,MAAM;AACjD,cAAQ,IAAI,8DAAoD;AAChE,cAAQ;AAAA,IACV;AAAA,EACF,OAAO;AACL,kBAAc,cAAc;AAAA;AAAA;AAAA,EAA0H,YAAY,IAAI,MAAM;AAC5K,YAAQ,IAAI,kEAAwD;AACpE,YAAQ;AAAA,EACV;AAGA,UAAQ,IAAI,EAAE;AACd,MAAI,OAAO;AACT,YAAQ,IAAI,6DAA6D;AACzE,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,WAAW;AACvB,YAAQ,IAAI,gEAAgE;AAAA,EAC9E,OAAO;AACL,YAAQ,IAAI,+CAA0C;AAAA,EACxD;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/init.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync, mkdirSync, appendFileSync } from \"fs\";\nimport { join, dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { handleAgentConfig } from \"./tools/agent-config.js\";\n\n// [sl:hy8oXisWnrZN1BfkonUqd] npx @graph-tl/graph init — zero friction onboarding\n\nlet PKG_VERSION = \"0.0.0\";\ntry {\n const __dirname = dirname(fileURLToPath(import.meta.url));\n const pkg = JSON.parse(readFileSync(join(__dirname, \"..\", \"package.json\"), \"utf-8\"));\n PKG_VERSION = pkg.version;\n} catch {}\n\nconst MCP_CONFIG = {\n command: \"npx\",\n args: [\"-y\", \"@graph-tl/graph\"],\n env: {\n GRAPH_AGENT: \"claude-code\",\n },\n};\n\nexport function init(): void {\n const cwd = process.cwd();\n let wrote = false;\n\n // 1. Write .mcp.json\n const configPath = join(cwd, \".mcp.json\");\n if (existsSync(configPath)) {\n try {\n const config = JSON.parse(readFileSync(configPath, \"utf8\"));\n if (config.mcpServers?.graph) {\n console.log(\"✓ .mcp.json — graph already configured\");\n } else {\n config.mcpServers = config.mcpServers ?? {};\n config.mcpServers.graph = MCP_CONFIG;\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\", \"utf8\");\n console.log(\"✓ .mcp.json — added graph server\");\n wrote = true;\n }\n } catch {\n console.error(`✗ .mcp.json exists but is not valid JSON — skipping`);\n }\n } else {\n const config = { mcpServers: { graph: MCP_CONFIG } };\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\", \"utf8\");\n console.log(\"✓ .mcp.json — created with graph server\");\n wrote = true;\n }\n\n // 2. Write .claude/agents/graph.md\n const agentPath = join(cwd, \".claude\", \"agents\", \"graph.md\");\n const { agent_file } = handleAgentConfig(PKG_VERSION);\n if (existsSync(agentPath)) {\n const current = readFileSync(agentPath, \"utf8\");\n if (current === agent_file) {\n console.log(\"✓ .claude/agents/graph.md — already up to date\");\n } else {\n writeFileSync(agentPath, agent_file, \"utf8\");\n console.log(\"✓ .claude/agents/graph.md — updated\");\n wrote = true;\n }\n } else {\n mkdirSync(dirname(agentPath), { recursive: true });\n writeFileSync(agentPath, agent_file, \"utf8\");\n console.log(\"✓ .claude/agents/graph.md — created graph workflow agent\");\n wrote = true;\n }\n\n // 3. Append graph workflow instructions to CLAUDE.md\n // [sl:qPxNQTKru6q3nPzsNWlfe] Ensure default agent follows graph workflow\n const claudeMdPath = join(cwd, \"CLAUDE.md\");\n const graphSection = `\n## Graph workflow\n\nThis project uses Graph for task tracking across sessions. Start every session with \\`graph_onboard\\` to see project state, actionable tasks, and continuity confidence. Follow the claim-work-resolve loop: \\`graph_next\\` (claim) → do work → \\`graph_update\\` (resolve with evidence). Don't execute ad-hoc work — add it to the graph first via \\`graph_plan\\`.\n`;\n\n if (existsSync(claudeMdPath)) {\n const current = readFileSync(claudeMdPath, \"utf8\");\n if (current.includes(\"Graph workflow\") || current.includes(\"graph_onboard\")) {\n console.log(\"✓ CLAUDE.md — graph workflow instructions already present\");\n } else {\n appendFileSync(claudeMdPath, graphSection, \"utf8\");\n console.log(\"✓ CLAUDE.md — appended graph workflow instructions\");\n wrote = true;\n }\n } else {\n writeFileSync(claudeMdPath, `# CLAUDE.md\\n\\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\\n${graphSection}`, \"utf8\");\n console.log(\"✓ CLAUDE.md — created with graph workflow instructions\");\n wrote = true;\n }\n\n // 4. Summary\n console.log(\"\");\n if (wrote) {\n console.log(\"Graph is ready. Restart Claude Code to load the MCP server.\");\n console.log(\"\");\n console.log(\"Then try:\");\n console.log(' \"Use graph to plan building a REST API with auth and tests.\"');\n } else {\n console.log(\"Graph is already set up — nothing to do.\");\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAc,eAAe,YAAY,WAAW,sBAAsB;AACnF,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAK9B,IAAI,cAAc;AAClB,IAAI;AACF,QAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,QAAM,MAAM,KAAK,MAAM,aAAa,KAAK,WAAW,MAAM,cAAc,GAAG,OAAO,CAAC;AACnF,gBAAc,IAAI;AACpB,QAAQ;AAAC;AAET,IAAM,aAAa;AAAA,EACjB,SAAS;AAAA,EACT,MAAM,CAAC,MAAM,iBAAiB;AAAA,EAC9B,KAAK;AAAA,IACH,aAAa;AAAA,EACf;AACF;AAEO,SAAS,OAAa;AAC3B,QAAM,MAAM,QAAQ,IAAI;AACxB,MAAI,QAAQ;AAGZ,QAAM,aAAa,KAAK,KAAK,WAAW;AACxC,MAAI,WAAW,UAAU,GAAG;AAC1B,QAAI;AACF,YAAM,SAAS,KAAK,MAAM,aAAa,YAAY,MAAM,CAAC;AAC1D,UAAI,OAAO,YAAY,OAAO;AAC5B,gBAAQ,IAAI,kDAAwC;AAAA,MACtD,OAAO;AACL,eAAO,aAAa,OAAO,cAAc,CAAC;AAC1C,eAAO,WAAW,QAAQ;AAC1B,sBAAc,YAAY,KAAK,UAAU,QAAQ,MAAM,CAAC,IAAI,MAAM,MAAM;AACxE,gBAAQ,IAAI,4CAAkC;AAC9C,gBAAQ;AAAA,MACV;AAAA,IACF,QAAQ;AACN,cAAQ,MAAM,+DAAqD;AAAA,IACrE;AAAA,EACF,OAAO;A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W;AACvB,YAAQ,IAAI,gEAAgE;AAAA,EAC9E,OAAO;AACL,YAAQ,IAAI,+CAA0C;AAAA,EACxD;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graph-tl/graph",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Agent-native persistent task graph. MCP server for agent planning and execution across sessions.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",