snow-flow 8.37.26 → 8.38.0

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 (41) hide show
  1. package/.snow-code/agent/deployment-specialist.md +346 -0
  2. package/.snow-code/agent/orchestrator.md +286 -0
  3. package/.snow-code/agent/risk-assessor.md +454 -0
  4. package/.snow-code/agent/solution-architect.md +582 -0
  5. package/.snow-code/agent/validator.md +503 -0
  6. package/.snow-code/opencode.json +49 -0
  7. package/README.md +141 -904
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +93 -256
  10. package/dist/cli.js.map +1 -1
  11. package/dist/utils/sync-mcp-configs.d.ts +7 -5
  12. package/dist/utils/sync-mcp-configs.d.ts.map +1 -1
  13. package/dist/utils/sync-mcp-configs.js +19 -74
  14. package/dist/utils/sync-mcp-configs.js.map +1 -1
  15. package/package.json +2 -3
  16. package/scripts/check-binary-updates.js +0 -169
  17. package/scripts/check-npm-version.js +0 -92
  18. package/scripts/classify-all-tools.ts +0 -446
  19. package/scripts/classify-edge-cases.ts +0 -275
  20. package/scripts/classify-operations-tools.sh +0 -96
  21. package/scripts/cleanup-mcp-servers.js +0 -115
  22. package/scripts/diagnose-mcp.js +0 -299
  23. package/scripts/generate-mcp-config.js +0 -45
  24. package/scripts/mcp-server-manager.sh +0 -320
  25. package/scripts/postinstall.js +0 -75
  26. package/scripts/reset-mcp-servers.js +0 -266
  27. package/scripts/safe-mcp-cleanup.js +0 -151
  28. package/scripts/setup-mcp.js +0 -106
  29. package/scripts/start-mcp-proper.js +0 -76
  30. package/scripts/start-snowcode.sh +0 -123
  31. package/scripts/start-sysprops-mcp.js +0 -43
  32. package/scripts/sync-snow-code-version.js +0 -74
  33. package/scripts/test-auth-flow.js +0 -172
  34. package/scripts/test-auth-location-fix.js +0 -84
  35. package/scripts/test-mcp-manual.js +0 -140
  36. package/scripts/test-todowrite-timeout.js +0 -108
  37. package/scripts/update-dependencies.js +0 -90
  38. package/scripts/update-mcp-config.js +0 -96
  39. package/scripts/update-snow-code.js +0 -146
  40. package/scripts/verify-snowcode-fork.sh +0 -141
  41. package/templates/snow-code-package.json +0 -3
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;GAEG;AAqhGH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,OAAe,GACrB,OAAO,CAAC,IAAI,CAAC,CAiTf"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;GAEG;AAi2FH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,OAAe,GACrB,OAAO,CAAC,IAAI,CAAC,CA6Sf"}
package/dist/cli.js CHANGED
@@ -1552,7 +1552,7 @@ program
1552
1552
  await copySnowCodeConfig(targetDir, options.force);
1553
1553
  await copySnowCodeThemes(targetDir, options.force);
1554
1554
  await copySnowCodePackageJson(targetDir, options.force);
1555
- await copyMCPServerScripts(targetDir, options.force);
1555
+ // copyMCPServerScripts removed - scripts/ directory no longer needed for snow-code
1556
1556
  setupSpinner.stop('Project configured');
1557
1557
  // Verify MCP servers
1558
1558
  if (!options.skipMcp) {
@@ -1561,8 +1561,8 @@ program
1561
1561
  await verifyMCPServers(targetDir);
1562
1562
  mcpSpinner.stop('MCP servers verified');
1563
1563
  }
1564
- // 🔥 CRITICAL: Sync .mcp.json to .claude/mcp-config.json
1565
- // This ensures Claude Code can discover all MCP servers
1564
+ // Sync .mcp.json to .snow-code/config.json
1565
+ // This ensures snow-code discovers all MCP servers
1566
1566
  try {
1567
1567
  const syncSpinner = prompts.spinner();
1568
1568
  syncSpinner.start('Syncing MCP configurations');
@@ -1739,46 +1739,20 @@ async function checkAndInstallSnowCode() {
1739
1739
  return false;
1740
1740
  }
1741
1741
  async function createDirectoryStructure(targetDir, force = false) {
1742
+ // Minimal directory structure for snow-code
1743
+ // Legacy directories (.claude, .swarm, .snow-flow, memory, coordination, servicenow, templates, scripts) removed
1742
1744
  const directories = [
1743
- '.claude', '.claude/commands', '.claude/commands/sparc', '.claude/configs',
1744
- '.swarm', '.swarm/sessions', '.swarm/agents',
1745
- '.snow-flow', '.snow-flow/queen', '.snow-flow/memory', '.snow-flow/data', '.snow-flow/queen-test', '.snow-flow/queen-advanced',
1746
- 'memory', 'memory/agents', 'memory/sessions',
1747
- 'coordination', 'coordination/memory_bank', 'coordination/subtasks',
1748
- 'servicenow', 'servicenow/widgets', 'servicenow/workflows', 'servicenow/scripts',
1749
- 'templates', 'templates/widgets', 'templates/workflows',
1750
- 'scripts'
1745
+ '.snow-code',
1746
+ '.snow-code/agent',
1747
+ '.snow-code/command',
1748
+ '.snow-code/plugin'
1751
1749
  ];
1752
1750
  for (const dir of directories) {
1753
1751
  const dirPath = (0, path_1.join)(targetDir, dir);
1754
1752
  await fs_1.promises.mkdir(dirPath, { recursive: true });
1755
1753
  }
1756
1754
  }
1757
- async function createBasicConfig(targetDir) {
1758
- const claudeConfig = {
1759
- version: version_js_1.VERSION,
1760
- name: 'snow-flow',
1761
- description: 'ServiceNow Multi-Agent Development Framework',
1762
- created: new Date().toISOString(),
1763
- features: {
1764
- swarmCoordination: true,
1765
- persistentMemory: true, // Queen uses JSON files, MCP tools use in-memory
1766
- serviceNowIntegration: true,
1767
- sparcModes: true
1768
- }
1769
- };
1770
- const swarmConfig = {
1771
- version: version_js_1.VERSION,
1772
- topology: 'hierarchical',
1773
- maxAgents: 8,
1774
- memory: {
1775
- path: '.swarm/memory',
1776
- namespace: 'snow-flow'
1777
- }
1778
- };
1779
- await fs_1.promises.writeFile((0, path_1.join)(targetDir, '.claude/config.json'), JSON.stringify(claudeConfig, null, 2));
1780
- await fs_1.promises.writeFile((0, path_1.join)(targetDir, '.swarm/config.json'), JSON.stringify(swarmConfig, null, 2));
1781
- }
1755
+ // createBasicConfig removed - legacy .claude and .swarm configs no longer needed
1782
1756
  async function createReadmeFiles(targetDir, force = false) {
1783
1757
  // Only create README.md if it doesn't exist already
1784
1758
  const readmePath = (0, path_1.join)(targetDir, 'README.md');
@@ -1787,9 +1761,7 @@ async function createReadmeFiles(targetDir, force = false) {
1787
1761
  const { README_TEMPLATE } = await Promise.resolve().then(() => __importStar(require('./templates/readme-template.js')));
1788
1762
  await fs_1.promises.writeFile(readmePath, README_TEMPLATE);
1789
1763
  }
1790
- // Create sub-directory READMEs
1791
- await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'memory/agents/README.md'), '# Agent Memory\n\nThis directory contains persistent memory for ServiceNow agents.');
1792
- await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'servicenow/README.md'), '# ServiceNow Artifacts\n\nThis directory contains generated ServiceNow development artifacts.');
1764
+ // Legacy sub-directory READMEs removed (memory/, servicenow/ directories no longer created)
1793
1765
  }
1794
1766
  // Helper functions
1795
1767
  async function copySnowCodeConfig(targetDir, force = false) {
@@ -2138,96 +2110,10 @@ async function verifyMCPServers(targetDir) {
2138
2110
  // Silent error handling
2139
2111
  }
2140
2112
  }
2141
- async function copyMCPServerScripts(targetDir, force = false) {
2142
- try {
2143
- // Determine the snow-flow installation directory (same logic as other copy functions)
2144
- let snowFlowRoot;
2145
- const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
2146
- __dirname.includes('node_modules/.pnpm') ||
2147
- __dirname.includes('npm/snow-flow');
2148
- if (isGlobalInstall) {
2149
- const parts = __dirname.split(/node_modules[\/\\]/);
2150
- snowFlowRoot = parts[0] + 'node_modules/snow-flow';
2151
- }
2152
- else {
2153
- let currentDir = __dirname;
2154
- while (currentDir !== '/') {
2155
- try {
2156
- const packageJsonPath = (0, path_1.join)(currentDir, 'package.json');
2157
- const packageJson = JSON.parse(await fs_1.promises.readFile(packageJsonPath, 'utf-8'));
2158
- if (packageJson.name === 'snow-flow') {
2159
- snowFlowRoot = currentDir;
2160
- break;
2161
- }
2162
- }
2163
- catch {
2164
- // Continue searching up
2165
- }
2166
- currentDir = (0, path_1.dirname)(currentDir);
2167
- }
2168
- if (!snowFlowRoot) {
2169
- throw new Error('Could not find snow-flow project root');
2170
- }
2171
- }
2172
- // Find scripts directory
2173
- const scriptsSourcePaths = [
2174
- (0, path_1.join)(snowFlowRoot, 'scripts'),
2175
- (0, path_1.join)(__dirname, '..', 'scripts'),
2176
- (0, path_1.join)(__dirname, 'scripts')
2177
- ];
2178
- let scriptsSourceDir = null;
2179
- for (const sourcePath of scriptsSourcePaths) {
2180
- try {
2181
- await fs_1.promises.access(sourcePath);
2182
- scriptsSourceDir = sourcePath;
2183
- break;
2184
- }
2185
- catch {
2186
- // Continue to next path
2187
- }
2188
- }
2189
- if (!scriptsSourceDir) {
2190
- return;
2191
- }
2192
- // Create target scripts directory
2193
- const scriptsTargetDir = (0, path_1.join)(targetDir, 'scripts');
2194
- await fs_1.promises.mkdir(scriptsTargetDir, { recursive: true });
2195
- // Copy specific scripts
2196
- const scriptFiles = [
2197
- // 'mcp-server-manager.sh', // REMOVED: MCP servers auto-start via .mcp.json, this script is for dev only
2198
- 'start-snowcode.sh'
2199
- ];
2200
- let copiedCount = 0;
2201
- for (const scriptFile of scriptFiles) {
2202
- const sourcePath = (0, path_1.join)(scriptsSourceDir, scriptFile);
2203
- const targetPath = (0, path_1.join)(scriptsTargetDir, scriptFile);
2204
- try {
2205
- // Check if file already exists
2206
- try {
2207
- await fs_1.promises.access(targetPath);
2208
- if (!force) {
2209
- continue;
2210
- }
2211
- }
2212
- catch {
2213
- // File doesn't exist, continue with copy
2214
- }
2215
- const content = await fs_1.promises.readFile(sourcePath, 'utf8');
2216
- await fs_1.promises.writeFile(targetPath, content, { mode: 0o755 }); // Make executable
2217
- copiedCount++;
2218
- }
2219
- catch (error) {
2220
- // Silent error handling
2221
- }
2222
- }
2223
- }
2224
- catch (error) {
2225
- // Silent error handling
2226
- }
2227
- }
2113
+ // copyMCPServerScripts removed - scripts/ directory no longer needed for snow-code
2114
+ // snow-code auto-manages MCP servers via .mcp.json and .snow-code/config.json
2228
2115
  async function copyCLAUDEmd(targetDir, force = false) {
2229
2116
  let claudeMdContent = '';
2230
- let agentsMdContent = '';
2231
2117
  // Determine the snow-flow installation directory for absolute MCP paths
2232
2118
  let snowFlowRoot;
2233
2119
  const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
@@ -2260,14 +2146,10 @@ async function copyCLAUDEmd(targetDir, force = false) {
2260
2146
  try {
2261
2147
  // First try to find the CLAUDE.md in the source directory (for global installs)
2262
2148
  const sourceClaudeFiles = [
2263
- // Try the project root (when running from dist/)
2264
2149
  (0, path_1.join)(__dirname, '..', 'CLAUDE.md'),
2265
- // Try when running directly from src/
2266
2150
  (0, path_1.join)(__dirname, 'CLAUDE.md'),
2267
- // Try npm global installation paths
2268
2151
  (0, path_1.join)(__dirname, '..', '..', '..', 'CLAUDE.md'),
2269
2152
  (0, path_1.join)(__dirname, '..', '..', '..', '..', 'CLAUDE.md'),
2270
- // Try current working directory as fallback
2271
2153
  (0, path_1.join)(process.cwd(), 'CLAUDE.md')
2272
2154
  ];
2273
2155
  let foundSource = false;
@@ -2282,145 +2164,104 @@ async function copyCLAUDEmd(targetDir, force = false) {
2282
2164
  }
2283
2165
  }
2284
2166
  if (!foundSource) {
2285
- // Import the template from the dedicated file
2286
2167
  const { CLAUDE_MD_TEMPLATE } = await Promise.resolve().then(() => __importStar(require('./templates/claude-md-template.js')));
2287
2168
  claudeMdContent = CLAUDE_MD_TEMPLATE;
2288
2169
  }
2289
- // Use same content for AGENTS.md as CLAUDE.md (they should be identical)
2290
- agentsMdContent = claudeMdContent;
2291
- // Create CLAUDE.md (primary instructions for Claude Code)
2292
- const claudeMdPath = (0, path_1.join)(targetDir, 'CLAUDE.md');
2293
- try {
2294
- await fs_1.promises.access(claudeMdPath);
2295
- if (force) {
2296
- await fs_1.promises.writeFile(claudeMdPath, claudeMdContent);
2297
- }
2298
- }
2299
- catch {
2300
- await fs_1.promises.writeFile(claudeMdPath, claudeMdContent);
2301
- }
2302
- // Create AGENTS.md (identical copy for SnowCode compatibility)
2170
+ // Create AGENTS.md in root (snow-code searches for AGENTS.md or CLAUDE.md)
2303
2171
  const agentsMdPath = (0, path_1.join)(targetDir, 'AGENTS.md');
2304
2172
  try {
2305
2173
  await fs_1.promises.access(agentsMdPath);
2306
2174
  if (force) {
2307
- await fs_1.promises.writeFile(agentsMdPath, agentsMdContent);
2175
+ await fs_1.promises.writeFile(agentsMdPath, claudeMdContent);
2308
2176
  }
2309
2177
  }
2310
2178
  catch {
2311
- await fs_1.promises.writeFile(agentsMdPath, agentsMdContent);
2179
+ await fs_1.promises.writeFile(agentsMdPath, claudeMdContent);
2312
2180
  }
2313
- // Create .snow-code/ directory structure
2181
+ // Setup .snow-code/ directory (directories already created by createDirectoryStructure)
2314
2182
  const snowcodeDir = (0, path_1.join)(targetDir, '.snow-code');
2315
- const agentsDir = (0, path_1.join)(snowcodeDir, 'agent'); // Singular 'agent' as required by SnowCode
2316
- const modesDir = (0, path_1.join)(snowcodeDir, 'modes');
2183
+ const agentsDir = (0, path_1.join)(snowcodeDir, 'agent');
2184
+ // Copy agent files from .snow-code/agent/ in snow-flow package
2185
+ const sourceAgentsDir = (0, path_1.join)(snowFlowRoot, '.snow-code', 'agent');
2317
2186
  try {
2318
- await fs_1.promises.mkdir(snowcodeDir, { recursive: true });
2319
- await fs_1.promises.mkdir(agentsDir, { recursive: true });
2320
- await fs_1.promises.mkdir(modesDir, { recursive: true });
2321
- // Copy agent files from .claude/ to .snow-code/agent/ (if they exist)
2322
- const sourceAgentsDir = (0, path_1.join)(__dirname, '..', '.claude', 'agents');
2323
- try {
2324
- const agentFiles = await fs_1.promises.readdir(sourceAgentsDir);
2325
- for (const file of agentFiles) {
2326
- if (file.endsWith('.md')) {
2327
- const sourceFile = (0, path_1.join)(sourceAgentsDir, file);
2328
- const targetFile = (0, path_1.join)(agentsDir, file);
2187
+ const agentFiles = await fs_1.promises.readdir(sourceAgentsDir);
2188
+ for (const file of agentFiles) {
2189
+ if (file.endsWith('.md')) {
2190
+ const sourceFile = (0, path_1.join)(sourceAgentsDir, file);
2191
+ const targetFile = (0, path_1.join)(agentsDir, file);
2192
+ try {
2193
+ await fs_1.promises.access(targetFile);
2194
+ if (force) {
2195
+ const content = await fs_1.promises.readFile(sourceFile, 'utf-8');
2196
+ await fs_1.promises.writeFile(targetFile, content);
2197
+ }
2198
+ }
2199
+ catch {
2329
2200
  const content = await fs_1.promises.readFile(sourceFile, 'utf-8');
2330
2201
  await fs_1.promises.writeFile(targetFile, content);
2331
2202
  }
2332
2203
  }
2333
2204
  }
2334
- catch (err) {
2335
- // Silently continue - agent configs are in snow-code.json, not separate files
2336
- }
2337
- // Create .snow-code/snow-code.json by converting from .mcp.json.template
2338
- // SINGLE SOURCE OF TRUTH: .mcp.json.template → both Claude and SnowCode formats
2339
- // CRITICAL: SnowCode/OpenCode does NOT auto-expand ${...} variables
2340
- // 🔧 Read actual environment values from .env file
2341
- const envPath = (0, path_1.join)(targetDir, '.env');
2342
- const envValues = {};
2343
- try {
2344
- const envContent = await fs_1.promises.readFile(envPath, 'utf-8');
2345
- // Parse .env file (simple parser - handles KEY=VALUE lines)
2346
- const lines = envContent.split('\n');
2347
- for (var line of lines) {
2348
- line = line.trim();
2349
- // Skip comments and empty lines
2350
- if (!line || line.startsWith('#'))
2351
- continue;
2352
- var equalIndex = line.indexOf('=');
2353
- if (equalIndex > 0) {
2354
- var key = line.substring(0, equalIndex).trim();
2355
- var value = line.substring(equalIndex + 1).trim();
2356
- // Remove quotes if present
2357
- if ((value.startsWith('"') && value.endsWith('"')) ||
2358
- (value.startsWith("'") && value.endsWith("'"))) {
2359
- value = value.substring(1, value.length - 1);
2360
- }
2361
- envValues[key] = value;
2205
+ }
2206
+ catch (err) {
2207
+ // Silently continue - agent files are optional
2208
+ }
2209
+ // Create .snow-code/config.json from .mcp.json.template
2210
+ const envPath = (0, path_1.join)(targetDir, '.env');
2211
+ const envValues = {};
2212
+ try {
2213
+ const envContent = await fs_1.promises.readFile(envPath, 'utf-8');
2214
+ const lines = envContent.split('\n');
2215
+ for (var line of lines) {
2216
+ line = line.trim();
2217
+ if (!line || line.startsWith('#'))
2218
+ continue;
2219
+ var equalIndex = line.indexOf('=');
2220
+ if (equalIndex > 0) {
2221
+ var key = line.substring(0, equalIndex).trim();
2222
+ var value = line.substring(equalIndex + 1).trim();
2223
+ if ((value.startsWith('"') && value.endsWith('"')) ||
2224
+ (value.startsWith("'") && value.endsWith("'"))) {
2225
+ value = value.substring(1, value.length - 1);
2362
2226
  }
2227
+ envValues[key] = value;
2363
2228
  }
2364
2229
  }
2365
- catch (error) {
2366
- // Silent error handling
2367
- }
2368
- // Helper function to get env value with proper URL formatting
2369
- function getEnvValue(key, defaultValue = '') {
2370
- var value = envValues[key] || process.env[key] || defaultValue;
2371
- // Special handling for SNOW_INSTANCE - ensure it's a full URL
2372
- if (key === 'SNOW_INSTANCE' && value && !value.startsWith('http')) {
2373
- value = 'https://' + value.replace(/^https?:\/\//, '');
2374
- }
2375
- return value;
2376
- }
2377
- // Read .mcp.json.template (single source of truth for MCP servers)
2378
- const mcpTemplatePath = (0, path_1.join)(snowFlowRoot, '.mcp.json.template');
2379
- let mcpTemplateContent;
2380
- try {
2381
- mcpTemplateContent = await fs_1.promises.readFile(mcpTemplatePath, 'utf-8');
2382
- }
2383
- catch (error) {
2384
- throw error;
2385
- }
2386
- // Replace placeholders with ACTUAL values from .env (not ${...} syntax!)
2387
- const mcpConfigContent = mcpTemplateContent
2388
- .replace(/{{PROJECT_ROOT}}/g, snowFlowRoot)
2389
- .replace(/{{SNOW_INSTANCE}}/g, getEnvValue('SNOW_INSTANCE'))
2390
- .replace(/{{SNOW_CLIENT_ID}}/g, getEnvValue('SNOW_CLIENT_ID'))
2391
- .replace(/{{SNOW_CLIENT_SECRET}}/g, getEnvValue('SNOW_CLIENT_SECRET'))
2392
- .replace(/{{SNOW_FLOW_ENV}}/g, getEnvValue('SNOW_FLOW_ENV', 'development'));
2393
- const claudeConfig = JSON.parse(mcpConfigContent);
2394
- // Convert Claude Desktop format to SnowCode format
2395
- const snowcodeConfig = convertToSnowCodeFormat(claudeConfig);
2396
- // Write snow-code.json (SnowCode searches for this name!)
2397
- // ✅ PROJECT-SCOPED: Only write to project .snow-code/ directory
2398
- const snowCodeJsonPath = (0, path_1.join)(snowcodeDir, 'snow-code.json');
2399
- const configJsonPath = (0, path_1.join)(snowcodeDir, 'config.json');
2400
- await fs_1.promises.writeFile(snowCodeJsonPath, JSON.stringify(snowcodeConfig, null, 2));
2401
- await fs_1.promises.writeFile(configJsonPath, JSON.stringify(snowcodeConfig, null, 2));
2402
- // ❌ REMOVED: Global config write
2403
- // We do NOT write to ~/.config/snow-code/ anymore
2404
- // Each snow-flow project maintains its own isolated SnowCode configuration
2405
- // SnowCode will automatically discover and use the project-level .snow-code/ config
2406
- // Also create AGENTS.md in .snow-code/
2407
- const snowcodeAgentsMdPath = (0, path_1.join)(snowcodeDir, 'AGENTS.md');
2408
- await fs_1.promises.writeFile(snowcodeAgentsMdPath, agentsMdContent);
2409
2230
  }
2410
2231
  catch (error) {
2411
2232
  // Silent error handling
2412
2233
  }
2234
+ function getEnvValue(key, defaultValue = '') {
2235
+ var value = envValues[key] || process.env[key] || defaultValue;
2236
+ if (key === 'SNOW_INSTANCE' && value && !value.startsWith('http')) {
2237
+ value = 'https://' + value.replace(/^https?:\/\//, '');
2238
+ }
2239
+ return value;
2240
+ }
2241
+ const mcpTemplatePath = (0, path_1.join)(snowFlowRoot, '.mcp.json.template');
2242
+ let mcpTemplateContent;
2243
+ try {
2244
+ mcpTemplateContent = await fs_1.promises.readFile(mcpTemplatePath, 'utf-8');
2245
+ }
2246
+ catch (error) {
2247
+ throw error;
2248
+ }
2249
+ const mcpConfigContent = mcpTemplateContent
2250
+ .replace(/{{PROJECT_ROOT}}/g, snowFlowRoot)
2251
+ .replace(/{{SNOW_INSTANCE}}/g, getEnvValue('SNOW_INSTANCE'))
2252
+ .replace(/{{SNOW_CLIENT_ID}}/g, getEnvValue('SNOW_CLIENT_ID'))
2253
+ .replace(/{{SNOW_CLIENT_SECRET}}/g, getEnvValue('SNOW_CLIENT_SECRET'))
2254
+ .replace(/{{SNOW_FLOW_ENV}}/g, getEnvValue('SNOW_FLOW_ENV', 'development'));
2255
+ const mcpConfig = JSON.parse(mcpConfigContent);
2256
+ const snowcodeConfig = convertToSnowCodeFormat(mcpConfig);
2257
+ // Write only config.json (snow-code reads this)
2258
+ const configJsonPath = (0, path_1.join)(snowcodeDir, 'config.json');
2259
+ await fs_1.promises.writeFile(configJsonPath, JSON.stringify(snowcodeConfig, null, 2));
2413
2260
  }
2414
2261
  catch (error) {
2415
- // Silent error handling
2416
- // Import the template as fallback
2262
+ // Fallback: create minimal AGENTS.md
2417
2263
  const { CLAUDE_MD_TEMPLATE } = await Promise.resolve().then(() => __importStar(require('./templates/claude-md-template.js')));
2418
- const claudeMdPath = (0, path_1.join)(targetDir, 'CLAUDE.md');
2419
2264
  const agentsMdPath = (0, path_1.join)(targetDir, 'AGENTS.md');
2420
- if (force || !(0, fs_2.existsSync)(claudeMdPath)) {
2421
- await fs_1.promises.writeFile(claudeMdPath, CLAUDE_MD_TEMPLATE);
2422
- }
2423
- // Use same content for AGENTS.md (they should be identical)
2424
2265
  if (force || !(0, fs_2.existsSync)(agentsMdPath)) {
2425
2266
  await fs_1.promises.writeFile(agentsMdPath, CLAUDE_MD_TEMPLATE);
2426
2267
  }
@@ -2670,7 +2511,7 @@ async function createMCPConfig(targetDir, force = false) {
2670
2511
  // Keep the standard MCP structure that snow-code expects
2671
2512
  // Use the snow-code MCP structure directly from template (mcp key)
2672
2513
  const finalConfig = mcpConfig;
2673
- // Create .mcp.json in project root for Claude Code discovery
2514
+ // Create .mcp.json in project root (snow-code reads this directly)
2674
2515
  const mcpConfigPath = (0, path_1.join)(targetDir, '.mcp.json');
2675
2516
  try {
2676
2517
  await fs_1.promises.access(mcpConfigPath);
@@ -2685,13 +2526,10 @@ async function createMCPConfig(targetDir, force = false) {
2685
2526
  catch {
2686
2527
  await fs_1.promises.writeFile(mcpConfigPath, JSON.stringify(finalConfig, null, 2));
2687
2528
  }
2688
- // Also create legacy config in .claude for backward compatibility
2689
- const legacyConfigPath = (0, path_1.join)(targetDir, '.claude/mcp-config.json');
2690
- await fs_1.promises.writeFile(legacyConfigPath, JSON.stringify(finalConfig, null, 2));
2529
+ // .claude/mcp-config.json removed - snow-code is the only supported client
2691
2530
  // ✅ PROJECT-SCOPED MCP CONFIG ONLY
2692
- // We do NOT modify global Snow-Code config (~/.snow-code/snow-code.json)
2693
2531
  // Each project maintains its own isolated MCP configuration in .mcp.json
2694
- // SnowCode/Claude Code will automatically discover and use the project-level .mcp.json
2532
+ // snow-code automatically discovers and uses the project-level .mcp.json
2695
2533
  // Create comprehensive Claude Code settings file
2696
2534
  // NOTE: Only include properties that Claude Code actually accepts
2697
2535
  // Valid properties: apiKeyHelper, cleanupPeriodDays, env, includeCoAuthoredBy,
@@ -2889,8 +2727,10 @@ async function createMCPConfig(targetDir, force = false) {
2889
2727
  // Snow-Flow v3.5.13+ optimized settings with servicenow-local-development
2890
2728
  // Comprehensive permissions for Snow-Flow development workflow
2891
2729
  };
2892
- const claudeSettingsPath = (0, path_1.join)(targetDir, '.claude/settings.json');
2893
- await fs_1.promises.writeFile(claudeSettingsPath, JSON.stringify(claudeSettings, null, 2));
2730
+ // .claude/settings.json removed - snow-code doesn't use this format
2731
+ // snow-code uses .snow-code/config.json for all configuration
2732
+ // Keeping claudeSettings object for potential future snow-code config migration
2733
+ void claudeSettings; // Suppress unused variable warning
2894
2734
  }
2895
2735
  // Setup MCP configuration function
2896
2736
  async function setupMCPConfig(targetDir, instanceUrl, clientId, clientSecret, force = false) {
@@ -3054,13 +2894,10 @@ async function setupMCPConfig(targetDir, instanceUrl, clientId, clientSecret, fo
3054
2894
  catch {
3055
2895
  await fs_1.promises.writeFile(mcpConfigPath, JSON.stringify(finalConfig, null, 2));
3056
2896
  }
3057
- // Also create legacy config in .claude for backward compatibility
3058
- const legacyConfigPath = (0, path_1.join)(targetDir, '.claude/mcp-config.json');
3059
- await fs_1.promises.writeFile(legacyConfigPath, JSON.stringify(finalConfig, null, 2));
3060
- // 🔧 CRITICAL FIX: Also update global SnowCode configuration
3061
- // SnowCode/OpenCode reads from ~/.snowcode/snowcode.json
3062
- const snowcodeConfigPath = (0, path_1.join)(process.env.HOME || '', '.snow-code', 'snow-code.json');
3063
- const snowcodeConfigDirPath = (0, path_1.join)(process.env.HOME || '', '.snow-code');
2897
+ // .claude/mcp-config.json removed - snow-code is the only supported client
2898
+ // Update project-level .snow-code/config.json
2899
+ const snowcodeConfigPath = (0, path_1.join)(targetDir, '.snow-code', 'config.json');
2900
+ const snowcodeConfigDirPath = (0, path_1.join)(targetDir, '.snow-code');
3064
2901
  try {
3065
2902
  // Ensure directory exists
3066
2903
  try {