@snapback/cli 1.0.8 → 1.0.9

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
@@ -5,7 +5,7 @@ import { generateSnapshotId, generateId } from './chunk-6MR2TINI.js';
5
5
  import { createChangeImpactAnalyzer } from './chunk-G7QXHNGB.js';
6
6
  import './chunk-QAKFE3NE.js';
7
7
  import { sha256, atomicWriteFileSync, hashContent } from './chunk-YOVA65PS.js';
8
- import { detectAIClients, validateClientConfig, getSnapbackMCPConfig, writeClientConfig, repairClientConfig } from './chunk-P2F6HU3P.js';
8
+ import { detectAIClients, validateClientConfig, getSnapbackMCPConfig, writeClientConfig, repairClientConfig } from './chunk-RF2TU7JM.js';
9
9
  import { __name, __require } from './chunk-BW7RALUZ.js';
10
10
  import * as fs22 from 'fs/promises';
11
11
  import { stat, lstat, access, constants, readFile, appendFile, readdir } from 'fs/promises';
@@ -25815,10 +25815,6 @@ __name(createHttpTransport, "createHttpTransport");
25815
25815
  __name6(createHttpTransport, "createHttpTransport");
25816
25816
  async function runStdioMcpServer(options) {
25817
25817
  const registry = createToolRegistry();
25818
- const adaptedTools = await getAdaptedConsolidatedTools();
25819
- for (const tool of adaptedTools) {
25820
- registry.register(tool);
25821
- }
25822
25818
  const server = createMcpServerWithRegistry({
25823
25819
  ...options,
25824
25820
  registry
@@ -25826,6 +25822,17 @@ async function runStdioMcpServer(options) {
25826
25822
  const transport = new StdioServerTransport();
25827
25823
  await server.connect(transport);
25828
25824
  console.error("[SnapBack MCP] Server running on stdio transport");
25825
+ setImmediate(async () => {
25826
+ try {
25827
+ const adaptedTools = await getAdaptedConsolidatedTools();
25828
+ for (const tool of adaptedTools) {
25829
+ registry.register(tool);
25830
+ }
25831
+ console.error(`[SnapBack MCP] Registered ${adaptedTools.length} tools`);
25832
+ } catch (error) {
25833
+ console.error("[SnapBack MCP] Failed to load tools:", error);
25834
+ }
25835
+ });
25829
25836
  process.on("SIGINT", async () => {
25830
25837
  console.error("[SnapBack MCP] Shutting down...");
25831
25838
  await server.close();
@@ -25991,7 +25998,7 @@ __name(createMcpCommand, "createMcpCommand");
25991
25998
  var mcpCommand = createMcpCommand();
25992
25999
  function createToolsCommand() {
25993
26000
  const tools = new Command("tools").description("Configure AI tools");
25994
- tools.command("configure").description("Auto-setup MCP for Cursor, Claude, or other AI tools").option("--cursor", "Configure for Cursor only").option("--claude", "Configure for Claude Desktop only").option("--windsurf", "Configure for Windsurf only").option("--continue", "Configure for Continue only").option("--vscode", "Configure for VS Code only").option("--zed", "Configure for Zed only").option("--cline", "Configure for Cline only").option("--gemini", "Configure for Gemini/Antigravity only").option("--aider", "Configure for Aider only").option("--roo-code", "Configure for Roo Code only").option("--qoder", "Configure for Qoder only").option("--list", "List available tools").option("--dry-run", "Show what would be configured without writing").option("--force", "Reconfigure even if already set up").option("-y, --yes", "Skip confirmation prompts (for CI/scripts)").option("--api-key <key>", "API key for Pro features").option("--dev", "Use local development mode (direct node execution with inferred workspace)").option("--workspace <path>", "Override workspace root path").action(async (options) => {
26001
+ tools.command("configure").description("Auto-setup MCP for Cursor, Claude, or other AI tools").option("--cursor", "Configure for Cursor only").option("--claude", "Configure for Claude Desktop only").option("--windsurf", "Configure for Windsurf only").option("--continue", "Configure for Continue only").option("--vscode", "Configure for VS Code only").option("--zed", "Configure for Zed only").option("--cline", "Configure for Cline only").option("--gemini", "Configure for Gemini/Antigravity only").option("--aider", "Configure for Aider only").option("--roo-code", "Configure for Roo Code only").option("--qoder", "Configure for Qoder only").option("--list", "List available tools").option("--dry-run", "Show what would be configured without writing").option("--force", "Reconfigure even if already set up").option("-y, --yes", "Skip confirmation prompts (for CI/scripts)").option("--api-key <key>", "API key for Pro features").option("--npm", "Use npm-installed CLI via npx (recommended for npm users)").option("--dev", "Use local development mode (direct node execution with inferred workspace)").option("--workspace <path>", "Override workspace root path").action(async (options) => {
25995
26002
  try {
25996
26003
  if (options.list) {
25997
26004
  await listTools();
@@ -26032,10 +26039,10 @@ function createToolsCommand() {
26032
26039
  toolsToConfig.push("qoder");
26033
26040
  }
26034
26041
  if (toolsToConfig.length === 0) {
26035
- await autoConfigureTools(options.dryRun, options.force, options.yes, options.apiKey, options.dev, options.workspace);
26042
+ await autoConfigureTools(options.dryRun, options.force, options.yes, options.apiKey, options.dev, options.npm, options.workspace);
26036
26043
  } else {
26037
26044
  for (const tool of toolsToConfig) {
26038
- await configureTool(tool, options.dryRun, options.yes, options.apiKey, options.dev, options.workspace);
26045
+ await configureTool(tool, options.dryRun, options.yes, options.apiKey, options.dev, options.npm, options.workspace);
26039
26046
  }
26040
26047
  }
26041
26048
  } catch (error) {
@@ -26069,7 +26076,7 @@ async function listTools() {
26069
26076
  console.log(chalk26.gray("Use --cursor, --claude, --windsurf, or --continue to configure a specific tool"));
26070
26077
  }
26071
26078
  __name(listTools, "listTools");
26072
- async function autoConfigureTools(dryRun, force, skipPrompts = false, providedApiKey, devMode = false, workspaceOverride) {
26079
+ async function autoConfigureTools(dryRun, force, skipPrompts = false, providedApiKey, devMode = false, npmMode = false, workspaceOverride) {
26073
26080
  const detection = detectAIClients();
26074
26081
  if (detection.detected.length === 0) {
26075
26082
  console.log(chalk26.yellow("\nNo AI tools detected"));
@@ -26107,12 +26114,12 @@ Detected ${detection.detected.length} AI tool(s):`));
26107
26114
  }
26108
26115
  const apiKey = await resolveApiKey(providedApiKey, skipPrompts);
26109
26116
  for (const client of needsSetup) {
26110
- await configureClient(client, dryRun, apiKey, devMode, workspaceOverride);
26117
+ await configureClient(client, dryRun, apiKey, devMode, npmMode, workspaceOverride);
26111
26118
  }
26112
26119
  showNextSteps();
26113
26120
  }
26114
26121
  __name(autoConfigureTools, "autoConfigureTools");
26115
- async function configureTool(toolName, dryRun, skipPrompts = false, providedApiKey, devMode = false, workspaceOverride) {
26122
+ async function configureTool(toolName, dryRun, skipPrompts = false, providedApiKey, devMode = false, npmMode = false, workspaceOverride) {
26116
26123
  const detection = detectAIClients();
26117
26124
  const client = detection.clients.find((c) => c.name === toolName);
26118
26125
  if (!client) {
@@ -26126,11 +26133,11 @@ async function configureTool(toolName, dryRun, skipPrompts = false, providedApiK
26126
26133
  return;
26127
26134
  }
26128
26135
  const apiKey = await resolveApiKey(providedApiKey, skipPrompts);
26129
- await configureClient(client, dryRun, apiKey, devMode, workspaceOverride);
26136
+ await configureClient(client, dryRun, apiKey, devMode, npmMode, workspaceOverride);
26130
26137
  showNextSteps();
26131
26138
  }
26132
26139
  __name(configureTool, "configureTool");
26133
- async function configureClient(client, dryRun, apiKey, devMode = false, workspaceOverride) {
26140
+ async function configureClient(client, dryRun, apiKey, devMode = false, npmMode = false, workspaceOverride) {
26134
26141
  const spinner2 = ora8(`Configuring ${client.displayName}...`).start();
26135
26142
  try {
26136
26143
  let workspaceRoot;
@@ -26143,6 +26150,9 @@ async function configureClient(client, dryRun, apiKey, devMode = false, workspac
26143
26150
  return;
26144
26151
  }
26145
26152
  spinner2.text = `Configuring ${client.displayName} (dev mode)...`;
26153
+ } else if (npmMode) {
26154
+ workspaceRoot = workspaceOverride || findWorkspaceRoot2(process.cwd());
26155
+ spinner2.text = `Configuring ${client.displayName} (npm/npx mode)...`;
26146
26156
  }
26147
26157
  if (client.hasSnapback) {
26148
26158
  spinner2.text = `Validating existing config for ${client.displayName}...`;
@@ -26159,6 +26169,7 @@ async function configureClient(client, dryRun, apiKey, devMode = false, workspac
26159
26169
  }
26160
26170
  const mcpConfig = getSnapbackMCPConfig({
26161
26171
  apiKey,
26172
+ useNpx: npmMode,
26162
26173
  useLocalDev: devMode,
26163
26174
  localCliPath,
26164
26175
  workspaceRoot
@@ -26167,8 +26178,14 @@ async function configureClient(client, dryRun, apiKey, devMode = false, workspac
26167
26178
  spinner2.info(`Would configure ${client.displayName}`);
26168
26179
  console.log(chalk26.gray(` Path: ${client.configPath}`));
26169
26180
  if (devMode) {
26181
+ console.log(chalk26.gray(" Mode: Local development"));
26170
26182
  console.log(chalk26.gray(` Workspace: ${workspaceRoot}`));
26171
26183
  console.log(chalk26.gray(` CLI Path: ${localCliPath}`));
26184
+ } else if (npmMode) {
26185
+ console.log(chalk26.gray(" Mode: npm (npx @snapback/cli)"));
26186
+ console.log(chalk26.gray(` Workspace: ${workspaceRoot}`));
26187
+ } else {
26188
+ console.log(chalk26.gray(" Mode: Remote server (https://snapback-mcp.fly.dev)"));
26172
26189
  }
26173
26190
  console.log(chalk26.gray(" Config:"));
26174
26191
  console.log(JSON.stringify(mcpConfig, null, 2));
@@ -26180,8 +26197,9 @@ async function configureClient(client, dryRun, apiKey, devMode = false, workspac
26180
26197
  ...client,
26181
26198
  hasSnapback: true
26182
26199
  });
26200
+ const modeLabel = devMode ? " (dev mode)" : npmMode ? " (npm mode)" : "";
26183
26201
  if (postValidation.valid) {
26184
- spinner2.succeed(`Configured ${client.displayName}${devMode ? " (dev mode)" : ""}`);
26202
+ spinner2.succeed(`Configured ${client.displayName}${modeLabel}`);
26185
26203
  } else {
26186
26204
  const warnings = postValidation.issues.filter((i) => i.severity === "warning");
26187
26205
  if (warnings.length > 0) {
@@ -26190,11 +26208,11 @@ async function configureClient(client, dryRun, apiKey, devMode = false, workspac
26190
26208
  console.log(chalk26.yellow(` \u26A0 ${warning.message}`));
26191
26209
  }
26192
26210
  } else {
26193
- spinner2.succeed(`Configured ${client.displayName}${devMode ? " (dev mode)" : ""}`);
26211
+ spinner2.succeed(`Configured ${client.displayName}${modeLabel}`);
26194
26212
  }
26195
26213
  }
26196
26214
  console.log(chalk26.gray(` Config: ${client.configPath}`));
26197
- if (devMode) {
26215
+ if (devMode || npmMode) {
26198
26216
  console.log(chalk26.gray(` Workspace: ${workspaceRoot}`));
26199
26217
  }
26200
26218
  if (result7.backup) {
@@ -29498,7 +29516,7 @@ async function mcpStep(state) {
29498
29516
  let getSnapbackMCPConfig2;
29499
29517
  let writeClientConfig2;
29500
29518
  try {
29501
- const mcpConfig = await import('./dist-JX77JABV.js');
29519
+ const mcpConfig = await import('./dist-3KZGNWFE.js');
29502
29520
  detectAIClients2 = mcpConfig.detectAIClients;
29503
29521
  getSnapbackMCPConfig2 = mcpConfig.getSnapbackMCPConfig;
29504
29522
  writeClientConfig2 = mcpConfig.writeClientConfig;
@@ -29852,7 +29870,7 @@ async function summaryStep(state) {
29852
29870
  console.log(chalk26.gray("\u2500".repeat(40)));
29853
29871
  console.log("\n" + chalk26.cyan.bold("Quick Health Check:\n"));
29854
29872
  try {
29855
- const { detectAIClients: detectAIClients2 } = await import('./dist-JX77JABV.js');
29873
+ const { detectAIClients: detectAIClients2 } = await import('./dist-3KZGNWFE.js');
29856
29874
  const detection = detectAIClients2({
29857
29875
  cwd: state.workspaceRoot || process.cwd()
29858
29876
  });
@@ -29867,7 +29885,7 @@ async function summaryStep(state) {
29867
29885
  } catch {
29868
29886
  }
29869
29887
  try {
29870
- const { detectAIClients: detectAIClients2 } = await import('./dist-JX77JABV.js');
29888
+ const { detectAIClients: detectAIClients2 } = await import('./dist-3KZGNWFE.js');
29871
29889
  const detection = detectAIClients2({
29872
29890
  cwd: state.workspaceRoot || process.cwd()
29873
29891
  });