|
| 1 | +diff --git a/AutoSnap/test-enhanced-flow-ci.js b/AutoSnap/test-enhanced-flow-ci.js |
| 2 | +index 123456..789012 100644 |
| 3 | +--- a/AutoSnap/test-enhanced-flow-ci.js |
| 4 | ++++ b/AutoSnap/test-enhanced-flow-ci.js |
| 5 | +@@ -1290,6 +1290,7 @@ const args = process.argv.slice(2); |
| 6 | + let changedFiles = null; |
| 7 | + let modeArg = null; |
| 8 | + let folderPath = null; |
| 9 | ++let scenarioArg = null; |
| 10 | + let singleFilePath = null; |
| 11 | + let listFilePath = null; |
| 12 | + let languageCodeArg = null; |
| 13 | +@@ -1306,6 +1307,9 @@ for (let i = 0; i < args.length; i++) { |
| 14 | + } else if ((args[i] === '--mode' || args[i] === '-m') && args[i + 1]) { |
| 15 | + modeArg = args[i + 1]; |
| 16 | + i++; |
| 17 | ++ } else if (args[i] === '--scenario' && args[i + 1]) { |
| 18 | ++ scenarioArg = args[i + 1]; |
| 19 | ++ i++; |
| 20 | + } else if (args[i] === '--folder' && args[i + 1]) { |
| 21 | + folderPath = args[i + 1]; |
| 22 | + i++; |
| 23 | +@@ -1321,6 +1325,12 @@ for (let i = 0; i < args.length; i++) { |
| 24 | + } |
| 25 | + } |
| 26 | + |
| 27 | ++// If scenario is specified but mode is not, use scenario as mode |
| 28 | ++if (scenarioArg && !modeArg) { |
| 29 | ++ console.log(`🔄 Using scenario '${scenarioArg}' as mode`); |
| 30 | ++ modeArg = scenarioArg; |
| 31 | ++} |
| 32 | ++ |
| 33 | + // Validate exclusive options |
| 34 | + const exclusiveOptions = [folderPath, singleFilePath, changedFiles, listFilePath].filter(Boolean); |
| 35 | + if (exclusiveOptions.length > 1) { |
| 36 | +@@ -1329,6 +1339,9 @@ if (exclusiveOptions.length > 1) { |
| 37 | + process.exit(1); |
| 38 | + } |
| 39 | + |
| 40 | ++// Detect if running in GitHub Actions or CI environment |
| 41 | ++const isCI = process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true'; |
| 42 | ++ |
| 43 | + // Determine execution mode and process files accordingly |
| 44 | + let executionMode = 'default'; |
| 45 | + let filesToProcess = []; |
| 46 | +@@ -1357,7 +1370,7 @@ if (singleFilePath) { |
| 47 | + console.log(`🔍 Classifying file: ${singleFilePath}`); |
| 48 | + let mode; |
| 49 | + |
| 50 | +- if (modeArg && ['new_feature', 'ui_change', 'default'].includes(modeArg)) { |
| 51 | ++ if (modeArg && ['new_feature', 'ui_change', 'default'].includes(modeArg.toLowerCase())) { |
| 52 | + // Force specific mode if provided |
| 53 | + mode = modeArg; |
| 54 | + console.log(`🎯 Forced mode: ${mode.toUpperCase()}`); |
| 55 | +@@ -1677,7 +1690,7 @@ const processNewFeature = async (filePath) => { |
| 56 | + // Determine if a specific mode was specified on the command line |
| 57 | + const modeIndex = args.findIndex(arg => arg === '--mode' || arg === '-m'); |
| 58 | + if (modeIndex !== -1 && args[modeIndex + 1]) { |
| 59 | +- const mode = args[modeIndex + 1]; |
| 60 | ++ const mode = args[modeIndex + 1].toLowerCase(); |
| 61 | + if (['new_feature', 'ui_change', 'default'].includes(mode)) { |
| 62 | + console.log(`🎯 Using command-line specified mode: ${mode.toUpperCase()}`); |
| 63 | + return mode; |
| 64 | +@@ -1685,6 +1698,16 @@ const processNewFeature = async (filePath) => { |
| 65 | + console.warn(`⚠️ Invalid mode specified: ${mode}, will determine automatically`); |
| 66 | + } |
| 67 | + |
| 68 | ++ // Check if scenario was specified |
| 69 | ++ const scenarioIndex = args.findIndex(arg => arg === '--scenario'); |
| 70 | ++ if (scenarioIndex !== -1 && args[scenarioIndex + 1]) { |
| 71 | ++ const scenario = args[scenarioIndex + 1].toLowerCase(); |
| 72 | ++ if (['new_feature', 'ui_change', 'default'].includes(scenario)) { |
| 73 | ++ console.log(`🎯 Using command-line specified scenario as mode: ${scenario.toUpperCase()}`); |
| 74 | ++ return scenario; |
| 75 | ++ } |
| 76 | ++ } |
| 77 | ++ |
| 78 | + // If in CI environment, default to new_feature mode for single files |
| 79 | + if (isCI) { |
| 80 | + console.log(`🤖 CI environment detected, defaulting to NEW_FEATURE mode for single file`); |
| 81 | +@@ -1693,6 +1716,12 @@ const processNewFeature = async (filePath) => { |
| 82 | + |
| 83 | + // Interactive mode selection for single file |
| 84 | + console.log(`\nAvailable modes for single file:`); |
| 85 | ++ |
| 86 | ++ // If running in CI environment, default to new_feature without prompting |
| 87 | ++ if (isCI) { |
| 88 | ++ console.log(`🤖 CI environment detected, using NEW_FEATURE mode without prompting`); |
| 89 | ++ return 'new_feature'; |
| 90 | ++ } |
| 91 | + |
| 92 | + const readline = await import('node:readline'); |
| 93 | + const rl = readline.createInterface({ |
0 commit comments