snow-flow 2.0.2 → 2.0.3

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.
Files changed (173) hide show
  1. package/{.claude/mcp-config.json → .mcp.json} +13 -12
  2. package/.releaserc.json +47 -0
  3. package/README.md +6 -0
  4. package/package.json +1 -1
  5. package/.claude/claude-settings.json +0 -15
  6. package/.claude/commands/analysis/README.md +0 -9
  7. package/.claude/commands/automation/README.md +0 -9
  8. package/.claude/commands/github/README.md +0 -11
  9. package/.claude/commands/helpers/standard-checkpoint-hooks.sh +0 -179
  10. package/.claude/commands/hooks/README.md +0 -11
  11. package/.claude/commands/monitoring/README.md +0 -9
  12. package/.claude/commands/optimization/README.md +0 -9
  13. package/.claude/commands/training/README.md +0 -9
  14. package/.claude/commands/workflows/README.md +0 -9
  15. package/.claude/config.json +0 -36
  16. package/.claude/helpers/github-setup.sh +0 -28
  17. package/.claude/helpers/quick-start.sh +0 -19
  18. package/.claude/helpers/setup-mcp.sh +0 -18
  19. package/.claude/settings.json +0 -114
  20. package/.claude/settings.local.json +0 -33
  21. package/.claude-flow/metrics/agent-metrics.json +0 -1
  22. package/.claude-flow/metrics/performance.json +0 -9
  23. package/.claude-flow/metrics/system-metrics.json +0 -15986
  24. package/.claude-flow/metrics/task-metrics.json +0 -10
  25. package/.roo/README.md +0 -402
  26. package/.roo/mcp-list.txt +0 -257
  27. package/.roo/mcp.json +0 -32
  28. package/.roo/workflows/basic-tdd.json +0 -32
  29. package/.roomodes +0 -201
  30. package/CLAUDE.md +0 -393
  31. package/bin/snow-flow.js +0 -3
  32. package/dist/cli.js.bak +0 -2052
  33. package/dist/config/snow-flow-config.d.ts +0 -1492
  34. package/dist/config/snow-flow-config.js +0 -938
  35. package/scripts/create-env.js +0 -91
  36. package/scripts/postinstall.js +0 -30
  37. package/scripts/register-mcp-servers.js +0 -210
  38. package/scripts/reset-mcp-servers.js +0 -246
  39. package/scripts/setup-mcp.js +0 -106
  40. package/scripts/update-version.js +0 -31
  41. package/src/agents/README.md +0 -192
  42. package/src/agents/base-agent.ts +0 -251
  43. package/src/agents/coordinator.ts +0 -971
  44. package/src/agents/index.ts +0 -18
  45. package/src/agents/queen-403-handler.ts +0 -230
  46. package/src/agents/queen-agent.ts +0 -1399
  47. package/src/agents/script-writer-agent.ts +0 -769
  48. package/src/agents/security-agent.ts +0 -726
  49. package/src/agents/widget-creator-agent.ts +0 -568
  50. package/src/api/error-handling.ts +0 -1758
  51. package/src/api/natural-language-mapper.ts +0 -630
  52. package/src/api/performance-optimizer.ts +0 -891
  53. package/src/api/transaction-manager.ts +0 -754
  54. package/src/cli/deploy-artifact.ts +0 -304
  55. package/src/cli/snow-flow-cli-integration.ts +0 -434
  56. package/src/cli.ts +0 -4455
  57. package/src/cli.ts.bak +0 -5616
  58. package/src/compliance/advanced-compliance-system.ts +0 -1268
  59. package/src/compliance/index.ts +0 -19
  60. package/src/config/snow-flow-config.ts +0 -1019
  61. package/src/documentation/index.ts +0 -16
  62. package/src/documentation/self-documenting-system.ts +0 -1421
  63. package/src/dynamic-version.ts +0 -44
  64. package/src/healing/index.ts +0 -20
  65. package/src/healing/self-healing-system.ts +0 -1435
  66. package/src/health/README.md +0 -161
  67. package/src/health/system-health.ts +0 -995
  68. package/src/index.ts +0 -60
  69. package/src/intelligence/acl-analyzer.ts +0 -377
  70. package/src/intelligence/auto-resolution-engine.ts +0 -643
  71. package/src/intelligence/gap-analysis-engine.ts +0 -488
  72. package/src/intelligence/manual-instructions-generator.ts +0 -744
  73. package/src/intelligence/mcp-coverage-analyzer.ts +0 -708
  74. package/src/intelligence/multi-pass-requirements-analyzer.ts +0 -603
  75. package/src/intelligence/performance-recommendations-engine.ts +0 -1223
  76. package/src/intelligence/requirements-analyzer.ts +0 -1148
  77. package/src/intelligence/task-analyzer.ts +0 -628
  78. package/src/managers/scope-manager.ts +0 -555
  79. package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +0 -16110
  80. package/src/mcp/base-mcp-server.ts +0 -660
  81. package/src/mcp/http-transport-wrapper.ts +0 -426
  82. package/src/mcp/service-discovery-client.ts +0 -312
  83. package/src/mcp/servicenow-automation-mcp-refactored.ts +0 -678
  84. package/src/mcp/servicenow-automation-mcp.ts +0 -838
  85. package/src/mcp/servicenow-deployment-mcp-refactored.ts +0 -1292
  86. package/src/mcp/servicenow-deployment-mcp.ts +0 -7244
  87. package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +0 -721
  88. package/src/mcp/servicenow-graph-memory-mcp.ts +0 -832
  89. package/src/mcp/servicenow-integration-mcp-refactored.ts +0 -655
  90. package/src/mcp/servicenow-integration-mcp.ts +0 -819
  91. package/src/mcp/servicenow-intelligent-mcp-refactored.ts +0 -977
  92. package/src/mcp/servicenow-intelligent-mcp.ts +0 -4638
  93. package/src/mcp/servicenow-mcp-server.ts +0 -728
  94. package/src/mcp/servicenow-memory-mcp.ts +0 -474
  95. package/src/mcp/servicenow-operations-mcp-refactored.ts +0 -1995
  96. package/src/mcp/servicenow-operations-mcp.ts +0 -3384
  97. package/src/mcp/servicenow-platform-development-mcp-refactored.ts +0 -611
  98. package/src/mcp/servicenow-platform-development-mcp.ts +0 -970
  99. package/src/mcp/servicenow-progressive-indexer.ts +0 -370
  100. package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +0 -695
  101. package/src/mcp/servicenow-reporting-analytics-mcp.ts +0 -1123
  102. package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +0 -642
  103. package/src/mcp/servicenow-security-compliance-mcp.ts +0 -1157
  104. package/src/mcp/servicenow-update-set-mcp-refactored.ts +0 -751
  105. package/src/mcp/servicenow-update-set-mcp.ts +0 -811
  106. package/src/mcp/shared/agent-context-provider.ts +0 -365
  107. package/src/mcp/shared/base-mcp-server.ts +0 -2463
  108. package/src/mcp/shared/mcp-memory-manager.ts +0 -540
  109. package/src/mcp/shared/mcp-resource-manager.ts +0 -367
  110. package/src/mcp/snow-flow-mcp.ts +0 -911
  111. package/src/mcp/start-all-mcp-servers.ts +0 -102
  112. package/src/mcp/start-servicenow-mcp.ts +0 -67
  113. package/src/monitoring/enhanced-monitoring-system.ts +0 -1345
  114. package/src/monitoring/performance-tracker.ts +0 -777
  115. package/src/optimization/cost-optimization-engine.ts +0 -1125
  116. package/src/optimization/index.ts +0 -10
  117. package/src/queen/README.md +0 -403
  118. package/src/queen/agent-factory.ts +0 -574
  119. package/src/queen/index.ts +0 -94
  120. package/src/queen/mcp-execution-bridge.ts +0 -681
  121. package/src/queen/neural-learning.ts +0 -319
  122. package/src/queen/parallel-agent-engine.ts +0 -848
  123. package/src/queen/queen-memory-system.ts +0 -490
  124. package/src/queen/queen-memory.ts +0 -456
  125. package/src/queen/servicenow-queen.ts +0 -1029
  126. package/src/queen/types.ts +0 -87
  127. package/src/rollback/smart-rollback-system.ts +0 -866
  128. package/src/schemas/deployment.schema.json +0 -58
  129. package/src/schemas/flow.schema.json +0 -79
  130. package/src/schemas/widget.schema.json +0 -72
  131. package/src/snow-flow-system.ts +0 -541
  132. package/src/sparc/sparc-help.ts +0 -49
  133. package/src/sparc/team-sparc.ts +0 -88
  134. package/src/strategies/global-scope-strategy.ts +0 -736
  135. package/src/templates/base/application.template.json +0 -45
  136. package/src/templates/base/business_rule.template.json +0 -33
  137. package/src/templates/base/script_include.template.json +0 -18
  138. package/src/templates/base/table.template.json +0 -64
  139. package/src/templates/base/widget.template.json +0 -25
  140. package/src/templates/patterns/composite.incident-management.template.json +0 -140
  141. package/src/templates/patterns/widget.dashboard.template.json +0 -238
  142. package/src/templates/patterns/widget.datatable.template.json +0 -292
  143. package/src/testing/integration-test-suite.ts +0 -1276
  144. package/src/types/index.ts +0 -183
  145. package/src/types/neo4j-driver.d.ts +0 -23
  146. package/src/types/servicenow.types.ts +0 -307
  147. package/src/types/snow-flow.types.ts +0 -186
  148. package/src/types/todo.types.ts +0 -70
  149. package/src/utils/action-type-cache.ts +0 -286
  150. package/src/utils/agent-detector.ts +0 -573
  151. package/src/utils/artifact-tracker.ts +0 -379
  152. package/src/utils/dependency-detector.ts +0 -233
  153. package/src/utils/deployment-metadata-handler.ts +0 -518
  154. package/src/utils/error-recovery.ts +0 -680
  155. package/src/utils/logger.ts +0 -60
  156. package/src/utils/mcp-auth-middleware.ts +0 -262
  157. package/src/utils/mcp-config-manager.ts +0 -270
  158. package/src/utils/mcp-server-manager.ts +0 -446
  159. package/src/utils/mcp-tool-registry.ts +0 -298
  160. package/src/utils/migrate-snow-flow.ts +0 -98
  161. package/src/utils/oauth-html-templates.ts +0 -188
  162. package/src/utils/scope-utils.ts +0 -443
  163. package/src/utils/servicenow-client.ts +0 -3321
  164. package/src/utils/servicenow-id-generator.ts +0 -181
  165. package/src/utils/snow-memory-manager.ts +0 -605
  166. package/src/utils/snow-oauth.ts +0 -797
  167. package/src/utils/template-engine.ts +0 -463
  168. package/src/utils/theme-manager.ts +0 -295
  169. package/src/utils/unified-auth-store.ts +0 -222
  170. package/src/utils/update-set-importer.ts +0 -422
  171. package/src/utils/update-set-xml-packager.ts +0 -371
  172. package/src/utils/widget-template-generator.ts +0 -1744
  173. package/src/version.ts +0 -1950
@@ -1,370 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Progressive Indexing Strategy for ServiceNow Artifacts
4
- * Prevents overwhelming the system with too much data
5
- */
6
-
7
- import { ServiceNowClient } from '../utils/servicenow-client.js';
8
- import { Logger } from '../utils/logger.js';
9
-
10
- export interface IndexingStrategy {
11
- mode: 'lazy' | 'eager' | 'progressive' | 'context-aware';
12
- maxInitialArtifacts: number;
13
- relevanceThreshold: number;
14
- contextWindow: number;
15
- }
16
-
17
- export interface ArtifactRelevance {
18
- artifact_id: string;
19
- relevance_score: number;
20
- last_accessed: Date;
21
- access_count: number;
22
- related_to_current_task: boolean;
23
- }
24
-
25
- export class ServiceNowProgressiveIndexer {
26
- private logger: Logger;
27
- private client: ServiceNowClient;
28
- private indexedArtifacts: Set<string> = new Set();
29
- private relevanceMap: Map<string, ArtifactRelevance> = new Map();
30
- private currentContext: string = '';
31
-
32
- constructor() {
33
- this.logger = new Logger('ProgressiveIndexer');
34
- this.client = new ServiceNowClient();
35
- }
36
-
37
- /**
38
- * Smart indexing based on current task context
39
- */
40
- async indexForContext(context: string, userInstruction: string): Promise<any> {
41
- this.currentContext = context;
42
- this.logger.info('Progressive indexing for context', { context, instruction: userInstruction });
43
-
44
- // Step 1: Extract key concepts from instruction
45
- const concepts = this.extractConcepts(userInstruction);
46
-
47
- // Step 2: Find most relevant artifacts (not everything!)
48
- const relevantArtifacts = await this.findRelevantArtifacts(concepts, {
49
- limit: 10, // Start with just 10 most relevant
50
- types: this.determineRelevantTypes(userInstruction)
51
- });
52
-
53
- // Step 3: Index only what's needed
54
- const indexingPlan = {
55
- immediate: relevantArtifacts.filter(a => a.relevance > 0.8),
56
- lazy: relevantArtifacts.filter(a => a.relevance > 0.5 && a.relevance <= 0.8),
57
- skip: relevantArtifacts.filter(a => a.relevance <= 0.5)
58
- };
59
-
60
- // Step 4: Progressive indexing
61
- await this.indexArtifacts(indexingPlan.immediate, 'immediate');
62
-
63
- // Lazy load others as needed
64
- this.scheduleLazyIndexing(indexingPlan.lazy);
65
-
66
- return {
67
- indexed_immediately: indexingPlan.immediate.length,
68
- scheduled_for_lazy: indexingPlan.lazy.length,
69
- skipped: indexingPlan.skip.length,
70
- strategy: this.getIndexingStrategy(concepts)
71
- };
72
- }
73
-
74
- /**
75
- * Extract key concepts from natural language
76
- */
77
- private extractConcepts(instruction: string): string[] {
78
- const concepts: string[] = [];
79
- const lower = instruction.toLowerCase();
80
-
81
- // Common ServiceNow concepts
82
- const conceptMap = {
83
- 'incident': ['incident', 'ticket', 'issue', 'problem'],
84
- 'widget': ['widget', 'ui', 'dashboard', 'interface', 'component'],
85
- 'flow': ['flow', 'workflow', 'automation', 'process'],
86
- 'approval': ['approval', 'approve', 'goedkeuring', 'review'],
87
- 'script': ['script', 'code', 'function', 'api'],
88
- 'table': ['table', 'data', 'record', 'database'],
89
- 'integration': ['integration', 'connect', 'api', 'external'],
90
- 'notification': ['notification', 'email', 'alert', 'message']
91
- };
92
-
93
- for (const [concept, keywords] of Object.entries(conceptMap)) {
94
- if (keywords.some(keyword => lower.includes(keyword))) {
95
- concepts.push(concept);
96
- }
97
- }
98
-
99
- return concepts;
100
- }
101
-
102
- /**
103
- * Determine which artifact types are relevant
104
- */
105
- private determineRelevantTypes(instruction: string): string[] {
106
- const types: string[] = [];
107
- const lower = instruction.toLowerCase();
108
-
109
- if (lower.includes('widget') || lower.includes('dashboard') || lower.includes('ui')) {
110
- types.push('widget', 'client_script', 'ui_script');
111
- }
112
-
113
- if (lower.includes('flow') || lower.includes('workflow') || lower.includes('automation')) {
114
- types.push('flow', 'script_include', 'business_rule');
115
- }
116
-
117
- if (lower.includes('script') || lower.includes('api') || lower.includes('function')) {
118
- types.push('script_include', 'business_rule');
119
- }
120
-
121
- if (lower.includes('table') || lower.includes('data') || lower.includes('record')) {
122
- types.push('table', 'business_rule');
123
- }
124
-
125
- // Default to common types if nothing specific found
126
- if (types.length === 0) {
127
- types.push('widget', 'flow', 'script_include');
128
- }
129
-
130
- return [...new Set(types)]; // Remove duplicates
131
- }
132
-
133
- /**
134
- * Find artifacts relevant to concepts
135
- */
136
- private async findRelevantArtifacts(concepts: string[], options: any): Promise<any[]> {
137
- const artifacts: any[] = [];
138
-
139
- // Build smart query based on concepts
140
- const searchQueries = concepts.map(concept => {
141
- switch (concept) {
142
- case 'incident':
143
- return 'nameLIKEincident^ORdescriptionLIKEincident^ORtableLIKEincident';
144
- case 'widget':
145
- return 'sys_class_name=sp_widget^ORcategoryLIKEdashboard';
146
- case 'flow':
147
- return 'sys_class_name=sys_hub_flow^ORnameLIKEflow^ORnameLIKEworkflow';
148
- case 'approval':
149
- return 'nameLIKEapproval^ORdescriptionLIKEapproval^ORscriptLIKEapproval';
150
- default:
151
- return `nameLIKE${concept}^ORdescriptionLIKE${concept}`;
152
- }
153
- });
154
-
155
- // Search each type with relevance scoring
156
- for (const type of options.types) {
157
- const results = await this.searchArtifactsByType(type, searchQueries, options.limit);
158
-
159
- // Score each result
160
- results.forEach((artifact: any) => {
161
- artifact.relevance = this.calculateRelevance(artifact, concepts);
162
- artifacts.push(artifact);
163
- });
164
- }
165
-
166
- // Sort by relevance and limit
167
- return artifacts
168
- .sort((a, b) => b.relevance - a.relevance)
169
- .slice(0, options.limit);
170
- }
171
-
172
- /**
173
- * Calculate relevance score
174
- */
175
- private calculateRelevance(artifact: any, concepts: string[]): number {
176
- let score = 0;
177
- const name = (artifact.name || '').toLowerCase();
178
- const description = (artifact.description || '').toLowerCase();
179
- const content = (artifact.script || artifact.template || '').toLowerCase();
180
-
181
- // Name matches are most important
182
- concepts.forEach(concept => {
183
- if (name.includes(concept)) score += 0.4;
184
- if (description.includes(concept)) score += 0.2;
185
- if (content.includes(concept)) score += 0.1;
186
- });
187
-
188
- // Recent artifacts are more relevant
189
- const lastUpdated = new Date(artifact.sys_updated_on || artifact.sys_created_on);
190
- const daysSinceUpdate = (Date.now() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
191
- if (daysSinceUpdate < 7) score += 0.2;
192
- else if (daysSinceUpdate < 30) score += 0.1;
193
-
194
- // Popular artifacts (based on past usage)
195
- const relevance = this.relevanceMap.get(artifact.sys_id);
196
- if (relevance) {
197
- score += Math.min(relevance.access_count * 0.05, 0.2);
198
- }
199
-
200
- return Math.min(score, 1.0);
201
- }
202
-
203
- /**
204
- * Search artifacts by type
205
- */
206
- private async searchArtifactsByType(type: string, queries: string[], limit: number): Promise<any[]> {
207
- const tableMap: Record<string, string> = {
208
- 'widget': 'sp_widget',
209
- 'flow': 'sys_hub_flow',
210
- 'script_include': 'sys_script_include',
211
- 'business_rule': 'sys_script',
212
- 'table': 'sys_db_object',
213
- 'client_script': 'sys_ui_script',
214
- 'ui_script': 'sys_ui_script'
215
- };
216
-
217
- const table = tableMap[type];
218
- if (!table) return [];
219
-
220
- try {
221
- const query = queries.join('^OR');
222
- const response = await this.client.searchRecords(table, query, limit);
223
- return response.success ? response.data.result : [];
224
- } catch (error) {
225
- this.logger.error(`Failed to search ${type}`, error);
226
- return [];
227
- }
228
- }
229
-
230
- /**
231
- * Index artifacts immediately
232
- */
233
- private async indexArtifacts(artifacts: any[], priority: string): Promise<void> {
234
- this.logger.info(`Indexing ${artifacts.length} artifacts with ${priority} priority`);
235
-
236
- for (const artifact of artifacts) {
237
- if (!this.indexedArtifacts.has(artifact.sys_id)) {
238
- // Index in Neo4j
239
- await this.indexInGraph(artifact);
240
-
241
- // Track indexing
242
- this.indexedArtifacts.add(artifact.sys_id);
243
- this.updateRelevance(artifact.sys_id, artifact.relevance);
244
- }
245
- }
246
- }
247
-
248
- /**
249
- * Schedule lazy indexing
250
- */
251
- private scheduleLazyIndexing(artifacts: any[]): void {
252
- // Index these when Claude actually needs them
253
- artifacts.forEach(artifact => {
254
- this.relevanceMap.set(artifact.sys_id, {
255
- artifact_id: artifact.sys_id,
256
- relevance_score: artifact.relevance,
257
- last_accessed: new Date(),
258
- access_count: 0,
259
- related_to_current_task: true
260
- });
261
- });
262
- }
263
-
264
- /**
265
- * Index artifact in Neo4j graph
266
- */
267
- private async indexInGraph(artifact: any): Promise<void> {
268
- // This would call the Neo4j MCP
269
- this.logger.info(`Indexing ${artifact.name} in graph database`);
270
- // Implementation would use snow_graph_index_artifact
271
- }
272
-
273
- /**
274
- * Update relevance tracking
275
- */
276
- private updateRelevance(artifactId: string, score: number): void {
277
- const existing = this.relevanceMap.get(artifactId);
278
- if (existing) {
279
- existing.relevance_score = score;
280
- existing.last_accessed = new Date();
281
- existing.access_count++;
282
- } else {
283
- this.relevanceMap.set(artifactId, {
284
- artifact_id: artifactId,
285
- relevance_score: score,
286
- last_accessed: new Date(),
287
- access_count: 1,
288
- related_to_current_task: true
289
- });
290
- }
291
- }
292
-
293
- /**
294
- * Get indexing strategy based on context
295
- */
296
- private getIndexingStrategy(concepts: string[]): IndexingStrategy {
297
- // Simple tasks need less indexing
298
- if (concepts.length <= 2) {
299
- return {
300
- mode: 'lazy',
301
- maxInitialArtifacts: 5,
302
- relevanceThreshold: 0.8,
303
- contextWindow: 10
304
- };
305
- }
306
-
307
- // Complex tasks need more context
308
- if (concepts.length > 5) {
309
- return {
310
- mode: 'eager',
311
- maxInitialArtifacts: 20,
312
- relevanceThreshold: 0.5,
313
- contextWindow: 50
314
- };
315
- }
316
-
317
- // Default progressive strategy
318
- return {
319
- mode: 'progressive',
320
- maxInitialArtifacts: 10,
321
- relevanceThreshold: 0.7,
322
- contextWindow: 25
323
- };
324
- }
325
-
326
- /**
327
- * Clean up old irrelevant artifacts
328
- */
329
- async cleanupIrrelevantArtifacts(): Promise<number> {
330
- const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
331
- let cleaned = 0;
332
-
333
- for (const [id, relevance] of this.relevanceMap.entries()) {
334
- if (relevance.last_accessed < thirtyDaysAgo &&
335
- relevance.access_count < 2 &&
336
- relevance.relevance_score < 0.5) {
337
- this.relevanceMap.delete(id);
338
- this.indexedArtifacts.delete(id);
339
- cleaned++;
340
- }
341
- }
342
-
343
- this.logger.info(`Cleaned up ${cleaned} irrelevant artifacts`);
344
- return cleaned;
345
- }
346
-
347
- /**
348
- * Get indexing statistics
349
- */
350
- getIndexingStats(): any {
351
- const stats = {
352
- total_indexed: this.indexedArtifacts.size,
353
- total_tracked: this.relevanceMap.size,
354
- current_context: this.currentContext,
355
- relevance_distribution: {
356
- high: 0,
357
- medium: 0,
358
- low: 0
359
- }
360
- };
361
-
362
- for (const relevance of this.relevanceMap.values()) {
363
- if (relevance.relevance_score > 0.8) stats.relevance_distribution.high++;
364
- else if (relevance.relevance_score > 0.5) stats.relevance_distribution.medium++;
365
- else stats.relevance_distribution.low++;
366
- }
367
-
368
- return stats;
369
- }
370
- }