snow-flow 8.4.21 → 8.4.24
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/CLAUDE.md +1 -1
- package/README.md +23 -23
- package/{OPENCODE-SETUP.md → SNOWCODE-SETUP.md} +19 -19
- package/{OPENCODE-TROUBLESHOOTING.md → SNOWCODE-TROUBLESHOOTING.md} +18 -18
- package/dist/cli/auth.js +21 -21
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli.js +208 -208
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/claude-md-template.d.ts +1 -1
- package/dist/templates/claude-md-template.js +1 -1
- package/dist/templates/readme-template.d.ts +1 -1
- package/dist/templates/readme-template.js +18 -18
- package/dist/utils/artifact-local-sync.d.ts +1 -1
- package/dist/utils/artifact-local-sync.js +4 -4
- package/dist/utils/snowcode-output-interceptor.d.ts +40 -0
- package/dist/utils/snowcode-output-interceptor.d.ts.map +1 -0
- package/dist/utils/snowcode-output-interceptor.js +258 -0
- package/dist/utils/snowcode-output-interceptor.js.map +1 -0
- package/package.json +14 -6
- package/scripts/{start-opencode.sh → start-snowcode.sh} +28 -28
- /package/{opencode-config.example.json → snowcode-config.example.json} +0 -0
package/dist/cli.js
CHANGED
|
@@ -326,13 +326,13 @@ program
|
|
|
326
326
|
started_at: new Date().toISOString(),
|
|
327
327
|
is_authenticated: isAuthenticated
|
|
328
328
|
});
|
|
329
|
-
// Start
|
|
329
|
+
// Start SnowCode multi-agent orchestration
|
|
330
330
|
try {
|
|
331
331
|
// Generate the orchestration prompt
|
|
332
332
|
const orchestrationPrompt = buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated, sessionId);
|
|
333
333
|
if (options.verbose) {
|
|
334
|
-
cliLogger.info('\n👑 Initializing multi-agent orchestration with
|
|
335
|
-
cliLogger.info('🎯
|
|
334
|
+
cliLogger.info('\n👑 Initializing multi-agent orchestration with SnowCode...');
|
|
335
|
+
cliLogger.info('🎯 SnowCode will coordinate the following:');
|
|
336
336
|
cliLogger.info(` - Analyze objective: "${objective}"`);
|
|
337
337
|
cliLogger.info(` - Spawn ${taskAnalysis.estimatedAgentCount} specialized agents via Task() system`);
|
|
338
338
|
cliLogger.info(` - Coordinate through shared memory (session: ${sessionId})`);
|
|
@@ -344,7 +344,7 @@ program
|
|
|
344
344
|
options.sharedMemory || options.progressMonitoring;
|
|
345
345
|
if (options.verbose && hasIntelligentFeatures && isAuthenticated) {
|
|
346
346
|
cliLogger.info('\n🧠 INTELLIGENT ORCHESTRATION MODE ENABLED!');
|
|
347
|
-
cliLogger.info('✨
|
|
347
|
+
cliLogger.info('✨ SnowCode will use advanced features:');
|
|
348
348
|
if (options.autoPermissions) {
|
|
349
349
|
cliLogger.info(' 🔐 Automatic permission escalation');
|
|
350
350
|
}
|
|
@@ -376,12 +376,12 @@ program
|
|
|
376
376
|
cliLogger.info('\n🔗 Live ServiceNow integration: ❌ Disabled');
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
// Try to execute
|
|
380
|
-
const success = await
|
|
379
|
+
// Try to execute SnowCode directly with the objective
|
|
380
|
+
const success = await executeSnowCode(objective);
|
|
381
381
|
if (success) {
|
|
382
382
|
if (options.verbose) {
|
|
383
|
-
cliLogger.info('✅
|
|
384
|
-
cliLogger.info('🤖
|
|
383
|
+
cliLogger.info('✅ SnowCode launched successfully!');
|
|
384
|
+
cliLogger.info('🤖 SnowCode is now executing your objective');
|
|
385
385
|
cliLogger.info(`💾 Monitor progress with session ID: ${sessionId}`);
|
|
386
386
|
if (isAuthenticated && options.autoDeploy) {
|
|
387
387
|
cliLogger.info('🚀 Real artifacts will be created in ServiceNow');
|
|
@@ -397,11 +397,11 @@ program
|
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
else {
|
|
400
|
-
cliLogger.warn('⚠️
|
|
401
|
-
cliLogger.info('\n📋 Please ensure
|
|
402
|
-
cliLogger.info(' npm install -g
|
|
403
|
-
cliLogger.info('\n💡 Or start
|
|
404
|
-
cliLogger.info(' 1. Run:
|
|
400
|
+
cliLogger.warn('⚠️ SnowCode CLI not found or failed to start');
|
|
401
|
+
cliLogger.info('\n📋 Please ensure SnowCode is installed:');
|
|
402
|
+
cliLogger.info(' npm install -g @groeimetai/snowcode');
|
|
403
|
+
cliLogger.info('\n💡 Or start SnowCode manually:');
|
|
404
|
+
cliLogger.info(' 1. Run: snowcode');
|
|
405
405
|
cliLogger.info(` 2. Enter objective: ${objective}`);
|
|
406
406
|
if (isAuthenticated && options.autoDeploy) {
|
|
407
407
|
cliLogger.info('\n🚀 Deployment Mode: Artifacts will be created in ServiceNow');
|
|
@@ -421,26 +421,26 @@ program
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
|
-
// Helper function to execute
|
|
425
|
-
async function
|
|
424
|
+
// Helper function to execute SnowCode directly with the objective
|
|
425
|
+
async function executeSnowCode(objective) {
|
|
426
426
|
try {
|
|
427
|
-
// Check if
|
|
427
|
+
// Check if SnowCode CLI is available
|
|
428
428
|
const { execSync } = require('child_process');
|
|
429
429
|
try {
|
|
430
|
-
execSync('which
|
|
430
|
+
execSync('which snowcode', { stdio: 'ignore' });
|
|
431
431
|
}
|
|
432
432
|
catch {
|
|
433
|
-
cliLogger.warn('⚠️
|
|
434
|
-
cliLogger.info('📋 Please install
|
|
433
|
+
cliLogger.warn('⚠️ SnowCode CLI not found in PATH');
|
|
434
|
+
cliLogger.info('📋 Please install SnowCode: npm install -g @groeimetai/snowcode');
|
|
435
435
|
return false;
|
|
436
436
|
}
|
|
437
|
-
// Check for
|
|
438
|
-
const
|
|
439
|
-
const
|
|
440
|
-
if (!
|
|
441
|
-
cliLogger.warn('⚠️
|
|
437
|
+
// Check for SnowCode config (.snowcode/snowcode.json created by init)
|
|
438
|
+
const snowcodeConfigPath = (0, path_1.join)(process.cwd(), '.snowcode', 'snowcode.json');
|
|
439
|
+
const hasSnowcodeConfig = (0, fs_2.existsSync)(snowcodeConfigPath);
|
|
440
|
+
if (!hasSnowcodeConfig) {
|
|
441
|
+
cliLogger.warn('⚠️ SnowCode configuration not found');
|
|
442
442
|
cliLogger.info('📋 Please run: snow-flow init');
|
|
443
|
-
cliLogger.info(' This will create .
|
|
443
|
+
cliLogger.info(' This will create .snowcode/snowcode.json with MCP servers configured');
|
|
444
444
|
return false;
|
|
445
445
|
}
|
|
446
446
|
// Check for .env file with required configuration
|
|
@@ -457,10 +457,10 @@ async function executeOpenCode(objective) {
|
|
|
457
457
|
// Debug output if enabled
|
|
458
458
|
if (process.env.SNOW_FLOW_DEBUG === 'true' || process.env.VERBOSE === 'true') {
|
|
459
459
|
cliLogger.info(`🔍 Working Directory: ${process.cwd()}`);
|
|
460
|
-
cliLogger.info(`🔍
|
|
460
|
+
cliLogger.info(`🔍 SnowCode Config: ${snowcodeConfigPath}`);
|
|
461
461
|
cliLogger.info(`🔍 Environment File: ${envPath}`);
|
|
462
462
|
}
|
|
463
|
-
// Write objective to temp file for
|
|
463
|
+
// Write objective to temp file for SnowCode to read
|
|
464
464
|
const { tmpdir } = await Promise.resolve().then(() => __importStar(require('os')));
|
|
465
465
|
const { writeFileSync, unlinkSync } = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
466
466
|
const tmpFile = (0, path_1.join)(tmpdir(), `snow-flow-objective-${Date.now()}.txt`);
|
|
@@ -468,29 +468,29 @@ async function executeOpenCode(objective) {
|
|
|
468
468
|
// Get default model from .env if available
|
|
469
469
|
const defaultModel = process.env.DEFAULT_MODEL;
|
|
470
470
|
const defaultProvider = process.env.DEFAULT_LLM_PROVIDER;
|
|
471
|
-
// Start
|
|
472
|
-
//
|
|
473
|
-
let
|
|
474
|
-
// If we have a default model, pass it to
|
|
471
|
+
// Start SnowCode with the objective and default model
|
|
472
|
+
// SnowCode will be started interactively with stdin redirect
|
|
473
|
+
let snowcodeCommand = `snowcode < "${tmpFile}"`;
|
|
474
|
+
// If we have a default model, pass it to SnowCode
|
|
475
475
|
if (defaultModel) {
|
|
476
|
-
|
|
476
|
+
snowcodeCommand = `snowcode --model "${defaultModel}" < "${tmpFile}"`;
|
|
477
477
|
}
|
|
478
|
-
// Spawn
|
|
479
|
-
//
|
|
480
|
-
// We pass the objective via stdin redirect (shell:
|
|
481
|
-
const
|
|
482
|
-
stdio: 'inherit', // All stdio inherited -
|
|
478
|
+
// Spawn SnowCode process - let it run fully interactively
|
|
479
|
+
// SnowCode is a TUI (Terminal User Interface) application that needs full terminal control
|
|
480
|
+
// We pass the objective via stdin redirect (shell: snowcode < tmpfile)
|
|
481
|
+
const snowcodeProcess = (0, child_process_1.spawn)('sh', ['-c', snowcodeCommand], {
|
|
482
|
+
stdio: 'inherit', // All stdio inherited - SnowCode can use TTY
|
|
483
483
|
cwd: process.cwd(),
|
|
484
484
|
env: {
|
|
485
485
|
...process.env,
|
|
486
|
-
// Ensure DEFAULT_MODEL is available to
|
|
486
|
+
// Ensure DEFAULT_MODEL is available to SnowCode
|
|
487
487
|
DEFAULT_MODEL: defaultModel || '',
|
|
488
488
|
DEFAULT_LLM_PROVIDER: defaultProvider || ''
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
// Set up process monitoring
|
|
492
492
|
return new Promise((resolve) => {
|
|
493
|
-
|
|
493
|
+
snowcodeProcess.on('close', async (code) => {
|
|
494
494
|
// Clean up temp file
|
|
495
495
|
try {
|
|
496
496
|
unlinkSync(tmpFile);
|
|
@@ -500,7 +500,7 @@ async function executeOpenCode(objective) {
|
|
|
500
500
|
}
|
|
501
501
|
resolve(code === 0);
|
|
502
502
|
});
|
|
503
|
-
|
|
503
|
+
snowcodeProcess.on('error', (error) => {
|
|
504
504
|
// Clean up temp file
|
|
505
505
|
try {
|
|
506
506
|
unlinkSync(tmpFile);
|
|
@@ -508,15 +508,15 @@ async function executeOpenCode(objective) {
|
|
|
508
508
|
catch (e) {
|
|
509
509
|
// Ignore cleanup errors
|
|
510
510
|
}
|
|
511
|
-
cliLogger.error(`❌ Failed to start
|
|
511
|
+
cliLogger.error(`❌ Failed to start SnowCode: ${error.message}`);
|
|
512
512
|
resolve(false);
|
|
513
513
|
});
|
|
514
514
|
// Set timeout (configurable via environment variable)
|
|
515
515
|
const timeoutMinutes = parseInt(process.env.SNOW_FLOW_TIMEOUT_MINUTES || '0');
|
|
516
516
|
if (timeoutMinutes > 0) {
|
|
517
517
|
setTimeout(() => {
|
|
518
|
-
cliLogger.warn(`⏱️
|
|
519
|
-
|
|
518
|
+
cliLogger.warn(`⏱️ SnowCode session timeout (${timeoutMinutes} minutes), terminating...`);
|
|
519
|
+
snowcodeProcess.kill('SIGTERM');
|
|
520
520
|
// Clean up temp file
|
|
521
521
|
try {
|
|
522
522
|
unlinkSync(tmpFile);
|
|
@@ -530,25 +530,25 @@ async function executeOpenCode(objective) {
|
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
532
|
catch (error) {
|
|
533
|
-
cliLogger.error('❌ Error launching
|
|
534
|
-
cliLogger.info('📋 Please start
|
|
533
|
+
cliLogger.error('❌ Error launching SnowCode:', error instanceof Error ? error.message : String(error));
|
|
534
|
+
cliLogger.info('📋 Please start SnowCode manually: snowcode');
|
|
535
535
|
return false;
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
// Real-time monitoring dashboard for
|
|
539
|
-
function startMonitoringDashboard(
|
|
538
|
+
// Real-time monitoring dashboard for SnowCode process
|
|
539
|
+
function startMonitoringDashboard(snowcodeProcess) {
|
|
540
540
|
let iterations = 0;
|
|
541
541
|
const startTime = Date.now();
|
|
542
542
|
// Show initial dashboard only once
|
|
543
543
|
cliLogger.info(`┌─────────────────────────────────────────────────────────────┐`);
|
|
544
544
|
cliLogger.info(`│ 🚀 Snow-Flow Dashboard v${version_js_1.VERSION} │`);
|
|
545
545
|
cliLogger.info(`├─────────────────────────────────────────────────────────────┤`);
|
|
546
|
-
cliLogger.info(`│ 🤖
|
|
547
|
-
cliLogger.info(`│ 📊 Process ID: ${
|
|
546
|
+
cliLogger.info(`│ 🤖 SnowCode Status: ✅ Starting │`);
|
|
547
|
+
cliLogger.info(`│ 📊 Process ID: ${snowcodeProcess.pid || 'N/A'} │`);
|
|
548
548
|
cliLogger.info(`│ ⏱️ Session Time: 00:00 │`);
|
|
549
549
|
cliLogger.info(`│ 🔄 Monitoring Cycles: 0 │`);
|
|
550
550
|
cliLogger.info('└─────────────────────────────────────────────────────────────┘');
|
|
551
|
-
// Silent monitoring - only log to file or memory, don't interfere with
|
|
551
|
+
// Silent monitoring - only log to file or memory, don't interfere with SnowCode UI
|
|
552
552
|
const monitoringInterval = setInterval(() => {
|
|
553
553
|
iterations++;
|
|
554
554
|
const uptime = Math.floor((Date.now() - startTime) / 1000);
|
|
@@ -1363,7 +1363,7 @@ program
|
|
|
1363
1363
|
cliLogger.info(` - Primary: ${sessionData.taskAnalysis.primaryAgent}`);
|
|
1364
1364
|
cliLogger.info(` - Supporting: ${sessionData.taskAnalysis.supportingAgents.join(', ')}`);
|
|
1365
1365
|
if (launchData && launchData.success) {
|
|
1366
|
-
cliLogger.info(`\n✅ Status:
|
|
1366
|
+
cliLogger.info(`\n✅ Status: SnowCode (or Claude Code) launched successfully`);
|
|
1367
1367
|
cliLogger.info(`🚀 Launched at: ${launchData.launched_at}`);
|
|
1368
1368
|
}
|
|
1369
1369
|
else if (errorData) {
|
|
@@ -1372,11 +1372,11 @@ program
|
|
|
1372
1372
|
cliLogger.error(`🕐 Failed at: ${errorData.failed_at}`);
|
|
1373
1373
|
}
|
|
1374
1374
|
else {
|
|
1375
|
-
cliLogger.info(`\n⏳ Status: Awaiting manual
|
|
1375
|
+
cliLogger.info(`\n⏳ Status: Awaiting manual SnowCode execution`);
|
|
1376
1376
|
}
|
|
1377
1377
|
cliLogger.info('\n💡 Tips:');
|
|
1378
|
-
cliLogger.info(' - Check
|
|
1379
|
-
cliLogger.info(' - Use Memory.get("swarm_session_' + sessionId + '") in
|
|
1378
|
+
cliLogger.info(' - Check SnowCode for real-time agent progress');
|
|
1379
|
+
cliLogger.info(' - Use Memory.get("swarm_session_' + sessionId + '") in SnowCode');
|
|
1380
1380
|
cliLogger.info(' - Monitor TodoRead for task completion status');
|
|
1381
1381
|
if (options.watch) {
|
|
1382
1382
|
cliLogger.info(`\n👀 Watching for updates every ${options.interval} seconds...`);
|
|
@@ -1387,7 +1387,7 @@ program
|
|
|
1387
1387
|
// Re-fetch session data to check for updates
|
|
1388
1388
|
const updatedSession = memorySystem.getLearning(`session_${sessionId}`);
|
|
1389
1389
|
if (updatedSession) {
|
|
1390
|
-
cliLogger.info(' Status: Active - Check
|
|
1390
|
+
cliLogger.info(' Status: Active - Check SnowCode for details');
|
|
1391
1391
|
}
|
|
1392
1392
|
}, parseInt(options.interval) * 1000);
|
|
1393
1393
|
// Handle graceful shutdown
|
|
@@ -1480,12 +1480,12 @@ program
|
|
|
1480
1480
|
console.log('│ 📋 Recent Activity: │');
|
|
1481
1481
|
console.log(`│ • ${new Date().toLocaleTimeString()} - System monitoring active │`);
|
|
1482
1482
|
cliLogger.info('└─────────────────────────────────────────────────────────────┘');
|
|
1483
|
-
// Check for active
|
|
1483
|
+
// Check for active SnowCode/Claude Code processes
|
|
1484
1484
|
try {
|
|
1485
1485
|
const { execSync } = require('child_process');
|
|
1486
|
-
const processes = execSync('ps aux | grep "claude\\|opencode" | grep -v grep', { encoding: 'utf8' }).toString();
|
|
1486
|
+
const processes = execSync('ps aux | grep "claude\\|opencode\\|snowcode" | grep -v grep', { encoding: 'utf8' }).toString();
|
|
1487
1487
|
if (processes.trim()) {
|
|
1488
|
-
cliLogger.info('\n🤖 Active
|
|
1488
|
+
cliLogger.info('\n🤖 Active SnowCode/Claude Code Processes:');
|
|
1489
1489
|
const lines = processes.trim().split('\n');
|
|
1490
1490
|
lines.forEach((line, index) => {
|
|
1491
1491
|
if (index < 3) { // Show max 3 processes
|
|
@@ -1576,38 +1576,38 @@ program
|
|
|
1576
1576
|
console.log('🔐 Creating environment configuration...');
|
|
1577
1577
|
await createEnvFile(targetDir, options.force);
|
|
1578
1578
|
// Create MCP configuration - always included now (SPARC is default)
|
|
1579
|
-
console.log('🔧 Setting up MCP servers for
|
|
1579
|
+
console.log('🔧 Setting up MCP servers for SnowCode (also works with Claude Code)...');
|
|
1580
1580
|
await createMCPConfig(targetDir, options.force);
|
|
1581
1581
|
// Copy CLAUDE.md file
|
|
1582
1582
|
console.log('📚 Creating documentation files...');
|
|
1583
1583
|
await copyCLAUDEmd(targetDir, options.force);
|
|
1584
1584
|
// Create README files
|
|
1585
1585
|
await createReadmeFiles(targetDir, options.force);
|
|
1586
|
-
// Copy
|
|
1587
|
-
await
|
|
1588
|
-
// Copy
|
|
1589
|
-
await
|
|
1590
|
-
// Copy
|
|
1591
|
-
console.log('📦 Configuring
|
|
1592
|
-
await
|
|
1586
|
+
// Copy snowcode-config.example.json
|
|
1587
|
+
await copySnowCodeConfig(targetDir, options.force);
|
|
1588
|
+
// Copy SnowCode themes
|
|
1589
|
+
await copySnowCodeThemes(targetDir, options.force);
|
|
1590
|
+
// Copy SnowCode package.json with snowcode-plugin
|
|
1591
|
+
console.log('📦 Configuring SnowCode plugin (snowcode fork)...');
|
|
1592
|
+
await copySnowCodePackageJson(targetDir, options.force);
|
|
1593
1593
|
// Copy MCP server management scripts
|
|
1594
1594
|
console.log('🔧 Setting up MCP server management scripts...');
|
|
1595
1595
|
await copyMCPServerScripts(targetDir, options.force);
|
|
1596
1596
|
console.log(chalk_1.default.green.bold('\n✅ Snow-Flow project initialized successfully!'));
|
|
1597
1597
|
console.log('\n📋 Created Snow-Flow configuration:');
|
|
1598
|
-
console.log(' ✓ .
|
|
1599
|
-
console.log(' ✓ .
|
|
1598
|
+
console.log(' ✓ .snowcode/ - SnowCode configuration with both MCP servers');
|
|
1599
|
+
console.log(' ✓ .snowcode/themes/ - ServiceNow custom theme for SnowCode');
|
|
1600
1600
|
console.log(' ✓ .claude/ - Claude Code MCP configuration (backward compatibility)');
|
|
1601
1601
|
console.log(' ✓ .mcp.json - 2 unified MCP servers (370 tools total)');
|
|
1602
|
-
console.log(' ✓ scripts/ - MCP server management and
|
|
1603
|
-
console.log(' ✓ AGENTS.md -
|
|
1602
|
+
console.log(' ✓ scripts/ - MCP server management and SnowCode launcher');
|
|
1603
|
+
console.log(' ✓ AGENTS.md - SnowCode primary instructions');
|
|
1604
1604
|
console.log(' ✓ CLAUDE.md - Claude Code compatibility');
|
|
1605
1605
|
console.log(' ✓ README.md - Complete capabilities documentation');
|
|
1606
|
-
console.log(' ✓
|
|
1606
|
+
console.log(' ✓ SNOWCODE-TROUBLESHOOTING.md - Troubleshooting guide');
|
|
1607
1607
|
console.log(' ✓ .snow-flow/ - Project workspace and memory');
|
|
1608
1608
|
if (!options.skipMcp) {
|
|
1609
|
-
// NOTE: MCP servers work with
|
|
1610
|
-
console.log(chalk_1.default.blue('\nℹ️ MCP servers configured for
|
|
1609
|
+
// NOTE: MCP servers work with SnowCode's native Task() system
|
|
1610
|
+
console.log(chalk_1.default.blue('\nℹ️ MCP servers configured for SnowCode (also compatible with Claude Code)'));
|
|
1611
1611
|
console.log(chalk_1.default.green('✅ 411 ServiceNow tools automatically available via 2 unified servers'));
|
|
1612
1612
|
console.log(chalk_1.default.blue('📋 SDK handles MCP server lifecycle automatically'));
|
|
1613
1613
|
// Verify MCP servers can actually start
|
|
@@ -1653,15 +1653,15 @@ program
|
|
|
1653
1653
|
}
|
|
1654
1654
|
}
|
|
1655
1655
|
catch (error) {
|
|
1656
|
-
console.log(chalk_1.default.yellow('⚠️ MCP servers will start automatically when you launch
|
|
1656
|
+
console.log(chalk_1.default.yellow('⚠️ MCP servers will start automatically when you launch SnowCode'));
|
|
1657
1657
|
console.log(chalk_1.default.dim(' Or start manually: ./scripts/mcp-server-manager.sh start'));
|
|
1658
1658
|
if (error.message.includes('No .env file found')) {
|
|
1659
1659
|
console.log(chalk_1.default.dim(' 💡 Tip: Configure .env first, then run: ./scripts/mcp-server-manager.sh start'));
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
|
-
// Check and optionally install
|
|
1664
|
-
const configImported = await
|
|
1663
|
+
// Check and optionally install SnowCode
|
|
1664
|
+
const configImported = await checkAndInstallSnowCode();
|
|
1665
1665
|
console.log(chalk_1.default.blue.bold('\n🎯 Next steps:'));
|
|
1666
1666
|
console.log('1. Configure credentials: Edit ' + chalk_1.default.cyan('.env'));
|
|
1667
1667
|
console.log(' - Add your ServiceNow instance URL, username/password or OAuth credentials');
|
|
@@ -1669,10 +1669,10 @@ program
|
|
|
1669
1669
|
console.log(' - Authenticates with your LLM provider (Claude/OpenAI/Google/Ollama)');
|
|
1670
1670
|
console.log(' - Then authenticates with ServiceNow OAuth');
|
|
1671
1671
|
console.log(' - Your provider choice is automatically saved to .env');
|
|
1672
|
-
console.log('3. Start developing with
|
|
1672
|
+
console.log('3. Start developing with SnowCode: ' + chalk_1.default.cyan('./scripts/start-snowcode.sh'));
|
|
1673
1673
|
console.log(' - Smart launcher with pre-flight checks and MCP server management');
|
|
1674
1674
|
console.log(' - Or use swarm: ' + chalk_1.default.cyan('snow-flow swarm "create incident dashboard"'));
|
|
1675
|
-
console.log(' - Or launch
|
|
1675
|
+
console.log(' - Or launch SnowCode directly: ' + chalk_1.default.cyan('snowcode'));
|
|
1676
1676
|
console.log('\n📚 Documentation: ' + chalk_1.default.blue('https://github.com/groeimetai/snow-flow'));
|
|
1677
1677
|
console.log('💡 370+ ServiceNow tools • 2 MCP servers • Multi-LLM support');
|
|
1678
1678
|
// Force exit to prevent hanging
|
|
@@ -1703,7 +1703,7 @@ program
|
|
|
1703
1703
|
help Show this help
|
|
1704
1704
|
|
|
1705
1705
|
🎯 Example Usage:
|
|
1706
|
-
snow-flow init # Initialize project (auto-configures
|
|
1706
|
+
snow-flow init # Initialize project (auto-configures SnowCode)
|
|
1707
1707
|
snow-flow auth login # Authenticate (handles LLM + ServiceNow)
|
|
1708
1708
|
snow-flow auth status # Check authentication status
|
|
1709
1709
|
snow-flow swarm "create a widget for incident management"
|
|
@@ -1744,63 +1744,63 @@ program
|
|
|
1744
1744
|
`);
|
|
1745
1745
|
});
|
|
1746
1746
|
// Helper functions for init command
|
|
1747
|
-
// Check if
|
|
1748
|
-
async function
|
|
1747
|
+
// Check if SnowCode is installed, and offer to install it
|
|
1748
|
+
async function checkAndInstallSnowCode() {
|
|
1749
1749
|
const { execSync } = require('child_process');
|
|
1750
|
-
let
|
|
1750
|
+
let snowcodeInstalled = false;
|
|
1751
1751
|
try {
|
|
1752
|
-
// Check if
|
|
1753
|
-
execSync('which
|
|
1754
|
-
console.log(chalk_1.default.green('\n✅
|
|
1755
|
-
|
|
1752
|
+
// Check if snowcode is already installed
|
|
1753
|
+
execSync('which snowcode', { stdio: 'ignore' });
|
|
1754
|
+
console.log(chalk_1.default.green('\n✅ SnowCode is already installed!'));
|
|
1755
|
+
snowcodeInstalled = true;
|
|
1756
1756
|
}
|
|
1757
1757
|
catch {
|
|
1758
|
-
//
|
|
1759
|
-
console.log(chalk_1.default.yellow('\n⚠️
|
|
1760
|
-
console.log(chalk_1.default.blue('
|
|
1758
|
+
// SnowCode not installed
|
|
1759
|
+
console.log(chalk_1.default.yellow('\n⚠️ SnowCode is not installed'));
|
|
1760
|
+
console.log(chalk_1.default.blue('SnowCode is required to use Snow-Flow with any LLM provider'));
|
|
1761
1761
|
// Import inquirer dynamically
|
|
1762
1762
|
const inquirer = (await Promise.resolve().then(() => __importStar(require('inquirer')))).default;
|
|
1763
1763
|
const { shouldInstall } = await inquirer.prompt([
|
|
1764
1764
|
{
|
|
1765
1765
|
type: 'confirm',
|
|
1766
1766
|
name: 'shouldInstall',
|
|
1767
|
-
message: 'Would you like to install
|
|
1767
|
+
message: 'Would you like to install SnowCode now? (npm install -g @groeimetai/snowcode)',
|
|
1768
1768
|
default: true
|
|
1769
1769
|
}
|
|
1770
1770
|
]);
|
|
1771
1771
|
if (!shouldInstall) {
|
|
1772
|
-
console.log(chalk_1.default.yellow('\n⏭️ Skipping
|
|
1773
|
-
console.log(chalk_1.default.blue('You can install it later with: ') + chalk_1.default.cyan('npm install -g
|
|
1772
|
+
console.log(chalk_1.default.yellow('\n⏭️ Skipping SnowCode installation'));
|
|
1773
|
+
console.log(chalk_1.default.blue('You can install it later with: ') + chalk_1.default.cyan('npm install -g @groeimetai/snowcode'));
|
|
1774
1774
|
return false;
|
|
1775
1775
|
}
|
|
1776
|
-
// Install
|
|
1777
|
-
console.log(chalk_1.default.blue('\n📦 Installing
|
|
1776
|
+
// Install SnowCode
|
|
1777
|
+
console.log(chalk_1.default.blue('\n📦 Installing SnowCode globally...'));
|
|
1778
1778
|
console.log(chalk_1.default.dim('This may take a minute...'));
|
|
1779
1779
|
try {
|
|
1780
|
-
execSync('npm install -g
|
|
1781
|
-
console.log(chalk_1.default.green('\n✅
|
|
1782
|
-
|
|
1780
|
+
execSync('npm install -g @groeimetai/snowcode', { stdio: 'inherit' });
|
|
1781
|
+
console.log(chalk_1.default.green('\n✅ SnowCode installed successfully!'));
|
|
1782
|
+
snowcodeInstalled = true;
|
|
1783
1783
|
}
|
|
1784
1784
|
catch (error) {
|
|
1785
|
-
console.log(chalk_1.default.red('\n❌ Failed to install
|
|
1786
|
-
console.log(chalk_1.default.yellow('Please install it manually: ') + chalk_1.default.cyan('npm install -g
|
|
1785
|
+
console.log(chalk_1.default.red('\n❌ Failed to install SnowCode'));
|
|
1786
|
+
console.log(chalk_1.default.yellow('Please install it manually: ') + chalk_1.default.cyan('npm install -g @groeimetai/snowcode'));
|
|
1787
1787
|
return false;
|
|
1788
1788
|
}
|
|
1789
1789
|
}
|
|
1790
|
-
// If
|
|
1791
|
-
//
|
|
1792
|
-
if (
|
|
1793
|
-
const exampleConfigPath = (0, path_1.join)(process.cwd(), '
|
|
1794
|
-
const
|
|
1790
|
+
// If SnowCode is installed, copy config to .snowcode/ directory
|
|
1791
|
+
// SnowCode automatically detects config files in project root and .snowcode/ directory
|
|
1792
|
+
if (snowcodeInstalled) {
|
|
1793
|
+
const exampleConfigPath = (0, path_1.join)(process.cwd(), 'snowcode-config.example.json');
|
|
1794
|
+
const snowcodeConfigPath = (0, path_1.join)(process.cwd(), '.snowcode', 'config.json');
|
|
1795
1795
|
// Check if example config file exists
|
|
1796
1796
|
try {
|
|
1797
1797
|
await fs_1.promises.access(exampleConfigPath);
|
|
1798
|
-
console.log(chalk_1.default.blue('\n🔧 Setting up
|
|
1798
|
+
console.log(chalk_1.default.blue('\n🔧 Setting up SnowCode configuration...'));
|
|
1799
1799
|
try {
|
|
1800
|
-
// Copy example config to .
|
|
1800
|
+
// Copy example config to .snowcode/config.json for automatic detection
|
|
1801
1801
|
let configContent = await fs_1.promises.readFile(exampleConfigPath, 'utf-8');
|
|
1802
1802
|
// Ensure the config content has the correct cwd (in case it still has a placeholder)
|
|
1803
|
-
// This is a safety check - the placeholder should already be replaced by
|
|
1803
|
+
// This is a safety check - the placeholder should already be replaced by copySnowCodeConfig
|
|
1804
1804
|
if (configContent.includes('"/path/to/your/snow-flow/installation"')) {
|
|
1805
1805
|
console.log(chalk_1.default.yellow('⚠️ Config still contains placeholder, attempting to fix...'));
|
|
1806
1806
|
// Determine the snow-flow installation directory
|
|
@@ -1833,19 +1833,19 @@ async function checkAndInstallOpenCode() {
|
|
|
1833
1833
|
configContent = configContent.replace('"/path/to/your/snow-flow/installation"', `"${snowFlowRoot.replace(/\\/g, '/')}"`);
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
await fs_1.promises.writeFile(
|
|
1837
|
-
console.log(chalk_1.default.green('✅
|
|
1838
|
-
console.log(chalk_1.default.blue('💡
|
|
1836
|
+
await fs_1.promises.writeFile(snowcodeConfigPath, configContent);
|
|
1837
|
+
console.log(chalk_1.default.green('✅ SnowCode configuration created at .snowcode/config.json'));
|
|
1838
|
+
console.log(chalk_1.default.blue('💡 SnowCode will automatically detect this configuration'));
|
|
1839
1839
|
return true; // Successfully configured
|
|
1840
1840
|
}
|
|
1841
1841
|
catch (error) {
|
|
1842
|
-
console.log(chalk_1.default.yellow('\n⚠️ Could not create
|
|
1843
|
-
console.log(chalk_1.default.blue('You can copy it manually: ') + chalk_1.default.cyan(`cp
|
|
1842
|
+
console.log(chalk_1.default.yellow('\n⚠️ Could not create SnowCode config'));
|
|
1843
|
+
console.log(chalk_1.default.blue('You can copy it manually: ') + chalk_1.default.cyan(`cp snowcode-config.example.json .snowcode/config.json`));
|
|
1844
1844
|
return false;
|
|
1845
1845
|
}
|
|
1846
1846
|
}
|
|
1847
1847
|
catch {
|
|
1848
|
-
console.log(chalk_1.default.yellow('\n⚠️
|
|
1848
|
+
console.log(chalk_1.default.yellow('\n⚠️ snowcode-config.example.json not found'));
|
|
1849
1849
|
console.log(chalk_1.default.blue('Config will be available after init completes'));
|
|
1850
1850
|
return false;
|
|
1851
1851
|
}
|
|
@@ -1906,7 +1906,7 @@ async function createReadmeFiles(targetDir, force = false) {
|
|
|
1906
1906
|
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'servicenow/README.md'), '# ServiceNow Artifacts\n\nThis directory contains generated ServiceNow development artifacts.');
|
|
1907
1907
|
}
|
|
1908
1908
|
// Helper functions
|
|
1909
|
-
async function
|
|
1909
|
+
async function copySnowCodeConfig(targetDir, force = false) {
|
|
1910
1910
|
try {
|
|
1911
1911
|
// Determine the snow-flow installation directory
|
|
1912
1912
|
let snowFlowRoot;
|
|
@@ -1941,14 +1941,14 @@ async function copyOpenCodeConfig(targetDir, force = false) {
|
|
|
1941
1941
|
throw new Error('Could not find snow-flow project root');
|
|
1942
1942
|
}
|
|
1943
1943
|
}
|
|
1944
|
-
// Try to find the
|
|
1944
|
+
// Try to find the snowcode-config.example.json
|
|
1945
1945
|
const sourceFiles = [
|
|
1946
|
-
(0, path_1.join)(snowFlowRoot, '
|
|
1947
|
-
(0, path_1.join)(__dirname, '..', '
|
|
1948
|
-
(0, path_1.join)(__dirname, '
|
|
1949
|
-
(0, path_1.join)(__dirname, '..', '..', '..', '
|
|
1950
|
-
(0, path_1.join)(__dirname, '..', '..', '..', '..', '
|
|
1951
|
-
(0, path_1.join)(process.cwd(), '
|
|
1946
|
+
(0, path_1.join)(snowFlowRoot, 'snowcode-config.example.json'),
|
|
1947
|
+
(0, path_1.join)(__dirname, '..', 'snowcode-config.example.json'),
|
|
1948
|
+
(0, path_1.join)(__dirname, 'snowcode-config.example.json'),
|
|
1949
|
+
(0, path_1.join)(__dirname, '..', '..', '..', 'snowcode-config.example.json'),
|
|
1950
|
+
(0, path_1.join)(__dirname, '..', '..', '..', '..', 'snowcode-config.example.json'),
|
|
1951
|
+
(0, path_1.join)(process.cwd(), 'snowcode-config.example.json')
|
|
1952
1952
|
];
|
|
1953
1953
|
let foundSource = false;
|
|
1954
1954
|
let configContent = '';
|
|
@@ -1956,7 +1956,7 @@ async function copyOpenCodeConfig(targetDir, force = false) {
|
|
|
1956
1956
|
try {
|
|
1957
1957
|
configContent = await fs_1.promises.readFile(sourcePath, 'utf8');
|
|
1958
1958
|
foundSource = true;
|
|
1959
|
-
console.log(`✅ Found
|
|
1959
|
+
console.log(`✅ Found snowcode-config.example.json at: ${sourcePath}`);
|
|
1960
1960
|
break;
|
|
1961
1961
|
}
|
|
1962
1962
|
catch {
|
|
@@ -1964,19 +1964,19 @@ async function copyOpenCodeConfig(targetDir, force = false) {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
}
|
|
1966
1966
|
if (!foundSource) {
|
|
1967
|
-
console.log('⚠️ Could not find
|
|
1967
|
+
console.log('⚠️ Could not find snowcode-config.example.json source file');
|
|
1968
1968
|
return;
|
|
1969
1969
|
}
|
|
1970
1970
|
// Replace placeholders with actual snow-flow installation path
|
|
1971
1971
|
configContent = configContent.replace('"/path/to/your/snow-flow/installation"', `"${snowFlowRoot.replace(/\\/g, '/')}"`);
|
|
1972
|
-
const targetPath = (0, path_1.join)(targetDir, '
|
|
1972
|
+
const targetPath = (0, path_1.join)(targetDir, 'snowcode-config.example.json');
|
|
1973
1973
|
try {
|
|
1974
1974
|
await fs_1.promises.access(targetPath);
|
|
1975
1975
|
if (force) {
|
|
1976
|
-
console.log('⚠️
|
|
1976
|
+
console.log('⚠️ snowcode-config.example.json already exists, overwriting with --force flag');
|
|
1977
1977
|
}
|
|
1978
1978
|
else {
|
|
1979
|
-
console.log('✅
|
|
1979
|
+
console.log('✅ snowcode-config.example.json already exists');
|
|
1980
1980
|
return;
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
@@ -1984,15 +1984,15 @@ async function copyOpenCodeConfig(targetDir, force = false) {
|
|
|
1984
1984
|
// File doesn't exist, continue with creation
|
|
1985
1985
|
}
|
|
1986
1986
|
await fs_1.promises.writeFile(targetPath, configContent);
|
|
1987
|
-
console.log('✅ Created
|
|
1987
|
+
console.log('✅ Created snowcode-config.example.json with correct snow-flow path');
|
|
1988
1988
|
}
|
|
1989
1989
|
catch (error) {
|
|
1990
|
-
console.error('❌ Error copying
|
|
1990
|
+
console.error('❌ Error copying snowcode-config.example.json:', error);
|
|
1991
1991
|
}
|
|
1992
1992
|
}
|
|
1993
|
-
async function
|
|
1993
|
+
async function copySnowCodeThemes(targetDir, force = false) {
|
|
1994
1994
|
try {
|
|
1995
|
-
// Determine the snow-flow installation directory (same logic as
|
|
1995
|
+
// Determine the snow-flow installation directory (same logic as copySnowCodeConfig)
|
|
1996
1996
|
let snowFlowRoot;
|
|
1997
1997
|
const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
|
|
1998
1998
|
__dirname.includes('node_modules/.pnpm') ||
|
|
@@ -2026,8 +2026,8 @@ async function copyOpenCodeThemes(targetDir, force = false) {
|
|
|
2026
2026
|
(0, path_1.join)(snowFlowRoot, 'themes'),
|
|
2027
2027
|
(0, path_1.join)(__dirname, '..', 'themes'),
|
|
2028
2028
|
(0, path_1.join)(__dirname, 'themes'),
|
|
2029
|
-
(0, path_1.join)(snowFlowRoot, '.
|
|
2030
|
-
(0, path_1.join)(__dirname, '..', '.
|
|
2029
|
+
(0, path_1.join)(snowFlowRoot, '.snowcode', 'themes'),
|
|
2030
|
+
(0, path_1.join)(__dirname, '..', '.snowcode', 'themes')
|
|
2031
2031
|
];
|
|
2032
2032
|
let themesSourceDir = null;
|
|
2033
2033
|
for (const sourcePath of themesSourcePaths) {
|
|
@@ -2045,8 +2045,8 @@ async function copyOpenCodeThemes(targetDir, force = false) {
|
|
|
2045
2045
|
console.log('⚠️ Could not find themes directory, skipping theme installation');
|
|
2046
2046
|
return;
|
|
2047
2047
|
}
|
|
2048
|
-
// Create target .
|
|
2049
|
-
const themesTargetDir = (0, path_1.join)(targetDir, '.
|
|
2048
|
+
// Create target .snowcode/themes directory
|
|
2049
|
+
const themesTargetDir = (0, path_1.join)(targetDir, '.snowcode', 'themes');
|
|
2050
2050
|
await fs_1.promises.mkdir(themesTargetDir, { recursive: true });
|
|
2051
2051
|
// Copy all theme files
|
|
2052
2052
|
const themeFiles = await fs_1.promises.readdir(themesSourceDir);
|
|
@@ -2078,14 +2078,14 @@ async function copyOpenCodeThemes(targetDir, force = false) {
|
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
2080
|
if (copiedCount > 0) {
|
|
2081
|
-
console.log(`✅ Copied ${copiedCount}
|
|
2081
|
+
console.log(`✅ Copied ${copiedCount} SnowCode theme file(s) to .snowcode/themes/`);
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
2084
|
catch (error) {
|
|
2085
|
-
console.error('❌ Error copying
|
|
2085
|
+
console.error('❌ Error copying SnowCode themes:', error);
|
|
2086
2086
|
}
|
|
2087
2087
|
}
|
|
2088
|
-
async function
|
|
2088
|
+
async function copySnowCodePackageJson(targetDir, force = false) {
|
|
2089
2089
|
try {
|
|
2090
2090
|
// Determine the snow-flow installation directory
|
|
2091
2091
|
let snowFlowRoot;
|
|
@@ -2116,11 +2116,11 @@ async function copyOpenCodePackageJson(targetDir, force = false) {
|
|
|
2116
2116
|
throw new Error('Could not find snow-flow project root');
|
|
2117
2117
|
}
|
|
2118
2118
|
}
|
|
2119
|
-
// Find
|
|
2119
|
+
// Find snowcode package.json template
|
|
2120
2120
|
const templateSourcePaths = [
|
|
2121
|
-
(0, path_1.join)(snowFlowRoot, 'templates', '
|
|
2122
|
-
(0, path_1.join)(__dirname, '..', 'templates', '
|
|
2123
|
-
(0, path_1.join)(__dirname, 'templates', '
|
|
2121
|
+
(0, path_1.join)(snowFlowRoot, 'templates', 'snowcode-package.json'),
|
|
2122
|
+
(0, path_1.join)(__dirname, '..', 'templates', 'snowcode-package.json'),
|
|
2123
|
+
(0, path_1.join)(__dirname, 'templates', 'snowcode-package.json')
|
|
2124
2124
|
];
|
|
2125
2125
|
let templatePath = null;
|
|
2126
2126
|
for (const sourcePath of templateSourcePaths) {
|
|
@@ -2134,19 +2134,19 @@ async function copyOpenCodePackageJson(targetDir, force = false) {
|
|
|
2134
2134
|
}
|
|
2135
2135
|
}
|
|
2136
2136
|
if (!templatePath) {
|
|
2137
|
-
console.log('⚠️
|
|
2137
|
+
console.log('⚠️ SnowCode package.json template not found, SnowCode will use default plugin');
|
|
2138
2138
|
return;
|
|
2139
2139
|
}
|
|
2140
|
-
// Create .
|
|
2141
|
-
const
|
|
2142
|
-
await fs_1.promises.mkdir(
|
|
2140
|
+
// Create .snowcode directory
|
|
2141
|
+
const snowcodeDir = (0, path_1.join)(targetDir, '.snowcode');
|
|
2142
|
+
await fs_1.promises.mkdir(snowcodeDir, { recursive: true });
|
|
2143
2143
|
// Copy package.json template
|
|
2144
|
-
const targetPath = (0, path_1.join)(
|
|
2144
|
+
const targetPath = (0, path_1.join)(snowcodeDir, 'package.json');
|
|
2145
2145
|
// Check if file already exists
|
|
2146
2146
|
try {
|
|
2147
2147
|
await fs_1.promises.access(targetPath);
|
|
2148
2148
|
if (!force) {
|
|
2149
|
-
console.log('✅ .
|
|
2149
|
+
console.log('✅ .snowcode/package.json already exists (snowcode-plugin configured)');
|
|
2150
2150
|
return;
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
@@ -2154,10 +2154,10 @@ async function copyOpenCodePackageJson(targetDir, force = false) {
|
|
|
2154
2154
|
// File doesn't exist, we can create it
|
|
2155
2155
|
}
|
|
2156
2156
|
await fs_1.promises.copyFile(templatePath, targetPath);
|
|
2157
|
-
console.log('✅ Created .
|
|
2157
|
+
console.log('✅ Created .snowcode/package.json with @groeimetai/snowcode-plugin');
|
|
2158
2158
|
}
|
|
2159
2159
|
catch (error) {
|
|
2160
|
-
console.error('❌ Error copying
|
|
2160
|
+
console.error('❌ Error copying SnowCode package.json:', error);
|
|
2161
2161
|
}
|
|
2162
2162
|
}
|
|
2163
2163
|
/**
|
|
@@ -2168,8 +2168,8 @@ async function verifyMCPServers(targetDir) {
|
|
|
2168
2168
|
const path = require('path');
|
|
2169
2169
|
const fs = require('fs').promises;
|
|
2170
2170
|
try {
|
|
2171
|
-
// Read
|
|
2172
|
-
const configPath = path.join(targetDir, '.
|
|
2171
|
+
// Read SnowCode configuration
|
|
2172
|
+
const configPath = path.join(targetDir, '.snowcode', 'snowcode.json');
|
|
2173
2173
|
const configContent = await fs.readFile(configPath, 'utf-8');
|
|
2174
2174
|
const config = JSON.parse(configContent);
|
|
2175
2175
|
if (!config.mcp) {
|
|
@@ -2271,7 +2271,7 @@ async function verifyMCPServers(targetDir) {
|
|
|
2271
2271
|
}
|
|
2272
2272
|
catch (error) {
|
|
2273
2273
|
console.log(chalk_1.default.yellow(` ⚠️ Could not verify MCP servers: ${error.message}`));
|
|
2274
|
-
console.log(chalk_1.default.dim(' Servers will be tested when
|
|
2274
|
+
console.log(chalk_1.default.dim(' Servers will be tested when SnowCode starts'));
|
|
2275
2275
|
}
|
|
2276
2276
|
}
|
|
2277
2277
|
async function copyMCPServerScripts(targetDir, force = false) {
|
|
@@ -2333,7 +2333,7 @@ async function copyMCPServerScripts(targetDir, force = false) {
|
|
|
2333
2333
|
// Copy specific scripts
|
|
2334
2334
|
const scriptFiles = [
|
|
2335
2335
|
'mcp-server-manager.sh',
|
|
2336
|
-
'start-
|
|
2336
|
+
'start-snowcode.sh'
|
|
2337
2337
|
];
|
|
2338
2338
|
let copiedCount = 0;
|
|
2339
2339
|
for (const scriptFile of scriptFiles) {
|
|
@@ -2363,11 +2363,11 @@ async function copyMCPServerScripts(targetDir, force = false) {
|
|
|
2363
2363
|
console.log(`✅ Copied ${copiedCount} MCP server management script(s) to scripts/`);
|
|
2364
2364
|
console.log(`✅ Scripts are executable and ready to use`);
|
|
2365
2365
|
}
|
|
2366
|
-
// Also copy
|
|
2366
|
+
// Also copy SNOWCODE-TROUBLESHOOTING.md to project root
|
|
2367
2367
|
const troubleshootingSourcePaths = [
|
|
2368
|
-
(0, path_1.join)(snowFlowRoot, '
|
|
2369
|
-
(0, path_1.join)(__dirname, '..', '
|
|
2370
|
-
(0, path_1.join)(__dirname, '
|
|
2368
|
+
(0, path_1.join)(snowFlowRoot, 'SNOWCODE-TROUBLESHOOTING.md'),
|
|
2369
|
+
(0, path_1.join)(__dirname, '..', 'SNOWCODE-TROUBLESHOOTING.md'),
|
|
2370
|
+
(0, path_1.join)(__dirname, 'SNOWCODE-TROUBLESHOOTING.md')
|
|
2371
2371
|
];
|
|
2372
2372
|
let troubleshootingSourcePath = null;
|
|
2373
2373
|
for (const sourcePath of troubleshootingSourcePaths) {
|
|
@@ -2381,22 +2381,22 @@ async function copyMCPServerScripts(targetDir, force = false) {
|
|
|
2381
2381
|
}
|
|
2382
2382
|
}
|
|
2383
2383
|
if (troubleshootingSourcePath) {
|
|
2384
|
-
const targetPath = (0, path_1.join)(targetDir, '
|
|
2384
|
+
const targetPath = (0, path_1.join)(targetDir, 'SNOWCODE-TROUBLESHOOTING.md');
|
|
2385
2385
|
try {
|
|
2386
2386
|
await fs_1.promises.access(targetPath);
|
|
2387
2387
|
if (!force) {
|
|
2388
|
-
console.log(`✅
|
|
2388
|
+
console.log(`✅ SNOWCODE-TROUBLESHOOTING.md already exists`);
|
|
2389
2389
|
}
|
|
2390
2390
|
else {
|
|
2391
2391
|
const content = await fs_1.promises.readFile(troubleshootingSourcePath, 'utf8');
|
|
2392
2392
|
await fs_1.promises.writeFile(targetPath, content);
|
|
2393
|
-
console.log(`✅ Created
|
|
2393
|
+
console.log(`✅ Created SNOWCODE-TROUBLESHOOTING.md`);
|
|
2394
2394
|
}
|
|
2395
2395
|
}
|
|
2396
2396
|
catch {
|
|
2397
2397
|
const content = await fs_1.promises.readFile(troubleshootingSourcePath, 'utf8');
|
|
2398
2398
|
await fs_1.promises.writeFile(targetPath, content);
|
|
2399
|
-
console.log(`✅ Created
|
|
2399
|
+
console.log(`✅ Created SNOWCODE-TROUBLESHOOTING.md`);
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
2402
2402
|
}
|
|
@@ -2485,7 +2485,7 @@ async function copyCLAUDEmd(targetDir, force = false) {
|
|
|
2485
2485
|
await fs_1.promises.writeFile(claudeMdPath, claudeMdContent);
|
|
2486
2486
|
console.log('✅ Created CLAUDE.md (Primary instructions)');
|
|
2487
2487
|
}
|
|
2488
|
-
// Create AGENTS.md (identical copy for
|
|
2488
|
+
// Create AGENTS.md (identical copy for SnowCode compatibility)
|
|
2489
2489
|
const agentsMdPath = (0, path_1.join)(targetDir, 'AGENTS.md');
|
|
2490
2490
|
try {
|
|
2491
2491
|
await fs_1.promises.access(agentsMdPath);
|
|
@@ -2499,18 +2499,18 @@ async function copyCLAUDEmd(targetDir, force = false) {
|
|
|
2499
2499
|
}
|
|
2500
2500
|
catch {
|
|
2501
2501
|
await fs_1.promises.writeFile(agentsMdPath, agentsMdContent);
|
|
2502
|
-
console.log('✅ Created AGENTS.md (Identical copy for
|
|
2502
|
+
console.log('✅ Created AGENTS.md (Identical copy for SnowCode compatibility)');
|
|
2503
2503
|
}
|
|
2504
|
-
// Create .
|
|
2505
|
-
const
|
|
2506
|
-
const agentsDir = (0, path_1.join)(
|
|
2507
|
-
const modesDir = (0, path_1.join)(
|
|
2504
|
+
// Create .snowcode/ directory structure
|
|
2505
|
+
const snowcodeDir = (0, path_1.join)(targetDir, '.snowcode');
|
|
2506
|
+
const agentsDir = (0, path_1.join)(snowcodeDir, 'agent'); // Singular 'agent' as required by SnowCode
|
|
2507
|
+
const modesDir = (0, path_1.join)(snowcodeDir, 'modes');
|
|
2508
2508
|
try {
|
|
2509
|
-
await fs_1.promises.mkdir(
|
|
2509
|
+
await fs_1.promises.mkdir(snowcodeDir, { recursive: true });
|
|
2510
2510
|
await fs_1.promises.mkdir(agentsDir, { recursive: true });
|
|
2511
2511
|
await fs_1.promises.mkdir(modesDir, { recursive: true });
|
|
2512
|
-
console.log('✅ Created .
|
|
2513
|
-
// Copy agent files from .claude/ to .
|
|
2512
|
+
console.log('✅ Created .snowcode/ directory structure');
|
|
2513
|
+
// Copy agent files from .claude/ to .snowcode/agent/ (if they exist)
|
|
2514
2514
|
const sourceAgentsDir = (0, path_1.join)(__dirname, '..', '.claude', 'agents');
|
|
2515
2515
|
try {
|
|
2516
2516
|
const agentFiles = await fs_1.promises.readdir(sourceAgentsDir);
|
|
@@ -2522,20 +2522,20 @@ async function copyCLAUDEmd(targetDir, force = false) {
|
|
|
2522
2522
|
await fs_1.promises.writeFile(targetFile, content);
|
|
2523
2523
|
}
|
|
2524
2524
|
}
|
|
2525
|
-
console.log('✅ Copied agent configurations to .
|
|
2525
|
+
console.log('✅ Copied agent configurations to .snowcode/agent/');
|
|
2526
2526
|
}
|
|
2527
2527
|
catch (err) {
|
|
2528
|
-
// Silently continue - agent configs are in
|
|
2528
|
+
// Silently continue - agent configs are in snowcode.json, not separate files
|
|
2529
2529
|
}
|
|
2530
|
-
// Create .
|
|
2531
|
-
// CRITICAL: Use ABSOLUTE paths so
|
|
2530
|
+
// Create .snowcode/snowcode.json with both MCP servers
|
|
2531
|
+
// CRITICAL: Use ABSOLUTE paths so SnowCode can find the servers!
|
|
2532
2532
|
const distPath = (0, path_1.join)(snowFlowRoot, 'dist');
|
|
2533
|
-
// CRITICAL:
|
|
2534
|
-
// Also: environment variables are inherited from parent process (
|
|
2535
|
-
const
|
|
2533
|
+
// CRITICAL: SnowCode expects command as array with all parts
|
|
2534
|
+
// Also: environment variables are inherited from parent process (SnowCode reads .env)
|
|
2535
|
+
const snowcodeConfig = {
|
|
2536
2536
|
$schema: "https://opencode.ai/config.json",
|
|
2537
2537
|
name: "snow-flow",
|
|
2538
|
-
description: "ServiceNow development with
|
|
2538
|
+
description: "ServiceNow development with SnowCode and multi-LLM support",
|
|
2539
2539
|
mcp: {
|
|
2540
2540
|
"servicenow-unified": {
|
|
2541
2541
|
type: "local",
|
|
@@ -2560,20 +2560,20 @@ async function copyCLAUDEmd(targetDir, force = false) {
|
|
|
2560
2560
|
"../AGENTS.md"
|
|
2561
2561
|
]
|
|
2562
2562
|
};
|
|
2563
|
-
// Write both
|
|
2564
|
-
const
|
|
2565
|
-
const configJsonPath = (0, path_1.join)(
|
|
2566
|
-
await fs_1.promises.writeFile(
|
|
2567
|
-
await fs_1.promises.writeFile(configJsonPath, JSON.stringify(
|
|
2568
|
-
console.log('✅ Created .
|
|
2569
|
-
console.log('✅ Created .
|
|
2570
|
-
// Also create AGENTS.md in .
|
|
2571
|
-
const
|
|
2572
|
-
await fs_1.promises.writeFile(
|
|
2573
|
-
console.log('✅ Created .
|
|
2563
|
+
// Write both snowcode.json AND config.json (Claude uses config.json)
|
|
2564
|
+
const snowcodeConfigPath = (0, path_1.join)(snowcodeDir, 'snowcode.json');
|
|
2565
|
+
const configJsonPath = (0, path_1.join)(snowcodeDir, 'config.json');
|
|
2566
|
+
await fs_1.promises.writeFile(snowcodeConfigPath, JSON.stringify(snowcodeConfig, null, 2));
|
|
2567
|
+
await fs_1.promises.writeFile(configJsonPath, JSON.stringify(snowcodeConfig, null, 2));
|
|
2568
|
+
console.log('✅ Created .snowcode/snowcode.json with both MCP servers');
|
|
2569
|
+
console.log('✅ Created .snowcode/config.json (for Claude compatibility)');
|
|
2570
|
+
// Also create AGENTS.md in .snowcode/
|
|
2571
|
+
const snowcodeAgentsMdPath = (0, path_1.join)(snowcodeDir, 'AGENTS.md');
|
|
2572
|
+
await fs_1.promises.writeFile(snowcodeAgentsMdPath, agentsMdContent);
|
|
2573
|
+
console.log('✅ Created .snowcode/AGENTS.md');
|
|
2574
2574
|
}
|
|
2575
2575
|
catch (error) {
|
|
2576
|
-
console.log('⚠️ Error creating .
|
|
2576
|
+
console.log('⚠️ Error creating .snowcode/ directory:', error instanceof Error ? error.message : String(error));
|
|
2577
2577
|
}
|
|
2578
2578
|
}
|
|
2579
2579
|
catch (error) {
|
|
@@ -3105,8 +3105,8 @@ program
|
|
|
3105
3105
|
console.log('\n📝 Updating MCP configuration...');
|
|
3106
3106
|
await setupMCPConfig(process.cwd(), instanceUrl, clientId, clientSecret, options.force || false);
|
|
3107
3107
|
console.log(chalk_1.default.green('\n✅ MCP configuration refreshed successfully!'));
|
|
3108
|
-
console.log('\n📢 IMPORTANT: Restart
|
|
3109
|
-
console.log(chalk_1.default.cyan('
|
|
3108
|
+
console.log('\n📢 IMPORTANT: Restart SnowCode (or Claude Code) to use the new configuration:');
|
|
3109
|
+
console.log(chalk_1.default.cyan(' SnowCode: snowcode'));
|
|
3110
3110
|
console.log(chalk_1.default.cyan(' Claude Code: claude --mcp-config .mcp.json'));
|
|
3111
3111
|
console.log('\n💡 The Local Development server now includes:');
|
|
3112
3112
|
console.log(' • Universal artifact detection via sys_metadata');
|
|
@@ -3137,16 +3137,16 @@ program
|
|
|
3137
3137
|
// MCP Server command with subcommands
|
|
3138
3138
|
program
|
|
3139
3139
|
.command('mcp <action>')
|
|
3140
|
-
.description('Manage ServiceNow MCP servers for
|
|
3140
|
+
.description('Manage ServiceNow MCP servers for SnowCode integration')
|
|
3141
3141
|
.option('--server <name>', 'Specific server name to manage')
|
|
3142
3142
|
.option('--port <port>', 'Port for MCP server (default: auto)')
|
|
3143
3143
|
.option('--host <host>', 'Host for MCP server (default: localhost)')
|
|
3144
3144
|
.action(async (action, options) => {
|
|
3145
|
-
// NOTE: MCP servers work with
|
|
3146
|
-
console.log(chalk_1.default.blue('ℹ️ MCP servers configured for
|
|
3145
|
+
// NOTE: MCP servers work with SnowCode's native Task() system
|
|
3146
|
+
console.log(chalk_1.default.blue('ℹ️ MCP servers configured for SnowCode (also compatible with Claude Code)'));
|
|
3147
3147
|
console.log(chalk_1.default.yellow('⚠️ Manual MCP commands are no longer needed'));
|
|
3148
|
-
console.log(chalk_1.default.green('✅
|
|
3149
|
-
console.log(chalk_1.default.blue('\n💡 Simply run your swarm commands -
|
|
3148
|
+
console.log(chalk_1.default.green('✅ SnowCode automatically handles all MCP server lifecycle'));
|
|
3149
|
+
console.log(chalk_1.default.blue('\n💡 Simply run your swarm commands - SnowCode handles the rest!'));
|
|
3150
3150
|
return;
|
|
3151
3151
|
});
|
|
3152
3152
|
// MCP action handlers
|
|
@@ -3171,9 +3171,9 @@ async function handleMCPStart(manager, options) {
|
|
|
3171
3171
|
const total = status.length;
|
|
3172
3172
|
console.log(`\n✅ Started ${running}/${total} MCP servers`);
|
|
3173
3173
|
if (running === total) {
|
|
3174
|
-
console.log('🎉 All MCP servers are now running and available in
|
|
3174
|
+
console.log('🎉 All MCP servers are now running and available in SnowCode!');
|
|
3175
3175
|
console.log('\n📋 Next steps:');
|
|
3176
|
-
console.log(' 1. Open
|
|
3176
|
+
console.log(' 1. Open SnowCode (or Claude Code)');
|
|
3177
3177
|
console.log(' 2. MCP tools will be automatically available');
|
|
3178
3178
|
console.log(' 3. Use snow_deploy_widget, snow_deploy_flow, etc.');
|
|
3179
3179
|
}
|
|
@@ -3252,7 +3252,7 @@ async function handleMCPStatus(manager, options) {
|
|
|
3252
3252
|
const total = servers.length;
|
|
3253
3253
|
console.log(`📈 Summary: ${running}/${total} servers running`);
|
|
3254
3254
|
if (running === total) {
|
|
3255
|
-
console.log('🎉 All MCP servers are operational and available in
|
|
3255
|
+
console.log('🎉 All MCP servers are operational and available in SnowCode (or Claude Code)!');
|
|
3256
3256
|
}
|
|
3257
3257
|
else if (running > 0) {
|
|
3258
3258
|
console.log('⚠️ Some servers are not running. Use "snow-flow mcp start" to start them.');
|
|
@@ -3362,22 +3362,22 @@ async function handleMCPDebug(options) {
|
|
|
3362
3362
|
console.log(` SNOW_INSTANCE: ${process.env.SNOW_INSTANCE ? '✅ Set' : '❌ Not set'}`);
|
|
3363
3363
|
console.log(` SNOW_CLIENT_ID: ${process.env.SNOW_CLIENT_ID ? '✅ Set' : '❌ Not set'}`);
|
|
3364
3364
|
console.log(` SNOW_CLIENT_SECRET: ${process.env.SNOW_CLIENT_SECRET ? '✅ Set' : '❌ Not set'}`);
|
|
3365
|
-
// Check
|
|
3366
|
-
console.log('\n🤖
|
|
3365
|
+
// Check SnowCode
|
|
3366
|
+
console.log('\n🤖 SnowCode:');
|
|
3367
3367
|
const { execSync } = require('child_process');
|
|
3368
3368
|
try {
|
|
3369
|
-
execSync('which
|
|
3370
|
-
console.log(' ✅
|
|
3369
|
+
execSync('which snowcode', { stdio: 'ignore' });
|
|
3370
|
+
console.log(' ✅ SnowCode CLI found');
|
|
3371
3371
|
}
|
|
3372
3372
|
catch {
|
|
3373
|
-
console.log(' ❌
|
|
3374
|
-
console.log(' 💡 Install with: npm install -g
|
|
3373
|
+
console.log(' ❌ SnowCode CLI not found in PATH');
|
|
3374
|
+
console.log(' 💡 Install with: npm install -g @groeimetai/snowcode');
|
|
3375
3375
|
}
|
|
3376
3376
|
console.log('\n💡 Tips:');
|
|
3377
|
-
console.log(' 1. Ensure
|
|
3377
|
+
console.log(' 1. Ensure SnowCode is configured: snowcode config import snowcode-config.example.json');
|
|
3378
3378
|
console.log(' 2. Check .env file has valid ServiceNow credentials and LLM API keys');
|
|
3379
3379
|
console.log(' 3. Start developing: snow-flow swarm "your objective"');
|
|
3380
|
-
console.log(' 4.
|
|
3380
|
+
console.log(' 4. SnowCode will automatically connect to Snow-Flow\'s MCP servers');
|
|
3381
3381
|
}
|
|
3382
3382
|
// SPARC Detailed Help Command - DISABLED (sparc-help.js file missing)
|
|
3383
3383
|
// program
|