snow-flow 1.4.1 ā 1.4.2
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 +560 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -52,6 +52,7 @@ const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
|
52
52
|
const agent_detector_js_1 = require("./utils/agent-detector.js");
|
|
53
53
|
const version_js_1 = require("./version.js");
|
|
54
54
|
const logger_js_1 = require("./utils/logger.js");
|
|
55
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
55
56
|
// Load environment variables
|
|
56
57
|
dotenv_1.default.config();
|
|
57
58
|
// Create CLI logger instance
|
|
@@ -2057,6 +2058,75 @@ program
|
|
|
2057
2058
|
process.exit(1);
|
|
2058
2059
|
}
|
|
2059
2060
|
});
|
|
2061
|
+
// Initialize Snow-Flow project
|
|
2062
|
+
program
|
|
2063
|
+
.command('init')
|
|
2064
|
+
.description('Initialize a Snow-Flow project with SPARC environment')
|
|
2065
|
+
.option('--sparc', 'Initialize with SPARC methodology and MCP servers (recommended)', true)
|
|
2066
|
+
.option('--skip-mcp', 'Skip MCP server activation prompt')
|
|
2067
|
+
.action(async (options) => {
|
|
2068
|
+
console.log(chalk_1.default.blue.bold(`\nš Initializing Snow-Flow Project v${version_js_1.VERSION}...`));
|
|
2069
|
+
console.log('='.repeat(60));
|
|
2070
|
+
const targetDir = process.cwd();
|
|
2071
|
+
try {
|
|
2072
|
+
// Create directory structure
|
|
2073
|
+
console.log('\nš Creating project structure...');
|
|
2074
|
+
await createDirectoryStructure(targetDir);
|
|
2075
|
+
// Create .env file
|
|
2076
|
+
console.log('š Creating environment configuration...');
|
|
2077
|
+
await createEnvFile(targetDir);
|
|
2078
|
+
// Create MCP configuration
|
|
2079
|
+
if (options.sparc) {
|
|
2080
|
+
console.log('š§ Setting up MCP servers for Claude Code...');
|
|
2081
|
+
await createMCPConfig(targetDir);
|
|
2082
|
+
// Copy CLAUDE.md file
|
|
2083
|
+
console.log('š Creating documentation files...');
|
|
2084
|
+
await copyCLAUDEmd(targetDir);
|
|
2085
|
+
// Create README files
|
|
2086
|
+
await createReadmeFiles(targetDir);
|
|
2087
|
+
}
|
|
2088
|
+
console.log(chalk_1.default.green.bold('\nā
Snow-Flow project initialized successfully!'));
|
|
2089
|
+
console.log('\nš Created files and directories:');
|
|
2090
|
+
console.log(' ā .claude/ - Claude Code configuration');
|
|
2091
|
+
console.log(' ā .swarm/ - Swarm session management');
|
|
2092
|
+
console.log(' ā memory/ - Persistent memory storage');
|
|
2093
|
+
console.log(' ā .env - ServiceNow OAuth configuration');
|
|
2094
|
+
if (options.sparc) {
|
|
2095
|
+
console.log(' ā .mcp.json - MCP server configuration');
|
|
2096
|
+
console.log(' ā CLAUDE.md - Development documentation');
|
|
2097
|
+
console.log(' ā README.md - Project documentation');
|
|
2098
|
+
if (!options.skipMcp) {
|
|
2099
|
+
console.log(chalk_1.default.yellow.bold('\nš Ready to activate MCP servers in Claude Code!'));
|
|
2100
|
+
console.log('\nWould you like to start Claude Code with MCP servers automatically? (Y/n)');
|
|
2101
|
+
const readline = await Promise.resolve().then(() => __importStar(require('readline')));
|
|
2102
|
+
const rl = readline.createInterface({
|
|
2103
|
+
input: process.stdin,
|
|
2104
|
+
output: process.stdout
|
|
2105
|
+
});
|
|
2106
|
+
const answer = await new Promise(resolve => {
|
|
2107
|
+
rl.question('> ', resolve);
|
|
2108
|
+
});
|
|
2109
|
+
rl.close();
|
|
2110
|
+
if (!answer || answer.toLowerCase() === 'y') {
|
|
2111
|
+
await activateMCPServers();
|
|
2112
|
+
}
|
|
2113
|
+
else {
|
|
2114
|
+
console.log('\nš To activate MCP servers manually later, run:');
|
|
2115
|
+
console.log(chalk_1.default.cyan(' claude --mcp-config .mcp.json .'));
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
console.log(chalk_1.default.blue.bold('\nšÆ Next steps:'));
|
|
2120
|
+
console.log('1. Edit .env file with your ServiceNow credentials');
|
|
2121
|
+
console.log('2. Run: ' + chalk_1.default.cyan('snow-flow auth login'));
|
|
2122
|
+
console.log('3. Start developing: ' + chalk_1.default.cyan('snow-flow swarm "your objective"'));
|
|
2123
|
+
console.log('\nš Full documentation: https://github.com/groeimetai/snow-flow');
|
|
2124
|
+
}
|
|
2125
|
+
catch (error) {
|
|
2126
|
+
console.error(chalk_1.default.red('\nā Initialization failed:'), error);
|
|
2127
|
+
process.exit(1);
|
|
2128
|
+
}
|
|
2129
|
+
});
|
|
2060
2130
|
// Help command
|
|
2061
2131
|
program
|
|
2062
2132
|
.command('help')
|
|
@@ -3829,6 +3899,462 @@ For full documentation, visit: https://github.com/groeimetai/snow-flow
|
|
|
3829
3899
|
3. \`snow-flow auth login\` - Authenticate with ServiceNow OAuth
|
|
3830
3900
|
4. \`snow-flow swarm "create a widget for incident management"\` - Everything automatic!
|
|
3831
3901
|
|
|
3902
|
+
For full documentation, visit: https://github.com/groeimetai/snow-flow
|
|
3903
|
+
`;
|
|
3904
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'CLAUDE.md'), claudeMdFallback);
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
async function copyCLAUDEmd(targetDir) {
|
|
3908
|
+
let claudeMdContent = '';
|
|
3909
|
+
try {
|
|
3910
|
+
// First try to find the CLAUDE.md in the source directory (for global installs)
|
|
3911
|
+
const sourceClaudeFiles = [
|
|
3912
|
+
// Try the project root (when running from dist/)
|
|
3913
|
+
(0, path_1.join)(__dirname, '..', 'CLAUDE.md'),
|
|
3914
|
+
// Try when running directly from src/
|
|
3915
|
+
(0, path_1.join)(__dirname, 'CLAUDE.md'),
|
|
3916
|
+
// Try npm global installation paths
|
|
3917
|
+
(0, path_1.join)(__dirname, '..', '..', '..', 'CLAUDE.md'),
|
|
3918
|
+
(0, path_1.join)(__dirname, '..', '..', '..', '..', 'CLAUDE.md'),
|
|
3919
|
+
// Try current working directory as fallback
|
|
3920
|
+
(0, path_1.join)(process.cwd(), 'CLAUDE.md')
|
|
3921
|
+
];
|
|
3922
|
+
let foundSource = false;
|
|
3923
|
+
for (const sourcePath of sourceClaudeFiles) {
|
|
3924
|
+
try {
|
|
3925
|
+
claudeMdContent = await fs_1.promises.readFile(sourcePath, 'utf8');
|
|
3926
|
+
foundSource = true;
|
|
3927
|
+
console.log(`ā
Found CLAUDE.md source at: ${sourcePath}`);
|
|
3928
|
+
break;
|
|
3929
|
+
}
|
|
3930
|
+
catch {
|
|
3931
|
+
// Continue to next path
|
|
3932
|
+
}
|
|
3933
|
+
}
|
|
3934
|
+
if (!foundSource) {
|
|
3935
|
+
// Fallback to a minimal CLAUDE.md if source not found
|
|
3936
|
+
console.log('ā ļø Could not find CLAUDE.md source, creating minimal version');
|
|
3937
|
+
claudeMdContent = `# Snow-Flow Development with Claude Code
|
|
3938
|
+
|
|
3939
|
+
## š Core Development Principles
|
|
3940
|
+
|
|
3941
|
+
### Concurrent Execution Strategy
|
|
3942
|
+
**Golden Rule**: "1 MESSAGE = ALL RELATED OPERATIONS"
|
|
3943
|
+
- Always batch related MCP tool calls in a single response
|
|
3944
|
+
- Use TodoWrite extensively for complex task coordination
|
|
3945
|
+
- Launch multiple agents concurrently for maximum performance
|
|
3946
|
+
- Leverage batch file operations whenever reading/writing multiple files
|
|
3947
|
+
|
|
3948
|
+
### ServiceNow Development Best Practices
|
|
3949
|
+
1. **Never hardcode credentials** - Use OAuth and environment variables
|
|
3950
|
+
2. **Always work in Update Sets** - Provides rollback safety
|
|
3951
|
+
3. **Test before deploy** - Use mock testing tools for validation
|
|
3952
|
+
4. **Validate permissions** - Check OAuth scopes before operations
|
|
3953
|
+
5. **Use fuzzy search** - ServiceNow names can vary (iPhone vs iPhone 6S)
|
|
3954
|
+
|
|
3955
|
+
## š Essential MCP Tool Patterns
|
|
3956
|
+
|
|
3957
|
+
### Batch Operations for Maximum Efficiency
|
|
3958
|
+
\`\`\`javascript
|
|
3959
|
+
// GOOD: Single message with multiple tool calls
|
|
3960
|
+
TodoWrite([...tasks]);
|
|
3961
|
+
Task("Architect", "Design system architecture");
|
|
3962
|
+
Task("Developer", "Implement components");
|
|
3963
|
+
Task("Tester", "Create test scenarios");
|
|
3964
|
+
|
|
3965
|
+
// BAD: Sequential single operations
|
|
3966
|
+
TodoWrite([task1]);
|
|
3967
|
+
// wait for response
|
|
3968
|
+
TodoWrite([task2]);
|
|
3969
|
+
// wait for response
|
|
3970
|
+
\`\`\`
|
|
3971
|
+
|
|
3972
|
+
### Memory-Driven Coordination
|
|
3973
|
+
Use Memory to coordinate information across agents:
|
|
3974
|
+
\`\`\`javascript
|
|
3975
|
+
// Store architecture decisions
|
|
3976
|
+
snow_memory_store({
|
|
3977
|
+
key: "widget_architecture",
|
|
3978
|
+
value: "Service Portal widget with Chart.js for data visualization"
|
|
3979
|
+
});
|
|
3980
|
+
|
|
3981
|
+
// All agents can reference this
|
|
3982
|
+
Task("Frontend Dev", "Implement widget based on widget_architecture in memory");
|
|
3983
|
+
Task("Backend Dev", "Create REST endpoints for widget_architecture requirements");
|
|
3984
|
+
\`\`\`
|
|
3985
|
+
|
|
3986
|
+
## š ļø Complete ServiceNow MCP Tools Reference
|
|
3987
|
+
|
|
3988
|
+
### Discovery & Search Tools
|
|
3989
|
+
\`\`\`javascript
|
|
3990
|
+
// Find any ServiceNow artifact using natural language
|
|
3991
|
+
snow_find_artifact({
|
|
3992
|
+
query: "the widget that shows incidents on homepage",
|
|
3993
|
+
type: "widget" // or "flow", "script", "application", "any"
|
|
3994
|
+
});
|
|
3995
|
+
|
|
3996
|
+
// Search catalog items with fuzzy matching
|
|
3997
|
+
snow_catalog_item_search({
|
|
3998
|
+
query: "laptop",
|
|
3999
|
+
fuzzy_match: true, // Finds variations: notebook, MacBook, etc.
|
|
4000
|
+
category_filter: "hardware",
|
|
4001
|
+
include_variables: true // Get catalog variables too
|
|
4002
|
+
});
|
|
4003
|
+
|
|
4004
|
+
// Direct sys_id lookup (faster than search)
|
|
4005
|
+
snow_get_by_sysid({
|
|
4006
|
+
sys_id: "<artifact_sys_id>",
|
|
4007
|
+
table: "sp_widget"
|
|
4008
|
+
});
|
|
4009
|
+
\`\`\`
|
|
4010
|
+
|
|
4011
|
+
### Flow Development Tools
|
|
4012
|
+
\`\`\`javascript
|
|
4013
|
+
// Create flows from natural language
|
|
4014
|
+
snow_create_flow({
|
|
4015
|
+
instruction: "create a flow that sends email when incident priority is high",
|
|
4016
|
+
deploy_immediately: true // Automatically deploys XML to ServiceNow
|
|
4017
|
+
});
|
|
4018
|
+
|
|
4019
|
+
// Test flows with mock data
|
|
4020
|
+
snow_test_flow_with_mock({
|
|
4021
|
+
flow_id: "incident_notification_flow",
|
|
4022
|
+
create_test_user: true,
|
|
4023
|
+
mock_catalog_items: true,
|
|
4024
|
+
test_inputs: {
|
|
4025
|
+
priority: "1",
|
|
4026
|
+
category: "hardware"
|
|
4027
|
+
},
|
|
4028
|
+
simulate_approvals: true
|
|
4029
|
+
});
|
|
4030
|
+
|
|
4031
|
+
// Link catalog items to flows
|
|
4032
|
+
snow_link_catalog_to_flow({
|
|
4033
|
+
catalog_item_id: "New Laptop Request",
|
|
4034
|
+
flow_id: "laptop_provisioning_flow",
|
|
4035
|
+
link_type: "flow_catalog_process",
|
|
4036
|
+
variable_mapping: [
|
|
4037
|
+
{
|
|
4038
|
+
catalog_variable: "laptop_model",
|
|
4039
|
+
flow_input: "equipment_type"
|
|
4040
|
+
}
|
|
4041
|
+
]
|
|
4042
|
+
});
|
|
4043
|
+
\`\`\`
|
|
4044
|
+
|
|
4045
|
+
### Widget Development Tools
|
|
4046
|
+
\`\`\`javascript
|
|
4047
|
+
// Deploy widgets with automatic validation
|
|
4048
|
+
snow_deploy_widget({
|
|
4049
|
+
name: "incident_dashboard",
|
|
4050
|
+
title: "Incident Dashboard",
|
|
4051
|
+
template: htmlContent,
|
|
4052
|
+
css: cssContent,
|
|
4053
|
+
client_script: clientJS,
|
|
4054
|
+
server_script: serverJS,
|
|
4055
|
+
demo_data: { incidents: [...] }
|
|
4056
|
+
});
|
|
4057
|
+
|
|
4058
|
+
// Preview and test widgets
|
|
4059
|
+
snow_preview_widget({
|
|
4060
|
+
widget_id: "incident_dashboard",
|
|
4061
|
+
check_dependencies: true
|
|
4062
|
+
});
|
|
4063
|
+
|
|
4064
|
+
snow_widget_test({
|
|
4065
|
+
widget_id: "incident_dashboard",
|
|
4066
|
+
test_scenarios: [
|
|
4067
|
+
{
|
|
4068
|
+
name: "Load with no data",
|
|
4069
|
+
server_data: { incidents: [] }
|
|
4070
|
+
}
|
|
4071
|
+
]
|
|
4072
|
+
});
|
|
4073
|
+
\`\`\`
|
|
4074
|
+
|
|
4075
|
+
### Bulk Operations
|
|
4076
|
+
\`\`\`javascript
|
|
4077
|
+
// Deploy multiple artifacts at once
|
|
4078
|
+
snow_bulk_deploy({
|
|
4079
|
+
artifacts: [
|
|
4080
|
+
{ type: "widget", data: widgetData },
|
|
4081
|
+
{ type: "flow", data: flowData },
|
|
4082
|
+
{ type: "script", data: scriptData }
|
|
4083
|
+
],
|
|
4084
|
+
transaction_mode: true, // All or nothing
|
|
4085
|
+
parallel: true, // Deploy simultaneously
|
|
4086
|
+
dry_run: false
|
|
4087
|
+
});
|
|
4088
|
+
\`\`\`
|
|
4089
|
+
|
|
4090
|
+
### Intelligent Analysis
|
|
4091
|
+
\`\`\`javascript
|
|
4092
|
+
// Analyze incidents with AI
|
|
4093
|
+
snow_analyze_incident({
|
|
4094
|
+
incident_id: "INC0010001",
|
|
4095
|
+
include_similar: true,
|
|
4096
|
+
suggest_resolution: true
|
|
4097
|
+
});
|
|
4098
|
+
|
|
4099
|
+
// Pattern analysis
|
|
4100
|
+
snow_pattern_analysis({
|
|
4101
|
+
analysis_type: "incident_patterns",
|
|
4102
|
+
timeframe: "month"
|
|
4103
|
+
});
|
|
4104
|
+
\`\`\`
|
|
4105
|
+
|
|
4106
|
+
## ā” Performance Optimization
|
|
4107
|
+
|
|
4108
|
+
### Parallel Execution Patterns
|
|
4109
|
+
\`\`\`javascript
|
|
4110
|
+
// Execute multiple searches concurrently
|
|
4111
|
+
Promise.all([
|
|
4112
|
+
snow_find_artifact({ query: "incident widget" }),
|
|
4113
|
+
snow_catalog_item_search({ query: "laptop" }),
|
|
4114
|
+
snow_query_incidents({ query: "priority=1" })
|
|
4115
|
+
]);
|
|
4116
|
+
\`\`\`
|
|
4117
|
+
|
|
4118
|
+
### Batch File Operations
|
|
4119
|
+
\`\`\`javascript
|
|
4120
|
+
// Read multiple files in one operation
|
|
4121
|
+
MultiRead([
|
|
4122
|
+
"/path/to/widget.html",
|
|
4123
|
+
"/path/to/widget.css",
|
|
4124
|
+
"/path/to/widget.js"
|
|
4125
|
+
]);
|
|
4126
|
+
\`\`\`
|
|
4127
|
+
|
|
4128
|
+
## š Workflow Guidelines
|
|
4129
|
+
|
|
4130
|
+
### Standard Development Flow
|
|
4131
|
+
1. **Discovery Phase**: Use search tools to find existing artifacts
|
|
4132
|
+
2. **Planning Phase**: Use TodoWrite to plan all tasks
|
|
4133
|
+
3. **Development Phase**: Launch agents concurrently
|
|
4134
|
+
4. **Testing Phase**: Use mock testing tools
|
|
4135
|
+
5. **Deployment Phase**: Use bulk deploy with validation
|
|
4136
|
+
|
|
4137
|
+
### Error Recovery Patterns
|
|
4138
|
+
\`\`\`javascript
|
|
4139
|
+
// Always implement rollback strategies
|
|
4140
|
+
if (deployment.failed) {
|
|
4141
|
+
snow_deployment_rollback_manager({
|
|
4142
|
+
update_set_id: deployment.update_set,
|
|
4143
|
+
restore_point: deployment.backup_id
|
|
4144
|
+
});
|
|
4145
|
+
}
|
|
4146
|
+
\`\`\`
|
|
4147
|
+
|
|
4148
|
+
## š§ Advanced Configuration
|
|
4149
|
+
|
|
4150
|
+
## Build Commands
|
|
4151
|
+
- \`npm run build\`: Build the project
|
|
4152
|
+
- \`npm run test\`: Run the full test suite
|
|
4153
|
+
- \`npm run lint\`: Run ESLint and format checks
|
|
4154
|
+
- \`npm run typecheck\`: Run TypeScript type checking
|
|
4155
|
+
|
|
4156
|
+
## Snow-Flow Commands
|
|
4157
|
+
- \`snow-flow init --sparc\`: Initialize project with SPARC environment
|
|
4158
|
+
- \`snow-flow auth login\`: Authenticate with ServiceNow OAuth
|
|
4159
|
+
- \`snow-flow swarm "<objective>"\`: Start multi-agent swarm - ƩƩn command voor alles!
|
|
4160
|
+
- \`snow-flow sparc <mode> "<task>"\`: Run specific SPARC mode
|
|
4161
|
+
|
|
4162
|
+
## Enhanced Swarm Command (v1.1.41+)
|
|
4163
|
+
The swarm command now includes intelligent features that are **enabled by default**:
|
|
4164
|
+
|
|
4165
|
+
\`\`\`bash
|
|
4166
|
+
# Simple usage - ALL autonomous systems enabled by default!
|
|
4167
|
+
snow-flow swarm "create incident management dashboard"
|
|
4168
|
+
|
|
4169
|
+
# Disable specific autonomous systems if needed
|
|
4170
|
+
snow-flow swarm "create simple widget" --no-autonomous-cost-optimization --no-autonomous-compliance
|
|
4171
|
+
|
|
4172
|
+
# Disable ALL autonomous systems
|
|
4173
|
+
snow-flow swarm "basic development only" --no-autonomous-all
|
|
4174
|
+
|
|
4175
|
+
# Force enable all (overrides any --no- flags)
|
|
4176
|
+
snow-flow swarm "full orchestration mode" --autonomous-all
|
|
4177
|
+
\`\`\`
|
|
4178
|
+
|
|
4179
|
+
### š¤ NEW: Autonomous Systems (v1.3.26+) - **ENABLED BY DEFAULT!**
|
|
4180
|
+
True orchestration with zero manual intervention - all systems active unless disabled:
|
|
4181
|
+
|
|
4182
|
+
- ā
**Documentation**: Self-documenting system (auto-generates and updates docs)
|
|
4183
|
+
- ā
**Cost Optimization**: AI-driven cost management with auto-optimization
|
|
4184
|
+
- ā
**Compliance**: Multi-framework compliance monitoring with auto-remediation
|
|
4185
|
+
- ā
**Self-Healing**: Predictive failure detection with automatic recovery
|
|
4186
|
+
|
|
4187
|
+
**Disable Options**:
|
|
4188
|
+
- \`--no-autonomous-documentation\`: Disable documentation system
|
|
4189
|
+
- \`--no-autonomous-cost-optimization\`: Disable cost optimization
|
|
4190
|
+
- \`--no-autonomous-compliance\`: Disable compliance monitoring
|
|
4191
|
+
- \`--no-autonomous-healing\`: Disable self-healing
|
|
4192
|
+
- \`--no-autonomous-all\`: Disable ALL autonomous systems
|
|
4193
|
+
|
|
4194
|
+
**Force Options**:
|
|
4195
|
+
- \`--autonomous-all\`: Force enable all (overrides --no- flags)
|
|
4196
|
+
|
|
4197
|
+
**Perfect Orchestrator**: Systems work autonomously, make intelligent decisions, and continuously improve - no manual intervention needed!
|
|
4198
|
+
|
|
4199
|
+
### Default Settings (no flags needed):
|
|
4200
|
+
- ā
\`--smart-discovery\` - Automatically discovers and reuses existing artifacts
|
|
4201
|
+
- ā
\`--live-testing\` - Tests in real-time on your ServiceNow instance
|
|
4202
|
+
- ā
\`--auto-deploy\` - Deploys automatically (safe with update sets)
|
|
4203
|
+
- ā
\`--auto-rollback\` - Automatically rollbacks on failures
|
|
4204
|
+
- ā
\`--shared-memory\` - All agents share context and coordination
|
|
4205
|
+
- ā
\`--progress-monitoring\` - Real-time progress tracking
|
|
4206
|
+
- ā \`--auto-permissions\` - Disabled by default (enable with flag for automatic role elevation)
|
|
4207
|
+
|
|
4208
|
+
### Advanced Usage:
|
|
4209
|
+
\`\`\`bash
|
|
4210
|
+
# Enable automatic permission escalation
|
|
4211
|
+
snow-flow swarm "create global workflow" --auto-permissions
|
|
4212
|
+
|
|
4213
|
+
# Disable specific features
|
|
4214
|
+
snow-flow swarm "test widget" --no-auto-deploy --no-live-testing
|
|
4215
|
+
|
|
4216
|
+
# Full control
|
|
4217
|
+
snow-flow swarm "complex integration" \\
|
|
4218
|
+
--max-agents 8 \\
|
|
4219
|
+
--strategy development \\
|
|
4220
|
+
--mode distributed \\
|
|
4221
|
+
--parallel \\
|
|
4222
|
+
--auto-permissions
|
|
4223
|
+
\`\`\`
|
|
4224
|
+
|
|
4225
|
+
## New MCP Tools (v1.1.44+)
|
|
4226
|
+
|
|
4227
|
+
### Catalog Item Search
|
|
4228
|
+
Find catalog items with intelligent fuzzy matching:
|
|
4229
|
+
\`\`\`javascript
|
|
4230
|
+
snow_catalog_item_search({
|
|
4231
|
+
query: "iPhone", // Will find iPhone 6S, iPhone 7, etc.
|
|
4232
|
+
fuzzy_match: true, // Enable intelligent variations
|
|
4233
|
+
include_variables: true // Include catalog variables
|
|
4234
|
+
})
|
|
4235
|
+
\`\`\`
|
|
4236
|
+
|
|
4237
|
+
### Flow Testing with Mock Data
|
|
4238
|
+
Test flows without real data:
|
|
4239
|
+
\`\`\`javascript
|
|
4240
|
+
snow_test_flow_with_mock({
|
|
4241
|
+
flow_id: "equipment_provisioning_flow",
|
|
4242
|
+
create_test_user: true, // Creates test user
|
|
4243
|
+
mock_catalog_items: true, // Creates test catalog items
|
|
4244
|
+
simulate_approvals: true, // Auto-approves during test
|
|
4245
|
+
cleanup_after_test: true // Removes test data after
|
|
4246
|
+
})
|
|
4247
|
+
\`\`\`
|
|
4248
|
+
|
|
4249
|
+
### Direct Catalog-Flow Linking
|
|
4250
|
+
Link catalog items directly to flows:
|
|
4251
|
+
\`\`\`javascript
|
|
4252
|
+
snow_link_catalog_to_flow({
|
|
4253
|
+
catalog_item_id: "iPhone 6S",
|
|
4254
|
+
flow_id: "mobile_provisioning_flow",
|
|
4255
|
+
link_type: "flow_catalog_process", // Modern approach
|
|
4256
|
+
variable_mapping: [
|
|
4257
|
+
{
|
|
4258
|
+
catalog_variable: "phone_model",
|
|
4259
|
+
flow_input: "device_type"
|
|
4260
|
+
}
|
|
4261
|
+
],
|
|
4262
|
+
test_link: true // Creates test request
|
|
4263
|
+
})
|
|
4264
|
+
\`\`\`
|
|
4265
|
+
|
|
4266
|
+
### OAuth Configuration
|
|
4267
|
+
\`\`\`env
|
|
4268
|
+
# .env file
|
|
4269
|
+
SNOW_INSTANCE=dev123456
|
|
4270
|
+
SNOW_CLIENT_ID=your_oauth_client_id
|
|
4271
|
+
SNOW_CLIENT_SECRET=your_oauth_client_secret
|
|
4272
|
+
SNOW_USERNAME=admin
|
|
4273
|
+
SNOW_PASSWORD=admin_password
|
|
4274
|
+
\`\`\`
|
|
4275
|
+
|
|
4276
|
+
### Update Set Management
|
|
4277
|
+
\`\`\`javascript
|
|
4278
|
+
// Smart update set creation
|
|
4279
|
+
snow_smart_update_set({
|
|
4280
|
+
name: "Auto-generated for widget development",
|
|
4281
|
+
detect_context: true, // Auto-detects what you're working on
|
|
4282
|
+
auto_switch: true // Switches when context changes
|
|
4283
|
+
});
|
|
4284
|
+
\`\`\`
|
|
4285
|
+
|
|
4286
|
+
## šÆ Quick Start
|
|
4287
|
+
1. \`snow-flow init --sparc\` - Initialize project with SPARC environment
|
|
4288
|
+
2. Configure ServiceNow credentials in .env file
|
|
4289
|
+
3. \`snow-flow auth login\` - Authenticate with ServiceNow OAuth
|
|
4290
|
+
4. \`snow-flow swarm "create a widget for incident management"\` - Everything automatic!
|
|
4291
|
+
|
|
4292
|
+
## š” Important Notes
|
|
4293
|
+
|
|
4294
|
+
### Do's
|
|
4295
|
+
- ā
Use TodoWrite extensively for task tracking
|
|
4296
|
+
- ā
Batch MCP tool calls for performance
|
|
4297
|
+
- ā
Store important data in Memory for coordination
|
|
4298
|
+
- ā
Test with mock data before deploying
|
|
4299
|
+
- ā
Work within Update Sets for safety
|
|
4300
|
+
- ā
Use fuzzy search for finding artifacts
|
|
4301
|
+
|
|
4302
|
+
### Don'ts
|
|
4303
|
+
- ā Don't make sequential tool calls when batch is possible
|
|
4304
|
+
- ā Don't hardcode credentials or sys_ids
|
|
4305
|
+
- ā Don't deploy without testing
|
|
4306
|
+
- ā Don't ignore OAuth permission errors
|
|
4307
|
+
- ā Don't create artifacts without checking if they exist
|
|
4308
|
+
|
|
4309
|
+
## š Performance Benchmarks
|
|
4310
|
+
|
|
4311
|
+
With concurrent execution and batch operations:
|
|
4312
|
+
- **Widget Development**: 3x faster than sequential
|
|
4313
|
+
- **Flow Creation**: 2.5x faster with parallel validation
|
|
4314
|
+
- **Bulk Deployment**: Up to 5x faster with parallel mode
|
|
4315
|
+
- **Search Operations**: 4x faster with concurrent queries
|
|
4316
|
+
|
|
4317
|
+
## š Additional Resources
|
|
4318
|
+
|
|
4319
|
+
### MCP Server Documentation
|
|
4320
|
+
- **servicenow-deployment**: Widget, flow, and application deployment
|
|
4321
|
+
- **servicenow-intelligent**: Smart search and artifact discovery
|
|
4322
|
+
- **servicenow-operations**: Incident management and catalog operations
|
|
4323
|
+
- **servicenow-platform-development**: Scripts, rules, and policies
|
|
4324
|
+
|
|
4325
|
+
### SPARC Modes
|
|
4326
|
+
- \`orchestrator\`: Coordinates complex multi-step tasks
|
|
4327
|
+
- \`coder\`: Focused code implementation
|
|
4328
|
+
- \`researcher\`: Deep analysis and discovery
|
|
4329
|
+
- \`tester\`: Comprehensive testing strategies
|
|
4330
|
+
- \`architect\`: System design and architecture
|
|
4331
|
+
|
|
4332
|
+
---
|
|
4333
|
+
|
|
4334
|
+
This is a minimal CLAUDE.md file. The full documentation should be available in your Snow-Flow installation.
|
|
4335
|
+
|
|
4336
|
+
## Quick Start
|
|
4337
|
+
1. \`snow-flow init --sparc\` - Initialize project with SPARC environment
|
|
4338
|
+
2. Configure ServiceNow credentials in .env file
|
|
4339
|
+
3. \`snow-flow auth login\` - Authenticate with ServiceNow OAuth
|
|
4340
|
+
4. \`snow-flow swarm "create a widget for incident management"\` - Everything automatic!
|
|
4341
|
+
|
|
4342
|
+
For full documentation, visit: https://github.com/groeimetai/snow-flow
|
|
4343
|
+
`;
|
|
4344
|
+
}
|
|
4345
|
+
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'CLAUDE.md'), claudeMdContent);
|
|
4346
|
+
}
|
|
4347
|
+
catch (error) {
|
|
4348
|
+
console.log('ā ļø Error copying CLAUDE.md, creating minimal version');
|
|
4349
|
+
// Minimal fallback
|
|
4350
|
+
const claudeMdFallback = `# Snow-Flow Development with Claude Code
|
|
4351
|
+
|
|
4352
|
+
## Quick Start
|
|
4353
|
+
1. \`snow-flow init --sparc\` - Initialize project with SPARC environment
|
|
4354
|
+
2. Configure ServiceNow credentials in .env file
|
|
4355
|
+
3. \`snow-flow auth login\` - Authenticate with ServiceNow OAuth
|
|
4356
|
+
4. \`snow-flow swarm "create a widget for incident management"\` - Everything automatic!
|
|
4357
|
+
|
|
3832
4358
|
For full documentation, visit: https://github.com/groeimetai/snow-flow
|
|
3833
4359
|
`;
|
|
3834
4360
|
await fs_1.promises.writeFile((0, path_1.join)(targetDir, 'CLAUDE.md'), claudeMdFallback);
|
|
@@ -4676,6 +5202,40 @@ program
|
|
|
4676
5202
|
// ===================================================
|
|
4677
5203
|
// šÆ INTEGRATE SNOW-FLOW HIVE-MIND SYSTEM
|
|
4678
5204
|
// ===================================================
|
|
5205
|
+
async function activateMCPServers() {
|
|
5206
|
+
console.log(chalk_1.default.blue.bold('\nš Activating MCP servers in Claude Code...'));
|
|
5207
|
+
try {
|
|
5208
|
+
const { spawn } = await Promise.resolve().then(() => __importStar(require('child_process')));
|
|
5209
|
+
const platform = process.platform;
|
|
5210
|
+
// Check if claude command exists
|
|
5211
|
+
const claudeCommand = platform === 'win32' ? 'claude.exe' : 'claude';
|
|
5212
|
+
console.log('š” Starting Claude Code with MCP configuration...');
|
|
5213
|
+
// Launch Claude with MCP config
|
|
5214
|
+
const claudeProcess = spawn(claudeCommand, ['--mcp-config', '.mcp.json', '.'], {
|
|
5215
|
+
stdio: 'inherit',
|
|
5216
|
+
shell: true
|
|
5217
|
+
});
|
|
5218
|
+
claudeProcess.on('error', (error) => {
|
|
5219
|
+
if (error.message.includes('ENOENT')) {
|
|
5220
|
+
console.error(chalk_1.default.red('\nā Claude Code not found. Please install it first:'));
|
|
5221
|
+
console.log(' Visit: https://claude.ai/download');
|
|
5222
|
+
}
|
|
5223
|
+
else {
|
|
5224
|
+
console.error(chalk_1.default.red('\nā Failed to start Claude Code:'), error.message);
|
|
5225
|
+
}
|
|
5226
|
+
});
|
|
5227
|
+
claudeProcess.on('spawn', () => {
|
|
5228
|
+
console.log(chalk_1.default.green('ā
Claude Code started with MCP servers!'));
|
|
5229
|
+
console.log('\nš All 11 ServiceNow MCP servers are now available in Claude Code');
|
|
5230
|
+
console.log('šÆ You can start using Snow-Flow commands immediately!');
|
|
5231
|
+
});
|
|
5232
|
+
}
|
|
5233
|
+
catch (error) {
|
|
5234
|
+
console.error(chalk_1.default.red('\nā Failed to activate MCP servers:'), error);
|
|
5235
|
+
console.log('\nš To activate manually, run:');
|
|
5236
|
+
console.log(chalk_1.default.cyan(' claude --mcp-config .mcp.json .'));
|
|
5237
|
+
}
|
|
5238
|
+
}
|
|
4679
5239
|
// Note: The new integrated commands enhance the existing CLI with:
|
|
4680
5240
|
// - Advanced system status monitoring
|
|
4681
5241
|
// - Real-time monitoring dashboard
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "ServiceNow Queen Agent - Hive-Mind Intelligence for ServiceNow Development inspired by claude-flow. Transform complex workflows into elegant one-command orchestration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|