[fix] Statusline script creation - add missing imports and escape bash variables

- Added missing path and os imports to enhancedClaudeFlowInit function
- Fixed bash variable escaping in createStatuslineScript() template literal
- Escaped ${MEM_COLOR}, ${CPU_COLOR}, ${SUCCESS_COLOR} to prevent JS interpolation
- Added error message logging for better debugging
- Verified in Docker: statusline now creates with executable permissions (755)
- Resolves 'Could not create statusline script' warning
This commit is contained in:
rUv committed 2025-10-20 01:55:46 +00:00
1 parent 16ebe47357
commit 876f2782e7
1 file changed
+7 -4
+7 -4
View File
@@ -220,7 +220,7 @@ if [ -d "$FLOW_DIR" ]; then
else
MEM_COLOR="\\033[31m" # Red
fi
echo -ne " ${MEM_COLOR}💾 ${MEM_PERCENT}%\\033[0m"
echo -ne " \${MEM_COLOR}💾 \${MEM_PERCENT}%\\033[0m"
fi
# CPU load
@@ -234,7 +234,7 @@ if [ -d "$FLOW_DIR" ]; then
else
CPU_COLOR="\\033[31m" # Red
fi
echo -ne " ${CPU_COLOR}⚙ ${CPU_LOAD}%\\033[0m"
echo -ne " \${CPU_COLOR}⚙ \${CPU_LOAD}%\\033[0m"
fi
fi
fi
@@ -288,7 +288,7 @@ if [ -d "$FLOW_DIR" ]; then
else
SUCCESS_COLOR="\\033[31m" # Red
fi
echo -ne " ${SUCCESS_COLOR}🎯 ${SUCCESS_RATE}%\\033[0m"
echo -ne " \${SUCCESS_COLOR}🎯 \${SUCCESS_RATE}%\\033[0m"
fi
# Average Time
@@ -1332,9 +1332,11 @@ async function enhancedClaudeFlowInit(flags, subArgs = []) {
const args = subArgs || [];
const options = flags || {};
// Import fs module for Node.js
// Import fs, path, and os modules for Node.js
const fs = await import('fs/promises');
const { chmod } = fs;
const path = await import('path');
const os = await import('os');
try {
// Check existing files
@@ -1418,6 +1420,7 @@ async function enhancedClaudeFlowInit(flags, subArgs = []) {
// Not critical, just skip
if (!dryRun) {
console.log(' ⚠️ Could not create statusline script, skipping...');
console.log(` ℹ️ Error: ${err.message}`);
}
}