snow-flow 3.4.6 → 3.4.8
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
CHANGED
|
@@ -2183,455 +2183,10 @@ async function copyCLAUDEmd(targetDir, force = false) {
|
|
|
2183
2183
|
}
|
|
2184
2184
|
}
|
|
2185
2185
|
if (!foundSource) {
|
|
2186
|
-
//
|
|
2187
|
-
|
|
2188
|
-
claudeMdContent =
|
|
2189
|
-
|
|
2190
|
-
## 🚨 CRITICAL: MCP-FIRST WORKFLOW (READ THIS FIRST!)
|
|
2191
|
-
|
|
2192
|
-
**Snow-flow's core value is REAL ServiceNow integration through MCP tools. NEVER work in offline mode!**
|
|
2193
|
-
|
|
2194
|
-
### ⚠️ MANDATORY WORKFLOW - NO EXCEPTIONS
|
|
2195
|
-
|
|
2196
|
-
**Every ServiceNow task MUST start with this sequence:**
|
|
2197
|
-
|
|
2198
|
-
\`\`\`javascript
|
|
2199
|
-
// 1. MANDATORY: Pre-flight authentication check
|
|
2200
|
-
const authCheck = await snow_validate_live_connection({ test_level: "permissions" });
|
|
2201
|
-
if (!authCheck.success) {
|
|
2202
|
-
// STOP! Fix authentication first
|
|
2203
|
-
return authenticationError(authCheck.error);
|
|
2204
|
-
}
|
|
2205
|
-
|
|
2206
|
-
// 2. MANDATORY: Discovery before creation
|
|
2207
|
-
const discovery = await snow_find_artifact({
|
|
2208
|
-
query: "your objective",
|
|
2209
|
-
type: "widget|flow|script|any"
|
|
2210
|
-
});
|
|
2211
|
-
|
|
2212
|
-
// 3. MANDATORY: Real ServiceNow deployment
|
|
2213
|
-
const deployment = await snow_deploy({
|
|
2214
|
-
type: "widget|application", // Note: flow removed in v1.4.0+
|
|
2215
|
-
config: { /* your config */ },
|
|
2216
|
-
auto_update_set: true // Always track changes
|
|
2217
|
-
});
|
|
2218
|
-
|
|
2219
|
-
// 4. MANDATORY: Track in Update Set
|
|
2220
|
-
await snow_update_set_add_artifact({
|
|
2221
|
-
type: deployment.type,
|
|
2222
|
-
sys_id: deployment.result.sys_id,
|
|
2223
|
-
name: deployment.result.name
|
|
2224
|
-
});
|
|
2225
|
-
\`\`\`
|
|
2226
|
-
|
|
2227
|
-
### 🚫 FORBIDDEN ACTIONS
|
|
2228
|
-
|
|
2229
|
-
**THESE ACTIONS ARE BANNED - NEVER DO THESE:**
|
|
2230
|
-
|
|
2231
|
-
❌ **Creating local files** without MCP check first
|
|
2232
|
-
❌ **Generating mock data** instead of using MCP tools
|
|
2233
|
-
❌ **Working in "offline mode"** when ServiceNow is available
|
|
2234
|
-
❌ **Skipping authentication validation**
|
|
2235
|
-
❌ **Planning mode** without trying MCP tools first
|
|
2236
|
-
|
|
2237
|
-
### ✅ CORRECT: MCP-First Decision Tree
|
|
2238
|
-
|
|
2239
|
-
\`\`\`
|
|
2240
|
-
User Request → ALWAYS START HERE:
|
|
2241
|
-
↓
|
|
2242
|
-
1. snow_validate_live_connection()
|
|
2243
|
-
↓
|
|
2244
|
-
SUCCESS? → Continue to Step 2
|
|
2245
|
-
↓
|
|
2246
|
-
FAILURE? → Fix auth: snow_auth_diagnostics()
|
|
2247
|
-
Then guide user: "snow-flow auth login"
|
|
2248
|
-
STOP until auth works
|
|
2249
|
-
↓
|
|
2250
|
-
2. snow_find_artifact() // Check if exists
|
|
2251
|
-
↓
|
|
2252
|
-
FOUND? → Ask: "Reuse existing or create new?"
|
|
2253
|
-
↓
|
|
2254
|
-
NOT FOUND? → Continue to Step 3
|
|
2255
|
-
↓
|
|
2256
|
-
3. snow_deploy() // Real deployment to ServiceNow
|
|
2257
|
-
↓
|
|
2258
|
-
SUCCESS? → Step 4: Track in Update Set
|
|
2259
|
-
↓
|
|
2260
|
-
FAILURE? → Use fallback strategies
|
|
2261
|
-
↓
|
|
2262
|
-
4. snow_update_set_add_artifact() // Always track
|
|
2263
|
-
↓
|
|
2264
|
-
DONE! ✅
|
|
2265
|
-
\`\`\`
|
|
2266
|
-
|
|
2267
|
-
## 🚀 Snow-Flow Swarm Command - MCP-Orchestrated Multi-Agent Intelligence
|
|
2268
|
-
|
|
2269
|
-
**The Swarm system is MCP-native and ALWAYS uses ServiceNow tools first!**
|
|
2270
|
-
|
|
2271
|
-
### 🧠 Queen Agent with Parallel Execution (v1.4.0+)
|
|
2272
|
-
- Automatically spawns 6+ specialized agents for widget development
|
|
2273
|
-
- Achieves proven 2.8x speedup through intelligent parallel execution
|
|
2274
|
-
- All agents coordinate through Snow-Flow's memory system
|
|
2275
|
-
- Every agent uses MCP tools directly - no offline mode
|
|
2276
|
-
|
|
2277
|
-
## 🛠️ Complete ServiceNow MCP Tools Reference
|
|
2278
|
-
|
|
2279
|
-
### Discovery & Search Tools
|
|
2280
|
-
\`\`\`javascript
|
|
2281
|
-
// Find any ServiceNow artifact using natural language
|
|
2282
|
-
snow_find_artifact({
|
|
2283
|
-
query: "the widget that shows incidents on homepage",
|
|
2284
|
-
type: "widget" // or "flow", "script", "application", "any"
|
|
2285
|
-
});
|
|
2286
|
-
|
|
2287
|
-
// Search catalog items with fuzzy matching
|
|
2288
|
-
snow_catalog_item_search({
|
|
2289
|
-
query: "laptop",
|
|
2290
|
-
fuzzy_match: true, // Finds variations: notebook, MacBook, etc.
|
|
2291
|
-
category_filter: "hardware",
|
|
2292
|
-
include_variables: true // Get catalog variables too
|
|
2293
|
-
});
|
|
2294
|
-
|
|
2295
|
-
// Direct sys_id lookup (faster than search)
|
|
2296
|
-
snow_get_by_sysid({
|
|
2297
|
-
sys_id: "<artifact_sys_id>",
|
|
2298
|
-
table: "sp_widget"
|
|
2299
|
-
});
|
|
2300
|
-
\`\`\`
|
|
2301
|
-
|
|
2302
|
-
### Flow Development Tools
|
|
2303
|
-
\`\`\`javascript
|
|
2304
|
-
// Create flows from natural language
|
|
2305
|
-
snow_create_flow({
|
|
2306
|
-
instruction: "create a flow that sends email when incident priority is high",
|
|
2307
|
-
deploy_immediately: true // Automatically deploys XML to ServiceNow
|
|
2308
|
-
});
|
|
2309
|
-
|
|
2310
|
-
// Test flows with mock data
|
|
2311
|
-
snow_test_flow_with_mock({
|
|
2312
|
-
flow_id: "incident_notification_flow",
|
|
2313
|
-
create_test_user: true,
|
|
2314
|
-
mock_catalog_items: true,
|
|
2315
|
-
test_inputs: {
|
|
2316
|
-
priority: "1",
|
|
2317
|
-
category: "hardware"
|
|
2318
|
-
},
|
|
2319
|
-
simulate_approvals: true
|
|
2320
|
-
});
|
|
2321
|
-
|
|
2322
|
-
// Link catalog items to flows
|
|
2323
|
-
snow_link_catalog_to_flow({
|
|
2324
|
-
catalog_item_id: "New Laptop Request",
|
|
2325
|
-
flow_id: "laptop_provisioning_flow",
|
|
2326
|
-
link_type: "flow_catalog_process",
|
|
2327
|
-
variable_mapping: [
|
|
2328
|
-
{
|
|
2329
|
-
catalog_variable: "laptop_model",
|
|
2330
|
-
flow_input: "equipment_type"
|
|
2331
|
-
}
|
|
2332
|
-
]
|
|
2333
|
-
});
|
|
2334
|
-
\`\`\`
|
|
2335
|
-
|
|
2336
|
-
### Widget Development Tools
|
|
2337
|
-
\`\`\`javascript
|
|
2338
|
-
// Deploy widgets with automatic validation
|
|
2339
|
-
snow_deploy_widget({
|
|
2340
|
-
name: "incident_dashboard",
|
|
2341
|
-
title: "Incident Dashboard",
|
|
2342
|
-
template: htmlContent,
|
|
2343
|
-
css: cssContent,
|
|
2344
|
-
client_script: clientJS,
|
|
2345
|
-
server_script: serverJS,
|
|
2346
|
-
demo_data: { incidents: [...] }
|
|
2347
|
-
});
|
|
2348
|
-
|
|
2349
|
-
// Preview and test widgets
|
|
2350
|
-
snow_preview_widget({
|
|
2351
|
-
widget_id: "incident_dashboard",
|
|
2352
|
-
check_dependencies: true
|
|
2353
|
-
});
|
|
2354
|
-
|
|
2355
|
-
snow_widget_test({
|
|
2356
|
-
widget_id: "incident_dashboard",
|
|
2357
|
-
test_scenarios: [
|
|
2358
|
-
{
|
|
2359
|
-
name: "Load with no data",
|
|
2360
|
-
server_data: { incidents: [] }
|
|
2361
|
-
}
|
|
2362
|
-
]
|
|
2363
|
-
});
|
|
2364
|
-
\`\`\`
|
|
2365
|
-
|
|
2366
|
-
### Bulk Operations
|
|
2367
|
-
\`\`\`javascript
|
|
2368
|
-
// Deploy multiple artifacts at once
|
|
2369
|
-
snow_bulk_deploy({
|
|
2370
|
-
artifacts: [
|
|
2371
|
-
{ type: "widget", data: widgetData },
|
|
2372
|
-
{ type: "flow", data: flowData },
|
|
2373
|
-
{ type: "script", data: scriptData }
|
|
2374
|
-
],
|
|
2375
|
-
transaction_mode: true, // All or nothing
|
|
2376
|
-
parallel: true, // Deploy simultaneously
|
|
2377
|
-
dry_run: false
|
|
2378
|
-
});
|
|
2379
|
-
\`\`\`
|
|
2380
|
-
|
|
2381
|
-
### Intelligent Analysis
|
|
2382
|
-
\`\`\`javascript
|
|
2383
|
-
// Analyze incidents with AI
|
|
2384
|
-
snow_analyze_incident({
|
|
2385
|
-
incident_id: "INC0010001",
|
|
2386
|
-
include_similar: true,
|
|
2387
|
-
suggest_resolution: true
|
|
2388
|
-
});
|
|
2389
|
-
|
|
2390
|
-
// Pattern analysis
|
|
2391
|
-
snow_pattern__analysis({
|
|
2392
|
-
analysis_type: "incident_patterns",
|
|
2393
|
-
timeframe: "month"
|
|
2394
|
-
});
|
|
2395
|
-
\`\`\`
|
|
2396
|
-
|
|
2397
|
-
## ⚡ Performance Optimization
|
|
2398
|
-
|
|
2399
|
-
### Parallel Execution Patterns
|
|
2400
|
-
\`\`\`javascript
|
|
2401
|
-
// Execute multiple searches concurrently
|
|
2402
|
-
Promise.all([
|
|
2403
|
-
snow_find_artifact({ query: "incident widget" }),
|
|
2404
|
-
snow_catalog_item_search({ query: "laptop" }),
|
|
2405
|
-
snow_query_table({ table: "incident", query: "priority=1" }) // Universal query tool
|
|
2406
|
-
]);
|
|
2407
|
-
\`\`\`
|
|
2408
|
-
|
|
2409
|
-
### Batch File Operations
|
|
2410
|
-
\`\`\`javascript
|
|
2411
|
-
// Read multiple files in one operation
|
|
2412
|
-
MultiRead([
|
|
2413
|
-
"/path/to/widget.html",
|
|
2414
|
-
"/path/to/widget.css",
|
|
2415
|
-
"/path/to/widget.js"
|
|
2416
|
-
]);
|
|
2417
|
-
\`\`\`
|
|
2418
|
-
|
|
2419
|
-
## 📝 Workflow Guidelines
|
|
2420
|
-
|
|
2421
|
-
### Standard Development Flow
|
|
2422
|
-
1. **Discovery Phase**: Use search tools to find existing artifacts
|
|
2423
|
-
2. **Planning Phase**: Use TodoWrite to plan all tasks
|
|
2424
|
-
3. **Development Phase**: Launch agents concurrently
|
|
2425
|
-
4. **Testing Phase**: Use mock testing tools
|
|
2426
|
-
5. **Deployment Phase**: Use bulk deploy with validation
|
|
2427
|
-
|
|
2428
|
-
### Error Recovery Patterns
|
|
2429
|
-
\`\`\`javascript
|
|
2430
|
-
// Always implement rollback strategies
|
|
2431
|
-
if (deployment.failed) {
|
|
2432
|
-
snow_deployment_rollback_manager({
|
|
2433
|
-
update_set_id: deployment.update_set,
|
|
2434
|
-
restore_point: deployment.backup_id
|
|
2435
|
-
});
|
|
2436
|
-
}
|
|
2437
|
-
\`\`\`
|
|
2438
|
-
|
|
2439
|
-
## 🔧 Advanced Configuration
|
|
2440
|
-
|
|
2441
|
-
## Build Commands
|
|
2442
|
-
- \`npm run build\`: Build the project
|
|
2443
|
-
- \`npm run test\`: Run the full test suite
|
|
2444
|
-
- \`npm run lint\`: Run ESLint and format checks
|
|
2445
|
-
- \`npm run typecheck\`: Run TypeScript type checking
|
|
2446
|
-
|
|
2447
|
-
## Snow-Flow Commands
|
|
2448
|
-
- \`snow-flow init\`: Initialize project with MCP servers and SPARC environment and SPARC environment
|
|
2449
|
-
- \`snow-flow auth login\`: Authenticate with ServiceNow OAuth
|
|
2450
|
-
- \`snow-flow swarm "<objective>"\`: Start multi-agent swarm - één command voor alles!
|
|
2451
|
-
- \`snow-flow sparc <mode> "<task>"\`: Run specific SPARC mode
|
|
2452
|
-
|
|
2453
|
-
## Enhanced Swarm Command (v1.1.41+)
|
|
2454
|
-
The swarm command now includes intelligent features that are **enabled by default**:
|
|
2455
|
-
|
|
2456
|
-
\`\`\`bash
|
|
2457
|
-
# Simple usage - ALL autonomous systems enabled by default!
|
|
2458
|
-
snow-flow swarm "create incident management dashboard"
|
|
2459
|
-
|
|
2460
|
-
# Disable specific autonomous systems if needed
|
|
2461
|
-
snow-flow swarm "create simple widget" --no-autonomous-cost-optimization --no-autonomous-compliance
|
|
2462
|
-
|
|
2463
|
-
# Disable ALL autonomous systems
|
|
2464
|
-
snow-flow swarm "basic development only" --no-autonomous-all
|
|
2465
|
-
|
|
2466
|
-
# Force enable all (overrides any --no- flags)
|
|
2467
|
-
snow-flow swarm "full orchestration mode" --autonomous-all
|
|
2468
|
-
\`\`\`
|
|
2469
|
-
|
|
2470
|
-
### 🤖 NEW: Autonomous Systems (v1.3.26+) - **ENABLED BY DEFAULT!**
|
|
2471
|
-
True orchestration with zero manual intervention - all systems active unless disabled:
|
|
2472
|
-
|
|
2473
|
-
- ✅ **Documentation**: Self-documenting system (auto-generates and updates docs)
|
|
2474
|
-
- ✅ **Cost Optimization**: AI-driven cost management with auto-optimization
|
|
2475
|
-
- ✅ **Compliance**: Multi-framework compliance monitoring with auto-remediation
|
|
2476
|
-
- ✅ **Self-Healing**: Predictive failure detection with automatic recovery
|
|
2477
|
-
|
|
2478
|
-
**Disable Options**:
|
|
2479
|
-
- \`--no-autonomous-documentation\`: Disable documentation system
|
|
2480
|
-
- \`--no-autonomous-cost-optimization\`: Disable cost optimization
|
|
2481
|
-
- \`--no-autonomous-compliance\`: Disable compliance monitoring
|
|
2482
|
-
- \`--no-autonomous-healing\`: Disable self-healing
|
|
2483
|
-
- \`--no-autonomous-all\`: Disable ALL autonomous systems
|
|
2484
|
-
|
|
2485
|
-
**Force Options**:
|
|
2486
|
-
- \`--autonomous-all\`: Force enable all (overrides --no- flags)
|
|
2487
|
-
|
|
2488
|
-
**Perfect Orchestrator**: Systems work autonomously, make intelligent decisions, and continuously improve - no manual intervention needed!
|
|
2489
|
-
|
|
2490
|
-
### Default Settings (no flags needed):
|
|
2491
|
-
- ✅ \`--smart-discovery\` - Automatically discovers and reuses existing artifacts
|
|
2492
|
-
- ✅ \`--live-testing\` - Tests in real-time on your ServiceNow instance
|
|
2493
|
-
- ✅ \`--auto-deploy\` - Deploys automatically (safe with update sets)
|
|
2494
|
-
- ✅ \`--auto-rollback\` - Automatically rollbacks on failures
|
|
2495
|
-
- ✅ \`--shared-memory\` - All agents share context and coordination
|
|
2496
|
-
- ✅ \`--progress-monitoring\` - Real-time progress tracking
|
|
2497
|
-
- ❌ \`--auto-permissions\` - Disabled by default (enable with flag for automatic role elevation)
|
|
2498
|
-
|
|
2499
|
-
### Advanced Usage:
|
|
2500
|
-
\`\`\`bash
|
|
2501
|
-
# Enable automatic permission escalation
|
|
2502
|
-
snow-flow swarm "create global workflow" --auto-permissions
|
|
2503
|
-
|
|
2504
|
-
# Disable specific features
|
|
2505
|
-
snow-flow swarm "test widget" --no-auto-deploy --no-live-testing
|
|
2506
|
-
|
|
2507
|
-
# Full control
|
|
2508
|
-
snow-flow swarm "complex integration" \\
|
|
2509
|
-
--max-agents 8 \\
|
|
2510
|
-
--strategy development \\
|
|
2511
|
-
--mode distributed \\
|
|
2512
|
-
--parallel \\
|
|
2513
|
-
--auto-permissions
|
|
2514
|
-
\`\`\`
|
|
2515
|
-
|
|
2516
|
-
## New MCP Tools (v1.1.44+)
|
|
2517
|
-
|
|
2518
|
-
### Catalog Item Search
|
|
2519
|
-
Find catalog items with intelligent fuzzy matching:
|
|
2520
|
-
\`\`\`javascript
|
|
2521
|
-
snow_catalog_item_search({
|
|
2522
|
-
query: "iPhone", // Will find iPhone 6S, iPhone 7, etc.
|
|
2523
|
-
fuzzy_match: true, // Enable intelligent variations
|
|
2524
|
-
include_variables: true // Include catalog variables
|
|
2525
|
-
})
|
|
2526
|
-
\`\`\`
|
|
2527
|
-
|
|
2528
|
-
### Flow Testing with Mock Data
|
|
2529
|
-
Test flows without real data:
|
|
2530
|
-
\`\`\`javascript
|
|
2531
|
-
snow_test_flow_with_mock({
|
|
2532
|
-
flow_id: "equipment_provisioning_flow",
|
|
2533
|
-
create_test_user: true, // Creates test user
|
|
2534
|
-
mock_catalog_items: true, // Creates test catalog items
|
|
2535
|
-
simulate_approvals: true, // Auto-approves during test
|
|
2536
|
-
cleanup_after_test: true // Removes test data after
|
|
2537
|
-
})
|
|
2538
|
-
\`\`\`
|
|
2539
|
-
|
|
2540
|
-
### Direct Catalog-Flow Linking
|
|
2541
|
-
Link catalog items directly to flows:
|
|
2542
|
-
\`\`\`javascript
|
|
2543
|
-
snow_link_catalog_to_flow({
|
|
2544
|
-
catalog_item_id: "iPhone 6S",
|
|
2545
|
-
flow_id: "mobile_provisioning_flow",
|
|
2546
|
-
link_type: "flow_catalog_process", // Modern approach
|
|
2547
|
-
variable_mapping: [
|
|
2548
|
-
{
|
|
2549
|
-
catalog_variable: "phone_model",
|
|
2550
|
-
flow_input: "device_type"
|
|
2551
|
-
}
|
|
2552
|
-
],
|
|
2553
|
-
test_link: true // Creates test request
|
|
2554
|
-
})
|
|
2555
|
-
\`\`\`
|
|
2556
|
-
|
|
2557
|
-
### OAuth Configuration
|
|
2558
|
-
\`\`\`env
|
|
2559
|
-
# .env file
|
|
2560
|
-
SNOW_INSTANCE=dev123456
|
|
2561
|
-
SNOW_CLIENT_ID=your_oauth_client_id
|
|
2562
|
-
SNOW_CLIENT_SECRET=your_oauth_client_secret
|
|
2563
|
-
SNOW_USERNAME=admin
|
|
2564
|
-
SNOW_PASSWORD=admin_password
|
|
2565
|
-
\`\`\`
|
|
2566
|
-
|
|
2567
|
-
### Update Set Management
|
|
2568
|
-
\`\`\`javascript
|
|
2569
|
-
// Smart update set creation
|
|
2570
|
-
snow_smart_update_set({
|
|
2571
|
-
name: "Auto-generated for widget development",
|
|
2572
|
-
detect_context: true, // Auto-detects what you're working on
|
|
2573
|
-
auto_switch: true // Switches when context changes
|
|
2574
|
-
});
|
|
2575
|
-
\`\`\`
|
|
2576
|
-
|
|
2577
|
-
## 🎯 Quick Start
|
|
2578
|
-
1. \`snow-flow init\` - Initialize project with MCP servers and SPARC environment and SPARC environment
|
|
2579
|
-
2. Configure ServiceNow credentials in .env file
|
|
2580
|
-
3. \`snow-flow auth login\` - Authenticate with ServiceNow OAuth
|
|
2581
|
-
4. \`snow-flow swarm "create a widget for incident management"\` - Everything automatic!
|
|
2582
|
-
|
|
2583
|
-
## 💡 Important Notes
|
|
2584
|
-
|
|
2585
|
-
### Do's
|
|
2586
|
-
- ✅ Use TodoWrite extensively for task tracking
|
|
2587
|
-
- ✅ Batch MCP tool calls for performance
|
|
2588
|
-
- ✅ Store important data in Memory for coordination
|
|
2589
|
-
- ✅ Test with mock data before deploying
|
|
2590
|
-
- ✅ Work within Update Sets for safety
|
|
2591
|
-
- ✅ Use fuzzy search for finding artifacts
|
|
2592
|
-
|
|
2593
|
-
### Don'ts
|
|
2594
|
-
- ❌ Don't make sequential tool calls when batch is possible
|
|
2595
|
-
- ❌ Don't hardcode credentials or sys_ids
|
|
2596
|
-
- ❌ Don't deploy without testing
|
|
2597
|
-
- ❌ Don't ignore OAuth permission errors
|
|
2598
|
-
- ❌ Don't create artifacts without checking if they exist
|
|
2599
|
-
|
|
2600
|
-
## 🚀 Performance Benchmarks
|
|
2601
|
-
|
|
2602
|
-
With concurrent execution and batch operations:
|
|
2603
|
-
- **Widget Development**: 3x faster than sequential
|
|
2604
|
-
- **Flow Creation**: 2.5x faster with parallel validation
|
|
2605
|
-
- **Bulk Deployment**: Up to 5x faster with parallel mode
|
|
2606
|
-
- **Search Operations**: 4x faster with concurrent queries
|
|
2607
|
-
|
|
2608
|
-
## 📚 Additional Resources
|
|
2609
|
-
|
|
2610
|
-
### MCP Server Documentation
|
|
2611
|
-
- **servicenow-deployment**: Widget, flow, and application deployment
|
|
2612
|
-
- **servicenow-intelligent**: Smart search and artifact discovery
|
|
2613
|
-
- **servicenow-operations**: Incident management and catalog operations
|
|
2614
|
-
- **servicenow-platform-development**: Scripts, rules, and policies
|
|
2615
|
-
|
|
2616
|
-
### SPARC Modes
|
|
2617
|
-
- \`orchestrator\`: Coordinates complex multi-step tasks
|
|
2618
|
-
- \`coder\`: Focused code implementation
|
|
2619
|
-
- \`researcher\`: Deep _analysis and discovery
|
|
2620
|
-
- \`tester\`: Comprehensive testing strategies
|
|
2621
|
-
- \`architect\`: System design and architecture
|
|
2622
|
-
|
|
2623
|
-
---
|
|
2624
|
-
|
|
2625
|
-
This is a minimal CLAUDE.md file. The full documentation should be available in your Snow-Flow installation.
|
|
2626
|
-
|
|
2627
|
-
## Quick Start
|
|
2628
|
-
1. \`snow-flow init\` - Initialize project with MCP servers and SPARC environment and SPARC environment
|
|
2629
|
-
2. Configure ServiceNow credentials in .env file
|
|
2630
|
-
3. \`snow-flow auth login\` - Authenticate with ServiceNow OAuth
|
|
2631
|
-
4. \`snow-flow swarm "create a widget for incident management"\` - Everything automatic!
|
|
2632
|
-
|
|
2633
|
-
For full documentation, visit: https://github.com/groeimetai/snow-flow
|
|
2634
|
-
`;
|
|
2186
|
+
// Import the template from the dedicated file
|
|
2187
|
+
const { CLAUDE_MD_TEMPLATE } = await Promise.resolve().then(() => __importStar(require('./templates/claude-md-template.js')));
|
|
2188
|
+
claudeMdContent = CLAUDE_MD_TEMPLATE;
|
|
2189
|
+
console.log('✅ Using built-in CLAUDE.md template');
|
|
2635
2190
|
}
|
|
2636
2191
|
const claudeMdPath = (0, path_1.join)(targetDir, 'CLAUDE.md');
|
|
2637
2192
|
try {
|
|
@@ -2650,273 +2205,11 @@ For full documentation, visit: https://github.com/groeimetai/snow-flow
|
|
|
2650
2205
|
}
|
|
2651
2206
|
catch (error) {
|
|
2652
2207
|
console.log('⚠️ Error copying CLAUDE.md, creating Snow-Flow specific version');
|
|
2653
|
-
//
|
|
2654
|
-
const
|
|
2655
|
-
|
|
2656
|
-
## 🚨 CRITICAL: MCP-FIRST WORKFLOW (READ THIS FIRST!)
|
|
2657
|
-
|
|
2658
|
-
**Snow-flow's core value is REAL ServiceNow integration through MCP tools. NEVER work in offline mode!**
|
|
2659
|
-
|
|
2660
|
-
### ⚠️ MANDATORY WORKFLOW - NO EXCEPTIONS
|
|
2661
|
-
|
|
2662
|
-
**Every ServiceNow task MUST start with this sequence:**
|
|
2663
|
-
|
|
2664
|
-
\`\`\`javascript
|
|
2665
|
-
// 1. MANDATORY: Pre-flight authentication check
|
|
2666
|
-
const authCheck = await snow_validate_live_connection({ test_level: "permissions" });
|
|
2667
|
-
if (!authCheck.success) {
|
|
2668
|
-
// STOP! Fix authentication first
|
|
2669
|
-
return authenticationError(authCheck.error);
|
|
2670
|
-
}
|
|
2671
|
-
|
|
2672
|
-
// 2. MANDATORY: Discovery before creation
|
|
2673
|
-
const discovery = await snow_find_artifact({
|
|
2674
|
-
query: "your objective",
|
|
2675
|
-
type: "widget|flow|script|any"
|
|
2676
|
-
});
|
|
2677
|
-
|
|
2678
|
-
// 3. MANDATORY: Real ServiceNow deployment
|
|
2679
|
-
const deployment = await snow_deploy({
|
|
2680
|
-
type: "widget|application", // Note: flow removed in v1.4.0+
|
|
2681
|
-
config: { /* your config */ },
|
|
2682
|
-
auto_update_set: true // Always track changes
|
|
2683
|
-
});
|
|
2684
|
-
|
|
2685
|
-
// 4. MANDATORY: Track in Update Set
|
|
2686
|
-
await snow_update_set_add_artifact({
|
|
2687
|
-
type: deployment.type,
|
|
2688
|
-
sys_id: deployment.result.sys_id,
|
|
2689
|
-
name: deployment.result.name
|
|
2690
|
-
});
|
|
2691
|
-
\`\`\`
|
|
2692
|
-
|
|
2693
|
-
### 🚫 FORBIDDEN ACTIONS
|
|
2694
|
-
|
|
2695
|
-
**THESE ACTIONS ARE BANNED - NEVER DO THESE:**
|
|
2696
|
-
|
|
2697
|
-
❌ **Creating local files** without MCP check first
|
|
2698
|
-
❌ **Generating mock data** instead of using MCP tools
|
|
2699
|
-
❌ **Working in "offline mode"** when ServiceNow is available
|
|
2700
|
-
❌ **Skipping authentication validation**
|
|
2701
|
-
❌ **Planning mode** without trying MCP tools first
|
|
2702
|
-
|
|
2703
|
-
### ✅ CORRECT: MCP-First Decision Tree
|
|
2704
|
-
|
|
2705
|
-
\`\`\`
|
|
2706
|
-
User Request → ALWAYS START HERE:
|
|
2707
|
-
↓
|
|
2708
|
-
1. snow_validate_live_connection()
|
|
2709
|
-
↓
|
|
2710
|
-
SUCCESS? → Continue to Step 2
|
|
2711
|
-
↓
|
|
2712
|
-
FAILURE? → Fix auth: snow_auth_diagnostics()
|
|
2713
|
-
Then guide user: "snow-flow auth login"
|
|
2714
|
-
STOP until auth works
|
|
2715
|
-
↓
|
|
2716
|
-
2. snow_find_artifact() // Check if exists
|
|
2717
|
-
↓
|
|
2718
|
-
FOUND? → Ask: "Reuse existing or create new?"
|
|
2719
|
-
↓
|
|
2720
|
-
NOT FOUND? → Continue to Step 3
|
|
2721
|
-
↓
|
|
2722
|
-
3. snow_deploy() // Real deployment to ServiceNow
|
|
2723
|
-
↓
|
|
2724
|
-
SUCCESS? → Step 4: Track in Update Set
|
|
2725
|
-
↓
|
|
2726
|
-
FAILURE? → Use fallback strategies
|
|
2727
|
-
↓
|
|
2728
|
-
4. snow_update_set_add_artifact() // Always track
|
|
2729
|
-
↓
|
|
2730
|
-
DONE! ✅
|
|
2731
|
-
\`\`\`
|
|
2732
|
-
|
|
2733
|
-
## 🚀 Snow-Flow Swarm Command - MCP-Orchestrated Multi-Agent Intelligence
|
|
2734
|
-
|
|
2735
|
-
**The Swarm system is MCP-native and ALWAYS uses ServiceNow tools first!**
|
|
2736
|
-
|
|
2737
|
-
### 🧠 Queen Agent with Parallel Execution (v1.4.0+)
|
|
2738
|
-
- Automatically spawns 6+ specialized agents for widget development
|
|
2739
|
-
- Achieves proven 2.8x speedup through intelligent parallel execution
|
|
2740
|
-
- All agents coordinate through Snow-Flow's memory system
|
|
2741
|
-
- Every agent uses MCP tools directly - no offline mode
|
|
2742
|
-
|
|
2743
|
-
### Swarm Command Examples
|
|
2744
|
-
\`\`\`bash
|
|
2745
|
-
# Simple widget creation
|
|
2746
|
-
snow-flow swarm "create incident dashboard widget"
|
|
2747
|
-
|
|
2748
|
-
# Complex development
|
|
2749
|
-
snow-flow swarm "build employee onboarding portal with approval workflows"
|
|
2750
|
-
|
|
2751
|
-
# With specific options
|
|
2752
|
-
snow-flow swarm "create service catalog item" --no-auto-deploy --monitor
|
|
2753
|
-
\`\`\`
|
|
2754
|
-
|
|
2755
|
-
## 🛠️ Complete ServiceNow MCP Tools Reference
|
|
2756
|
-
|
|
2757
|
-
### Discovery & Search Tools
|
|
2758
|
-
\`\`\`javascript
|
|
2759
|
-
// Find any ServiceNow artifact using natural language
|
|
2760
|
-
snow_find_artifact({
|
|
2761
|
-
query: "the widget that shows incidents on homepage",
|
|
2762
|
-
type: "widget" // or "flow", "script", "application", "any"
|
|
2763
|
-
});
|
|
2764
|
-
|
|
2765
|
-
// Search catalog items with fuzzy matching
|
|
2766
|
-
snow_catalog_item_search({
|
|
2767
|
-
query: "laptop",
|
|
2768
|
-
fuzzy_match: true, // Finds variations: notebook, MacBook, etc.
|
|
2769
|
-
include_variables: true // Include catalog variables
|
|
2770
|
-
});
|
|
2771
|
-
|
|
2772
|
-
// Comprehensive search across all tables
|
|
2773
|
-
snow_comprehensive_search({
|
|
2774
|
-
query: "approval",
|
|
2775
|
-
include_inactive: false
|
|
2776
|
-
});
|
|
2777
|
-
\`\`\`
|
|
2778
|
-
|
|
2779
|
-
### Deployment Tools
|
|
2780
|
-
\`\`\`javascript
|
|
2781
|
-
// Universal deployment tool
|
|
2782
|
-
snow_deploy({
|
|
2783
|
-
type: "widget",
|
|
2784
|
-
config: {
|
|
2785
|
-
name: "Incident Dashboard",
|
|
2786
|
-
template: "<html>...</html>",
|
|
2787
|
-
css: "/* styles */",
|
|
2788
|
-
server_script: "// server code",
|
|
2789
|
-
client_script: "// client code"
|
|
2790
|
-
},
|
|
2791
|
-
auto_update_set: true
|
|
2792
|
-
});
|
|
2793
|
-
|
|
2794
|
-
// Bulk deployment
|
|
2795
|
-
snow_bulk_deploy({
|
|
2796
|
-
artifacts: [...],
|
|
2797
|
-
transaction_mode: true,
|
|
2798
|
-
rollback_on_error: true
|
|
2799
|
-
});
|
|
2800
|
-
\`\`\`
|
|
2801
|
-
|
|
2802
|
-
### Update Set Management
|
|
2803
|
-
\`\`\`javascript
|
|
2804
|
-
// Ensure active Update Set
|
|
2805
|
-
snow_ensure_active_update_set({
|
|
2806
|
-
context: "Widget development"
|
|
2807
|
-
});
|
|
2808
|
-
|
|
2809
|
-
// Track artifacts
|
|
2810
|
-
snow_update_set_add_artifact({
|
|
2811
|
-
type: "widget",
|
|
2812
|
-
sys_id: "abc123",
|
|
2813
|
-
name: "My Widget"
|
|
2814
|
-
});
|
|
2815
|
-
|
|
2816
|
-
// Preview changes
|
|
2817
|
-
snow_update_set_preview({
|
|
2818
|
-
update_set_id: "current"
|
|
2819
|
-
});
|
|
2820
|
-
\`\`\`
|
|
2821
|
-
|
|
2822
|
-
### Testing Tools
|
|
2823
|
-
\`\`\`javascript
|
|
2824
|
-
// Test flows with mock data
|
|
2825
|
-
snow_test_flow_with_mock({
|
|
2826
|
-
flow_id: "equipment_provisioning_flow",
|
|
2827
|
-
create_test_user: true,
|
|
2828
|
-
mock_catalog_items: true,
|
|
2829
|
-
simulate_approvals: true,
|
|
2830
|
-
cleanup_after_test: true
|
|
2831
|
-
});
|
|
2832
|
-
|
|
2833
|
-
// Link catalog to flow
|
|
2834
|
-
snow_link_catalog_to_flow({
|
|
2835
|
-
catalog_item_id: "iPhone 6S",
|
|
2836
|
-
flow_id: "mobile_provisioning_flow",
|
|
2837
|
-
test_link: true
|
|
2838
|
-
});
|
|
2839
|
-
\`\`\`
|
|
2840
|
-
|
|
2841
|
-
## 📋 Essential Patterns
|
|
2842
|
-
|
|
2843
|
-
### Authentication Handling
|
|
2844
|
-
\`\`\`javascript
|
|
2845
|
-
// Always handle auth failures gracefully
|
|
2846
|
-
if (error.includes('401') || error.includes('403')) {
|
|
2847
|
-
// Guide user to fix authentication
|
|
2848
|
-
console.log('Run: snow-flow auth login');
|
|
2849
|
-
console.log('Check .env file for credentials');
|
|
2850
|
-
// STOP - don't continue without auth
|
|
2851
|
-
}
|
|
2852
|
-
\`\`\`
|
|
2853
|
-
|
|
2854
|
-
### Error Recovery
|
|
2855
|
-
\`\`\`javascript
|
|
2856
|
-
// Implement fallback strategies
|
|
2857
|
-
if (deployment.failed) {
|
|
2858
|
-
// Try global scope
|
|
2859
|
-
const globalAttempt = await snow_deploy({
|
|
2860
|
-
...config,
|
|
2861
|
-
scope_preference: 'global'
|
|
2862
|
-
});
|
|
2863
|
-
|
|
2864
|
-
if (globalAttempt.failed) {
|
|
2865
|
-
// Provide manual instructions
|
|
2866
|
-
return createManualStepsGuide(config, error);
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
\`\`\`
|
|
2870
|
-
|
|
2871
|
-
## 🔧 Configuration
|
|
2872
|
-
|
|
2873
|
-
### Build Commands
|
|
2874
|
-
- \`npm run build\`: Build the project
|
|
2875
|
-
- \`npm run test\`: Run the full test suite
|
|
2876
|
-
- \`npm run lint\`: Run ESLint and format checks
|
|
2877
|
-
- \`npm run typecheck\`: Run TypeScript type checking
|
|
2878
|
-
|
|
2879
|
-
### Snow-Flow Commands
|
|
2880
|
-
- \`snow-flow init\`: Initialize project with MCP servers and SPARC environment
|
|
2881
|
-
- \`snow-flow auth login\`: Authenticate with ServiceNow
|
|
2882
|
-
- \`snow-flow swarm "<objective>"\`: Execute multi-agent development
|
|
2883
|
-
- \`snow-flow mcp start\`: Start MCP servers manually
|
|
2884
|
-
|
|
2885
|
-
### Environment Setup
|
|
2886
|
-
\`\`\`bash
|
|
2887
|
-
# .env file
|
|
2888
|
-
SNOW_INSTANCE=dev123456
|
|
2889
|
-
SNOW_CLIENT_ID=your_oauth_client_id
|
|
2890
|
-
SNOW_CLIENT_SECRET=your_oauth_client_secret
|
|
2891
|
-
\`\`\`
|
|
2892
|
-
|
|
2893
|
-
## 💡 Best Practices
|
|
2894
|
-
|
|
2895
|
-
### DO's
|
|
2896
|
-
✅ Always use \`snow_validate_live_connection()\` first
|
|
2897
|
-
✅ Check for existing artifacts with \`snow_find_artifact()\`
|
|
2898
|
-
✅ Use Update Sets for all changes
|
|
2899
|
-
✅ Test with mock data before production
|
|
2900
|
-
✅ Handle errors gracefully with fallbacks
|
|
2901
|
-
|
|
2902
|
-
### DON'Ts
|
|
2903
|
-
❌ Don't create local files first
|
|
2904
|
-
❌ Don't skip authentication
|
|
2905
|
-
❌ Don't hardcode sys_ids or credentials
|
|
2906
|
-
❌ Don't work in offline mode
|
|
2907
|
-
❌ Don't deploy without testing
|
|
2908
|
-
|
|
2909
|
-
## 🎯 Quick Start
|
|
2910
|
-
1. \`snow-flow init\` - Initialize project with MCP servers and SPARC environment
|
|
2911
|
-
2. Configure ServiceNow credentials in .env file
|
|
2912
|
-
3. \`snow-flow auth login\` - Authenticate with ServiceNow
|
|
2913
|
-
4. \`snow-flow swarm "create a widget for incident management"\` - Everything automatic!
|
|
2914
|
-
|
|
2915
|
-
For full documentation, visit: https://github.com/groeimetai/snow-flow
|
|
2916
|
-
`;
|
|
2208
|
+
// Import the template as fallback
|
|
2209
|
+
const { CLAUDE_MD_TEMPLATE } = await Promise.resolve().then(() => __importStar(require('./templates/claude-md-template.js')));
|
|
2917
2210
|
const claudeMdPath = (0, path_1.join)(targetDir, 'CLAUDE.md');
|
|
2918
2211
|
if (force || !(0, fs_2.existsSync)(claudeMdPath)) {
|
|
2919
|
-
await fs_1.promises.writeFile(claudeMdPath,
|
|
2212
|
+
await fs_1.promises.writeFile(claudeMdPath, CLAUDE_MD_TEMPLATE);
|
|
2920
2213
|
}
|
|
2921
2214
|
}
|
|
2922
2215
|
}
|