Skip to content

Commit 30f04d7

Browse files
authored
Merge pull request #290 from shivasurya/shiva/ux-improvements
secureflow-cli: ux improvements in logs
2 parents e9e1b32 + 34398cf commit 30f04d7

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

extension/secureflow/packages/secureflow-cli/lib/animated-loader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ async function withLoader(text, asyncFn, options = {}) {
262262
* Convenience function for security analysis with random meme text
263263
*/
264264
async function withSecurityLoader(asyncFn, options = {}) {
265+
// Add a newline before starting the loader for better spacing
266+
console.log('');
265267
const randomMeme = getRandomSecurityMeme();
266268
return await withLoader(randomMeme, asyncFn, options);
267269
}

extension/secureflow/packages/secureflow-cli/lib/token-display.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ class TokenDisplay {
104104

105105
console.log();
106106
console.log(
107-
green(`I:${currentInput} O:${currentOutput}${reasoningText}`) + ' | ' +
108-
cyan(`Total I:${totalInput} O:${totalOutput}`) + ' | ' +
109-
contextColor(`C:${remainingContext}`) + ' ' +
110-
outputColor(`O:${remainingOutput}`) + ' | ' +
111-
magenta(`${contextPercentage}%`)
107+
green(`Input :${currentInput} Output :${currentOutput} ${reasoningText}`) + ' | ' +
108+
cyan(`Total Input :${totalInput} Output :${totalOutput}`) + ' | ' +
109+
contextColor(`Context :${remainingContext}`) + ' ' +
110+
outputColor(`Output :${remainingOutput}`) + ' | ' +
111+
magenta(`Context Usage :${contextPercentage}%`)
112112
);
113113
console.log();
114114
}

extension/secureflow/packages/secureflow-cli/scanner/ai-security-analyzer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AISecurityAnalyzer {
2020
* Perform iterative security analysis with file requests
2121
*/
2222
async analyzeProject(profileInfo, projectSummary, reviewPrompt) {
23-
console.log(magenta('🔍 Starting AI-driven security analysis...'));
23+
// console.log(magenta('🔍 Starting AI-driven security analysis...'));
2424

2525
let iteration = 0;
2626
let currentContext = await this._buildInitialContext(profileInfo, projectSummary, reviewPrompt);
@@ -31,7 +31,6 @@ class AISecurityAnalyzer {
3131

3232
while (iteration < this.maxIterations) {
3333
iteration++;
34-
console.log(cyan(`\n📋 Analysis iteration ${iteration}/${this.maxIterations}`));
3534

3635
// Send context to AI and get response
3736
const aiResponse = await this._sendToAI(null, iteration, messages);

extension/secureflow/packages/secureflow-cli/tools/mgmt/analyze-plugins.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,28 @@ download_plugin() {
165165
log "Downloaded $slug successfully"
166166

167167
# Extract with size limits (prevent zip bombs)
168-
if unzip -q -j -o "$zip_file" -d "$plugin_dir" 2>/dev/null; then
168+
if unzip -q -o "$zip_file" -d "/tmp/extract_$$" 2>/dev/null; then
169+
# Handle WordPress plugin directory structure
170+
# Plugins are typically packaged as plugin-name/plugin-name/*
171+
local extracted_dir="/tmp/extract_$$"
172+
local plugin_content_dir
173+
174+
# Find the actual plugin directory (should be the only directory in extracted_dir)
175+
plugin_content_dir=$(find "$extracted_dir" -mindepth 1 -maxdepth 1 -type d | head -1)
176+
177+
if [[ -n "$plugin_content_dir" && -d "$plugin_content_dir" ]]; then
178+
# Move the plugin content to our target directory
179+
mv "$plugin_content_dir"/* "$plugin_dir"/ 2>/dev/null || true
180+
# Handle hidden files if any
181+
mv "$plugin_content_dir"/.[^.]* "$plugin_dir"/ 2>/dev/null || true
182+
# Clean up temporary extraction directory
183+
rm -rf "$extracted_dir"
184+
else
185+
# Fallback: move everything from extraction directory
186+
mv "$extracted_dir"/* "$plugin_dir"/ 2>/dev/null || true
187+
mv "$extracted_dir"/.[^.]* "$plugin_dir"/ 2>/dev/null || true
188+
rm -rf "$extracted_dir"
189+
fi
169190
# Check extracted size (limit to 100MB)
170191
local size=$(du -sm "$plugin_dir" | cut -f1)
171192
if [[ $size -gt 100 ]]; then
@@ -183,7 +204,7 @@ download_plugin() {
183204
return 0
184205
else
185206
error "Failed to extract $slug"
186-
rm -rf "$plugin_dir" "$zip_file"
207+
rm -rf "/tmp/extract_$$" "$zip_file"
187208
return 1
188209
fi
189210
else

0 commit comments

Comments
 (0)