create-snipara 2.0.12 → 2.0.14

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 (3) hide show
  1. package/README.md +29 -4
  2. package/dist/index.js +109 -23
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -25,7 +25,7 @@ behind the scenes.
25
25
 
26
26
  Use it for:
27
27
 
28
- - Hosted MCP onboarding for Claude Code, Cursor, Windsurf, Codex, Gemini, Mistral, VS Code/Copilot, Continue, ChatGPT Desktop, Orca-style MCP clients, LM Studio-backed local stacks, and similar clients
28
+ - Hosted MCP onboarding for Claude Code, Cursor, Kimi Code CLI, Codex, Gemini, Mistral, VS Code/Copilot, Continue, ChatGPT Desktop, Orca-style MCP clients, LM Studio-backed local stacks, and similar clients
29
29
  - free account signup with reviewed Context + Memory
30
30
  - local project wiring, `doctor`, `repair`, and `upgrade`
31
31
  - local source activation without GitHub, plus optional GitHub repository sync and PR Answer Packs approval when the current folder is a GitHub repo
@@ -86,7 +86,7 @@ Free onboarding is now **Context + Memory**, not Context-only:
86
86
 
87
87
  - Context Free: three projects and 1,000 context queries/month
88
88
  - Memory Free: reviewed hosted memories for continuity across sessions
89
- - Hosted MCP: direct connection for Claude Code, Cursor, Windsurf, Codex, Gemini, Mistral, VS Code/Copilot, Continue, ChatGPT Desktop, Orca-style MCP clients, LM Studio-backed local stacks, and other MCP clients
89
+ - Hosted MCP: direct connection for Claude Code, Cursor, Kimi Code CLI, Codex, Gemini, Mistral, VS Code/Copilot, Continue, ChatGPT Desktop, Orca-style MCP clients, LM Studio-backed local stacks, and other MCP clients
90
90
 
91
91
  The CLI opens a browser device-flow login when the user does not already have a key, auto-provisions the free Context + Memory account when needed, then writes the returned API key into the local MCP config.
92
92
 
@@ -122,6 +122,9 @@ That distinction matters:
122
122
  - creates `AGENTS.md` and `CLAUDE.md` when missing, or appends a marked Snipara section when those files already exist
123
123
  - creates `.cursor/rules/snipara.mdc` and `.codex/config.toml` when those files do not already exist
124
124
  - validates Codex config against Hosted MCP plus `bearer_token_env_var = "SNIPARA_API_KEY"` and tells users to restart Codex after MCP config changes
125
+ - generates one opaque correlation session ID and reuses it in `.mcp.json`,
126
+ Companion, Codex, and Kimi configuration so served context can be joined to
127
+ later project outcomes without treating the ID as authentication
125
128
  - installs local code overlay Git hooks only for explicit companion/full-stack
126
129
  setups unless `--skip-hooks` is passed
127
130
  - runs a real hosted MCP `tools/list` check and warns if the server still advertises legacy `rlm_*` duplicate tools
@@ -200,6 +203,10 @@ that is expected. Use `snipara_help(query=...)` for routed guidance and
200
203
  `snipara-companion task-commit` as the reliable local fallback when the simple
201
204
  hosted tools are not callable.
202
205
 
206
+ Codex also receives a static `X-Snipara-Session-Id` HTTP header. This value is
207
+ opaque, non-secret telemetry generated per workspace; `repair` and `upgrade`
208
+ reuse it when valid. It does not replace the bearer token or grant access.
209
+
203
210
  Existing root `AGENTS.md` and `CLAUDE.md` files are not replaced. The installer
204
211
  adds or refreshes a marked Snipara section so project-specific instructions stay
205
212
  intact.
@@ -413,10 +420,28 @@ companion add workflow ergonomics:
413
420
  - choose `hosted-only` or `--skip-companion` only in locked-down environments
414
421
  - use local `snipara-mcp` only for stdio compatibility, development, or tests
415
422
 
416
- Claude Code, Cursor, and Windsurf can receive generated automation files when
417
- that client has a useful local hook surface. Codex, Gemini, VS Code, Continue,
423
+ Claude Code, Cursor, and Kimi Code CLI can receive generated automation files when
424
+ that client has a useful local hook surface. Kimi receives a project-local MCP
425
+ config and a reviewable plugin that must be installed explicitly; its hooks are
426
+ fail-open. Codex, Gemini, VS Code, Continue,
418
427
  Mistral, ChatGPT, and custom clients are treated as MCP-first: they get the hosted MCP
419
428
  configuration/reference and agent instructions, not invented local hooks.
429
+
430
+ For Kimi Code CLI:
431
+
432
+ ```bash
433
+ npx -y create-snipara@latest init --client kimi --profile hosted-companion --with-hooks
434
+ npx -y snipara-companion@latest automations install --client kimi
435
+ # Then, in Kimi Code after reviewing the plugin:
436
+ /plugins install .kimi-code/snipara-plugin
437
+ ```
438
+
439
+ Export `SNIPARA_API_KEY` before starting Kimi. The generated
440
+ `.kimi-code/mcp.json` stores only `bearerTokenEnvVar`, never the raw key. It
441
+ also carries the same non-secret `X-Snipara-Session-Id` used by the project MCP
442
+ and Companion configuration so Outcome Loop telemetry remains joinable. Kimi
443
+ installs plugins per user, so the generated handler is project-neutral and
444
+ no-ops outside workspaces carrying a Snipara project or Companion marker.
420
445
  For Mistral, request hooks from LangChain are documented as `ChatMistralAI`
421
446
  request lifecycle hooks (`beforeRequestHooks`, `requestErrorHooks`, and
422
447
  `responseHooks`), not as local agent lifecycle hooks.
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: "2.0.12",
16
+ version: "2.0.14",
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",
@@ -45,7 +45,7 @@ var package_default = {
45
45
  "chatgpt",
46
46
  "openai",
47
47
  "cursor",
48
- "windsurf",
48
+ "kimi",
49
49
  "gemini",
50
50
  "mistral",
51
51
  "orca",
@@ -956,9 +956,9 @@ var AI_CLIENT_CHOICES = [
956
956
  description: "Hosted MCP plus Cursor rules and automation bundles"
957
957
  },
958
958
  {
959
- title: "Windsurf",
960
- value: "windsurf",
961
- description: "Hosted MCP plus Windsurf automation bundles"
959
+ title: "Kimi Code CLI",
960
+ value: "kimi",
961
+ description: "Project MCP plus a reviewable Snipara Companion plugin"
962
962
  },
963
963
  {
964
964
  title: "OpenAI Codex",
@@ -1001,7 +1001,7 @@ function getCompanionInitClientFlag(aiClient) {
1001
1001
  const supportedClientMap = {
1002
1002
  "claude-code": "claude-code",
1003
1003
  cursor: "cursor",
1004
- windsurf: "windsurf",
1004
+ kimi: "kimi",
1005
1005
  codex: "codex",
1006
1006
  gemini: "gemini",
1007
1007
  mistral: "mistral",
@@ -1027,7 +1027,7 @@ function buildProgram() {
1027
1027
  program.name("create-snipara").description("Scaffold hosted Snipara MCP config; advanced flags add local helpers").version(VERSION);
1028
1028
  program.command("init").description("Install and configure Snipara for this project").option("--api-key <key>", "Snipara API key").option("--slug <slug>", "Project slug").option("--project-id <id>", "Project ID").option(
1029
1029
  "--client <client>",
1030
- "AI client: claude-code, cursor, windsurf, codex, gemini, mistral, chatgpt, vscode, continue, claude-desktop, other"
1030
+ "AI client: claude-code, cursor, kimi, codex, gemini, mistral, chatgpt, vscode, continue, claude-desktop, other"
1031
1031
  ).option("--advanced", "Show advanced profile, project id, hooks, GitHub, and sandbox prompts").option(
1032
1032
  "--profile <profile>",
1033
1033
  "Install profile: hosted-only, hosted-companion, full-stack, runtime-only"
@@ -1068,7 +1068,7 @@ function buildProgram() {
1068
1068
  function addSharedRootOptions(program) {
1069
1069
  program.option("--api-key <key>", "Snipara API key").option("--slug <slug>", "Project slug").option("--project-id <id>", "Project ID").option(
1070
1070
  "--client <client>",
1071
- "AI client: claude-code, cursor, windsurf, codex, gemini, mistral, chatgpt, vscode, continue, claude-desktop, other"
1071
+ "AI client: claude-code, cursor, kimi, codex, gemini, mistral, chatgpt, vscode, continue, claude-desktop, other"
1072
1072
  ).option("--advanced", "Show advanced profile, project id, hooks, GitHub, and sandbox prompts").option(
1073
1073
  "--profile <profile>",
1074
1074
  "Install profile: hosted-only, hosted-companion, full-stack, runtime-only"
@@ -1682,7 +1682,7 @@ function normalizeClientOption(value) {
1682
1682
  "claude-desktop": "claude-desktop",
1683
1683
  claude_desktop: "claude-desktop",
1684
1684
  cursor: "cursor",
1685
- windsurf: "windsurf",
1685
+ kimi: "kimi",
1686
1686
  codex: "codex",
1687
1687
  gemini: "gemini",
1688
1688
  mistral: "mistral",
@@ -1700,7 +1700,7 @@ function normalizeClientOption(value) {
1700
1700
  const client = aliases[normalized];
1701
1701
  if (!client) {
1702
1702
  throw new Error(
1703
- `Unknown client '${value}'. Use claude, claude-code, cursor, codex, mistral, or other.`
1703
+ `Unknown client '${value}'. Use claude, claude-code, cursor, kimi, codex, mistral, or other.`
1704
1704
  );
1705
1705
  }
1706
1706
  return client;
@@ -2162,19 +2162,75 @@ async function createMcpConfig(answers) {
2162
2162
  }
2163
2163
  console.log(chalk.green(" \u2713 Created .mcp.json"));
2164
2164
  ensureGitignoreEntry(".mcp.json", "# Snipara MCP config (contains API key)");
2165
+ if (answers.aiClient === "kimi" && answers.profile !== "runtime-only") {
2166
+ createKimiMcpConfig(answers);
2167
+ }
2165
2168
  if (answers.aiClient === "claude-desktop") {
2166
2169
  await createClaudeDesktopConfig(answers);
2167
2170
  }
2168
2171
  }
2172
+ function createKimiMcpConfig(answers) {
2173
+ const kimiDir = path.join(process.cwd(), ".kimi-code");
2174
+ const configPath = path.join(kimiDir, "mcp.json");
2175
+ const existing = asObjectRecord(readJsonFile(configPath));
2176
+ const existingServers = asObjectRecord(existing.mcpServers);
2177
+ const config = {
2178
+ ...existing,
2179
+ mcpServers: {
2180
+ ...existingServers,
2181
+ snipara: {
2182
+ url: buildHostedMcpEndpoint(answers),
2183
+ bearerTokenEnvVar: "SNIPARA_API_KEY",
2184
+ headers: {
2185
+ "X-Snipara-Session-Id": getCorrelationSessionId(answers)
2186
+ }
2187
+ }
2188
+ }
2189
+ };
2190
+ fs.mkdirSync(kimiDir, { recursive: true });
2191
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
2192
+ console.log(
2193
+ chalk.green(" \u2713 Created .kimi-code/mcp.json") + chalk.dim(" - SNIPARA_API_KEY stays in the launch environment")
2194
+ );
2195
+ }
2169
2196
  function buildHostedMcpServer(answers) {
2170
2197
  return {
2171
2198
  type: "http",
2172
2199
  url: buildHostedMcpEndpoint(answers),
2173
2200
  headers: {
2174
- "X-API-Key": answers.apiKey || "YOUR_API_KEY_HERE"
2201
+ "X-API-Key": answers.apiKey || "YOUR_API_KEY_HERE",
2202
+ "X-Snipara-Session-Id": getCorrelationSessionId(answers)
2175
2203
  }
2176
2204
  };
2177
2205
  }
2206
+ var CORRELATION_SESSION_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._~:/@+-]{0,127}$/;
2207
+ function normalizeCorrelationSessionId(value) {
2208
+ if (typeof value !== "string") {
2209
+ return null;
2210
+ }
2211
+ const normalized = value.trim();
2212
+ return CORRELATION_SESSION_ID_PATTERN.test(normalized) ? normalized : null;
2213
+ }
2214
+ function readExistingCorrelationSessionId() {
2215
+ const companionConfig = readCompanionConfigFile(
2216
+ path.join(process.cwd(), ".snipara", "companion", "config.json")
2217
+ );
2218
+ const projectMcpConfig = asObjectRecord(readJsonFile(path.join(process.cwd(), ".mcp.json")));
2219
+ const projectMcpServer = asObjectRecord(asObjectRecord(projectMcpConfig.mcpServers).snipara);
2220
+ const projectMcpHeaders = asObjectRecord(projectMcpServer.headers);
2221
+ const kimiConfig = asObjectRecord(
2222
+ readJsonFile(path.join(process.cwd(), ".kimi-code", "mcp.json"))
2223
+ );
2224
+ const kimiServer = asObjectRecord(asObjectRecord(kimiConfig.mcpServers).snipara);
2225
+ const kimiHeaders = asObjectRecord(kimiServer.headers);
2226
+ return normalizeCorrelationSessionId(companionConfig.sessionId) || normalizeCorrelationSessionId(projectMcpHeaders["X-Snipara-Session-Id"]) || normalizeCorrelationSessionId(kimiHeaders["X-Snipara-Session-Id"]);
2227
+ }
2228
+ function getCorrelationSessionId(answers) {
2229
+ const existing = normalizeCorrelationSessionId(answers.correlationSessionId) || readExistingCorrelationSessionId();
2230
+ const sessionId = existing || `sess_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
2231
+ answers.correlationSessionId = sessionId;
2232
+ return sessionId;
2233
+ }
2178
2234
  function asObjectRecord(value) {
2179
2235
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
2180
2236
  }
@@ -2789,6 +2845,7 @@ function buildCodexConfigTemplate(answers) {
2789
2845
  type = "streamable_http"
2790
2846
  url = "${buildHostedMcpEndpoint(answers)}"
2791
2847
  bearer_token_env_var = "SNIPARA_API_KEY"
2848
+ http_headers = { "X-Snipara-Session-Id" = "${getCorrelationSessionId(answers)}" }
2792
2849
  `;
2793
2850
  }
2794
2851
  function buildChatGptMcpTemplate(answers) {
@@ -3330,7 +3387,7 @@ async function createCompanionConfig(answers) {
3330
3387
  apiKey: answers.apiKey,
3331
3388
  apiUrl: API_URL,
3332
3389
  projectId: answers.projectId || answers.projectSlug,
3333
- sessionId: typeof existingWorkspaceConfig.sessionId === "string" && existingWorkspaceConfig.sessionId ? existingWorkspaceConfig.sessionId : `sess_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
3390
+ sessionId: getCorrelationSessionId(answers),
3334
3391
  client: getAutomationClientId(answers.aiClient)
3335
3392
  };
3336
3393
  fs.writeFileSync(configPath, JSON.stringify(workspaceConfig, null, 2) + "\n");
@@ -3449,6 +3506,14 @@ function buildActivationSurfaceContract(client) {
3449
3506
  nextSurfaceAction: "Start a new Claude Code session and validate Snipara tools before enabling hooks or managed workflows."
3450
3507
  };
3451
3508
  }
3509
+ if (client === "kimi") {
3510
+ return {
3511
+ ...shared,
3512
+ entryPoint: "Kimi Code project MCP plus an explicitly installed Snipara plugin",
3513
+ clientRole: "Agent-first CLI surface: load .kimi-code/mcp.json for Hosted MCP and install the generated Companion plugin only after review.",
3514
+ nextSurfaceAction: "Start Kimi Code with SNIPARA_API_KEY exported, verify /mcp, then install .kimi-code/snipara-plugin when lifecycle automation is desired."
3515
+ };
3516
+ }
3452
3517
  return {
3453
3518
  ...shared,
3454
3519
  entryPoint: `${getClientDisplayName(client)} setup generated by create-snipara`,
@@ -3545,10 +3610,11 @@ function getClientGuidance(client) {
3545
3610
  "Use the companion CLI only for explicit upload, planning, chunk lookup, doctor, and task commit workflows outside the editor UI."
3546
3611
  ];
3547
3612
  }
3548
- if (client === "windsurf") {
3613
+ if (client === "kimi") {
3549
3614
  return [
3550
- "Windsurf should use the hosted MCP surface plus generated Windsurf automation bundles when available.",
3551
- "Use npx -y snipara-companion@latest automations install --client windsurf when you want dashboard-managed hook files in the local project."
3615
+ "Kimi Code CLI reads the project-local .kimi-code/mcp.json and resolves SNIPARA_API_KEY from the launch environment.",
3616
+ "Use npx -y snipara-companion@latest automations install --client kimi to download the reviewable plugin bundle, then install it explicitly inside Kimi with /plugins install .kimi-code/snipara-plugin.",
3617
+ "Kimi hooks are fail-open. Keep risky tool approvals enabled and use Hosted MCP tenant checks plus Companion guards as the authoritative boundary."
3552
3618
  ];
3553
3619
  }
3554
3620
  if (client === "codex") {
@@ -3765,7 +3831,7 @@ function getClientDisplayName(client) {
3765
3831
  const names = {
3766
3832
  "claude-code": "Claude Code",
3767
3833
  cursor: "Cursor",
3768
- windsurf: "Windsurf",
3834
+ kimi: "Kimi Code CLI",
3769
3835
  codex: "OpenAI Codex",
3770
3836
  gemini: "Gemini",
3771
3837
  mistral: "Mistral Le Chat / Vibe",
@@ -3781,7 +3847,7 @@ function getClientPackFilename(client) {
3781
3847
  const names = {
3782
3848
  "claude-code": "CLAUDE_CODE.md",
3783
3849
  cursor: "CURSOR.md",
3784
- windsurf: "WINDSURF.md",
3850
+ kimi: "KIMI.md",
3785
3851
  codex: "CODEX.md",
3786
3852
  gemini: "GEMINI.md",
3787
3853
  mistral: "MISTRAL.md",
@@ -3800,8 +3866,12 @@ function getClientConfigArtifacts(client) {
3800
3866
  if (client === "cursor") {
3801
3867
  return [".mcp.json", ".cursor/rules/snipara.mdc", "dashboard automation bundle when installed"];
3802
3868
  }
3803
- if (client === "windsurf") {
3804
- return [".mcp.json", "dashboard automation bundle when installed"];
3869
+ if (client === "kimi") {
3870
+ return [
3871
+ "AGENTS.md",
3872
+ ".kimi-code/mcp.json",
3873
+ ".kimi-code/snipara-plugin when installed through Companion"
3874
+ ];
3805
3875
  }
3806
3876
  if (client === "codex") {
3807
3877
  return ["AGENTS.md", ".codex/config.toml", ".snipara/templates/codex-config.toml"];
@@ -4823,6 +4893,11 @@ function printSuccess(answers, report, activationManifest) {
4823
4893
  chalk.green(" \u2713 Claude Code") + chalk.dim(" - .mcp.json MCP config, .claude/settings.json hooks when enabled")
4824
4894
  );
4825
4895
  }
4896
+ if (answers.aiClient === "kimi" && answers.profile !== "runtime-only") {
4897
+ console.log(
4898
+ chalk.green(" \u2713 Kimi Code CLI") + chalk.dim(" - .kimi-code/mcp.json with environment-backed authentication")
4899
+ );
4900
+ }
4826
4901
  console.log(
4827
4902
  chalk.green(" \u2713 .snipara/companion") + chalk.dim(" - Doctor report and optional command references")
4828
4903
  );
@@ -4859,6 +4934,17 @@ function printSuccess(answers, report, activationManifest) {
4859
4934
  `If Snipara tools are missing, run: ${CREATE_SNIPARA_NPX_COMMAND} doctor --client claude-desktop`
4860
4935
  );
4861
4936
  }
4937
+ if (answers.aiClient === "kimi") {
4938
+ printNextStep(
4939
+ "For Kimi Code CLI, export SNIPARA_API_KEY before launch and run /mcp to verify the project-local server."
4940
+ );
4941
+ printNextStep(
4942
+ `To enable Companion lifecycle hooks, run ${COMPANION_NPX_COMMAND} automations install --client kimi, review .kimi-code/snipara-plugin, then install it in Kimi with /plugins install .kimi-code/snipara-plugin.`
4943
+ );
4944
+ printNextStep(
4945
+ "Keep manual approval for risky tools because Kimi hooks are fail-open and are not a standalone security boundary."
4946
+ );
4947
+ }
4862
4948
  if (answers.aiClient === "codex") {
4863
4949
  printNextStep(
4864
4950
  "For Codex, merge .snipara/templates/codex-config.toml into ~/.codex/config.toml if the app does not read project .codex/config.toml."
@@ -5300,8 +5386,8 @@ function detectAiClient() {
5300
5386
  if (fs.existsSync(path.join(process.cwd(), ".cursor"))) {
5301
5387
  return "cursor";
5302
5388
  }
5303
- if (fs.existsSync(path.join(process.cwd(), ".windsurf"))) {
5304
- return "windsurf";
5389
+ if (fs.existsSync(path.join(process.cwd(), ".kimi-code"))) {
5390
+ return "kimi";
5305
5391
  }
5306
5392
  if (fs.existsSync(path.join(process.cwd(), ".gemini"))) {
5307
5393
  return "gemini";
@@ -5321,8 +5407,8 @@ function detectAiClient() {
5321
5407
  if (fs.existsSync(path.join(homedir(), ".cursor")) || process.env.CURSOR_EDITOR) {
5322
5408
  return "cursor";
5323
5409
  }
5324
- if (fs.existsSync(path.join(homedir(), ".windsurf")) || process.env.WINDSURF_EDITOR) {
5325
- return "windsurf";
5410
+ if (fs.existsSync(path.join(homedir(), ".kimi-code")) || process.env.KIMI_CODE_HOME) {
5411
+ return "kimi";
5326
5412
  }
5327
5413
  if (fs.existsSync(path.join(homedir(), ".gemini")) || process.env.GEMINI_CLI) {
5328
5414
  return "gemini";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-snipara",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
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",
@@ -32,7 +32,7 @@
32
32
  "chatgpt",
33
33
  "openai",
34
34
  "cursor",
35
- "windsurf",
35
+ "kimi",
36
36
  "gemini",
37
37
  "mistral",
38
38
  "orca",