create-snipara 1.3.35 → 1.3.36

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.
Files changed (2) hide show
  1. package/dist/index.js +62 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import { homedir } from "os";
13
13
  // package.json
14
14
  var package_default = {
15
15
  name: "create-snipara",
16
- version: "1.3.35",
16
+ version: "1.3.36",
17
17
  description: "Onboard Snipara Hosted MCP Context + Memory with auth, companion workflows, and optional Snipara Sandbox",
18
18
  main: "dist/index.js",
19
19
  type: "module",
@@ -285,6 +285,9 @@ async function runInit(options) {
285
285
  if (answers.profile !== "runtime-only" || answers.installRuntime) {
286
286
  await createMcpConfig(answers);
287
287
  }
288
+ if (answers.aiClient === "claude-code" && answers.profile !== "runtime-only") {
289
+ await createClaudeCodeConfig(answers);
290
+ }
288
291
  await createProjectBinding(answers);
289
292
  await createAgentTemplates(answers);
290
293
  if (answers.installHooks && answers.aiClient === "claude-code") {
@@ -331,6 +334,9 @@ async function runRepair(options) {
331
334
  await installNodeCompanion(true);
332
335
  }
333
336
  await createMcpConfig(answers);
337
+ if (answers.aiClient === "claude-code" && answers.profile !== "runtime-only") {
338
+ await createClaudeCodeConfig(answers);
339
+ }
334
340
  await createProjectBinding(answers);
335
341
  await createAgentTemplates(answers);
336
342
  await updateEnvFiles(answers);
@@ -362,6 +368,9 @@ async function runUpgrade(options) {
362
368
  if (options.withMcp || options.withRuntime || detection.files.mcpConfig) {
363
369
  await createMcpConfig(upgradedAnswers);
364
370
  }
371
+ if (upgradedAnswers.aiClient === "claude-code" && upgradedAnswers.profile !== "runtime-only") {
372
+ await createClaudeCodeConfig(upgradedAnswers);
373
+ }
365
374
  await createProjectBinding(upgradedAnswers);
366
375
  await createAgentTemplates(upgradedAnswers);
367
376
  await createCompanionConfig(upgradedAnswers);
@@ -1070,13 +1079,7 @@ async function createMcpConfig(answers) {
1070
1079
  }
1071
1080
  }
1072
1081
  if (answers.profile !== "runtime-only") {
1073
- mcpConfig.mcpServers.snipara = {
1074
- type: "http",
1075
- url: `${API_URL}/mcp/${answers.projectSlug}`,
1076
- headers: {
1077
- "X-API-Key": answers.apiKey || "YOUR_API_KEY_HERE"
1078
- }
1079
- };
1082
+ mcpConfig.mcpServers.snipara = buildHostedMcpServer(answers);
1080
1083
  }
1081
1084
  if (answers.installRuntime) {
1082
1085
  mcpConfig.mcpServers[SANDBOX_SERVER_NAME] = {
@@ -1096,6 +1099,48 @@ async function createMcpConfig(answers) {
1096
1099
  await createClaudeDesktopConfig(answers);
1097
1100
  }
1098
1101
  }
1102
+ function buildHostedMcpServer(answers) {
1103
+ return {
1104
+ type: "http",
1105
+ url: buildHostedMcpEndpoint(answers),
1106
+ headers: {
1107
+ "X-API-Key": answers.apiKey || "YOUR_API_KEY_HERE"
1108
+ }
1109
+ };
1110
+ }
1111
+ function asObjectRecord(value) {
1112
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1113
+ }
1114
+ async function createClaudeCodeConfig(answers) {
1115
+ if (answers.profile === "runtime-only") {
1116
+ return;
1117
+ }
1118
+ const claudeDir = path.join(homedir(), ".claude");
1119
+ const settingsPath = path.join(claudeDir, "settings.json");
1120
+ console.log(chalk.bold("\n\u{1F916} Configuring Claude Code MCP\n"));
1121
+ try {
1122
+ fs.mkdirSync(claudeDir, { recursive: true });
1123
+ let settings = {};
1124
+ if (fs.existsSync(settingsPath)) {
1125
+ settings = asObjectRecord(JSON.parse(fs.readFileSync(settingsPath, "utf-8")));
1126
+ }
1127
+ const mcpServers = asObjectRecord(settings.mcpServers);
1128
+ settings.mcpServers = {
1129
+ ...mcpServers,
1130
+ snipara: buildHostedMcpServer(answers)
1131
+ };
1132
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", { mode: 384 });
1133
+ try {
1134
+ fs.chmodSync(settingsPath, 384);
1135
+ } catch {
1136
+ }
1137
+ console.log(chalk.green(" \u2713 Updated ~/.claude/settings.json with Snipara MCP"));
1138
+ } catch (error) {
1139
+ const detail = error instanceof Error ? error.message : String(error);
1140
+ console.log(chalk.yellow(` \u26A0\uFE0F Could not update Claude Code MCP config: ${detail}`));
1141
+ console.log(chalk.dim(" Run create-snipara doctor --client claude after manual setup."));
1142
+ }
1143
+ }
1099
1144
  async function createProjectBinding(answers) {
1100
1145
  if (answers.profile === "runtime-only") {
1101
1146
  return;
@@ -1383,13 +1428,7 @@ async function createClaudeDesktopConfig(answers) {
1383
1428
  config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
1384
1429
  }
1385
1430
  config.mcpServers = config.mcpServers || {};
1386
- config.mcpServers.snipara = {
1387
- type: "http",
1388
- url: buildHostedMcpEndpoint(answers),
1389
- headers: {
1390
- "X-API-Key": answers.apiKey
1391
- }
1392
- };
1431
+ config.mcpServers.snipara = buildHostedMcpServer(answers);
1393
1432
  if (answers.installRuntime) {
1394
1433
  config.mcpServers[SANDBOX_SERVER_NAME] = {
1395
1434
  command: detectSandboxCommand() || SANDBOX_COMMAND_NAME,
@@ -1899,7 +1938,7 @@ function getClientPackFilename(client) {
1899
1938
  }
1900
1939
  function getClientConfigArtifacts(client) {
1901
1940
  if (client === "claude-code") {
1902
- return ["AGENTS.md", "CLAUDE.md", ".claude/settings.json when hooks are installed"];
1941
+ return ["AGENTS.md", "CLAUDE.md", "~/.claude/settings.json MCP server"];
1903
1942
  }
1904
1943
  if (client === "cursor") {
1905
1944
  return [".mcp.json", ".cursor/rules/snipara.mdc", "dashboard automation bundle when installed"];
@@ -2172,7 +2211,7 @@ function getClaudeClientChecks(answers, detection) {
2172
2211
  checks.push({
2173
2212
  name: "claude_code_settings",
2174
2213
  status: detection.files.claudeSettings ? codeSettingsHasSnipara ? "pass" : "warn" : "warn",
2175
- detail: detection.files.claudeSettings ? codeSettingsHasSnipara ? "~/.claude/settings.json references Snipara" : "~/.claude/settings.json exists but no Snipara MCP server was found" : "~/.claude/settings.json not found; Claude may require Settings -> MCP UI setup"
2214
+ detail: detection.files.claudeSettings ? codeSettingsHasSnipara ? "~/.claude/settings.json contains a Snipara MCP server" : "~/.claude/settings.json exists but no Snipara MCP server was found" : "~/.claude/settings.json not found; Claude may require Settings -> MCP UI setup"
2176
2215
  });
2177
2216
  }
2178
2217
  if (answers.aiClient === "claude-desktop") {
@@ -2598,6 +2637,11 @@ function printSuccess(answers, report) {
2598
2637
  if (answers.profile !== "runtime-only") {
2599
2638
  console.log(chalk.green(" \u2713 .mcp.json") + chalk.dim(" - Hosted MCP config"));
2600
2639
  }
2640
+ if (answers.aiClient === "claude-code" && answers.profile !== "runtime-only") {
2641
+ console.log(
2642
+ chalk.green(" \u2713 ~/.claude/settings.json") + chalk.dim(" - Claude Code Hosted MCP server")
2643
+ );
2644
+ }
2601
2645
  console.log(chalk.green(" \u2713 .snipara/companion") + chalk.dim(" - Local pack + doctor report"));
2602
2646
  const failedChecks = report.checks.filter((check) => check.status === "fail");
2603
2647
  const warnedChecks = report.checks.filter((check) => check.status === "warn");
@@ -2610,7 +2654,7 @@ function printSuccess(answers, report) {
2610
2654
  printNextStep("Restart your AI client if you created or changed hosted MCP config.");
2611
2655
  if (answers.aiClient === "claude-code") {
2612
2656
  printNextStep(
2613
- "For Claude Code, confirm Snipara appears in Settings -> MCP or ToolSearch; local files alone do not prove Claude loaded the server."
2657
+ "For Claude Code, start a new session and confirm Snipara appears in Settings -> MCP or ToolSearch."
2614
2658
  );
2615
2659
  printNextStep("If Snipara tools are missing, run: npx create-snipara doctor --client claude");
2616
2660
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-snipara",
3
- "version": "1.3.35",
3
+ "version": "1.3.36",
4
4
  "description": "Onboard Snipara Hosted MCP Context + Memory with auth, companion workflows, and optional Snipara Sandbox",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",