chore: remove permanent deliverables copying to Documents folder
Simplified deliverable management by removing automatic copying to ~/Documents/pentest-deliverables/. All deliverables now remain only in <target-repo>/deliverables/, eliminating file duplication and improving UX. Changes: - Removed savePermanentDeliverables() function from src/setup/deliverables.js - Removed function call and related console output from shannon.mjs - Removed unused 'os' import from deliverables.js 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-14
@@ -13,7 +13,7 @@ import { runPhase, getGitCommitHash } from './src/checkpoint-manager.js';
|
|||||||
|
|
||||||
// Setup and Deliverables
|
// Setup and Deliverables
|
||||||
import { setupLocalRepo, cleanupMCP } from './src/setup/environment.js';
|
import { setupLocalRepo, cleanupMCP } from './src/setup/environment.js';
|
||||||
import { saveRunMetadata, savePermanentDeliverables } from './src/setup/deliverables.js';
|
import { saveRunMetadata } from './src/setup/deliverables.js';
|
||||||
|
|
||||||
// AI and Prompts
|
// AI and Prompts
|
||||||
import { runClaudePromptWithRetry } from './src/ai/claude-executor.js';
|
import { runClaudePromptWithRetry } from './src/ai/claude-executor.js';
|
||||||
@@ -350,19 +350,6 @@ async function main(webUrl, repoPath, configPath = null, pipelineTestingMode = f
|
|||||||
costBreakdown
|
costBreakdown
|
||||||
});
|
});
|
||||||
|
|
||||||
// Save deliverables to permanent location in Documents
|
|
||||||
const permanentPath = await savePermanentDeliverables(
|
|
||||||
sourceDir, webUrl, repoPath, session, timingBreakdown, costBreakdown
|
|
||||||
);
|
|
||||||
if (permanentPath) {
|
|
||||||
console.log(chalk.green(`📂 Deliverables permanently saved to: ${permanentPath}`));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep files for manual review
|
|
||||||
console.log(chalk.blue(`📁 Files preserved for review at: ${sourceDir}`));
|
|
||||||
console.log(chalk.gray(` Deliverables: ${sourceDir}/deliverables/`));
|
|
||||||
console.log(chalk.gray(` Source code: ${sourceDir}/`));
|
|
||||||
|
|
||||||
// Display comprehensive timing summary
|
// Display comprehensive timing summary
|
||||||
displayTimingSummary();
|
displayTimingSummary();
|
||||||
|
|
||||||
|
|||||||
@@ -1,76 +1,7 @@
|
|||||||
import { fs, path, os } from 'zx';
|
import { fs, path } from 'zx';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { PentestError, logError } from '../error-handling.js';
|
import { PentestError, logError } from '../error-handling.js';
|
||||||
|
|
||||||
// Pure function: Save deliverables permanently to user directory
|
|
||||||
export async function savePermanentDeliverables(sourceDir, webUrl, repoPath, session, timingBreakdown, costBreakdown) {
|
|
||||||
try {
|
|
||||||
// Simple universal approach - try Documents, fallback to home
|
|
||||||
const homeDir = os.homedir();
|
|
||||||
const documentsDir = path.join(homeDir, 'Documents');
|
|
||||||
|
|
||||||
// Use Documents if it exists, otherwise use home directory
|
|
||||||
const baseDir = await fs.pathExists(documentsDir) ? documentsDir : homeDir;
|
|
||||||
const permanentBaseDir = path.join(baseDir, 'pentest-deliverables');
|
|
||||||
|
|
||||||
// Generate directory name from repo path and web URL
|
|
||||||
const repoName = path.basename(repoPath);
|
|
||||||
const webDomain = new URL(webUrl).hostname.replace(/[^a-zA-Z0-9-]/g, '-');
|
|
||||||
const timestamp = new Date().toISOString().replace(/[-:]/g, '').replace(/T/, '-').split('.')[0];
|
|
||||||
const dirName = `${webDomain}_${repoName}_${timestamp}`;
|
|
||||||
const permanentDir = path.join(permanentBaseDir, dirName);
|
|
||||||
|
|
||||||
// Ensure base directory exists
|
|
||||||
await fs.ensureDir(permanentBaseDir);
|
|
||||||
|
|
||||||
// Create the specific pentest directory
|
|
||||||
await fs.ensureDir(permanentDir);
|
|
||||||
|
|
||||||
// Copy deliverables folder if it exists
|
|
||||||
const deliverablesSource = path.join(sourceDir, 'deliverables');
|
|
||||||
const deliverablesDest = path.join(permanentDir, 'deliverables');
|
|
||||||
|
|
||||||
if (await fs.pathExists(deliverablesSource)) {
|
|
||||||
await fs.copy(deliverablesSource, deliverablesDest, { overwrite: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save metadata with session information
|
|
||||||
const metadata = {
|
|
||||||
session: {
|
|
||||||
id: session.id,
|
|
||||||
webUrl,
|
|
||||||
repoPath,
|
|
||||||
configFile: session.configFile,
|
|
||||||
status: session.status,
|
|
||||||
completedAgents: session.completedAgents,
|
|
||||||
createdAt: session.createdAt,
|
|
||||||
completedAt: new Date().toISOString()
|
|
||||||
},
|
|
||||||
timing: timingBreakdown,
|
|
||||||
cost: costBreakdown,
|
|
||||||
sourceDirectory: sourceDir,
|
|
||||||
savedAt: new Date().toISOString()
|
|
||||||
};
|
|
||||||
|
|
||||||
await fs.writeJSON(path.join(permanentDir, 'metadata.json'), metadata, { spaces: 2 });
|
|
||||||
|
|
||||||
// Copy prompts directory for reproducibility
|
|
||||||
const promptsSource = path.join(import.meta.dirname, '..', '..', 'prompts');
|
|
||||||
const promptsDest = path.join(permanentDir, 'prompts');
|
|
||||||
|
|
||||||
if (await fs.pathExists(promptsSource)) {
|
|
||||||
await fs.copy(promptsSource, promptsDest, { overwrite: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(chalk.green(`✅ Deliverables saved to permanent location: ${permanentDir}`));
|
|
||||||
return permanentDir;
|
|
||||||
} catch (error) {
|
|
||||||
// Non-fatal error - log but don't throw
|
|
||||||
console.log(chalk.yellow(`⚠️ Failed to save permanent deliverables: ${error.message}`));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pure function: Save run metadata for debugging and reproducibility
|
// Pure function: Save run metadata for debugging and reproducibility
|
||||||
export async function saveRunMetadata(sourceDir, webUrl, repoPath) {
|
export async function saveRunMetadata(sourceDir, webUrl, repoPath) {
|
||||||
console.log(chalk.blue('💾 Saving run metadata...'));
|
console.log(chalk.blue('💾 Saving run metadata...'));
|
||||||
|
|||||||
Reference in New Issue
Block a user