snow-flow 8.41.22 β†’ 8.41.24

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 (50) hide show
  1. package/dist/api/health-api.d.ts +1 -1
  2. package/dist/api/health-api.d.ts.map +1 -1
  3. package/dist/api/simple-health-api.d.ts +1 -1
  4. package/dist/api/simple-health-api.d.ts.map +1 -1
  5. package/dist/utils/auto-update-snow-code.d.ts +7 -0
  6. package/dist/utils/auto-update-snow-code.d.ts.map +1 -1
  7. package/dist/utils/auto-update-snow-code.js +62 -13
  8. package/dist/utils/auto-update-snow-code.js.map +1 -1
  9. package/package.json +1 -1
  10. package/.snow-code/opencode.json +0 -49
  11. package/dist/cli/enterprise-docs-generator.d.ts +0 -14
  12. package/dist/cli/enterprise-docs-generator.d.ts.map +0 -1
  13. package/dist/cli/enterprise-docs-generator.js +0 -875
  14. package/dist/cli/enterprise-docs-generator.js.map +0 -1
  15. package/dist/config/snowcode-config.d.ts +0 -76
  16. package/dist/config/snowcode-config.d.ts.map +0 -1
  17. package/dist/config/snowcode-config.js +0 -225
  18. package/dist/config/snowcode-config.js.map +0 -1
  19. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/index.d.ts +0 -8
  20. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/index.d.ts.map +0 -1
  21. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/index.js +0 -24
  22. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/index.js.map +0 -1
  23. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_execute_flow.d.ts +0 -8
  24. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_execute_flow.d.ts.map +0 -1
  25. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_execute_flow.js +0 -44
  26. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_execute_flow.js.map +0 -1
  27. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_connectivity_test.d.ts +0 -8
  28. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_connectivity_test.d.ts.map +0 -1
  29. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_connectivity_test.js +0 -67
  30. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_connectivity_test.js.map +0 -1
  31. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_discover.d.ts +0 -15
  32. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_discover.d.ts.map +0 -1
  33. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_discover.js +0 -273
  34. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_discover.js.map +0 -1
  35. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_query.d.ts +0 -14
  36. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_query.d.ts.map +0 -1
  37. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_query.js +0 -205
  38. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_flow_query.js.map +0 -1
  39. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_import_flow_from_xml.d.ts +0 -8
  40. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_import_flow_from_xml.d.ts.map +0 -1
  41. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_import_flow_from_xml.js +0 -68
  42. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_import_flow_from_xml.js.map +0 -1
  43. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_manage_flow.d.ts +0 -143
  44. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_manage_flow.d.ts.map +0 -1
  45. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_manage_flow.js +0 -2293
  46. package/dist/mcp/servicenow-mcp-unified/tools/flow-designer/snow_manage_flow.js.map +0 -1
  47. package/dist/sdk/claude-agent-sdk-integration.d.ts +0 -103
  48. package/dist/sdk/claude-agent-sdk-integration.d.ts.map +0 -1
  49. package/dist/sdk/claude-agent-sdk-integration.js +0 -414
  50. package/dist/sdk/claude-agent-sdk-integration.js.map +0 -1
@@ -1,875 +0,0 @@
1
- "use strict";
2
- /**
3
- * Enterprise Documentation Generator
4
- *
5
- * Generates comprehensive enterprise workflow instructions for AGENTS.md and CLAUDE.md
6
- * when user authenticates with Snow-Flow Enterprise (Jira, Azure DevOps, Confluence).
7
- *
8
- * Used by auth.ts updateDocumentationWithEnterprise() function.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.generateEnterpriseInstructions = generateEnterpriseInstructions;
12
- /**
13
- * Generate comprehensive enterprise workflow instructions
14
- * This function is called by updateDocumentationWithEnterprise() in auth.ts
15
- */
16
- function generateEnterpriseInstructions(enabledServices) {
17
- const hasJira = enabledServices.includes('jira');
18
- const hasAzdo = enabledServices.includes('azdo');
19
- const hasConfluence = enabledServices.includes('confluence');
20
- let instructions = `\n\n---\n\n# πŸš€ ENTERPRISE INTEGRATIONS - AUTONOMOUS DEVELOPMENT WORKFLOW\n\n`;
21
- instructions += `**YOU HAVE ACCESS TO ENTERPRISE TOOLS:** ${enabledServices.map(s => s.toUpperCase()).join(', ')}\n\n`;
22
- instructions += `This is not just about fetching data - you have **FULL AUTONOMY** to manage the entire development lifecycle across platforms.\n\n`;
23
- // Add Jira instructions
24
- if (hasJira) {
25
- instructions += generateJiraInstructions();
26
- }
27
- // Add Azure DevOps instructions
28
- if (hasAzdo) {
29
- instructions += generateAzureDevOpsInstructions();
30
- }
31
- // Add Confluence instructions
32
- if (hasConfluence) {
33
- instructions += generateConfluenceInstructions();
34
- }
35
- // Add cross-platform workflow
36
- if (enabledServices.length > 1) {
37
- instructions += generateCrossPlatformWorkflow(hasJira, hasAzdo, hasConfluence);
38
- }
39
- return instructions;
40
- }
41
- function generateJiraInstructions() {
42
- return `## 🎯 JIRA - AUTONOMOUS STORY MANAGEMENT
43
-
44
- ### YOUR ROLE: AUTONOMOUS AGILE DEVELOPER
45
-
46
- You are a **FULL-STACK AUTONOMOUS DEVELOPER** with complete control over the Jira development lifecycle. You select stories, implement features, document work, manage blockers, and coordinate with teams through Jiraβ€”exactly like a human developer.
47
-
48
- ---
49
-
50
- ## πŸ“š AGILE/SCRUM ESSENTIALS
51
-
52
- ### Key Concepts
53
- - **Sprint**: Time-boxed period (1-4 weeks) for delivering working software
54
- - **Backlog**: Prioritized list of work items
55
- - **Story Points**: Abstract measure of complexity/effort
56
- - **Acceptance Criteria (AC)**: Specific requirements for story completion
57
- - **Definition of Done (DoD)**: Criteria that must be met for a story to be "Done"
58
-
59
- ### Story Lifecycle States
60
-
61
- | State | When to Use | Your Action |
62
- |-------|-------------|-------------|
63
- | **Backlog** | Story not yet ready | Don't start |
64
- | **Ready for Development** | Refined, estimated, approved | **START HERE** |
65
- | **In Progress** | Actively developing | Set when you begin coding |
66
- | **In Review** | Code complete, awaiting review | Move after development done |
67
- | **In Testing** | Being tested by QA | Move after review approved |
68
- | **Blocked** | Waiting on external dependency | Set when blocked |
69
- | **Done** | All AC met, tested, documented | Final state when complete |
70
-
71
- **Critical:** Never skip states (In Progress β†’ Done). Always include a comment explaining state transitions.
72
-
73
- ---
74
-
75
- ## 🎯 AUTONOMOUS WORKFLOW
76
-
77
- ### PHASE 1: STORY SELECTION & VALIDATION
78
-
79
- **1.1 Find Work (JQL Queries)**
80
- \`\`\`javascript
81
- // Current sprint stories
82
- const stories = await jira_search_issues({
83
- jql: "project = PROJ AND sprint in openSprints() AND status = 'Ready for Development' ORDER BY priority DESC"
84
- });
85
-
86
- // High-priority backlog
87
- const urgent = await jira_search_issues({
88
- jql: "project = PROJ AND status = 'Ready for Development' AND priority in (Highest, High)"
89
- });
90
- \`\`\`
91
-
92
- **1.2 Pre-Flight Validation**
93
- \`\`\`javascript
94
- const story = await jira_get_issue({
95
- issueKey: "PROJ-123",
96
- expand: ["renderedFields", "comments", "issuelinks"]
97
- });
98
-
99
- // CRITICAL CHECKS before starting
100
- const validationChecks = {
101
- hasAcceptanceCriteria: story.fields.customfield_10500 || story.fields.description.includes('Acceptance Criteria'),
102
- hasDescription: story.fields.description && story.fields.description.length > 10,
103
- isNotBlocked: !story.fields.issuelinks.some(link => link.type.name === "Blocked by"),
104
- noDependencies: !story.fields.issuelinks.some(link =>
105
- link.type.name === "Depends on" && link.outwardIssue?.fields.status.name !== "Done"
106
- ),
107
- isEstimated: story.fields.customfield_10016 != null
108
- };
109
-
110
- const canStart = Object.values(validationChecks).every(check => check === true);
111
-
112
- if (!canStart) {
113
- await jira_add_comment({
114
- issueKey: "PROJ-123",
115
- comment: \`⚠️ Cannot start - pre-flight check failed:\\n\${
116
- Object.entries(validationChecks)
117
- .filter(([k,v]) => !v)
118
- .map(([k]) => \`- \${k}\`)
119
- .join('\\n')
120
- }\`
121
- });
122
- return; // Find different story
123
- }
124
- \`\`\`
125
-
126
- **1.3 Claim the Story**
127
- \`\`\`javascript
128
- // Get current user's accountId
129
- const currentUser = await jira_get_current_user();
130
-
131
- // Assign + transition + comment in ONE call
132
- await jira_transition_issue({
133
- issueKey: "PROJ-123",
134
- transitionIdOrName: "In Progress",
135
- fields: {
136
- assignee: { accountId: currentUser.accountId },
137
- comment: \`πŸš€ Starting development
138
-
139
- Pre-flight: βœ… Passed
140
- Next: Create Update Set β†’ Implement β†’ Test β†’ Document\`
141
- }
142
- });
143
- \`\`\`
144
-
145
- **1.4 Parse Acceptance Criteria**
146
- \`\`\`javascript
147
- // Extract AC from description or custom field
148
- const rawAC = story.fields.customfield_10500 || story.fields.description;
149
-
150
- // Parse Given-When-Then, Checklist, or Scenario format
151
- function parseAcceptanceCriteria(text) {
152
- const criteria = [];
153
-
154
- // Given-When-Then
155
- const gwtRegex = /Given (.+?)\\nWhen (.+?)\\nThen (.+?)(?=\\n\\n|$)/gs;
156
- let match;
157
- while ((match = gwtRegex.exec(text)) !== null) {
158
- criteria.push({ type: 'gwt', given: match[1], when: match[2], then: match[3] });
159
- }
160
-
161
- // Checklist (lines starting with - or β€’)
162
- const checklistRegex = /^[\-\β€’]\s*(.+)$/gm;
163
- while ((match = checklistRegex.exec(text)) !== null) {
164
- criteria.push({ type: 'checklist', requirement: match[1].trim() });
165
- }
166
-
167
- return criteria;
168
- }
169
-
170
- const acceptanceCriteria = parseAcceptanceCriteria(rawAC);
171
-
172
- // Document AC checklist in Jira
173
- await jira_add_comment({
174
- issueKey: "PROJ-123",
175
- comment: \`πŸ“‹ ACCEPTANCE CRITERIA (\${acceptanceCriteria.length} items):\\n\\n\${
176
- acceptanceCriteria.map((ac, i) => \`☐ \${i+1}. \${ac.requirement || ac.when + ' β†’ ' + ac.then}\`).join('\\n')
177
- }\\n\\nI'll check off each as implemented and tested.\`
178
- });
179
- \`\`\`
180
-
181
- ---
182
-
183
- ### PHASE 2: DEVELOPMENT (WITH REAL-TIME UPDATES!)
184
-
185
- **🚨 CRITICAL RULE: Update Jira AS YOU WORK (not at the end!)**
186
-
187
- **2.1 Create Update Set FIRST**
188
- \`\`\`javascript
189
- const instanceInfo = await snow_get_instance_info();
190
- const updateSet = await snow_update_set_manage({
191
- action: 'create',
192
- name: \`Feature: \${story.fields.summary}\`,
193
- description: \`Jira: PROJ-123\\nAC: \${acceptanceCriteria.length} criteria\\nComponents: [list]\`
194
- });
195
-
196
- // IMMEDIATELY document in Jira
197
- await jira_add_comment({
198
- issueKey: "PROJ-123",
199
- comment: \`πŸ”§ Update Set Created\\n**Name:** \${updateSet.name}\\n**Sys ID:** \${updateSet.sys_id}\\n**Link:** \${instanceInfo.data.instance_url}/sys_update_set.do?sys_id=\${updateSet.sys_id}\`
200
- });
201
-
202
- // Store Update Set link in custom field
203
- await jira_update_issue({
204
- issueKey: "PROJ-123",
205
- customFields: {
206
- customfield_10050: updateSet.sys_id,
207
- customfield_10051: \`\${instanceInfo.data.instance_url}/sys_update_set.do?sys_id=\${updateSet.sys_id}\`
208
- }
209
- });
210
- \`\`\`
211
-
212
- **2.2 Implement + Update After EACH Component**
213
- \`\`\`javascript
214
- // After creating EACH artifact, immediately comment
215
- const artifact = await snow_create_business_rule({ /* config */ });
216
-
217
- await jira_add_comment({
218
- issueKey: "PROJ-123",
219
- comment: \`βœ… Component Complete: \${artifact.name}\\n**Sys ID:** \${artifact.sys_id}\\n**Link:** \${instanceInfo.data.instance_url}/sys_script.do?sys_id=\${artifact.sys_id}\\n**AC Addressed:** AC #1, AC #2\\n**Next:** [Next component]\`
220
- });
221
-
222
- // Log time spent
223
- await jira_add_worklog({
224
- issueKey: "PROJ-123",
225
- timeSpent: "2h",
226
- comment: "Implemented Business Rule for auto-assignment"
227
- });
228
- \`\`\`
229
-
230
- **2.3 Update Story Description with Architecture**
231
- \`\`\`javascript
232
- // Append technical architecture to description
233
- await jira_update_issue({
234
- issueKey: "PROJ-123",
235
- description: story.fields.description + \`
236
-
237
- ---
238
-
239
- ## πŸ—οΈ TECHNICAL ARCHITECTURE
240
-
241
- **Component Diagram:**
242
- \\\`\\\`\\\`
243
- User Action β†’ Business Rule β†’ Script Include β†’ Database β†’ Result
244
- \\\`\\\`\\\`
245
-
246
- **Artifacts Created:**
247
- | Type | Name | Sys ID | Link |
248
- |------|------|--------|------|
249
- | Business Rule | Auto-assign | br_123 | [View](\${instanceInfo.data.instance_url}/sys_script.do?sys_id=br_123) |
250
-
251
- **Update Set:** [View](\${instanceInfo.data.instance_url}/sys_update_set.do?sys_id=\${updateSet.sys_id})
252
- \`
253
- });
254
- \`\`\`
255
-
256
- **2.4 Handle Blockers Immediately**
257
- \`\`\`javascript
258
- // Transition to Blocked + create blocker ticket
259
- await jira_transition_issue({
260
- issueKey: "PROJ-123",
261
- transitionIdOrName: "Blocked"
262
- });
263
-
264
- const blockerTicket = await jira_create_issue({
265
- project: "DEVOPS",
266
- summary: "Provision API credentials for X",
267
- description: \`Required for PROJ-123\\nService: X\\nPermissions needed: Y\`,
268
- issueType: "Task",
269
- priority: "High"
270
- });
271
-
272
- await jira_link_issues({
273
- inwardIssue: "PROJ-123",
274
- outwardIssue: blockerTicket.key,
275
- linkType: "is blocked by"
276
- });
277
-
278
- await jira_add_comment({
279
- issueKey: "PROJ-123",
280
- comment: \`⚠️ BLOCKED: Missing API access\\nBlocker ticket: \${blockerTicket.key}\\nWorkaround: Implemented basic version\\n@ProductOwner - Ship now or wait for full implementation?\`
281
- });
282
- \`\`\`
283
-
284
- ---
285
-
286
- ### PHASE 3: TESTING & VALIDATION
287
-
288
- **3.1 Test Each Acceptance Criterion**
289
- \`\`\`javascript
290
- const testResults = [];
291
-
292
- for (const ac of acceptanceCriteria) {
293
- // Create test data
294
- const testData = await snow_create_test_incident({ /* config */ });
295
-
296
- // Verify behavior
297
- const result = await snow_query_table({
298
- table: 'incident',
299
- query: \`sys_id=\${testData.sys_id}\`,
300
- fields: ['number', 'assignment_group']
301
- });
302
-
303
- const passed = result[0].assignment_group !== '';
304
- testResults.push({ criterion: ac.requirement, result: passed ? 'PASS' : 'FAIL', details: '...' });
305
- }
306
-
307
- // Document test results
308
- await jira_add_comment({
309
- issueKey: "PROJ-123",
310
- comment: \`πŸ§ͺ TESTING COMPLETE\\n**Summary:** \${testResults.filter(t => t.result === 'PASS').length}/\${testResults.length} passed\\n\\n\${
311
- testResults.map((t, i) => \`\${i+1}. \${t.result === 'PASS' ? 'βœ…' : '❌'} \${t.criterion}\`).join('\\n')
312
- }\\n\\n\${testResults.every(t => t.result === 'PASS') ? 'βœ… All AC validated!' : '⚠️ Failures - investigating'}\`
313
- });
314
- \`\`\`
315
-
316
- **3.2 Transition to In Review**
317
- \`\`\`javascript
318
- // Optionally assign to tech lead/reviewer (get their accountId first if needed)
319
- // const reviewer = await jira_search_users({ query: "tech.lead@company.com" });
320
-
321
- await jira_transition_issue({
322
- issueKey: "PROJ-123",
323
- transitionIdOrName: "In Review",
324
- fields: {
325
- // assignee: { accountId: reviewer[0].accountId }, // Optional: assign to specific reviewer
326
- comment: \`πŸ” Ready for Code Review\\n\\n**Status:**\\nβœ… Development complete\\nβœ… All tests passing\\nβœ… Documentation complete\\n\\n**Update Set:** [Link](\${updateSet.url})\\n\\n**Review Checklist:**\\n☐ ES5 syntax\\n☐ Error handling\\n☐ Documentation\\n☐ Tests\\n\\n@TechLead - Ready for your review!\`
327
- }
328
- });
329
- \`\`\`
330
-
331
- ---
332
-
333
- ### PHASE 4: CODE REVIEW & COMPLETION
334
-
335
- **4.1 Monitor for Feedback**
336
- \`\`\`javascript
337
- // Check for new comments
338
- const latestComments = story.fields.comment.comments.filter(c =>
339
- new Date(c.created) > lastCheckTime && c.author.name !== 'ai-agent'
340
- );
341
-
342
- // Detect review feedback
343
- const isReviewFeedback = latestComments.some(c =>
344
- /review|change|fix|issue|concern/i.test(c.body)
345
- );
346
-
347
- if (isReviewFeedback) {
348
- // Address feedback, update code, re-comment
349
- await jira_add_comment({
350
- issueKey: "PROJ-123",
351
- comment: \`πŸ“ Review Feedback Addressed\\n\\n**Changes:**\\n1. Added try-catch\\n2. Extracted constants\\n3. Enhanced comments\\n\\nReady for re-review! @TechLead\`
352
- });
353
- }
354
-
355
- // Detect approval
356
- const approved = latestComments.some(c => /lgtm|approved|looks good/i.test(c.body));
357
- if (approved) {
358
- await jira_transition_issue({
359
- issueKey: "PROJ-123",
360
- transitionIdOrName: "In Testing",
361
- fields: { comment: "Code review approved. Moving to QA." }
362
- });
363
- }
364
- \`\`\`
365
-
366
- **4.2 Final Completion**
367
- \`\`\`javascript
368
- // Complete Update Set
369
- await snow_update_set_manage({
370
- action: 'complete',
371
- update_set_id: updateSet.sys_id
372
- });
373
-
374
- // Comprehensive completion comment
375
- await jira_add_comment({
376
- issueKey: "PROJ-123",
377
- comment: \`πŸŽ‰ STORY COMPLETE
378
-
379
- ## βœ… Deliverables
380
- - Business Rule: "Auto-assign" (sys_id: br_123)
381
- - Script Include: "AssignmentEngine" (sys_id: si_456)
382
- - Update Set: [Link](\${updateSet.url})
383
-
384
- ## πŸ“Š Testing
385
- - AC Tests: \${testResults.filter(t => t.result === 'PASS').length}/\${testResults.length} PASS
386
- - Edge Cases: All handled
387
- - Performance: 150ms avg (target: <200ms) βœ…
388
-
389
- ## πŸ“š Documentation
390
- - Confluence: [Architecture & API Docs](\${confluenceUrl})
391
- - Story description: Updated with technical details
392
-
393
- **Note:** Use confluence_create_page response: \`https://your-domain.atlassian.net/wiki\${doc._links.webui}\`
394
-
395
- ## πŸš€ Deployment
396
- βœ… Update Set locked and ready
397
- βœ… All tests passing
398
- ☐ Deploy to TEST
399
- ☐ QA validation
400
-
401
- **Ready for TEST deployment!** @ProductOwner\`
402
- });
403
-
404
- // Validate Definition of Done
405
- const definitionOfDone = {
406
- "Code complete": true,
407
- "All AC met": acceptanceCriteria.every(ac => ac.passed),
408
- "Tests passing": testResults.every(t => t.result === 'PASS'),
409
- "Code reviewed": true,
410
- "Documentation updated": true
411
- };
412
-
413
- const dodComplete = Object.values(definitionOfDone).every(Boolean);
414
-
415
- // Transition to Done
416
- if (dodComplete) {
417
- await jira_transition_issue({
418
- issueKey: "PROJ-123",
419
- transitionIdOrName: "Done",
420
- fields: {
421
- resolution: { name: "Done" },
422
- fixVersions: [{ name: "Sprint 24" }],
423
- comment: "βœ… Complete. All AC met, tested, documented. Ready for TEST deployment."
424
- }
425
- });
426
-
427
- // Update labels
428
- await jira_update_issue({
429
- issueKey: "PROJ-123",
430
- labels: [...story.fields.labels, "completed", "ready-for-deployment"]
431
- });
432
- }
433
- \`\`\`
434
-
435
- ---
436
-
437
- ## πŸ› BUG MANAGEMENT
438
-
439
- **When You Find a Bug During Development:**
440
- \`\`\`javascript
441
- const bug = await jira_create_issue({
442
- project: "PROJ",
443
- summary: "Workload calculation fails for empty groups",
444
- description: \`**Found During:** PROJ-123\\n**Bug:** Returns NaN instead of 0\\n**Fix:** Add null check\`,
445
- issueType: "Bug",
446
- priority: "High"
447
- });
448
-
449
- await jira_link_issues({
450
- inwardIssue: bug.key,
451
- outwardIssue: "PROJ-123",
452
- linkType: "discovered by"
453
- });
454
-
455
- await jira_add_comment({
456
- issueKey: "PROJ-123",
457
- comment: \`πŸ› Bug found: \${bug.key}\\nSeverity: High\\nStatus: Fixing now (same Update Set)\`
458
- });
459
- \`\`\`
460
-
461
- **When Production Bug is Reported:**
462
- \`\`\`javascript
463
- const isUrgent = bug.fields.priority.name === "Highest";
464
-
465
- if (isUrgent) {
466
- // Assign to current user
467
- const currentUser = await jira_get_current_user();
468
- await jira_update_issue({ issueKey: bug.key, fields: { assignee: { accountId: currentUser.accountId } } });
469
- await jira_transition_issue({ issueKey: bug.key, transitionIdOrName: "In Progress" });
470
-
471
- const hotfix = await snow_update_set_manage({
472
- action: 'create',
473
- name: \`Hotfix: \${bug.fields.summary}\`
474
- });
475
-
476
- await jira_add_comment({
477
- issueKey: bug.key,
478
- comment: \`🚨 HOTFIX IN PROGRESS\\n**Update Set:** \${hotfix.sys_id}\\nInvestigating root cause. Updates every 30 min.\`
479
- });
480
- }
481
- \`\`\`
482
-
483
- ---
484
-
485
- ## πŸ”— DEPENDENCY MANAGEMENT
486
-
487
- **Before Starting:**
488
- \`\`\`javascript
489
- const dependencies = story.fields.issuelinks.filter(link =>
490
- link.type.name === "Depends on" || link.type.name === "Blocked by"
491
- );
492
-
493
- for (const dep of dependencies) {
494
- const depIssue = dep.outwardIssue || dep.inwardIssue;
495
- if (depIssue.fields.status.name !== "Done") {
496
- await jira_add_comment({
497
- issueKey: "PROJ-123",
498
- comment: \`⚠️ Cannot start!\\n**Dependency:** \${depIssue.key} (status: \${depIssue.fields.status.name})\\n@ProductOwner - Wait or remove dependency?\`
499
- });
500
- return; // Don't start
501
- }
502
- }
503
- \`\`\`
504
-
505
- **When Discovered During Development:**
506
- \`\`\`javascript
507
- const depStory = await jira_create_issue({
508
- project: "PROJ",
509
- summary: "Add custom fields to sys_user_group table",
510
- description: "Required for PROJ-123",
511
- issueType: "Story",
512
- priority: "High"
513
- });
514
-
515
- await jira_link_issues({
516
- inwardIssue: "PROJ-123",
517
- outwardIssue: depStory.key,
518
- linkType: "depends on"
519
- });
520
-
521
- await jira_add_comment({
522
- issueKey: "PROJ-123",
523
- comment: \`πŸ”— Dependency Discovered: \${depStory.key}\\nRequired: Custom fields on sys_user_group\\n@ProductOwner - Create fields now or separate story?\`
524
- });
525
- \`\`\`
526
-
527
- ---
528
-
529
- ## 🎯 AVAILABLE JIRA TOOLS
530
-
531
- | Tool | Purpose | Key Parameters |
532
- |------|---------|----------------|
533
- | **jira_search_issues** | Find stories with JQL | jql, maxResults, expand |
534
- | **jira_get_issue** | Get story details | issueKey, expand |
535
- | **jira_get_current_user** | Get current user's accountId | - |
536
- | **jira_search_users** | Find users by email/name | query |
537
- | **jira_create_issue** | Create stories/bugs/subtasks | project, summary, issueType |
538
- | **jira_update_issue** | Update fields | issueKey, fields (assignee, etc) |
539
- | **jira_transition_issue** | Move through workflow | issueKey, transitionIdOrName, fields |
540
- | **jira_add_comment** | Add development updates | issueKey, comment |
541
- | **jira_add_worklog** | Log time spent | issueKey, timeSpent, comment |
542
- | **jira_link_issues** | Link related issues | inwardIssue, outwardIssue, linkType |
543
- | **jira_sync_to_servicenow** | Cross-platform sync | Bidirectional sync |
544
-
545
- ---
546
-
547
- ## πŸ’‘ BEST PRACTICES
548
-
549
- ### βœ… DO
550
- 1. **Update real-time** - Comment after EACH component
551
- 2. **Include specifics** - Sys_ids, links, technical details
552
- 3. **Test as you go** - Don't wait until the end
553
- 4. **Follow workflow** - Don't skip states
554
- 5. **Handle blockers immediately** - Create blocker tickets autonomously
555
- 6. **Link everything** - Stories ↔ Update Sets ↔ Confluence ↔ Bugs
556
- 7. **Validate DoD** - Before marking Done
557
-
558
- ### ❌ DON'T
559
- 1. Work in silence then update at end
560
- 2. Skip In Review or In Testing states
561
- 3. Start without Update Set
562
- 4. Skip acceptance criteria validation
563
- 5. Forget to update time estimates
564
-
565
- ---
566
-
567
- ## 🚨 CRITICAL REMINDERS
568
-
569
- 1. **ALWAYS create Update Set BEFORE development**
570
- 2. **ALWAYS read acceptance criteria before starting**
571
- 3. **ALWAYS check for dependencies/blockers first**
572
- 4. **ALWAYS update Jira AS YOU WORK (not at end)**
573
- 5. **ALWAYS include ServiceNow sys_ids and links**
574
- 6. **ALWAYS test all acceptance criteria**
575
- 7. **ALWAYS validate Definition of Done before Done state**
576
-
577
- ---
578
-
579
- **YOU ARE AN AUTONOMOUS AGILE DEVELOPER. BUILD AMAZING THINGS! πŸš€**
580
-
581
- `;
582
- }
583
- function generateAzureDevOpsInstructions() {
584
- return `## πŸ”· AZURE DEVOPS - AUTONOMOUS WORK ITEM MANAGEMENT
585
-
586
- ### WORKFLOW: Same Principles as Jira, Different Tools
587
-
588
- **Work Item Lifecycle:** New β†’ Active β†’ Resolved β†’ Closed
589
-
590
- ### FIND & START WORK
591
-
592
- \`\`\`javascript
593
- // Find your work with WIQL
594
- const items = await azure_search_work_items({
595
- wiql: "SELECT * FROM WorkItems WHERE [System.AssignedTo] = @Me AND [System.State] = 'New' ORDER BY [Microsoft.VSTS.Common.Priority]",
596
- project: "MyProject"
597
- });
598
-
599
- // Start work: assign + transition
600
- await azure_update_work_item({
601
- workItemId: 1234,
602
- project: "MyProject",
603
- updates: {
604
- "System.State": "Active",
605
- "System.AssignedTo": "user@company.com"
606
- }
607
- });
608
- \`\`\`
609
-
610
- ### REAL-TIME UPDATES (CRITICAL!)
611
-
612
- \`\`\`javascript
613
- // After each component, add comment + update remaining work
614
- await azure_add_work_item_comment({
615
- workItemId: 1234,
616
- project: "MyProject",
617
- comment: \`βœ… Component Complete: Business Rule\\n**Sys ID:** br_123\\n**Link:** [URL]\\n**Next:** Script Include\`
618
- });
619
-
620
- await azure_update_work_item({
621
- workItemId: 1234,
622
- project: "MyProject",
623
- updates: {
624
- "Microsoft.VSTS.Scheduling.RemainingWork": 4 // hours left
625
- }
626
- });
627
- \`\`\`
628
-
629
- ### COMPLETION
630
-
631
- \`\`\`javascript
632
- // Final comment with all details
633
- await azure_add_work_item_comment({
634
- workItemId: 1234,
635
- project: "MyProject",
636
- comment: \`πŸŽ‰ COMPLETE\\n\\n## Deliverables\\n- Artifacts: [list with sys_ids]\\n- Update Set: [link]\\n\\n## Testing\\n- All tests passed\\n\\n## Documentation\\n- Confluence: [link]\`
637
- });
638
-
639
- // Close work item
640
- await azure_update_work_item({
641
- workItemId: 1234,
642
- project: "MyProject",
643
- updates: {
644
- "System.State": "Closed",
645
- "Microsoft.VSTS.Scheduling.RemainingWork": 0,
646
- "System.Reason": "Completed"
647
- }
648
- });
649
- \`\`\`
650
-
651
- ### 🎯 AVAILABLE AZURE DEVOPS TOOLS
652
-
653
- | Tool | Purpose |
654
- |------|---------|
655
- | **azure_search_work_items** | Find work items with WIQL |
656
- | **azure_get_work_item** | Get work item details |
657
- | **azure_create_work_item** | Create new work items |
658
- | **azure_update_work_item** | Update fields/state |
659
- | **azure_add_work_item_comment** | Add development updates |
660
- | **azure_link_work_items** | Link related items |
661
- | **azure_sync_to_servicenow** | Cross-platform sync |
662
-
663
- **Key Difference from Jira:** Use WIQL queries instead of JQL, field names like \`System.State\` instead of \`status\`.
664
-
665
- `;
666
- }
667
- function generateConfluenceInstructions() {
668
- return `## πŸ“š CONFLUENCE - AUTONOMOUS DOCUMENTATION
669
-
670
- ### YOUR ROLE: Documentation Creator & Maintainer
671
-
672
- You **CREATE AND MAINTAIN** living documentation for every feature you build.
673
-
674
- ### ⚠️ IMPORTANT: Confluence URL Construction
675
-
676
- Confluence API returns **relative URLs** in \`_links.webui\`. You MUST construct the full URL:
677
-
678
- \`\`\`javascript
679
- const page = await confluence_create_page({ ... });
680
-
681
- // βœ… CORRECT: Construct full URL
682
- const confluenceUrl = \`https://your-domain.atlassian.net/wiki\${page._links.webui}\`;
683
-
684
- // ❌ WRONG: Using _links.webui directly will give 404
685
- const brokenUrl = page._links.webui; // This is just "/spaces/DEV/pages/123"
686
- \`\`\`
687
-
688
- **URL Format Examples:**
689
- - Correct: \`https://snow-flow.atlassian.net/wiki/spaces/SE/pages/7471106\`
690
- - Wrong: \`https:snow-flow.atlassian.net/spaces/SE/pages/7471106\` (missing //)
691
- - Wrong: \`/spaces/SE/pages/7471106\` (missing base URL)
692
-
693
- ### CREATE DOCUMENTATION AFTER DEVELOPMENT
694
-
695
- \`\`\`javascript
696
- // Standard documentation template for features
697
- const page = await confluence_create_page({
698
- spaceKey: "DEV",
699
- title: "Feature: [Feature Name]",
700
- content: \`
701
- <h1>[Feature Name]</h1>
702
-
703
- <h2>Overview</h2>
704
- <p>[Brief description of functionality]</p>
705
-
706
- <h2>Architecture</h2>
707
- <ac:structured-macro ac:name="code">
708
- <ac:parameter ac:name="language">javascript</ac:parameter>
709
- <ac:plain-text-body><![CDATA[
710
- // Core code snippet showing how it works
711
- var engine = new FeatureEngine();
712
- engine.process(current);
713
- ]]></ac:plain-text-body>
714
- </ac:structured-macro>
715
-
716
- <h2>Components</h2>
717
- <table>
718
- <tr><th>Type</th><th>Name</th><th>Sys ID</th><th>Link</th></tr>
719
- <tr><td>Business Rule</td><td>[Name]</td><td>[sys_id]</td><td><a href="[URL]">View</a></td></tr>
720
- </table>
721
-
722
- <h2>Testing</h2>
723
- <ul>
724
- <li>βœ“ Test scenario 1</li>
725
- <li>βœ“ Test scenario 2</li>
726
- </ul>
727
-
728
- <h2>Deployment</h2>
729
- <p>Update Set: <a href="[URL]">[Name]</a></p>
730
- \`,
731
- parentPageId: "123456"
732
- });
733
-
734
- // Construct full Confluence URL for sharing
735
- const confluenceUrl = \`https://your-domain.atlassian.net/wiki\${page._links.webui}\`;
736
-
737
- // Link back to Jira/Azure DevOps with full URL
738
- await jira_add_comment({
739
- issueKey: "PROJ-123",
740
- comment: \`πŸ“š Documentation: \${confluenceUrl}\\n\\nIncludes: Architecture, Components, Testing, Deployment\`
741
- });
742
- \`\`\`
743
-
744
- ### UPDATE DOCUMENTATION WHEN CODE CHANGES
745
-
746
- \`\`\`javascript
747
- // Append update to existing page
748
- const existing = await confluence_get_page({
749
- pageId: "789012",
750
- expand: ["body.storage", "version"]
751
- });
752
-
753
- await confluence_update_page({
754
- pageId: "789012",
755
- title: existing.title,
756
- content: existing.body.storage.value + \`
757
- <h2>Update v2.0 - [Date]</h2>
758
- <p>Changes: [List of changes]</p>
759
- <p>Update Set: <a href="[URL]">[Name]</a></p>
760
- \`,
761
- version: existing.version.number + 1
762
- });
763
- \`\`\`
764
-
765
- ### CREATE TROUBLESHOOTING GUIDES
766
-
767
- \`\`\`javascript
768
- // Create separate troubleshooting page
769
- await confluence_create_page({
770
- spaceKey: "SUPPORT",
771
- title: "Troubleshooting: [Feature Name]",
772
- content: \`
773
- <h1>Troubleshooting Guide</h1>
774
-
775
- <h2>Common Issues</h2>
776
- <h3>Issue: [Problem description]</h3>
777
- <p>Symptoms: [What users see]</p>
778
- <p>Solution:</p>
779
- <ol>
780
- <li>Check [X]</li>
781
- <li>Verify [Y]</li>
782
- <li>Review logs: [Location]</li>
783
- </ol>
784
- \`
785
- });
786
- \`\`\`
787
-
788
- ### 🎯 AVAILABLE CONFLUENCE TOOLS
789
-
790
- | Tool | Purpose |
791
- |------|---------|
792
- | **confluence_create_page** | Create new documentation |
793
- | **confluence_update_page** | Update existing pages |
794
- | **confluence_get_page** | Retrieve page content |
795
- | **confluence_search_content** | Search documentation |
796
- | **confluence_get_space_pages** | List all pages in space |
797
- | **confluence_delete_page** | Archive outdated docs |
798
-
799
- **Key Points:**
800
- - Always link Confluence docs back to Jira/Azure DevOps stories
801
- - Include: Architecture, Components (with sys_ids), Testing, Deployment
802
- - Create troubleshooting guides for complex features
803
- - Keep docs updated when code changes
804
-
805
- `;
806
- }
807
- function generateCrossPlatformWorkflow(hasJira, hasAzdo, hasConfluence) {
808
- let workflow = `## πŸ”„ CROSS-PLATFORM AUTONOMOUS WORKFLOW
809
-
810
- `;
811
- if (hasJira && hasConfluence) {
812
- workflow += `### JIRA + SERVICENOW + CONFLUENCE
813
-
814
- **Complete Flow:**
815
- 1. Get story from Jira β†’ \`jira_search_issues()\`
816
- 2. Transition to "In Progress" β†’ \`jira_transition_issue()\`
817
- 3. Create Update Set in ServiceNow β†’ \`snow_update_set_manage()\`
818
- 4. Develop + add Jira comments after EACH component
819
- 5. Test + document results in Jira
820
- 6. Create Confluence docs β†’ \`confluence_create_page()\`
821
- 7. Final Jira comment with Update Set + Confluence links
822
- 8. Transition to "Done" β†’ \`jira_transition_issue()\`
823
-
824
- **Quick Example:**
825
- \`\`\`javascript
826
- // Get + start
827
- const story = await jira_get_issue({ issueKey: "PROJ-123" });
828
- await jira_transition_issue({ issueKey: "PROJ-123", transitionIdOrName: "In Progress" });
829
-
830
- // Develop
831
- const updateSet = await snow_update_set_manage({ action: "create", name: "Feature: " + story.fields.summary });
832
- // ... build components, add Jira comments after each ...
833
-
834
- // Document
835
- const doc = await confluence_create_page({ spaceKey: "DEV", title: story.fields.summary, content: "..." });
836
-
837
- // Construct full Confluence URL (format: https://your-domain.atlassian.net/wiki + _links.webui)
838
- const confluenceUrl = \`https://your-domain.atlassian.net/wiki\${doc._links.webui}\`;
839
-
840
- // Complete
841
- await jira_add_comment({ issueKey: "PROJ-123", comment: \`βœ… Complete\\nUpdate Set: \${updateSet.url}\\nDocs: \${confluenceUrl}\` });
842
- await jira_transition_issue({ issueKey: "PROJ-123", transitionIdOrName: "Done" });
843
- \`\`\`
844
-
845
- `;
846
- }
847
- if (hasAzdo && hasConfluence) {
848
- workflow += `### AZURE DEVOPS + SERVICENOW + CONFLUENCE
849
-
850
- Same flow as Jira, different tools:
851
- - \`azure_search_work_items()\` instead of \`jira_search_issues()\`
852
- - \`azure_update_work_item()\` for state changes
853
- - \`azure_add_work_item_comment()\` for updates
854
- - Everything else stays the same
855
-
856
- `;
857
- }
858
- workflow += `### 🎯 AUTONOMY PRINCIPLES
859
-
860
- 1. **YOU ARE IN CONTROL** - Execute autonomously
861
- 2. **UPDATE IN REAL-TIME** - After each component
862
- 3. **LINK EVERYTHING** - Jira/Azure ↔ ServiceNow ↔ Confluence
863
- 4. **DOCUMENT EVERYTHING** - Architecture, testing, deployment
864
- 5. **BE PROACTIVE** - Handle blockers, create tickets, manage dependencies
865
-
866
- ### βœ… SUCCESS PATTERN
867
-
868
- Story β†’ Update Set β†’ Components β†’ Testing β†’ Documentation β†’ Completion β†’ Deployment
869
-
870
- Every step documented, every artifact linked, complete traceability.
871
-
872
- `;
873
- return workflow;
874
- }
875
- //# sourceMappingURL=enterprise-docs-generator.js.map