snow-flow 1.3.24 → 1.3.27
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/.claude/config.json +33 -9
- package/.claude-flow/queen/queen-memory.db +0 -0
- package/.roo/README.md +56 -0
- package/.roo/workflows/basic-tdd.json +32 -0
- package/.roomodes +122 -0
- package/CLAUDE.md +140 -752
- package/claude-flow +30 -75
- package/dist/cli.js +250 -7
- package/dist/compliance/advanced-compliance-system.js +857 -0
- package/dist/compliance/index.js +8 -0
- package/dist/documentation/index.js +8 -0
- package/dist/documentation/self-documenting-system.js +1006 -0
- package/dist/healing/index.js +8 -0
- package/dist/healing/self-healing-system.js +1041 -0
- package/dist/intelligence/multi-pass-requirements-analyzer.js +477 -0
- package/dist/intelligence/performance-recommendations-engine.js +960 -0
- package/dist/managers/scope-manager.js +5 -2
- package/dist/mcp/servicenow-deployment-mcp.js +113 -15
- package/dist/mcp/servicenow-flow-composer-mcp.js +604 -15
- package/dist/mcp/servicenow-intelligent-mcp.js +350 -0
- package/dist/mcp/servicenow-operations-mcp.js +2 -2
- package/dist/memory/memory-system.js +146 -0
- package/dist/monitoring/enhanced-monitoring-system.js +1085 -0
- package/dist/optimization/cost-optimization-engine.js +771 -0
- package/dist/optimization/flow-performance-optimizer.js +723 -0
- package/dist/optimization/index.js +10 -0
- package/dist/orchestration/flow-update-orchestrator.js +648 -0
- package/dist/rollback/smart-rollback-system.js +462 -0
- package/dist/templates/flow-template-system.js +625 -0
- package/dist/testing/flow-testing-automation.js +641 -0
- package/dist/testing/integration-test-suite.js +890 -0
- package/dist/utils/flow-structure-builder.js +1 -1
- package/dist/utils/servicenow-client.js +50 -2
- package/dist/utils/snow-oauth.js +66 -8
- package/dist/utils/xml-first-flow-generator.js +35 -8
- package/dist/version.js +13 -1
- package/package.json +1 -1
|
@@ -415,9 +415,12 @@ class ScopeManager {
|
|
|
415
415
|
const newArtifactData = {
|
|
416
416
|
...artifact,
|
|
417
417
|
sys_scope: decision.selectedScope === global_scope_strategy_js_1.ScopeType.GLOBAL ? 'global' : decision.selectedScope,
|
|
418
|
-
name: `${artifact.name}_migrated
|
|
419
|
-
|
|
418
|
+
name: `${artifact.name}_migrated`
|
|
419
|
+
// 🔧 TEST-001 FIX: Remove sys_id property instead of setting to undefined
|
|
420
|
+
// This prevents "sys_id undefined" errors in testing tools
|
|
420
421
|
};
|
|
422
|
+
// 🔧 TEST-001 FIX: Explicitly delete sys_id so ServiceNow generates a new one
|
|
423
|
+
delete newArtifactData.sys_id;
|
|
421
424
|
const deploymentResult = await this.strategy.deployWithGlobalScope(artifact.sys_class_name || artifact.type, newArtifactData, { type: decision.selectedScope });
|
|
422
425
|
migrationResult.success = deploymentResult.success;
|
|
423
426
|
migrationResult.details = deploymentResult;
|
|
@@ -1837,30 +1837,128 @@ ${validationResults.every(r => r.startsWith('✅')) ? '✅ Validation passed!' :
|
|
|
1837
1837
|
}
|
|
1838
1838
|
async rollbackDeployment(args) {
|
|
1839
1839
|
try {
|
|
1840
|
-
|
|
1840
|
+
const { update_set_id, reason = 'Manual rollback requested' } = args;
|
|
1841
|
+
// 🔧 TEST-002 FIX: Add proper validation and 404 error handling
|
|
1842
|
+
if (!update_set_id) {
|
|
1843
|
+
return {
|
|
1844
|
+
content: [{
|
|
1845
|
+
type: 'text',
|
|
1846
|
+
text: `❌ TEST-002 FIX: Missing update_set_id parameter\n\n` +
|
|
1847
|
+
`🔧 Usage: snow_rollback_deployment({ update_set_id: "actual_sys_id", reason: "rollback reason" })`
|
|
1848
|
+
}]
|
|
1849
|
+
};
|
|
1850
|
+
}
|
|
1851
|
+
this.logger.info('Rolling back deployment', { update_set_id, reason });
|
|
1852
|
+
// 🔧 TEST-002 FIX: Validate update set exists before attempting rollback
|
|
1853
|
+
let updateSetInfo;
|
|
1854
|
+
try {
|
|
1855
|
+
updateSetInfo = await this.client.get(`/api/now/table/sys_update_set/${update_set_id}`, {
|
|
1856
|
+
sysparm_fields: 'name,description,state,sys_id,is_default'
|
|
1857
|
+
});
|
|
1858
|
+
if (!updateSetInfo?.result) {
|
|
1859
|
+
throw new Error('Update set not found');
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
catch (error) {
|
|
1863
|
+
// 🔧 TEST-002 FIX: Handle 404 errors gracefully with helpful guidance
|
|
1864
|
+
if (error instanceof Error && (error.message.includes('404') || error.message.includes('not found'))) {
|
|
1865
|
+
return {
|
|
1866
|
+
content: [{
|
|
1867
|
+
type: 'text',
|
|
1868
|
+
text: `❌ TEST-002 FIX: Update Set not found (404 error)\n\n` +
|
|
1869
|
+
`🔍 **Update Set ID:** ${update_set_id}\n\n` +
|
|
1870
|
+
`💡 **Possible causes:**\n` +
|
|
1871
|
+
` 1. Update Set sys_id is incorrect or doesn't exist\n` +
|
|
1872
|
+
` 2. Update Set was already rolled back or deleted\n` +
|
|
1873
|
+
` 3. Update Set is in a different instance\n` +
|
|
1874
|
+
` 4. Access permissions issue\n\n` +
|
|
1875
|
+
`🛠️ **Troubleshooting:**\n` +
|
|
1876
|
+
` 1. Verify the sys_id: Navigate to System Update Sets > Local Update Sets\n` +
|
|
1877
|
+
` 2. Check update set history: snow_deployment_status\n` +
|
|
1878
|
+
` 3. Ensure you're connected to the correct ServiceNow instance\n\n` +
|
|
1879
|
+
`📋 **Valid sys_id format:** 32-character hex string (e.g., "1a2b3c4d5e6f7890abcdef1234567890")`
|
|
1880
|
+
}]
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
throw error;
|
|
1884
|
+
}
|
|
1885
|
+
// 🔧 TEST-002 FIX: Check if update set can be rolled back
|
|
1886
|
+
const updateSet = updateSetInfo.result;
|
|
1887
|
+
if (updateSet.state === 'ignore' || updateSet.is_default === 'true') {
|
|
1888
|
+
return {
|
|
1889
|
+
content: [{
|
|
1890
|
+
type: 'text',
|
|
1891
|
+
text: `⚠️ Cannot rollback Update Set: ${updateSet.name}\n\n` +
|
|
1892
|
+
`📋 **Update Set Details:**\n` +
|
|
1893
|
+
` - Name: ${updateSet.name}\n` +
|
|
1894
|
+
` - State: ${updateSet.state}\n` +
|
|
1895
|
+
` - Is Default: ${updateSet.is_default}\n\n` +
|
|
1896
|
+
`🚫 **Rollback not allowed because:**\n` +
|
|
1897
|
+
` ${updateSet.is_default === 'true' ? '- This is the default update set (cannot be rolled back)' : ''}\n` +
|
|
1898
|
+
` ${updateSet.state === 'ignore' ? '- Update set is in "ignore" state' : ''}\n\n` +
|
|
1899
|
+
`💡 **Alternative:** Create a new update set to reverse the changes manually.`
|
|
1900
|
+
}]
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
// 🔧 TEST-002 FIX: Perform actual rollback via ServiceNow API
|
|
1904
|
+
let rollbackResult;
|
|
1905
|
+
try {
|
|
1906
|
+
// Set update set to ignore state (ServiceNow's way of "rolling back")
|
|
1907
|
+
rollbackResult = await this.client.update(`sys_update_set/${update_set_id}`, {
|
|
1908
|
+
state: 'ignore',
|
|
1909
|
+
description: `${updateSet.description || ''} - ROLLED BACK: ${reason}`
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
catch (rollbackError) {
|
|
1913
|
+
return {
|
|
1914
|
+
content: [{
|
|
1915
|
+
type: 'text',
|
|
1916
|
+
text: `❌ Rollback operation failed\n\n` +
|
|
1917
|
+
`🔍 **Update Set:** ${updateSet.name} (${update_set_id})\n` +
|
|
1918
|
+
`📝 **Reason:** ${reason}\n` +
|
|
1919
|
+
`❌ **Error:** ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}\n\n` +
|
|
1920
|
+
`🛠️ **Manual rollback:**\n` +
|
|
1921
|
+
` 1. Go to System Update Sets > Local Update Sets\n` +
|
|
1922
|
+
` 2. Find update set: ${updateSet.name}\n` +
|
|
1923
|
+
` 3. Right-click and select "Back out update set"\n` +
|
|
1924
|
+
` 4. Follow the ServiceNow rollback wizard`
|
|
1925
|
+
}]
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1841
1928
|
return {
|
|
1842
1929
|
content: [
|
|
1843
1930
|
{
|
|
1844
1931
|
type: 'text',
|
|
1845
|
-
text:
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
-
|
|
1849
|
-
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1932
|
+
text: `✅ Rollback completed successfully!\n\n` +
|
|
1933
|
+
`📋 **Update Set Details:**\n` +
|
|
1934
|
+
` - Name: ${updateSet.name}\n` +
|
|
1935
|
+
` - ID: ${update_set_id}\n` +
|
|
1936
|
+
` - Previous State: ${updateSet.state}\n` +
|
|
1937
|
+
` - New State: ignore (rolled back)\n\n` +
|
|
1938
|
+
`📝 **Rollback Reason:** ${reason}\n\n` +
|
|
1939
|
+
`⚠️ **Important Notes:**\n` +
|
|
1940
|
+
` - The update set has been set to "ignore" state\n` +
|
|
1941
|
+
` - Changes are now inactive but records still exist\n` +
|
|
1942
|
+
` - For complete removal, use ServiceNow's "Back out update set" feature\n` +
|
|
1943
|
+
` - Test your application to ensure rollback was successful\n\n` +
|
|
1944
|
+
`🔍 **Verify rollback:** Check that your changes are no longer active in ServiceNow`
|
|
1858
1945
|
},
|
|
1859
1946
|
],
|
|
1860
1947
|
};
|
|
1861
1948
|
}
|
|
1862
1949
|
catch (error) {
|
|
1863
|
-
|
|
1950
|
+
return {
|
|
1951
|
+
content: [{
|
|
1952
|
+
type: 'text',
|
|
1953
|
+
text: `❌ TEST-002 FIX: Rollback system error\n\n` +
|
|
1954
|
+
`📝 **Error:** ${error instanceof Error ? error.message : String(error)}\n\n` +
|
|
1955
|
+
`🛠️ **Recovery options:**\n` +
|
|
1956
|
+
` 1. Verify ServiceNow connection and authentication\n` +
|
|
1957
|
+
` 2. Check update_set_id format (must be 32-char hex string)\n` +
|
|
1958
|
+
` 3. Use ServiceNow UI for manual rollback if needed\n` +
|
|
1959
|
+
` 4. Contact ServiceNow administrator for assistance`
|
|
1960
|
+
}]
|
|
1961
|
+
};
|
|
1864
1962
|
}
|
|
1865
1963
|
}
|
|
1866
1964
|
async getDeploymentStatus(args) {
|