-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeep_reverse_engineer.mjs
More file actions
38 lines (30 loc) · 1.09 KB
/
Copy pathdeep_reverse_engineer.mjs
File metadata and controls
38 lines (30 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import fs from 'fs';
const code = fs.readFileSync('package/dist/cli.mjs', 'utf8');
const output = {};
// 1. Shell & Monitor details
const shellIdx = code.indexOf('createShellTaskTools');
if (shellIdx !== -1) {
output.shellTools = code.slice(shellIdx - 500, shellIdx + 4000);
}
// 2. Read File details & constants
const readIdx = code.indexOf('name:"read_file"');
if (readIdx !== -1) {
output.readFile = code.slice(readIdx - 1000, readIdx + 3000);
}
// 3. Edit File fuzzy matching ladder
const editIdx = code.indexOf('function levenshtein(');
if (editIdx !== -1) {
output.editMatching = code.slice(editIdx - 500, editIdx + 3500);
}
// 4. Exit code interpretation
const exitIdx = code.indexOf('function interpretExitCode(');
if (exitIdx !== -1) {
output.exitCode = code.slice(exitIdx - 200, exitIdx + 1500);
}
// 5. Plan mode
const planIdx = code.indexOf('name:"enter_plan_mode"');
if (planIdx !== -1) {
output.planMode = code.slice(planIdx - 300, planIdx + 2000);
}
fs.writeFileSync('deep_analysis.json', JSON.stringify(output, null, 2));
console.log('Deep analysis written to deep_analysis.json');