snow-flow 1.1.83 → 1.1.85
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/cli.js +1030 -56
- package/dist/cli.js.map +1 -1
- package/dist/version.d.ts +6 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +24 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -409,30 +409,121 @@ You are the Queen Agent, master coordinator of the Snow-Flow hive-mind. Your mis
|
|
|
409
409
|
|
|
410
410
|
## 👑 Your Queen Agent Responsibilities
|
|
411
411
|
|
|
412
|
-
### 1. Initialize
|
|
413
|
-
|
|
412
|
+
### 1. CRITICAL: Initialize Memory FIRST (Before Everything!)
|
|
413
|
+
**THIS MUST BE YOUR VERY FIRST ACTION - Initialize the swarm memory session:**
|
|
414
414
|
\`\`\`javascript
|
|
415
|
-
//
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
415
|
+
// 🚨 EXECUTE THIS IMMEDIATELY - DO NOT SKIP OR DELAY!
|
|
416
|
+
mcp__claude-flow__memory_usage({
|
|
417
|
+
action: "store",
|
|
418
|
+
key: "swarm_session_${sessionId}",
|
|
419
|
+
value: JSON.stringify({
|
|
420
|
+
objective: "${objective}",
|
|
421
|
+
status: "initializing",
|
|
422
|
+
started_at: new Date().toISOString(),
|
|
423
|
+
queen_agent_id: "queen_${sessionId}",
|
|
424
|
+
task_analysis: ${JSON.stringify(taskAnalysis, null, 2)},
|
|
425
|
+
configuration: {
|
|
426
|
+
strategy: "${options.strategy}",
|
|
427
|
+
mode: "${options.mode}",
|
|
428
|
+
max_agents: ${parseInt(options.maxAgents)},
|
|
429
|
+
parallel_execution: ${options.parallel ? 'true' : 'false'},
|
|
430
|
+
monitoring_enabled: ${options.monitor ? 'true' : 'false'},
|
|
431
|
+
auth_required: ${!isAuthenticated}
|
|
432
|
+
}
|
|
433
|
+
}),
|
|
434
|
+
namespace: "swarm_${sessionId}"
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// Initialize agent coordination memory namespace
|
|
438
|
+
mcp__claude-flow__memory_namespace({
|
|
439
|
+
action: "create",
|
|
440
|
+
namespace: "agents_${sessionId}"
|
|
441
|
+
});
|
|
442
|
+
\`\`\`
|
|
443
|
+
|
|
444
|
+
### 2. MANDATORY MCP-FIRST Workflow Steps
|
|
445
|
+
**Execute these steps IN ORDER before spawning agents:**
|
|
446
|
+
|
|
447
|
+
\`\`\`javascript
|
|
448
|
+
// Step 2.1: Validate ServiceNow authentication
|
|
449
|
+
const authCheck = await mcp__servicenow-intelligent__snow_validate_live_connection({
|
|
450
|
+
test_level: "permissions",
|
|
451
|
+
include_performance: false
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
if (!authCheck.connection_status === "success") {
|
|
455
|
+
throw new Error("Authentication failed! Run: snow-flow auth login");
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Step 2.2: Check for existing artifacts (DRY principle)
|
|
459
|
+
const existingArtifacts = await mcp__servicenow-intelligent__snow_comprehensive_search({
|
|
460
|
+
query: "${objective}",
|
|
461
|
+
include_inactive: false
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
// Store discovery results in memory for agents
|
|
465
|
+
await mcp__claude-flow__memory_usage({
|
|
466
|
+
action: "store",
|
|
467
|
+
key: "existing_artifacts_${sessionId}",
|
|
468
|
+
value: JSON.stringify(existingArtifacts),
|
|
469
|
+
namespace: "swarm_${sessionId}"
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
// Step 2.3: Create isolated Update Set for this objective
|
|
473
|
+
const updateSetName = "Snow-Flow: ${objective.substring(0, 50)}... - ${new Date().toISOString().split('T')[0]}";
|
|
474
|
+
const updateSet = await mcp__servicenow-update-set__snow_update_set_create({
|
|
475
|
+
name: updateSetName,
|
|
476
|
+
description: "Automated creation for: ${objective}\\n\\nSession: ${sessionId}",
|
|
477
|
+
auto_switch: true
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
// Store Update Set info in memory
|
|
481
|
+
await mcp__claude-flow__memory_usage({
|
|
482
|
+
action: "store",
|
|
483
|
+
key: "update_set_${sessionId}",
|
|
484
|
+
value: JSON.stringify(updateSet),
|
|
485
|
+
namespace: "swarm_${sessionId}"
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
// Step 2.4: For artifacts using tables, discover table schemas
|
|
489
|
+
${taskAnalysis.serviceNowArtifacts.includes('widget') || taskAnalysis.serviceNowArtifacts.includes('flow') ? `
|
|
490
|
+
// Discover common ITSM tables
|
|
491
|
+
const tablesToDiscover = ['incident', 'sc_request', 'change_request', 'problem'];
|
|
492
|
+
const tableSchemas = {};
|
|
493
|
+
|
|
494
|
+
for (const table of tablesToDiscover) {
|
|
495
|
+
try {
|
|
496
|
+
const schema = await mcp__servicenow-platform-development__snow_table_schema_discovery({
|
|
497
|
+
tableName: table,
|
|
498
|
+
includeRelated: true,
|
|
499
|
+
includeIndexes: false
|
|
500
|
+
});
|
|
501
|
+
tableSchemas[table] = schema;
|
|
502
|
+
} catch (e) {
|
|
503
|
+
// Table might not exist, continue
|
|
428
504
|
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// Store table schemas in memory
|
|
508
|
+
await mcp__claude-flow__memory_usage({
|
|
509
|
+
action: "store",
|
|
510
|
+
key: "table_schemas_${sessionId}",
|
|
511
|
+
value: JSON.stringify(tableSchemas),
|
|
512
|
+
namespace: "swarm_${sessionId}"
|
|
429
513
|
});
|
|
514
|
+
` : '// No table discovery needed for this task type'}
|
|
430
515
|
\`\`\`
|
|
431
516
|
|
|
432
|
-
###
|
|
433
|
-
|
|
517
|
+
### 3. Create Master Task List
|
|
518
|
+
After completing MCP-FIRST steps, create task breakdown:
|
|
434
519
|
\`\`\`javascript
|
|
435
520
|
TodoWrite([
|
|
521
|
+
{
|
|
522
|
+
id: "mcp_workflow_complete",
|
|
523
|
+
content: "✅ MCP-FIRST workflow: Auth, Discovery, Update Set, Tables",
|
|
524
|
+
status: "completed",
|
|
525
|
+
priority: "high"
|
|
526
|
+
},
|
|
436
527
|
{
|
|
437
528
|
id: "analyze_requirements",
|
|
438
529
|
content: "Analyze user requirements: ${objective}",
|
|
@@ -460,7 +551,7 @@ TodoWrite([
|
|
|
460
551
|
]);
|
|
461
552
|
\`\`\`
|
|
462
553
|
|
|
463
|
-
###
|
|
554
|
+
### 4. Spawn Specialized Agents
|
|
464
555
|
Based on the task analysis, spawn the following agents using the Task tool:
|
|
465
556
|
|
|
466
557
|
**Primary Agent**: ${taskAnalysis.primaryAgent}
|
|
@@ -474,19 +565,21 @@ Task("${taskAnalysis.primaryAgent}", \`
|
|
|
474
565
|
Task Type: ${taskAnalysis.taskType}
|
|
475
566
|
|
|
476
567
|
Instructions:
|
|
477
|
-
1. Read
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
568
|
+
1. FIRST: Read ALL shared context from memory:
|
|
569
|
+
- mcp__claude-flow__memory_usage({action: "retrieve", key: "swarm_session_${sessionId}", namespace: "swarm_${sessionId}"})
|
|
570
|
+
- mcp__claude-flow__memory_usage({action: "retrieve", key: "existing_artifacts_${sessionId}", namespace: "swarm_${sessionId}"})
|
|
571
|
+
- mcp__claude-flow__memory_usage({action: "retrieve", key: "update_set_${sessionId}", namespace: "swarm_${sessionId}"})
|
|
572
|
+
- mcp__claude-flow__memory_usage({action: "retrieve", key: "table_schemas_${sessionId}", namespace: "swarm_${sessionId}"})
|
|
573
|
+
2. Use the discovered table schemas when creating artifacts that reference tables
|
|
574
|
+
3. Check existing_artifacts to avoid duplication - reuse or extend existing ones
|
|
575
|
+
4. ALL deployments MUST use the Update Set stored in memory
|
|
576
|
+
5. Begin implementing the core ${taskAnalysis.taskType} requirements
|
|
577
|
+
6. Store all work progress with: mcp__claude-flow__memory_usage({action: "store", key: "agent_${taskAnalysis.primaryAgent}_progress", value: "...", namespace: "agents_${sessionId}"})
|
|
578
|
+
7. Update TodoWrite items as you complete tasks
|
|
579
|
+
8. Read other agents' progress from namespace "agents_${sessionId}"
|
|
482
580
|
|
|
483
|
-
🔐 AUTHENTICATION
|
|
484
|
-
|
|
485
|
-
2. If any MCP tool returns auth error:
|
|
486
|
-
- The tool will provide SPECIFIC instructions (e.g., "Run snow-flow auth login")
|
|
487
|
-
- Switch to PLANNING MODE - document the COMPLETE solution
|
|
488
|
-
- Store all plans in Memory for future automated deployment
|
|
489
|
-
3. NEVER skip directly to local files - always try MCP first!
|
|
581
|
+
🔐 AUTHENTICATION: Already validated by Queen. Use MCP tools directly.
|
|
582
|
+
📦 UPDATE SET: Use the one from memory - DO NOT create a new one!
|
|
490
583
|
\`);
|
|
491
584
|
\`\`\`
|
|
492
585
|
|
|
@@ -503,12 +596,20 @@ Task("${agent}", \`
|
|
|
503
596
|
Primary Agent: ${taskAnalysis.primaryAgent}
|
|
504
597
|
|
|
505
598
|
Instructions:
|
|
506
|
-
1.
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
599
|
+
1. FIRST: Read ALL shared context from memory (same as primary agent):
|
|
600
|
+
- mcp__claude-flow__memory_usage({action: "retrieve", key: "swarm_session_${sessionId}", namespace: "swarm_${sessionId}"})
|
|
601
|
+
- mcp__claude-flow__memory_usage({action: "retrieve", key: "existing_artifacts_${sessionId}", namespace: "swarm_${sessionId}"})
|
|
602
|
+
- mcp__claude-flow__memory_usage({action: "retrieve", key: "update_set_${sessionId}", namespace: "swarm_${sessionId}"})
|
|
603
|
+
- mcp__claude-flow__memory_usage({action: "retrieve", key: "table_schemas_${sessionId}", namespace: "swarm_${sessionId}"})
|
|
604
|
+
2. Monitor primary agent's progress: mcp__claude-flow__memory_search({pattern: "agent_${taskAnalysis.primaryAgent}_*", namespace: "agents_${sessionId}"})
|
|
605
|
+
3. Wait for primary agent to establish base structure before major changes
|
|
606
|
+
4. Use discovered table schemas for any table references
|
|
607
|
+
5. Enhance/support with your ${agent} expertise
|
|
608
|
+
6. Store your progress: mcp__claude-flow__memory_usage({action: "store", key: "agent_${agent}_progress", value: "...", namespace: "agents_${sessionId}"})
|
|
609
|
+
7. Update relevant TodoWrite items
|
|
610
|
+
|
|
611
|
+
🔐 AUTHENTICATION: Already validated by Queen. Use MCP tools directly.
|
|
612
|
+
📦 UPDATE SET: Use the one from memory - DO NOT create a new one!
|
|
512
613
|
|
|
513
614
|
🔐 AUTHENTICATION REQUIREMENTS:
|
|
514
615
|
- ALWAYS use MCP tools first - inherit auth status from primary agent
|
|
@@ -641,29 +742,97 @@ Agents must ALWAYS try MCP tools first!` : ''}
|
|
|
641
742
|
|
|
642
743
|
## 👑 Queen Agent Coordination Instructions
|
|
643
744
|
|
|
644
|
-
### 5.
|
|
645
|
-
|
|
745
|
+
### 5. Claude-Flow Memory Synchronization Pattern
|
|
746
|
+
Implement continuous memory synchronization for real-time coordination:
|
|
646
747
|
|
|
647
748
|
\`\`\`javascript
|
|
648
|
-
//
|
|
649
|
-
const
|
|
650
|
-
|
|
749
|
+
// Initialize coordination heartbeat (Claude-Flow pattern)
|
|
750
|
+
const coordinationInterval = setInterval(async () => {
|
|
751
|
+
// Sync agent states across namespace
|
|
752
|
+
const agentStates = await mcp__claude-flow__memory_search({
|
|
753
|
+
pattern: "agent_*_progress",
|
|
754
|
+
namespace: "agents_${sessionId}",
|
|
755
|
+
limit: 50
|
|
756
|
+
});
|
|
651
757
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
758
|
+
// Update swarm coordination state with TTL for freshness
|
|
759
|
+
await mcp__claude-flow__memory_usage({
|
|
760
|
+
action: "store",
|
|
761
|
+
key: "swarm_coordination_${sessionId}",
|
|
762
|
+
value: JSON.stringify({
|
|
763
|
+
timestamp: new Date().toISOString(),
|
|
764
|
+
active_agents: agentStates.length,
|
|
765
|
+
completion_status: TodoRead().filter(t => t.status === 'completed').length,
|
|
766
|
+
memory_sync: true,
|
|
767
|
+
discovered_artifacts: agentStates.filter(s => s.includes("deployed")).length
|
|
768
|
+
}),
|
|
769
|
+
namespace: "swarm_${sessionId}",
|
|
770
|
+
ttl: 300 // 5 minute TTL for coordination data
|
|
660
771
|
});
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
772
|
+
|
|
773
|
+
// Detect and resolve conflicts between agents
|
|
774
|
+
if (agentStates.some(s => s.includes("conflict") || s.includes("duplicate"))) {
|
|
775
|
+
await mcp__claude-flow__memory_usage({
|
|
776
|
+
action: "store",
|
|
777
|
+
key: "conflict_resolution_needed",
|
|
778
|
+
value: JSON.stringify({
|
|
779
|
+
agents: agentStates.filter(s => s.includes("conflict")),
|
|
780
|
+
timestamp: new Date().toISOString()
|
|
781
|
+
}),
|
|
782
|
+
namespace: "swarm_${sessionId}"
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// Track deployed artifacts in Update Set automatically
|
|
787
|
+
const deployedArtifacts = [];
|
|
788
|
+
for (const state of agentStates) {
|
|
789
|
+
if (state.includes("deployed") && state.includes("sys_id")) {
|
|
790
|
+
try {
|
|
791
|
+
const artifact = JSON.parse(state);
|
|
792
|
+
if (artifact.sys_id && !artifact.tracked_in_update_set) {
|
|
793
|
+
deployedArtifacts.push(artifact);
|
|
794
|
+
}
|
|
795
|
+
} catch (e) {
|
|
796
|
+
// Not valid JSON, skip
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Add all deployed artifacts to Update Set
|
|
802
|
+
for (const artifact of deployedArtifacts) {
|
|
803
|
+
await mcp__servicenow-update-set__snow_update_set_add_artifact({
|
|
804
|
+
type: artifact.type,
|
|
805
|
+
sys_id: artifact.sys_id,
|
|
806
|
+
name: artifact.name
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
// Mark as tracked
|
|
810
|
+
artifact.tracked_in_update_set = true;
|
|
811
|
+
await mcp__claude-flow__memory_usage({
|
|
812
|
+
action: "store",
|
|
813
|
+
key: \`agent_\${artifact.agent}_deployed_\${artifact.sys_id}\`,
|
|
814
|
+
value: JSON.stringify(artifact),
|
|
815
|
+
namespace: "agents_${sessionId}"
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// Monitor individual agent progress
|
|
820
|
+
const agents = [${[taskAnalysis.primaryAgent, ...taskAnalysis.supportingAgents].map(a => `"${a}"`).join(', ')}];
|
|
821
|
+
for (const agent of agents) {
|
|
822
|
+
const progress = agentStates.find(s => s.includes(\`agent_\${agent}_progress\`));
|
|
823
|
+
console.log(\`Agent \${agent}: \${progress ? 'active' : 'waiting'}\`);
|
|
824
|
+
}
|
|
825
|
+
}, 10000); // Every 10 seconds
|
|
826
|
+
|
|
827
|
+
// Also update main session state
|
|
828
|
+
await mcp__claude-flow__memory_usage({
|
|
829
|
+
action: "store",
|
|
830
|
+
key: "swarm_session_${sessionId}",
|
|
831
|
+
value: JSON.stringify({
|
|
832
|
+
status: "agents_working",
|
|
833
|
+
last_check: new Date().toISOString()
|
|
834
|
+
}),
|
|
835
|
+
namespace: "swarm_${sessionId}"
|
|
667
836
|
});
|
|
668
837
|
\`\`\`
|
|
669
838
|
|
|
@@ -1747,6 +1916,799 @@ This mode provides specialized ${mode} capabilities for ServiceNow development p
|
|
|
1747
1916
|
`;
|
|
1748
1917
|
await fs_1.promises.writeFile((0, path_1.join)(targetDir, `.claude/commands/sparc/${mode}.md`), content);
|
|
1749
1918
|
}
|
|
1919
|
+
// Create additional swarm documentation files
|
|
1920
|
+
console.log('📋 Creating swarm patterns documentation...');
|
|
1921
|
+
// Create swarm-patterns.md
|
|
1922
|
+
const swarmPatternsContent = `# Swarm Command Patterns - MCP-FIRST Workflow
|
|
1923
|
+
|
|
1924
|
+
## 🎯 Primary Interface: snow-flow swarm
|
|
1925
|
+
|
|
1926
|
+
The swarm command is your primary interface for ServiceNow development. It uses the Queen Agent backend to orchestrate multiple specialized agents through Claude Code.
|
|
1927
|
+
|
|
1928
|
+
## Basic Widget Creation
|
|
1929
|
+
\`\`\`bash
|
|
1930
|
+
snow-flow swarm "create incident dashboard widget"
|
|
1931
|
+
snow-flow swarm "build responsive widget with Chart.js for incident analytics"
|
|
1932
|
+
snow-flow swarm "create service portal widget for hardware requests"
|
|
1933
|
+
\`\`\`
|
|
1934
|
+
|
|
1935
|
+
## Flow Development
|
|
1936
|
+
\`\`\`bash
|
|
1937
|
+
snow-flow swarm "create approval workflow for equipment requests"
|
|
1938
|
+
snow-flow swarm "build multi-step approval flow with email notifications"
|
|
1939
|
+
snow-flow swarm "create automated incident escalation workflow"
|
|
1940
|
+
\`\`\`
|
|
1941
|
+
|
|
1942
|
+
## Complex Integration
|
|
1943
|
+
\`\`\`bash
|
|
1944
|
+
snow-flow swarm "integrate ServiceNow with Slack notifications"
|
|
1945
|
+
snow-flow swarm "create REST API integration with external ticketing system"
|
|
1946
|
+
snow-flow swarm "build bi-directional sync with Microsoft Teams"
|
|
1947
|
+
\`\`\`
|
|
1948
|
+
|
|
1949
|
+
## Testing Patterns
|
|
1950
|
+
\`\`\`bash
|
|
1951
|
+
snow-flow swarm "test existing flows and create comprehensive test report"
|
|
1952
|
+
snow-flow swarm "validate all widgets in service portal for mobile responsiveness"
|
|
1953
|
+
snow-flow swarm "performance test catalog item workflows"
|
|
1954
|
+
\`\`\`
|
|
1955
|
+
|
|
1956
|
+
## Application Development
|
|
1957
|
+
\`\`\`bash
|
|
1958
|
+
snow-flow swarm "create complete ITSM solution with custom tables"
|
|
1959
|
+
snow-flow swarm "build employee onboarding application with approval flows"
|
|
1960
|
+
snow-flow swarm "develop asset management system with automated workflows"
|
|
1961
|
+
\`\`\`
|
|
1962
|
+
|
|
1963
|
+
## Advanced Patterns with Options
|
|
1964
|
+
|
|
1965
|
+
### Disable Auto-Deploy for Testing
|
|
1966
|
+
\`\`\`bash
|
|
1967
|
+
snow-flow swarm "test new widget locally" --no-auto-deploy --no-live-testing
|
|
1968
|
+
\`\`\`
|
|
1969
|
+
|
|
1970
|
+
### Enable Permission Escalation
|
|
1971
|
+
\`\`\`bash
|
|
1972
|
+
snow-flow swarm "create global enterprise workflow" --auto-permissions
|
|
1973
|
+
\`\`\`
|
|
1974
|
+
|
|
1975
|
+
### Parallel Execution for Large Projects
|
|
1976
|
+
\`\`\`bash
|
|
1977
|
+
snow-flow swarm "migrate 50 workflows from legacy system" --parallel --max-agents 8
|
|
1978
|
+
\`\`\`
|
|
1979
|
+
|
|
1980
|
+
### Monitor Real-Time Progress
|
|
1981
|
+
\`\`\`bash
|
|
1982
|
+
snow-flow swarm "complex ITSM implementation" --monitor
|
|
1983
|
+
\`\`\`
|
|
1984
|
+
|
|
1985
|
+
## 🔐 MCP-FIRST Workflow
|
|
1986
|
+
|
|
1987
|
+
Every swarm command follows this mandatory workflow:
|
|
1988
|
+
|
|
1989
|
+
1. **Authentication Check**: Validates ServiceNow OAuth credentials
|
|
1990
|
+
2. **Smart Discovery**: Finds existing artifacts to prevent duplication
|
|
1991
|
+
3. **Live Development**: Creates real artifacts in ServiceNow
|
|
1992
|
+
4. **Update Set Tracking**: All changes tracked for deployment
|
|
1993
|
+
|
|
1994
|
+
## 💡 Best Practices
|
|
1995
|
+
|
|
1996
|
+
- Start simple: Let the Queen Agent determine complexity
|
|
1997
|
+
- Use natural language: Describe what you want, not how to build it
|
|
1998
|
+
- Trust the defaults: Intelligent features are enabled automatically
|
|
1999
|
+
- Monitor progress: Use --monitor for long-running tasks
|
|
2000
|
+
|
|
2001
|
+
## 🎯 Common Success Patterns
|
|
2002
|
+
|
|
2003
|
+
### Pattern 1: Quick Widget
|
|
2004
|
+
\`\`\`bash
|
|
2005
|
+
snow-flow swarm "simple dashboard widget"
|
|
2006
|
+
# Queen Agent will:
|
|
2007
|
+
# - Spawn widget-creator agent
|
|
2008
|
+
# - Create HTML/CSS/JS
|
|
2009
|
+
# - Deploy to ServiceNow
|
|
2010
|
+
# - Test automatically
|
|
2011
|
+
\`\`\`
|
|
2012
|
+
|
|
2013
|
+
### Pattern 2: Complex Flow
|
|
2014
|
+
\`\`\`bash
|
|
2015
|
+
snow-flow swarm "multi-department approval workflow with dynamic routing"
|
|
2016
|
+
# Queen Agent will:
|
|
2017
|
+
# - Spawn flow-builder, tester, and security agents
|
|
2018
|
+
# - Design flow architecture
|
|
2019
|
+
# - Implement with conditions
|
|
2020
|
+
# - Test all paths
|
|
2021
|
+
# - Validate permissions
|
|
2022
|
+
\`\`\`
|
|
2023
|
+
|
|
2024
|
+
### Pattern 3: Full Application
|
|
2025
|
+
\`\`\`bash
|
|
2026
|
+
snow-flow swarm "complete HR onboarding system"
|
|
2027
|
+
# Queen Agent will:
|
|
2028
|
+
# - Spawn app-architect, flow-builder, widget-creator, tester
|
|
2029
|
+
# - Design data model
|
|
2030
|
+
# - Create tables and relationships
|
|
2031
|
+
# - Build UI components
|
|
2032
|
+
# - Implement workflows
|
|
2033
|
+
# - Test end-to-end
|
|
2034
|
+
\`\`\`
|
|
2035
|
+
`;
|
|
2036
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, '.claude/commands/swarm-patterns.md'), swarmPatternsContent);
|
|
2037
|
+
// Create agent-types.md
|
|
2038
|
+
const agentTypesContent = `# Agent Types and Specializations
|
|
2039
|
+
|
|
2040
|
+
## 🤖 Primary Development Agents
|
|
2041
|
+
|
|
2042
|
+
### widget-creator
|
|
2043
|
+
**Specialization**: Service Portal widgets, HTML/CSS/JS, responsive design
|
|
2044
|
+
**When spawned**: Any widget-related objective
|
|
2045
|
+
**Key capabilities**:
|
|
2046
|
+
- HTML template generation
|
|
2047
|
+
- CSS styling and animations
|
|
2048
|
+
- Client-side JavaScript controllers
|
|
2049
|
+
- Server-side data scripts
|
|
2050
|
+
- Chart.js and data visualization
|
|
2051
|
+
- Mobile responsiveness
|
|
2052
|
+
|
|
2053
|
+
### flow-builder
|
|
2054
|
+
**Specialization**: Flow Designer, process automation, approvals
|
|
2055
|
+
**When spawned**: Workflow and automation objectives
|
|
2056
|
+
**Key capabilities**:
|
|
2057
|
+
- Trigger configuration
|
|
2058
|
+
- Conditional logic
|
|
2059
|
+
- Approval routing
|
|
2060
|
+
- Email notifications
|
|
2061
|
+
- Integration with catalog items
|
|
2062
|
+
- Subflow creation
|
|
2063
|
+
|
|
2064
|
+
### script-writer
|
|
2065
|
+
**Specialization**: Business rules, script includes, client scripts
|
|
2066
|
+
**When spawned**: Scripting and automation objectives
|
|
2067
|
+
**Key capabilities**:
|
|
2068
|
+
- GlideRecord operations
|
|
2069
|
+
- Business rule creation
|
|
2070
|
+
- Script include development
|
|
2071
|
+
- Background scripts
|
|
2072
|
+
- Fix scripts
|
|
2073
|
+
- Scheduled jobs
|
|
2074
|
+
|
|
2075
|
+
### app-architect
|
|
2076
|
+
**Specialization**: Application design, data modeling, system architecture
|
|
2077
|
+
**When spawned**: Full application development
|
|
2078
|
+
**Key capabilities**:
|
|
2079
|
+
- Table design and relationships
|
|
2080
|
+
- Application scoping
|
|
2081
|
+
- Security model design
|
|
2082
|
+
- Integration architecture
|
|
2083
|
+
- Performance optimization
|
|
2084
|
+
- Scalability planning
|
|
2085
|
+
|
|
2086
|
+
## 🛠️ Supporting Agents
|
|
2087
|
+
|
|
2088
|
+
### researcher
|
|
2089
|
+
**Specialization**: Discovery, best practices, documentation
|
|
2090
|
+
**When spawned**: Complex or unknown requirements
|
|
2091
|
+
**Key capabilities**:
|
|
2092
|
+
- ServiceNow best practices
|
|
2093
|
+
- Platform feature discovery
|
|
2094
|
+
- Existing artifact analysis
|
|
2095
|
+
- Documentation generation
|
|
2096
|
+
- Knowledge base creation
|
|
2097
|
+
|
|
2098
|
+
### tester
|
|
2099
|
+
**Specialization**: Quality assurance, validation, performance testing
|
|
2100
|
+
**When spawned**: After any development task
|
|
2101
|
+
**Key capabilities**:
|
|
2102
|
+
- Unit test creation
|
|
2103
|
+
- Integration testing
|
|
2104
|
+
- UI/UX validation
|
|
2105
|
+
- Performance benchmarking
|
|
2106
|
+
- Security testing
|
|
2107
|
+
- Accessibility compliance
|
|
2108
|
+
|
|
2109
|
+
### security
|
|
2110
|
+
**Specialization**: Access controls, compliance, vulnerability assessment
|
|
2111
|
+
**When spawned**: Enterprise or sensitive applications
|
|
2112
|
+
**Key capabilities**:
|
|
2113
|
+
- ACL configuration
|
|
2114
|
+
- Role management
|
|
2115
|
+
- Data encryption
|
|
2116
|
+
- Compliance validation
|
|
2117
|
+
- Security scanning
|
|
2118
|
+
- Audit trail setup
|
|
2119
|
+
|
|
2120
|
+
### ui-designer
|
|
2121
|
+
**Specialization**: User experience, design patterns, accessibility
|
|
2122
|
+
**When spawned**: Complex UI requirements
|
|
2123
|
+
**Key capabilities**:
|
|
2124
|
+
- Design system implementation
|
|
2125
|
+
- Accessibility (WCAG) compliance
|
|
2126
|
+
- Responsive layouts
|
|
2127
|
+
- User journey mapping
|
|
2128
|
+
- Style guide creation
|
|
2129
|
+
|
|
2130
|
+
## 🎯 How Agents are Selected
|
|
2131
|
+
|
|
2132
|
+
The Queen Agent analyzes your objective and automatically selects the optimal team:
|
|
2133
|
+
|
|
2134
|
+
### Example 1: "create incident dashboard"
|
|
2135
|
+
- **Primary**: widget-creator
|
|
2136
|
+
- **Supporting**: ui-designer, tester
|
|
2137
|
+
- **Reasoning**: Widget development with UI focus
|
|
2138
|
+
|
|
2139
|
+
### Example 2: "build approval workflow"
|
|
2140
|
+
- **Primary**: flow-builder
|
|
2141
|
+
- **Supporting**: security, tester
|
|
2142
|
+
- **Reasoning**: Process automation with security needs
|
|
2143
|
+
|
|
2144
|
+
### Example 3: "create ITSM application"
|
|
2145
|
+
- **Primary**: app-architect
|
|
2146
|
+
- **Supporting**: flow-builder, widget-creator, security, tester
|
|
2147
|
+
- **Reasoning**: Full application requiring all capabilities
|
|
2148
|
+
|
|
2149
|
+
## 💡 Agent Coordination Patterns
|
|
2150
|
+
|
|
2151
|
+
### Sequential Coordination
|
|
2152
|
+
Used when tasks have dependencies:
|
|
2153
|
+
\`\`\`
|
|
2154
|
+
app-architect → widget-creator → flow-builder → tester
|
|
2155
|
+
\`\`\`
|
|
2156
|
+
|
|
2157
|
+
### Parallel Coordination
|
|
2158
|
+
Used when tasks are independent:
|
|
2159
|
+
\`\`\`
|
|
2160
|
+
widget-creator ⟷ flow-builder ⟷ script-writer
|
|
2161
|
+
↓ ↓ ↓
|
|
2162
|
+
tester
|
|
2163
|
+
\`\`\`
|
|
2164
|
+
|
|
2165
|
+
### Hybrid Coordination
|
|
2166
|
+
Used for complex projects:
|
|
2167
|
+
\`\`\`
|
|
2168
|
+
Phase 1: app-architect (solo)
|
|
2169
|
+
Phase 2: widget-creator + flow-builder (parallel)
|
|
2170
|
+
Phase 3: security + tester (parallel)
|
|
2171
|
+
Phase 4: Final integration (sequential)
|
|
2172
|
+
\`\`\`
|
|
2173
|
+
|
|
2174
|
+
## 🔧 Manual Agent Control
|
|
2175
|
+
|
|
2176
|
+
While the Queen Agent handles selection automatically, you can influence agent selection:
|
|
2177
|
+
|
|
2178
|
+
### Request Specific Expertise
|
|
2179
|
+
\`\`\`bash
|
|
2180
|
+
snow-flow swarm "create widget with heavy security focus"
|
|
2181
|
+
# Queen will prioritize security agent
|
|
2182
|
+
\`\`\`
|
|
2183
|
+
|
|
2184
|
+
### Exclude Certain Agents
|
|
2185
|
+
\`\`\`bash
|
|
2186
|
+
snow-flow swarm "simple widget" --max-agents 2
|
|
2187
|
+
# Queen will use only essential agents
|
|
2188
|
+
\`\`\`
|
|
2189
|
+
|
|
2190
|
+
### Force Comprehensive Team
|
|
2191
|
+
\`\`\`bash
|
|
2192
|
+
snow-flow swarm "production-ready incident system" --max-agents 8
|
|
2193
|
+
# Queen will assemble full team with all specialists
|
|
2194
|
+
\`\`\`
|
|
2195
|
+
`;
|
|
2196
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, '.claude/commands/agent-types.md'), agentTypesContent);
|
|
2197
|
+
// Create mcp-tools-quick-ref.md
|
|
2198
|
+
const mcpToolsContent = `# MCP Tools Quick Reference
|
|
2199
|
+
|
|
2200
|
+
## 🔐 Authentication & Connection
|
|
2201
|
+
|
|
2202
|
+
### snow_validate_live_connection
|
|
2203
|
+
\`\`\`javascript
|
|
2204
|
+
snow_validate_live_connection({
|
|
2205
|
+
test_level: "permissions" // basic, full, permissions
|
|
2206
|
+
})
|
|
2207
|
+
\`\`\`
|
|
2208
|
+
**Use for**: Checking ServiceNow connection and OAuth status
|
|
2209
|
+
|
|
2210
|
+
### snow_auth_diagnostics
|
|
2211
|
+
\`\`\`javascript
|
|
2212
|
+
snow_auth_diagnostics({
|
|
2213
|
+
include_recommendations: true,
|
|
2214
|
+
run_write_test: true
|
|
2215
|
+
})
|
|
2216
|
+
\`\`\`
|
|
2217
|
+
**Use for**: Debugging authentication issues
|
|
2218
|
+
|
|
2219
|
+
## 🔍 Discovery & Search
|
|
2220
|
+
|
|
2221
|
+
### snow_find_artifact
|
|
2222
|
+
\`\`\`javascript
|
|
2223
|
+
snow_find_artifact({
|
|
2224
|
+
query: "incident dashboard widget",
|
|
2225
|
+
type: "widget" // widget, flow, script, application, any
|
|
2226
|
+
})
|
|
2227
|
+
\`\`\`
|
|
2228
|
+
**Use for**: Finding existing ServiceNow artifacts with natural language
|
|
2229
|
+
|
|
2230
|
+
### snow_catalog_item_search
|
|
2231
|
+
\`\`\`javascript
|
|
2232
|
+
snow_catalog_item_search({
|
|
2233
|
+
query: "laptop",
|
|
2234
|
+
fuzzy_match: true,
|
|
2235
|
+
include_variables: true
|
|
2236
|
+
})
|
|
2237
|
+
\`\`\`
|
|
2238
|
+
**Use for**: Finding catalog items with intelligent matching
|
|
2239
|
+
|
|
2240
|
+
### snow_get_by_sysid
|
|
2241
|
+
\`\`\`javascript
|
|
2242
|
+
snow_get_by_sysid({
|
|
2243
|
+
sys_id: "abc123...",
|
|
2244
|
+
table: "sp_widget"
|
|
2245
|
+
})
|
|
2246
|
+
\`\`\`
|
|
2247
|
+
**Use for**: Direct lookup when you have the sys_id
|
|
2248
|
+
|
|
2249
|
+
## 🚀 Deployment Tools
|
|
2250
|
+
|
|
2251
|
+
### snow_deploy (Universal - v1.1.73+)
|
|
2252
|
+
\`\`\`javascript
|
|
2253
|
+
snow_deploy({
|
|
2254
|
+
type: "widget", // widget, flow, application, script, batch
|
|
2255
|
+
config: {
|
|
2256
|
+
name: "incident_dashboard",
|
|
2257
|
+
title: "Incident Dashboard",
|
|
2258
|
+
template: htmlContent,
|
|
2259
|
+
css: cssContent,
|
|
2260
|
+
client_script: clientJS,
|
|
2261
|
+
server_script: serverJS
|
|
2262
|
+
},
|
|
2263
|
+
auto_update_set: true
|
|
2264
|
+
})
|
|
2265
|
+
\`\`\`
|
|
2266
|
+
**Use for**: All deployments - replaces individual deploy tools
|
|
2267
|
+
|
|
2268
|
+
## 🔄 Flow Development
|
|
2269
|
+
|
|
2270
|
+
### snow_create_flow
|
|
2271
|
+
\`\`\`javascript
|
|
2272
|
+
snow_create_flow({
|
|
2273
|
+
instruction: "create approval flow for purchases over $1000",
|
|
2274
|
+
deploy_immediately: true,
|
|
2275
|
+
enable_intelligent_analysis: true
|
|
2276
|
+
})
|
|
2277
|
+
\`\`\`
|
|
2278
|
+
**Use for**: Creating flows from natural language
|
|
2279
|
+
|
|
2280
|
+
### snow_test_flow_with_mock
|
|
2281
|
+
\`\`\`javascript
|
|
2282
|
+
snow_test_flow_with_mock({
|
|
2283
|
+
flow_id: "equipment_approval",
|
|
2284
|
+
create_test_user: true,
|
|
2285
|
+
mock_catalog_items: true,
|
|
2286
|
+
simulate_approvals: true,
|
|
2287
|
+
cleanup_after_test: true
|
|
2288
|
+
})
|
|
2289
|
+
\`\`\`
|
|
2290
|
+
**Use for**: Testing flows without affecting real data
|
|
2291
|
+
|
|
2292
|
+
### snow_link_catalog_to_flow
|
|
2293
|
+
\`\`\`javascript
|
|
2294
|
+
snow_link_catalog_to_flow({
|
|
2295
|
+
catalog_item_id: "New Laptop",
|
|
2296
|
+
flow_id: "laptop_provisioning",
|
|
2297
|
+
variable_mapping: [{
|
|
2298
|
+
catalog_variable: "model",
|
|
2299
|
+
flow_input: "equipment_type"
|
|
2300
|
+
}]
|
|
2301
|
+
})
|
|
2302
|
+
\`\`\`
|
|
2303
|
+
**Use for**: Connecting catalog items to flows
|
|
2304
|
+
|
|
2305
|
+
## 📦 Update Set Management
|
|
2306
|
+
|
|
2307
|
+
### snow_update_set_create
|
|
2308
|
+
\`\`\`javascript
|
|
2309
|
+
snow_update_set_create({
|
|
2310
|
+
name: "Widget Development - Jan 2024",
|
|
2311
|
+
description: "Dashboard widgets for incident management",
|
|
2312
|
+
auto_switch: true
|
|
2313
|
+
})
|
|
2314
|
+
\`\`\`
|
|
2315
|
+
**Use for**: Creating new update sets
|
|
2316
|
+
|
|
2317
|
+
### snow_update_set_add_artifact
|
|
2318
|
+
\`\`\`javascript
|
|
2319
|
+
snow_update_set_add_artifact({
|
|
2320
|
+
type: "widget",
|
|
2321
|
+
sys_id: "abc123...",
|
|
2322
|
+
name: "incident_dashboard"
|
|
2323
|
+
})
|
|
2324
|
+
\`\`\`
|
|
2325
|
+
**Use for**: Tracking artifacts in update sets
|
|
2326
|
+
|
|
2327
|
+
### snow_smart_update_set
|
|
2328
|
+
\`\`\`javascript
|
|
2329
|
+
snow_smart_update_set({
|
|
2330
|
+
detect_context: true,
|
|
2331
|
+
separate_by_task: true,
|
|
2332
|
+
close_previous: true
|
|
2333
|
+
})
|
|
2334
|
+
\`\`\`
|
|
2335
|
+
**Use for**: Automatic update set management
|
|
2336
|
+
|
|
2337
|
+
## 🧪 Testing Tools
|
|
2338
|
+
|
|
2339
|
+
### snow_widget_test
|
|
2340
|
+
\`\`\`javascript
|
|
2341
|
+
snow_widget_test({
|
|
2342
|
+
sys_id: "widget_sys_id",
|
|
2343
|
+
test_scenarios: [{
|
|
2344
|
+
name: "No data test",
|
|
2345
|
+
input: { incidents: [] },
|
|
2346
|
+
expected: { message: "No incidents found" }
|
|
2347
|
+
}],
|
|
2348
|
+
validate_dependencies: true
|
|
2349
|
+
})
|
|
2350
|
+
\`\`\`
|
|
2351
|
+
**Use for**: Widget functionality testing
|
|
2352
|
+
|
|
2353
|
+
### snow_comprehensive_flow_test
|
|
2354
|
+
\`\`\`javascript
|
|
2355
|
+
snow_comprehensive_flow_test({
|
|
2356
|
+
flow_sys_id: "flow_id",
|
|
2357
|
+
test_data_generation: "automatic",
|
|
2358
|
+
edge_case_detection: true,
|
|
2359
|
+
performance_validation: true
|
|
2360
|
+
})
|
|
2361
|
+
\`\`\`
|
|
2362
|
+
**Use for**: Comprehensive flow testing
|
|
2363
|
+
|
|
2364
|
+
## 🔄 Batch Operations
|
|
2365
|
+
|
|
2366
|
+
### Parallel Tool Execution
|
|
2367
|
+
\`\`\`javascript
|
|
2368
|
+
// Execute multiple operations in one message
|
|
2369
|
+
Promise.all([
|
|
2370
|
+
snow_find_artifact({ query: "widget" }),
|
|
2371
|
+
snow_catalog_item_search({ query: "laptop" }),
|
|
2372
|
+
snow_update_set_current()
|
|
2373
|
+
])
|
|
2374
|
+
\`\`\`
|
|
2375
|
+
**Use for**: Maximum performance with concurrent operations
|
|
2376
|
+
|
|
2377
|
+
## 💡 Common Patterns
|
|
2378
|
+
|
|
2379
|
+
### Pre-flight Check Pattern
|
|
2380
|
+
\`\`\`javascript
|
|
2381
|
+
// Always start with authentication
|
|
2382
|
+
const auth = await snow_validate_live_connection();
|
|
2383
|
+
if (!auth.success) {
|
|
2384
|
+
// Switch to planning mode
|
|
2385
|
+
return "Run: snow-flow auth login";
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
// Then discover existing artifacts
|
|
2389
|
+
const existing = await snow_find_artifact({
|
|
2390
|
+
query: "similar to what I want to create"
|
|
2391
|
+
});
|
|
2392
|
+
|
|
2393
|
+
// Finally deploy new artifact
|
|
2394
|
+
const result = await snow_deploy({
|
|
2395
|
+
type: "widget",
|
|
2396
|
+
config: widgetConfig
|
|
2397
|
+
});
|
|
2398
|
+
\`\`\`
|
|
2399
|
+
|
|
2400
|
+
### Error Recovery Pattern
|
|
2401
|
+
\`\`\`javascript
|
|
2402
|
+
try {
|
|
2403
|
+
await snow_deploy({ type: "flow", config });
|
|
2404
|
+
} catch (error) {
|
|
2405
|
+
if (error.includes("permissions")) {
|
|
2406
|
+
// Try global scope
|
|
2407
|
+
await snow_escalate_permissions();
|
|
2408
|
+
} else if (error.includes("validation")) {
|
|
2409
|
+
// Create manual deployment guide
|
|
2410
|
+
await snow_create_manual_guide();
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
\`\`\`
|
|
2414
|
+
|
|
2415
|
+
### Update Set Pattern
|
|
2416
|
+
\`\`\`javascript
|
|
2417
|
+
// Ensure update set exists
|
|
2418
|
+
await snow_smart_update_set();
|
|
2419
|
+
|
|
2420
|
+
// Deploy artifact
|
|
2421
|
+
const artifact = await snow_deploy({ type: "widget", config });
|
|
2422
|
+
|
|
2423
|
+
// Track in update set
|
|
2424
|
+
await snow_update_set_add_artifact({
|
|
2425
|
+
type: "widget",
|
|
2426
|
+
sys_id: artifact.sys_id,
|
|
2427
|
+
name: artifact.name
|
|
2428
|
+
});
|
|
2429
|
+
\`\`\`
|
|
2430
|
+
`;
|
|
2431
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, '.claude/commands/mcp-tools-quick-ref.md'), mcpToolsContent);
|
|
2432
|
+
// Create examples directory
|
|
2433
|
+
await fs_1.promises.mkdir((0, path_1.join)(targetDir, 'examples'), { recursive: true });
|
|
2434
|
+
// Create memory patterns directory and sample patterns
|
|
2435
|
+
await fs_1.promises.mkdir((0, path_1.join)(targetDir, 'memory/patterns'), { recursive: true });
|
|
2436
|
+
const successfulPatternsContent = {
|
|
2437
|
+
patterns: [
|
|
2438
|
+
{
|
|
2439
|
+
objective: "create incident dashboard widget",
|
|
2440
|
+
agents: ["widget-creator", "ui-designer", "tester"],
|
|
2441
|
+
mcpTools: ["snow_deploy", "snow_widget_test", "snow_preview_widget"],
|
|
2442
|
+
successRate: 0.95,
|
|
2443
|
+
avgDuration: "5-10 minutes",
|
|
2444
|
+
commonIssues: ["Missing Chart.js dependency", "Mobile responsiveness"],
|
|
2445
|
+
bestPractices: ["Always test on mobile", "Use Chart.js from CDN"]
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
objective: "create approval workflow",
|
|
2449
|
+
agents: ["flow-builder", "security", "tester"],
|
|
2450
|
+
mcpTools: ["snow_create_flow", "snow_test_flow_with_mock", "snow_link_catalog_to_flow"],
|
|
2451
|
+
successRate: 0.92,
|
|
2452
|
+
avgDuration: "10-15 minutes",
|
|
2453
|
+
commonIssues: ["Complex approval routing", "Email notification setup"],
|
|
2454
|
+
bestPractices: ["Test all approval paths", "Use mock data first"]
|
|
2455
|
+
},
|
|
2456
|
+
{
|
|
2457
|
+
objective: "create ITSM application",
|
|
2458
|
+
agents: ["app-architect", "flow-builder", "widget-creator", "security", "tester"],
|
|
2459
|
+
mcpTools: ["snow_deploy", "snow_create_flow", "snow_update_set_create"],
|
|
2460
|
+
successRate: 0.88,
|
|
2461
|
+
avgDuration: "30-45 minutes",
|
|
2462
|
+
commonIssues: ["Table relationships", "Permission model"],
|
|
2463
|
+
bestPractices: ["Design data model first", "Use Update Sets throughout"]
|
|
2464
|
+
}
|
|
2465
|
+
],
|
|
2466
|
+
agentCapabilities: {
|
|
2467
|
+
"widget-creator": {
|
|
2468
|
+
strengths: ["HTML/CSS/JS", "Chart.js", "Responsive design"],
|
|
2469
|
+
limitations: ["Complex backend logic", "Database design"]
|
|
2470
|
+
},
|
|
2471
|
+
"flow-builder": {
|
|
2472
|
+
strengths: ["Process automation", "Conditional logic", "Approvals"],
|
|
2473
|
+
limitations: ["UI development", "Complex integrations"]
|
|
2474
|
+
},
|
|
2475
|
+
"app-architect": {
|
|
2476
|
+
strengths: ["System design", "Data modeling", "Architecture"],
|
|
2477
|
+
limitations: ["Detailed implementation", "UI/UX design"]
|
|
2478
|
+
}
|
|
2479
|
+
},
|
|
2480
|
+
mcpToolPatterns: {
|
|
2481
|
+
"authentication_first": {
|
|
2482
|
+
pattern: "Always start with snow_validate_live_connection",
|
|
2483
|
+
reason: "Ensures OAuth is valid before attempting operations"
|
|
2484
|
+
},
|
|
2485
|
+
"discovery_before_creation": {
|
|
2486
|
+
pattern: "Use snow_find_artifact before snow_deploy",
|
|
2487
|
+
reason: "Prevents duplicate artifacts and wasted effort"
|
|
2488
|
+
},
|
|
2489
|
+
"update_set_tracking": {
|
|
2490
|
+
pattern: "Create Update Set, deploy, then track artifacts",
|
|
2491
|
+
reason: "Professional change management like ServiceNow pros"
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'memory/patterns/successful-deployments.json'), JSON.stringify(successfulPatternsContent, null, 2));
|
|
2496
|
+
// Create workflow patterns JSON
|
|
2497
|
+
const workflowPatternsContent = {
|
|
2498
|
+
workflowTemplates: [
|
|
2499
|
+
{
|
|
2500
|
+
name: "Standard Widget Development",
|
|
2501
|
+
steps: [
|
|
2502
|
+
"snow_validate_live_connection",
|
|
2503
|
+
"snow_find_artifact (check existing)",
|
|
2504
|
+
"snow_update_set_create",
|
|
2505
|
+
"snow_deploy (type: widget)",
|
|
2506
|
+
"snow_widget_test",
|
|
2507
|
+
"snow_update_set_add_artifact"
|
|
2508
|
+
]
|
|
2509
|
+
},
|
|
2510
|
+
{
|
|
2511
|
+
name: "Flow Development with Testing",
|
|
2512
|
+
steps: [
|
|
2513
|
+
"snow_validate_live_connection",
|
|
2514
|
+
"snow_discover_existing_flows",
|
|
2515
|
+
"snow_create_flow",
|
|
2516
|
+
"snow_test_flow_with_mock",
|
|
2517
|
+
"snow_link_catalog_to_flow (if needed)",
|
|
2518
|
+
"snow_comprehensive_flow_test (if authenticated)"
|
|
2519
|
+
]
|
|
2520
|
+
},
|
|
2521
|
+
{
|
|
2522
|
+
name: "Full Application Deployment",
|
|
2523
|
+
steps: [
|
|
2524
|
+
"snow_validate_live_connection",
|
|
2525
|
+
"snow_analyze_requirements",
|
|
2526
|
+
"snow_update_set_create",
|
|
2527
|
+
"snow_deploy (multiple artifacts)",
|
|
2528
|
+
"snow_create_flow (for workflows)",
|
|
2529
|
+
"snow_deploy (for widgets)",
|
|
2530
|
+
"snow_update_set_complete"
|
|
2531
|
+
]
|
|
2532
|
+
}
|
|
2533
|
+
]
|
|
2534
|
+
};
|
|
2535
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'memory/patterns/workflow-templates.json'), JSON.stringify(workflowPatternsContent, null, 2));
|
|
2536
|
+
// Create quick start guide
|
|
2537
|
+
const quickStartContent = `# Snow-Flow Quick Start Guide
|
|
2538
|
+
|
|
2539
|
+
## 🚀 5-Minute Setup
|
|
2540
|
+
|
|
2541
|
+
### 1. Initialize Your Project
|
|
2542
|
+
\`\`\`bash
|
|
2543
|
+
snow-flow init --sparc
|
|
2544
|
+
\`\`\`
|
|
2545
|
+
|
|
2546
|
+
### 2. Configure ServiceNow OAuth
|
|
2547
|
+
Edit the .env file with your ServiceNow credentials:
|
|
2548
|
+
\`\`\`env
|
|
2549
|
+
SNOW_INSTANCE=dev123456.service-now.com
|
|
2550
|
+
SNOW_CLIENT_ID=your_oauth_client_id
|
|
2551
|
+
SNOW_CLIENT_SECRET=your_oauth_client_secret
|
|
2552
|
+
\`\`\`
|
|
2553
|
+
|
|
2554
|
+
### 3. Authenticate
|
|
2555
|
+
\`\`\`bash
|
|
2556
|
+
snow-flow auth login
|
|
2557
|
+
\`\`\`
|
|
2558
|
+
|
|
2559
|
+
### 4. Create Your First Widget
|
|
2560
|
+
\`\`\`bash
|
|
2561
|
+
snow-flow swarm "create simple incident counter widget"
|
|
2562
|
+
\`\`\`
|
|
2563
|
+
|
|
2564
|
+
## 📋 What Just Happened?
|
|
2565
|
+
|
|
2566
|
+
When you ran the swarm command, Snow-Flow:
|
|
2567
|
+
1. ✅ Validated your ServiceNow connection
|
|
2568
|
+
2. ✅ Analyzed your objective using Queen Agent
|
|
2569
|
+
3. ✅ Spawned specialized agents (widget-creator, tester)
|
|
2570
|
+
4. ✅ Created a real widget in your ServiceNow instance
|
|
2571
|
+
5. ✅ Tracked everything in an Update Set
|
|
2572
|
+
6. ✅ Tested the widget automatically
|
|
2573
|
+
|
|
2574
|
+
## 🎯 Next Steps
|
|
2575
|
+
|
|
2576
|
+
### Try More Examples
|
|
2577
|
+
\`\`\`bash
|
|
2578
|
+
# Create a workflow
|
|
2579
|
+
snow-flow swarm "create simple approval workflow"
|
|
2580
|
+
|
|
2581
|
+
# Build a dashboard
|
|
2582
|
+
snow-flow swarm "create IT dashboard with KPIs"
|
|
2583
|
+
|
|
2584
|
+
# Develop an application
|
|
2585
|
+
snow-flow swarm "create basic ticketing system"
|
|
2586
|
+
\`\`\`
|
|
2587
|
+
|
|
2588
|
+
### Explore Documentation
|
|
2589
|
+
- **Swarm Patterns**: .claude/commands/swarm-patterns.md
|
|
2590
|
+
- **Agent Types**: .claude/commands/agent-types.md
|
|
2591
|
+
- **MCP Tools**: .claude/commands/mcp-tools-quick-ref.md
|
|
2592
|
+
- **Examples**: ./examples/
|
|
2593
|
+
|
|
2594
|
+
### Monitor Progress
|
|
2595
|
+
\`\`\`bash
|
|
2596
|
+
# Check swarm status
|
|
2597
|
+
snow-flow swarm-status <sessionId>
|
|
2598
|
+
|
|
2599
|
+
# View system status
|
|
2600
|
+
snow-flow status
|
|
2601
|
+
\`\`\`
|
|
2602
|
+
|
|
2603
|
+
## 💡 Pro Tips
|
|
2604
|
+
|
|
2605
|
+
1. **Start Simple**: Let the Queen Agent handle complexity
|
|
2606
|
+
2. **Use Natural Language**: Describe what you want, not how
|
|
2607
|
+
3. **Trust the Defaults**: Intelligent features are enabled
|
|
2608
|
+
4. **Check Examples**: Run scripts in ./examples/ folder
|
|
2609
|
+
|
|
2610
|
+
## 🆘 Need Help?
|
|
2611
|
+
|
|
2612
|
+
- **Auth Issues**: Run \`snow-flow auth status\`
|
|
2613
|
+
- **MCP Tools**: Check .claude/commands/mcp-tools-quick-ref.md
|
|
2614
|
+
- **Agent Info**: See .claude/commands/agent-types.md
|
|
2615
|
+
- **GitHub**: https://github.com/groeimetai/snow-flow
|
|
2616
|
+
|
|
2617
|
+
Happy ServiceNow Development! 🎉
|
|
2618
|
+
`;
|
|
2619
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'QUICK_START.md'), quickStartContent);
|
|
2620
|
+
// Create example scripts
|
|
2621
|
+
const widgetExampleContent = `#!/bin/bash
|
|
2622
|
+
# Example: Create an incident dashboard widget
|
|
2623
|
+
|
|
2624
|
+
# This example shows how to create a comprehensive incident dashboard
|
|
2625
|
+
# with real-time data, charts, and mobile responsiveness
|
|
2626
|
+
|
|
2627
|
+
snow-flow swarm "create incident dashboard widget with:
|
|
2628
|
+
- Real-time incident counts by priority (Critical, High, Medium, Low)
|
|
2629
|
+
- Chart.js bar chart showing incidents by category
|
|
2630
|
+
- Line graph for incident trends over the last 7 days
|
|
2631
|
+
- Responsive grid layout for mobile devices
|
|
2632
|
+
- Auto-refresh every 30 seconds
|
|
2633
|
+
- Click-through to incident details
|
|
2634
|
+
- Color coding for priority levels (red for critical, orange for high)
|
|
2635
|
+
- Export to PDF functionality
|
|
2636
|
+
- Filter by assignment group"
|
|
2637
|
+
|
|
2638
|
+
# The Queen Agent will:
|
|
2639
|
+
# 1. Spawn widget-creator as primary agent
|
|
2640
|
+
# 2. Add ui-designer for responsive design
|
|
2641
|
+
# 3. Add tester for validation
|
|
2642
|
+
# 4. Create complete widget in ServiceNow
|
|
2643
|
+
# 5. Test on mobile and desktop
|
|
2644
|
+
# 6. Deploy with Update Set tracking
|
|
2645
|
+
`;
|
|
2646
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'examples/widget-dashboard.sh'), widgetExampleContent);
|
|
2647
|
+
await fs_1.promises.chmod((0, path_1.join)(targetDir, 'examples/widget-dashboard.sh'), '755');
|
|
2648
|
+
const approvalFlowExampleContent = `#!/bin/bash
|
|
2649
|
+
# Example: Create equipment approval workflow
|
|
2650
|
+
|
|
2651
|
+
# This example demonstrates creating a multi-level approval workflow
|
|
2652
|
+
# with dynamic routing based on cost and department
|
|
2653
|
+
|
|
2654
|
+
snow-flow swarm "create approval workflow for equipment requests with:
|
|
2655
|
+
- Automatic approval for items under $100
|
|
2656
|
+
- Manager approval for items $100-$1000
|
|
2657
|
+
- Department head approval for items $1000-$5000
|
|
2658
|
+
- VP approval for items over $5000
|
|
2659
|
+
- IT approval required for all technology items regardless of cost
|
|
2660
|
+
- Finance review for items over $10000
|
|
2661
|
+
- Email notifications at each approval step
|
|
2662
|
+
- Slack notifications for urgent requests
|
|
2663
|
+
- 48-hour SLA with escalation
|
|
2664
|
+
- Rejection reasons and resubmission process
|
|
2665
|
+
- Integration with catalog items for equipment selection
|
|
2666
|
+
- Automatic PO generation upon final approval"
|
|
2667
|
+
|
|
2668
|
+
# The Queen Agent will:
|
|
2669
|
+
# 1. Spawn flow-builder as primary agent
|
|
2670
|
+
# 2. Add security agent for approval permissions
|
|
2671
|
+
# 3. Add tester for all approval paths
|
|
2672
|
+
# 4. Create complex flow with conditions
|
|
2673
|
+
# 5. Link to catalog items
|
|
2674
|
+
# 6. Test all approval scenarios
|
|
2675
|
+
# 7. Validate email notifications
|
|
2676
|
+
`;
|
|
2677
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'examples/approval-workflow.sh'), approvalFlowExampleContent);
|
|
2678
|
+
await fs_1.promises.chmod((0, path_1.join)(targetDir, 'examples/approval-workflow.sh'), '755');
|
|
2679
|
+
const itsmApplicationExampleContent = `#!/bin/bash
|
|
2680
|
+
# Example: Create complete ITSM solution
|
|
2681
|
+
|
|
2682
|
+
# This example shows how to build a full IT Service Management application
|
|
2683
|
+
# with custom tables, workflows, and user interfaces
|
|
2684
|
+
|
|
2685
|
+
snow-flow swarm "create complete ITSM solution for laptop provisioning with:
|
|
2686
|
+
- Custom request table extending task table
|
|
2687
|
+
- Fields: laptop_model, specifications, justification, cost_center
|
|
2688
|
+
- Catalog item for laptop requests with dynamic pricing
|
|
2689
|
+
- Multi-stage approval workflow based on cost and user role
|
|
2690
|
+
- Integration with asset management for laptop assignment
|
|
2691
|
+
- Automated Active Directory account provisioning
|
|
2692
|
+
- Email notifications to user, manager, and IT
|
|
2693
|
+
- Dashboard showing request status and metrics
|
|
2694
|
+
- SLA tracking with 5-day fulfillment target
|
|
2695
|
+
- Mobile-friendly request portal
|
|
2696
|
+
- Reporting on request volumes and fulfillment times
|
|
2697
|
+
- Return process for laptop replacement
|
|
2698
|
+
- Integration with purchase order system"
|
|
2699
|
+
|
|
2700
|
+
# The Queen Agent will:
|
|
2701
|
+
# 1. Spawn app-architect to design the solution
|
|
2702
|
+
# 2. Add flow-builder for approval workflows
|
|
2703
|
+
# 3. Add widget-creator for dashboards
|
|
2704
|
+
# 4. Add script-writer for integrations
|
|
2705
|
+
# 5. Add security for access controls
|
|
2706
|
+
# 6. Add tester for end-to-end validation
|
|
2707
|
+
# 7. Create all components in sequence
|
|
2708
|
+
# 8. Deploy complete solution
|
|
2709
|
+
`;
|
|
2710
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'examples/itsm-application.sh'), itsmApplicationExampleContent);
|
|
2711
|
+
await fs_1.promises.chmod((0, path_1.join)(targetDir, 'examples/itsm-application.sh'), '755');
|
|
1750
2712
|
// Create CLAUDE.md by copying from source (v1.1.62+)
|
|
1751
2713
|
let claudeMdContent = '';
|
|
1752
2714
|
try {
|
|
@@ -2924,7 +3886,13 @@ program
|
|
|
2924
3886
|
if (options.sparc) {
|
|
2925
3887
|
console.log('🎯 Creating SPARC environment...');
|
|
2926
3888
|
await createSparcFiles(targetDir);
|
|
2927
|
-
console.log('✅ SPARC environment created
|
|
3889
|
+
console.log('✅ SPARC environment created');
|
|
3890
|
+
console.log('📋 Added swarm documentation:');
|
|
3891
|
+
console.log(' - swarm-patterns.md: Common swarm command examples');
|
|
3892
|
+
console.log(' - agent-types.md: Agent specializations guide');
|
|
3893
|
+
console.log(' - mcp-tools-quick-ref.md: MCP tools reference');
|
|
3894
|
+
console.log(' - examples/: Ready-to-run example scripts');
|
|
3895
|
+
console.log(' - memory/patterns/: Success patterns and templates\n');
|
|
2928
3896
|
}
|
|
2929
3897
|
// Phase 4: Create .env file
|
|
2930
3898
|
console.log('🔐 Creating environment configuration...');
|
|
@@ -3399,6 +4367,12 @@ echo "💡 Check MCP servers with: /mcp in Claude Code"
|
|
|
3399
4367
|
console.log(' 2. Run: snow-flow auth login');
|
|
3400
4368
|
console.log(' 3. Start your first swarm: snow-flow swarm "create a widget for incident management"');
|
|
3401
4369
|
console.log('');
|
|
4370
|
+
console.log('📚 Documentation created:');
|
|
4371
|
+
console.log(' - QUICK_START.md: 5-minute getting started guide');
|
|
4372
|
+
console.log(' - CLAUDE.md: Complete development guide with MCP-FIRST workflow');
|
|
4373
|
+
console.log(' - .claude/commands/: Swarm patterns, agent types, MCP tools reference');
|
|
4374
|
+
console.log(' - examples/: Ready-to-run example scripts for common tasks');
|
|
4375
|
+
console.log('');
|
|
3402
4376
|
console.log('✅ Project is ready to use!');
|
|
3403
4377
|
console.log('');
|
|
3404
4378
|
console.log('🔧 MCP Servers:');
|