snow-flow 3.6.5 → 3.6.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.
- package/.mcp.json.template +1 -1
- package/dist/cli.js +119 -0
- package/package.json +2 -2
package/.mcp.json.template
CHANGED
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
"args": [
|
|
200
200
|
"{{PROJECT_ROOT}}/dist/mcp/servicenow-local-development-mcp.js"
|
|
201
201
|
],
|
|
202
|
-
"description": "
|
|
202
|
+
"description": "UNIVERSAL ARTIFACT DETECTION v3.6.6 - finds ANY ServiceNow record by sys_id using sys_metadata! Pull any artifact (even custom tables) to local files with Claude Code native tools. Supports all tables, generic artifact creation for unknown types, smart chunking, ES5 validation, coherence checking. Tools: snow_pull_artifact, snow_push_artifact, snow_validate_artifact_coherence",
|
|
203
203
|
"env": {
|
|
204
204
|
"SNOW_INSTANCE": "{{SNOW_INSTANCE}}",
|
|
205
205
|
"SNOW_CLIENT_ID": "{{SNOW_CLIENT_ID}}",
|
package/dist/cli.js
CHANGED
|
@@ -2646,6 +2646,125 @@ async function createMCPConfig(targetDir, force = false) {
|
|
|
2646
2646
|
const claudeSettingsPath = (0, path_1.join)(targetDir, '.claude/settings.json');
|
|
2647
2647
|
await fs_1.promises.writeFile(claudeSettingsPath, JSON.stringify(claudeSettings, null, 2));
|
|
2648
2648
|
}
|
|
2649
|
+
// Setup MCP configuration function
|
|
2650
|
+
async function setupMCPConfig(targetDir, instanceUrl, clientId, clientSecret, force = false) {
|
|
2651
|
+
// Find the Snow-Flow installation root
|
|
2652
|
+
let snowFlowRoot = '';
|
|
2653
|
+
// Try different locations to find the Snow-Flow root
|
|
2654
|
+
const possiblePaths = [
|
|
2655
|
+
(0, path_1.join)(targetDir, 'node_modules/snow-flow'),
|
|
2656
|
+
(0, path_1.join)(targetDir, '../snow-flow-dev/snow-flow'),
|
|
2657
|
+
(0, path_1.join)(process.env.HOME || '', 'Projects/snow-flow-dev/snow-flow'),
|
|
2658
|
+
__dirname.includes('dist') ? (0, path_1.resolve)(__dirname, '..') : __dirname
|
|
2659
|
+
];
|
|
2660
|
+
for (const testPath of possiblePaths) {
|
|
2661
|
+
try {
|
|
2662
|
+
await fs_1.promises.access((0, path_1.join)(testPath, '.mcp.json.template'));
|
|
2663
|
+
snowFlowRoot = testPath;
|
|
2664
|
+
break;
|
|
2665
|
+
}
|
|
2666
|
+
catch {
|
|
2667
|
+
// Keep trying
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
if (!snowFlowRoot) {
|
|
2671
|
+
// Last resort: assume we're running from the installed package
|
|
2672
|
+
snowFlowRoot = (0, path_1.resolve)(__dirname, '..');
|
|
2673
|
+
// Verify we can find the template
|
|
2674
|
+
try {
|
|
2675
|
+
await fs_1.promises.access((0, path_1.join)(snowFlowRoot, '.mcp.json.template'));
|
|
2676
|
+
}
|
|
2677
|
+
catch {
|
|
2678
|
+
throw new Error('Could not find snow-flow project root');
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
// Read the template file
|
|
2682
|
+
const templatePath = (0, path_1.join)(snowFlowRoot, '.mcp.json.template');
|
|
2683
|
+
let templateContent;
|
|
2684
|
+
try {
|
|
2685
|
+
templateContent = await fs_1.promises.readFile(templatePath, 'utf-8');
|
|
2686
|
+
}
|
|
2687
|
+
catch (error) {
|
|
2688
|
+
console.error('❌ Could not find .mcp.json.template file');
|
|
2689
|
+
throw error;
|
|
2690
|
+
}
|
|
2691
|
+
// Replace placeholders in template
|
|
2692
|
+
const mcpConfigContent = templateContent
|
|
2693
|
+
.replace(/{{PROJECT_ROOT}}/g, snowFlowRoot)
|
|
2694
|
+
.replace(/{{SNOW_INSTANCE}}/g, '${SNOW_INSTANCE}')
|
|
2695
|
+
.replace(/{{SNOW_CLIENT_ID}}/g, '${SNOW_CLIENT_ID}')
|
|
2696
|
+
.replace(/{{SNOW_CLIENT_SECRET}}/g, '${SNOW_CLIENT_SECRET}')
|
|
2697
|
+
.replace(/{{SNOW_DEPLOYMENT_TIMEOUT}}/g, '${SNOW_DEPLOYMENT_TIMEOUT}')
|
|
2698
|
+
.replace(/{{MCP_DEPLOYMENT_TIMEOUT}}/g, '${MCP_DEPLOYMENT_TIMEOUT}')
|
|
2699
|
+
.replace(/{{NEO4J_URI}}/g, '${NEO4J_URI}')
|
|
2700
|
+
.replace(/{{NEO4J_USER}}/g, '${NEO4J_USER}')
|
|
2701
|
+
.replace(/{{NEO4J_PASSWORD}}/g, '${NEO4J_PASSWORD}')
|
|
2702
|
+
.replace(/{{SNOW_FLOW_ENV}}/g, '${SNOW_FLOW_ENV}');
|
|
2703
|
+
// Parse to ensure it's valid JSON
|
|
2704
|
+
const mcpConfig = JSON.parse(mcpConfigContent);
|
|
2705
|
+
// Keep the standard MCP structure that Claude Code expects
|
|
2706
|
+
const finalConfig = {
|
|
2707
|
+
"mcpServers": mcpConfig.servers
|
|
2708
|
+
};
|
|
2709
|
+
// Create .mcp.json in project root for Claude Code discovery
|
|
2710
|
+
const mcpConfigPath = (0, path_1.join)(targetDir, '.mcp.json');
|
|
2711
|
+
try {
|
|
2712
|
+
await fs_1.promises.access(mcpConfigPath);
|
|
2713
|
+
if (force) {
|
|
2714
|
+
console.log('⚠️ .mcp.json already exists, overwriting with --force flag');
|
|
2715
|
+
await fs_1.promises.writeFile(mcpConfigPath, JSON.stringify(finalConfig, null, 2));
|
|
2716
|
+
}
|
|
2717
|
+
else {
|
|
2718
|
+
console.log('⚠️ .mcp.json already exists, skipping (use --force to overwrite)');
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
catch {
|
|
2722
|
+
await fs_1.promises.writeFile(mcpConfigPath, JSON.stringify(finalConfig, null, 2));
|
|
2723
|
+
}
|
|
2724
|
+
// Also create legacy config in .claude for backward compatibility
|
|
2725
|
+
const legacyConfigPath = (0, path_1.join)(targetDir, '.claude/mcp-config.json');
|
|
2726
|
+
await fs_1.promises.writeFile(legacyConfigPath, JSON.stringify(finalConfig, null, 2));
|
|
2727
|
+
}
|
|
2728
|
+
// Refresh MCP configuration command
|
|
2729
|
+
program
|
|
2730
|
+
.command('refresh-mcp')
|
|
2731
|
+
.description('Refresh MCP server configuration to latest version')
|
|
2732
|
+
.option('--force', 'Force overwrite existing configuration')
|
|
2733
|
+
.action(async (options) => {
|
|
2734
|
+
console.log(chalk_1.default.blue.bold(`\n🔄 Refreshing MCP Configuration to v${version_js_1.VERSION}...`));
|
|
2735
|
+
console.log('='.repeat(60));
|
|
2736
|
+
try {
|
|
2737
|
+
// Check if project is initialized
|
|
2738
|
+
const envPath = (0, path_1.join)(process.cwd(), '.env');
|
|
2739
|
+
if (!(0, fs_2.existsSync)(envPath)) {
|
|
2740
|
+
console.error(chalk_1.default.red('\n❌ No .env file found. Please run "snow-flow init" first.'));
|
|
2741
|
+
process.exit(1);
|
|
2742
|
+
}
|
|
2743
|
+
// Load env vars
|
|
2744
|
+
dotenv_1.default.config({ path: envPath });
|
|
2745
|
+
const instanceUrl = process.env.SNOW_INSTANCE;
|
|
2746
|
+
const clientId = process.env.SNOW_CLIENT_ID;
|
|
2747
|
+
const clientSecret = process.env.SNOW_CLIENT_SECRET;
|
|
2748
|
+
if (!instanceUrl || !clientId || !clientSecret) {
|
|
2749
|
+
console.error(chalk_1.default.red('\n❌ Missing ServiceNow credentials in .env file.'));
|
|
2750
|
+
process.exit(1);
|
|
2751
|
+
}
|
|
2752
|
+
console.log('\n📝 Updating MCP configuration...');
|
|
2753
|
+
await setupMCPConfig(process.cwd(), instanceUrl, clientId, clientSecret, options.force || false);
|
|
2754
|
+
console.log(chalk_1.default.green('\n✅ MCP configuration refreshed successfully!'));
|
|
2755
|
+
console.log('\n📢 IMPORTANT: Restart Claude Code to use the new configuration:');
|
|
2756
|
+
console.log(chalk_1.default.cyan(' claude --mcp-config .mcp.json'));
|
|
2757
|
+
console.log('\n💡 The Local Development server now includes:');
|
|
2758
|
+
console.log(' • Universal artifact detection via sys_metadata');
|
|
2759
|
+
console.log(' • Support for ANY ServiceNow table (even custom)');
|
|
2760
|
+
console.log(' • Generic artifact handling for unknown types');
|
|
2761
|
+
console.log(' • Automatic file structure creation');
|
|
2762
|
+
}
|
|
2763
|
+
catch (error) {
|
|
2764
|
+
console.error(chalk_1.default.red('\n❌ Failed to refresh MCP configuration:'), error);
|
|
2765
|
+
process.exit(1);
|
|
2766
|
+
}
|
|
2767
|
+
});
|
|
2649
2768
|
// Direct widget creation command
|
|
2650
2769
|
program
|
|
2651
2770
|
.command('create-widget [type]')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.6.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.6.6",
|
|
4
|
+
"description": "MCP TEMPLATE FIX - v3.6.6 ensures snow-flow init generates correct .mcp.json with UNIVERSAL ARTIFACT DETECTION. Uses sys_metadata to find ANY ServiceNow record by sys_id alone. Generic artifact support for custom/unknown tables. Auto-creates editable file structure for ANY table type. Includes early auto-compact, audit logging, and consolidated CLAUDE.md.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|