snow-flow 1.3.9 → 1.3.11

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/dist/cli.js CHANGED
@@ -159,8 +159,8 @@ program
159
159
  cliLogger.info('šŸ“‹ Creating production-ready ServiceNow flow XML...');
160
160
  cliLogger.info('šŸ’” Reason: Flow Designer flows are most reliable with XML-first approach\n');
161
161
  try {
162
- // Import XML flow generator
163
- const { generateProductionFlowXML } = await Promise.resolve().then(() => __importStar(require('./utils/xml-first-flow-generator.js')));
162
+ // Import IMPROVED XML flow generator (fixes "too small to work" issue!)
163
+ const { generateImprovedFlowXML } = await Promise.resolve().then(() => __importStar(require('./utils/improved-flow-xml-generator.js')));
164
164
  // Parse instruction to determine activities
165
165
  const activities = [];
166
166
  const objectiveLower = objective.toLowerCase();
@@ -236,12 +236,25 @@ program
236
236
  outputs: { started: 'boolean' }
237
237
  }]
238
238
  };
239
- // Generate XML
240
- cliLogger.info('šŸ—ļø Generating production XML...');
241
- const result = generateProductionFlowXML(flowDef);
239
+ // Generate IMPROVED XML with enhanced structure
240
+ cliLogger.info('šŸ—ļø Generating IMPROVED production XML...');
241
+ // Convert to improved flow definition
242
+ const improvedFlowDef = {
243
+ ...flowDef,
244
+ run_as: 'user',
245
+ accessible_from: 'package_private',
246
+ category: 'custom',
247
+ tags: ['auto-generated'],
248
+ activities: flowDef.activities.map((act) => ({
249
+ ...act,
250
+ description: act.description || act.name
251
+ }))
252
+ };
253
+ const result = generateImprovedFlowXML(improvedFlowDef);
242
254
  xmlFlowResult = { ...result, flowDefinition: flowDef };
243
- cliLogger.info(`\nāœ… XML Generated Successfully!`);
255
+ cliLogger.info(`\nāœ… IMPROVED XML Generated Successfully!`);
244
256
  cliLogger.info(`šŸ“ File saved to: ${result.filePath}`);
257
+ cliLogger.info(`šŸ”„ IMPROVEMENTS: Uses v2 tables, Base64+gzip encoding, complete label_cache!`);
245
258
  cliLogger.info(`šŸ“Š Flow structure:`);
246
259
  cliLogger.info(` - Name: ${flowDef.name}`);
247
260
  cliLogger.info(` - Table: ${flowDef.table}`);
@@ -399,29 +412,29 @@ async function executeClaudeCode(prompt) {
399
412
  // Check for MCP config
400
413
  const mcpConfigPath = (0, path_1.join)(process.cwd(), '.mcp.json');
401
414
  const hasMcpConfig = (0, fs_2.existsSync)(mcpConfigPath);
402
- // Launch Claude Code with MCP config
415
+ // Launch Claude Code with MCP config and skip permissions to avoid raw mode issues
403
416
  const claudeArgs = hasMcpConfig
404
- ? ['--mcp-config', '.mcp.json', '.']
405
- : ['.'];
417
+ ? ['--mcp-config', '.mcp.json', '.', '--dangerously-skip-permissions']
418
+ : ['--dangerously-skip-permissions'];
406
419
  cliLogger.info('šŸš€ Launching Claude Code automatically...');
407
420
  if (hasMcpConfig) {
408
421
  cliLogger.info('šŸ”§ Starting Claude Code with ServiceNow MCP servers...');
409
422
  }
410
- // Start Claude Code process in interactive mode
423
+ // Start Claude Code process in interactive mode with stdin piping
411
424
  const claudeProcess = (0, child_process_1.spawn)('claude', claudeArgs, {
412
- stdio: ['pipe', 'inherit', 'inherit'],
413
- shell: true,
425
+ stdio: ['pipe', 'inherit', 'inherit'], // pipe stdin, inherit stdout/stderr
426
+ cwd: process.cwd(),
414
427
  env: { ...process.env }
415
428
  });
416
- // Send the prompt to Claude Code
429
+ // Send the prompt via stdin
417
430
  cliLogger.info('šŸ“ Sending orchestration prompt to Claude Code...');
418
431
  cliLogger.info('šŸš€ Claude Code interface opening...\n');
419
- // Write prompt and close stdin to trigger execution
432
+ // Write prompt to stdin
420
433
  claudeProcess.stdin.write(prompt);
421
434
  claudeProcess.stdin.end();
422
435
  // Set up process monitoring
423
436
  return new Promise((resolve) => {
424
- claudeProcess.on('close', (code) => {
437
+ claudeProcess.on('close', async (code) => {
425
438
  if (code === 0) {
426
439
  cliLogger.info('\nāœ… Claude Code session completed successfully!');
427
440
  resolve(true);
@@ -4324,8 +4337,8 @@ program
4324
4337
  console.log(`\nšŸ”§ XML-First Flow Generator v${version_js_1.VERSION}`);
4325
4338
  console.log('šŸ“‹ Creating production-ready ServiceNow flow XML...\n');
4326
4339
  try {
4327
- // Import XML flow generator
4328
- const { generateProductionFlowXML } = await Promise.resolve().then(() => __importStar(require('./utils/xml-first-flow-generator.js')));
4340
+ // Import IMPROVED XML flow generator (fixes "too small to work" issue!)
4341
+ const { generateImprovedFlowXML } = await Promise.resolve().then(() => __importStar(require('./utils/improved-flow-xml-generator.js')));
4329
4342
  // Parse instruction to determine activities
4330
4343
  const activities = [];
4331
4344
  // Check for common patterns in instruction
@@ -4403,11 +4416,24 @@ return { started: true };`
4403
4416
  }
4404
4417
  ];
4405
4418
  }
4406
- // Generate XML
4407
- console.log('\nšŸ—ļø Generating production XML...');
4408
- const result = generateProductionFlowXML(flowDef);
4409
- console.log(`\nāœ… XML Generated Successfully!`);
4419
+ // Generate IMPROVED XML with enhanced structure
4420
+ console.log('\nšŸ—ļø Generating IMPROVED production XML...');
4421
+ // Convert to improved flow definition
4422
+ const improvedFlowDef = {
4423
+ ...flowDef,
4424
+ run_as: 'user',
4425
+ accessible_from: 'package_private',
4426
+ category: 'custom',
4427
+ tags: ['cli-generated'],
4428
+ activities: flowDef.activities.map((act) => ({
4429
+ ...act,
4430
+ description: act.description || act.name
4431
+ }))
4432
+ };
4433
+ const result = generateImprovedFlowXML(improvedFlowDef);
4434
+ console.log(`\nāœ… IMPROVED XML Generated Successfully!`);
4410
4435
  console.log(`šŸ“ File saved to: ${result.filePath}`);
4436
+ console.log(`šŸ”„ IMPROVEMENTS: Uses v2 tables, Base64+gzip encoding, complete label_cache!`);
4411
4437
  console.log(`šŸ“Š Flow structure:`);
4412
4438
  console.log(` - Name: ${flowDef.name}`);
4413
4439
  console.log(` - Table: ${flowDef.table}`);