chore: remove run-metadata.json functionality
Reasoning:
- Pollutes target repo with run-metadata.json
- Redundant with audit system (session.json has all metadata)
- Less useful than comprehensive audit logs
- Target repos should stay clean - only deliverables belong there
All debugging info now lives in audit-logs/{hostname}_{sessionId}/session.json
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
-10
@@ -13,7 +13,6 @@ 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 } 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';
|
||||||
@@ -178,15 +177,6 @@ async function main(webUrl, repoPath, configPath = null, pipelineTestingMode = f
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save run metadata with error handling
|
|
||||||
try {
|
|
||||||
await saveRunMetadata(sourceDir, webUrl, repoPath);
|
|
||||||
} catch (error) {
|
|
||||||
// Non-critical operation, log warning and continue
|
|
||||||
console.log(chalk.yellow(`⚠️ Failed to save run metadata: ${error.message}`));
|
|
||||||
await logError(error, 'Run metadata saving', sourceDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we should continue from where session left off
|
// Check if we should continue from where session left off
|
||||||
const nextAgent = getNextAgent(session);
|
const nextAgent = getNextAgent(session);
|
||||||
if (!nextAgent) {
|
if (!nextAgent) {
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
import { fs, path } from 'zx';
|
|
||||||
import chalk from 'chalk';
|
|
||||||
import { PentestError, logError } from '../error-handling.js';
|
|
||||||
|
|
||||||
// Pure function: Save run metadata for debugging and reproducibility
|
|
||||||
export async function saveRunMetadata(sourceDir, webUrl, repoPath) {
|
|
||||||
console.log(chalk.blue('💾 Saving run metadata...'));
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Read package.json to get version info with error handling
|
|
||||||
const packagePath = path.join(import.meta.dirname, '..', '..', 'package.json');
|
|
||||||
let packageJson;
|
|
||||||
try {
|
|
||||||
packageJson = await fs.readJSON(packagePath);
|
|
||||||
} catch (packageError) {
|
|
||||||
throw new PentestError(
|
|
||||||
`Cannot read package.json: ${packageError.message}`,
|
|
||||||
'filesystem',
|
|
||||||
false,
|
|
||||||
{ packagePath, originalError: packageError.message }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const metadata = {
|
|
||||||
timestamp: new Date().toISOString(),
|
|
||||||
targets: { webUrl, repoPath },
|
|
||||||
environment: {
|
|
||||||
nodeVersion: process.version,
|
|
||||||
platform: process.platform,
|
|
||||||
arch: process.arch,
|
|
||||||
cwd: process.cwd()
|
|
||||||
},
|
|
||||||
dependencies: {
|
|
||||||
claudeCodeVersion: packageJson.dependencies?.['@anthropic-ai/claude-code'] || 'unknown',
|
|
||||||
zxVersion: packageJson.dependencies?.['zx'] || 'unknown',
|
|
||||||
chalkVersion: packageJson.dependencies?.['chalk'] || 'unknown'
|
|
||||||
},
|
|
||||||
execution: {
|
|
||||||
args: process.argv,
|
|
||||||
env: {
|
|
||||||
PLAYWRIGHT_HEADLESS: process.env.PLAYWRIGHT_HEADLESS || 'true',
|
|
||||||
NODE_ENV: process.env.NODE_ENV
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const metadataPath = path.join(sourceDir, 'run-metadata.json');
|
|
||||||
await fs.writeJSON(metadataPath, metadata, { spaces: 2 });
|
|
||||||
|
|
||||||
console.log(chalk.green(`✅ Run metadata saved to: ${metadataPath}`));
|
|
||||||
return metadata;
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof PentestError) {
|
|
||||||
await logError(error, 'Saving run metadata', sourceDir);
|
|
||||||
throw error; // Re-throw PentestError to be handled by caller
|
|
||||||
}
|
|
||||||
|
|
||||||
const metadataError = new PentestError(
|
|
||||||
`Run metadata saving failed: ${error.message}`,
|
|
||||||
'filesystem',
|
|
||||||
false,
|
|
||||||
{ sourceDir, originalError: error.message }
|
|
||||||
);
|
|
||||||
await logError(metadataError, 'Saving run metadata', sourceDir);
|
|
||||||
throw metadataError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user