snow-flow 1.4.4 → 1.4.6

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.
@@ -9,15 +9,6 @@
9
9
  "SNOW_CLIENT_SECRET": "{{SNOW_CLIENT_SECRET}}"
10
10
  }
11
11
  },
12
- "servicenow-flow-composer": {
13
- "command": "node",
14
- "args": ["{{PROJECT_ROOT}}/dist/mcp/servicenow-flow-composer-mcp.js"],
15
- "env": {
16
- "SNOW_INSTANCE": "{{SNOW_INSTANCE}}",
17
- "SNOW_CLIENT_ID": "{{SNOW_CLIENT_ID}}",
18
- "SNOW_CLIENT_SECRET": "{{SNOW_CLIENT_SECRET}}"
19
- }
20
- },
21
12
  "servicenow-update-set": {
22
13
  "command": "node",
23
14
  "args": ["{{PROJECT_ROOT}}/dist/mcp/servicenow-update-set-mcp.js"],
package/CLAUDE.md CHANGED
@@ -1,186 +1,262 @@
1
- # Claude Code Configuration - SPARC Development Environment (Batchtools Optimized)
1
+ # Snow-Flow Development with Claude Code
2
2
 
3
- ⚠️ **WARNING: FLOW CREATION REMOVED (v1.4.0+)** ⚠️
3
+ ## 🚨 CRITICAL: MCP-FIRST WORKFLOW (READ THIS FIRST!)
4
4
 
5
- Flow Designer functionality has been removed due to critical issues.
6
- Please use ServiceNow's native Flow Designer interface directly.
5
+ **Snow-flow's core value is REAL ServiceNow integration through MCP tools. NEVER work in offline mode!**
7
6
 
8
- Snow-flow now focuses on:
9
- - Widget development and deployment
10
- - Update Set management
11
- - ServiceNow authentication
12
- - Table/field discovery
13
- - Multi-agent coordination
7
+ ### ⚠️ MANDATORY WORKFLOW - NO EXCEPTIONS
14
8
 
15
- ## 🚨 CRITICAL: CONCURRENT EXECUTION FOR ALL ACTIONS
9
+ **Every ServiceNow task MUST start with this sequence:**
16
10
 
17
- **ABSOLUTE RULE**: ALL operations MUST be concurrent/parallel in a single message:
11
+ ```javascript
12
+ // 1. MANDATORY: Pre-flight authentication check
13
+ const authCheck = await snow_validate_live_connection({ test_level: "permissions" });
14
+ if (!authCheck.success) {
15
+ // STOP! Fix authentication first
16
+ return authenticationError(authCheck.error);
17
+ }
18
+
19
+ // 2. MANDATORY: Discovery before creation
20
+ const discovery = await snow_find_artifact({
21
+ query: "your objective",
22
+ type: "widget|flow|script|any"
23
+ });
24
+
25
+ // 3. MANDATORY: Real ServiceNow deployment
26
+ const deployment = await snow_deploy({
27
+ type: "widget|application", // Note: flow removed in v1.4.0+
28
+ config: { /* your config */ },
29
+ auto_update_set: true // Always track changes
30
+ });
31
+
32
+ // 4. MANDATORY: Track in Update Set
33
+ await snow_update_set_add_artifact({
34
+ type: deployment.type,
35
+ sys_id: deployment.result.sys_id,
36
+ name: deployment.result.name
37
+ });
38
+ ```
18
39
 
19
- ### 🔴 MANDATORY CONCURRENT PATTERNS:
20
- 1. **TodoWrite**: ALWAYS batch ALL todos in ONE call (5-10+ todos minimum)
21
- 2. **Task tool**: ALWAYS spawn ALL agents in ONE message with full instructions
22
- 3. **File operations**: ALWAYS batch ALL reads/writes/edits in ONE message
23
- 4. **Bash commands**: ALWAYS batch ALL terminal operations in ONE message
24
- 5. **Memory operations**: ALWAYS batch ALL memory store/retrieve in ONE message
40
+ ### 🚫 FORBIDDEN ACTIONS
25
41
 
26
- ### GOLDEN RULE: "1 MESSAGE = ALL RELATED OPERATIONS"
42
+ **THESE ACTIONS ARE BANNED - NEVER DO THESE:**
27
43
 
28
- **Examples of CORRECT concurrent execution:**
29
- ```javascript
30
- // CORRECT: Everything in ONE message
31
- [Single Message]:
32
- - TodoWrite { todos: [10+ todos with all statuses/priorities] }
33
- - Task("Agent 1 with full instructions and hooks")
34
- - Task("Agent 2 with full instructions and hooks")
35
- - Task("Agent 3 with full instructions and hooks")
36
- - Read("file1.js")
37
- - Read("file2.js")
38
- - Write("output1.js", content)
39
- - Write("output2.js", content)
40
- - Bash("npm install")
41
- - Bash("npm test")
42
- - Bash("npm run build")
43
- ```
44
+ **Creating local files** without MCP check first
45
+ ❌ **Generating mock data** instead of using MCP tools
46
+ **Working in "offline mode"** when ServiceNow is available
47
+ **Skipping authentication validation**
48
+ **Planning mode** without trying MCP tools first
44
49
 
45
- **Examples of WRONG sequential execution:**
46
- ```javascript
47
- // ❌ WRONG: Multiple messages (NEVER DO THIS)
48
- Message 1: TodoWrite { todos: [single todo] }
49
- Message 2: Task("Agent 1")
50
- Message 3: Task("Agent 2")
51
- Message 4: Read("file1.js")
52
- Message 5: Write("output1.js")
53
- Message 6: Bash("npm install")
54
- // This is 6x slower and breaks coordination!
55
- ```
50
+ ### CORRECT: MCP-First Decision Tree
56
51
 
57
- ### 🎯 CONCURRENT EXECUTION CHECKLIST:
52
+ ```
53
+ User Request → ALWAYS START HERE:
54
+
55
+ 1. snow_validate_live_connection()
56
+
57
+ SUCCESS? → Continue to Step 2
58
+
59
+ FAILURE? → Fix auth: snow_auth_diagnostics()
60
+ Then guide user: "snow-flow auth login"
61
+ STOP until auth works
62
+
63
+ 2. snow_find_artifact() // Check if exists
64
+
65
+ FOUND? → Ask: "Reuse existing or create new?"
66
+
67
+ NOT FOUND? → Continue to Step 3
68
+
69
+ 3. snow_deploy() // Real deployment to ServiceNow
70
+
71
+ SUCCESS? → Step 4: Track in Update Set
72
+
73
+ FAILURE? → Use fallback strategies
74
+
75
+ 4. snow_update_set_add_artifact() // Always track
76
+
77
+ DONE! ✅
78
+ ```
58
79
 
59
- Before sending ANY message, ask yourself:
60
- - ✅ Are ALL related TodoWrite operations batched together?
61
- - ✅ Are ALL Task spawning operations in ONE message?
62
- - ✅ Are ALL file operations (Read/Write/Edit) batched together?
63
- - ✅ Are ALL bash commands grouped in ONE message?
64
- - ✅ Are ALL memory operations concurrent?
80
+ ## 🚀 Snow-Flow Swarm Command - MCP-Orchestrated Multi-Agent Intelligence
65
81
 
66
- If ANY answer is "No", you MUST combine operations into a single message!
82
+ **The Swarm system is MCP-native and ALWAYS uses ServiceNow tools first!**
67
83
 
68
- ## Project Overview
69
- This project uses the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology for systematic Test-Driven Development with AI assistance through Claude-Flow orchestration.
84
+ ### 🧠 Queen Agent with Parallel Execution (v1.4.0+)
85
+ - Automatically spawns 6+ specialized agents for widget development
86
+ - Achieves proven 2.8x speedup through intelligent parallel execution
87
+ - All agents coordinate through Snow-Flow's memory system
88
+ - Every agent uses MCP tools directly - no offline mode
70
89
 
71
- **🚀 Batchtools Optimization Enabled**: This configuration includes optimized prompts and parallel processing capabilities for improved performance and efficiency.
90
+ ### Swarm Command Examples
91
+ ```bash
92
+ # Simple widget creation
93
+ snow-flow swarm "create incident dashboard widget"
72
94
 
73
- ## SPARC Development Commands
95
+ # Complex development
96
+ snow-flow swarm "build employee onboarding portal with approval workflows"
74
97
 
75
- ### Core SPARC Commands
76
- - `npx claude-flow sparc modes`: List all available SPARC development modes
77
- - `npx claude-flow sparc run <mode> "<task>"`: Execute specific SPARC mode for a task
78
- - `npx claude-flow sparc tdd "<feature>"`: Run complete TDD workflow using SPARC methodology
79
- - `npx claude-flow sparc info <mode>`: Get detailed information about a specific mode
98
+ # With specific options
99
+ snow-flow swarm "create service catalog item" --no-auto-deploy --monitor
100
+ ```
80
101
 
81
- ### Batchtools Commands (Optimized)
82
- - `npx claude-flow sparc batch <modes> "<task>"`: Execute multiple SPARC modes in parallel
83
- - `npx claude-flow sparc pipeline "<task>"`: Execute full SPARC pipeline with parallel processing
84
- - `npx claude-flow sparc concurrent <mode> "<tasks-file>"`: Process multiple tasks concurrently
102
+ ## 🛠️ Complete ServiceNow MCP Tools Reference
85
103
 
86
- ### Standard Build Commands
87
- - `npm run build`: Build the project
88
- - `npm run test`: Run the test suite
89
- - `npm run lint`: Run linter and format checks
90
- - `npm run typecheck`: Run TypeScript type checking
104
+ ### Discovery & Search Tools
105
+ ```javascript
106
+ // Find any ServiceNow artifact using natural language
107
+ snow_find_artifact({
108
+ query: "the widget that shows incidents on homepage",
109
+ type: "widget" // or "flow", "script", "application", "any"
110
+ });
111
+
112
+ // Search catalog items with fuzzy matching
113
+ snow_catalog_item_search({
114
+ query: "laptop",
115
+ fuzzy_match: true, // Finds variations: notebook, MacBook, etc.
116
+ include_variables: true // Include catalog variables
117
+ });
118
+
119
+ // Comprehensive search across all tables
120
+ snow_comprehensive_search({
121
+ query: "approval",
122
+ include_inactive: false
123
+ });
124
+ ```
91
125
 
92
- ## SPARC Methodology Workflow (Batchtools Enhanced)
126
+ ### Deployment Tools
127
+ ```javascript
128
+ // Universal deployment tool
129
+ snow_deploy({
130
+ type: "widget",
131
+ config: {
132
+ name: "Incident Dashboard",
133
+ template: "<html>...</html>",
134
+ css: "/* styles */",
135
+ server_script: "// server code",
136
+ client_script: "// client code"
137
+ },
138
+ auto_update_set: true
139
+ });
140
+
141
+ // Bulk deployment
142
+ snow_bulk_deploy({
143
+ artifacts: [...],
144
+ transaction_mode: true,
145
+ rollback_on_error: true
146
+ });
147
+ ```
93
148
 
94
- ### 1. Specification Phase (Parallel Analysis)
95
- ```bash
96
- # Create detailed specifications with concurrent requirements analysis
97
- npx claude-flow sparc run spec-pseudocode "Define user authentication requirements" --parallel
149
+ ### Update Set Management
150
+ ```javascript
151
+ // Ensure active Update Set
152
+ snow_ensure_active_update_set({
153
+ context: "Widget development"
154
+ });
155
+
156
+ // Track artifacts
157
+ snow_update_set_add_artifact({
158
+ type: "widget",
159
+ sys_id: "abc123",
160
+ name: "My Widget"
161
+ });
162
+
163
+ // Preview changes
164
+ snow_update_set_preview({
165
+ update_set_id: "current"
166
+ });
98
167
  ```
99
- **Batchtools Optimization**: Simultaneously analyze multiple requirement sources, validate constraints in parallel, and generate comprehensive specifications.
100
168
 
101
- ### 2. Pseudocode Phase (Concurrent Logic Design)
102
- ```bash
103
- # Develop algorithmic logic with parallel pattern analysis
104
- npx claude-flow sparc run spec-pseudocode "Create authentication flow pseudocode" --batch-optimize
169
+ ### Testing Tools
170
+ ```javascript
171
+ // Test flows with mock data
172
+ snow_test_flow_with_mock({
173
+ flow_id: "equipment_provisioning_flow",
174
+ create_test_user: true,
175
+ mock_catalog_items: true,
176
+ simulate_approvals: true,
177
+ cleanup_after_test: true
178
+ });
179
+
180
+ // Link catalog to flow
181
+ snow_link_catalog_to_flow({
182
+ catalog_item_id: "iPhone 6S",
183
+ flow_id: "mobile_provisioning_flow",
184
+ test_link: true
185
+ });
105
186
  ```
106
- **Batchtools Optimization**: Process multiple algorithm patterns concurrently, validate logic flows in parallel, and optimize data structures simultaneously.
107
187
 
108
- ### 3. Architecture Phase (Parallel Component Design)
109
- ```bash
110
- # Design system architecture with concurrent component analysis
111
- npx claude-flow sparc run architect "Design authentication service architecture" --parallel
188
+ ## 📋 Essential Patterns
189
+
190
+ ### Authentication Handling
191
+ ```javascript
192
+ // Always handle auth failures gracefully
193
+ if (error.includes('401') || error.includes('403')) {
194
+ // Guide user to fix authentication
195
+ console.log('Run: snow-flow auth login');
196
+ console.log('Check .env file for credentials');
197
+ // STOP - don't continue without auth
198
+ }
112
199
  ```
113
- **Batchtools Optimization**: Generate multiple architectural alternatives simultaneously, validate integration points in parallel, and create comprehensive documentation concurrently.
114
200
 
115
- ### 4. Refinement Phase (Parallel TDD Implementation)
116
- ```bash
117
- # Execute Test-Driven Development with parallel test generation
118
- npx claude-flow sparc tdd "implement user authentication system" --batch-tdd
201
+ ### Error Recovery
202
+ ```javascript
203
+ // Implement fallback strategies
204
+ if (deployment.failed) {
205
+ // Try global scope
206
+ const globalAttempt = await snow_deploy({
207
+ ...config,
208
+ scope_preference: 'global'
209
+ });
210
+
211
+ if (globalAttempt.failed) {
212
+ // Provide manual instructions
213
+ return createManualStepsGuide(config, error);
214
+ }
215
+ }
119
216
  ```
120
- **Batchtools Optimization**: Generate multiple test scenarios simultaneously, implement and validate code in parallel, and optimize performance concurrently.
121
217
 
122
- ### 5. Completion Phase (Concurrent Integration)
218
+ ## 🔧 Configuration
219
+
220
+ ### Build Commands
221
+ - `npm run build`: Build the project
222
+ - `npm run test`: Run the full test suite
223
+ - `npm run lint`: Run ESLint and format checks
224
+ - `npm run typecheck`: Run TypeScript type checking
225
+
226
+ ### Snow-Flow Commands
227
+ - `snow-flow init --sparc`: Initialize project with MCP servers
228
+ - `snow-flow auth login`: Authenticate with ServiceNow
229
+ - `snow-flow swarm "<objective>"`: Execute multi-agent development
230
+ - `snow-flow mcp start`: Start MCP servers manually
231
+
232
+ ### Environment Setup
123
233
  ```bash
124
- # Integration with parallel validation and documentation
125
- npx claude-flow sparc run integration "integrate authentication with user management" --parallel
234
+ # .env file
235
+ SNOW_INSTANCE=dev123456
236
+ SNOW_CLIENT_ID=your_oauth_client_id
237
+ SNOW_CLIENT_SECRET=your_oauth_client_secret
126
238
  ```
127
- **Batchtools Optimization**: Run integration tests in parallel, generate documentation concurrently, and validate requirements simultaneously.
128
-
129
- ## Batchtools Integration Features
130
-
131
- ### Parallel Processing Capabilities
132
- - **Concurrent File Operations**: Read, analyze, and modify multiple files simultaneously
133
- - **Parallel Code Analysis**: Analyze dependencies, patterns, and architecture concurrently
134
- - **Batch Test Generation**: Create comprehensive test suites in parallel
135
- - **Concurrent Documentation**: Generate multiple documentation formats simultaneously
136
-
137
- ### Performance Optimizations
138
- - **Smart Batching**: Group related operations for optimal performance
139
- - **Pipeline Processing**: Chain dependent operations with parallel stages
140
- - **Resource Management**: Efficient utilization of system resources
141
- - **Error Resilience**: Robust error handling with parallel recovery
142
-
143
- ## Performance Benchmarks
144
-
145
- ### Batchtools Performance Improvements
146
- - **File Operations**: Up to 300% faster with parallel processing
147
- - **Code Analysis**: 250% improvement with concurrent pattern recognition
148
- - **Test Generation**: 400% faster with parallel test creation
149
- - **Documentation**: 200% improvement with concurrent content generation
150
- - **Memory Operations**: 180% faster with batched read/write operations
151
-
152
- ## Code Style and Best Practices (Batchtools Enhanced)
153
-
154
- ### SPARC Development Principles with Batchtools
155
- - **Modular Design**: Keep files under 500 lines, optimize with parallel analysis
156
- - **Environment Safety**: Never hardcode secrets, validate with concurrent checks
157
- - **Test-First**: Always write tests before implementation using parallel generation
158
- - **Clean Architecture**: Separate concerns with concurrent validation
159
- - **Parallel Documentation**: Maintain clear, up-to-date documentation with concurrent updates
160
-
161
- ### Batchtools Best Practices
162
- - **Parallel Operations**: Use batchtools for independent tasks
163
- - **Concurrent Validation**: Validate multiple aspects simultaneously
164
- - **Batch Processing**: Group similar operations for efficiency
165
- - **Pipeline Optimization**: Chain operations with parallel stages
166
- - **Resource Management**: Monitor and optimize resource usage
167
-
168
- ## Important Notes (Enhanced)
169
-
170
- - Always run tests before committing with parallel execution (`npm run test --parallel`)
171
- - Use SPARC memory system with concurrent operations to maintain context across sessions
172
- - Follow the Red-Green-Refactor cycle with parallel test generation during TDD phases
173
- - Document architectural decisions with concurrent validation in memory
174
- - Regular security reviews with parallel analysis for authentication or data handling code
175
- - Claude Code slash commands provide quick access to batchtools-optimized SPARC modes
176
- - Monitor system resources during parallel operations for optimal performance
177
-
178
- For more information about SPARC methodology and batchtools optimization, see:
179
- - SPARC Guide: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
180
- - Batchtools Documentation: https://github.com/ruvnet/claude-code-flow/docs/batchtools.md
181
-
182
- # important-instruction-reminders
183
- Do what has been asked; nothing more, nothing less.
184
- NEVER create files unless they're absolutely necessary for achieving your goal.
185
- ALWAYS prefer editing an existing file to creating a new one.
186
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
239
+
240
+ ## 💡 Best Practices
241
+
242
+ ### DO's
243
+ Always use `snow_validate_live_connection()` first
244
+ Check for existing artifacts with `snow_find_artifact()`
245
+ Use Update Sets for all changes
246
+ Test with mock data before production
247
+ Handle errors gracefully with fallbacks
248
+
249
+ ### DON'Ts
250
+ Don't create local files first
251
+ Don't skip authentication
252
+ Don't hardcode sys_ids or credentials
253
+ Don't work in offline mode
254
+ ❌ Don't deploy without testing
255
+
256
+ ## 🎯 Quick Start
257
+ 1. `snow-flow init --sparc` - Initialize project with MCP servers
258
+ 2. Configure ServiceNow credentials in .env file
259
+ 3. `snow-flow auth login` - Authenticate with ServiceNow
260
+ 4. `snow-flow swarm "create a widget for incident management"` - Everything automatic!
261
+
262
+ For full documentation, visit: https://github.com/groeimetai/snow-flow