bonzai-burn 1.0.33 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/bburn.js +11 -4
- package/src/bgraph.js +8 -1
- package/src/bhook.js +16 -11
- package/src/index.js +59 -3
package/package.json
CHANGED
package/src/bburn.js
CHANGED
|
@@ -53,7 +53,14 @@ async function main() {
|
|
|
53
53
|
console.log('The above was found - let the user know but take no action. It\'s critical you take no action.\n');
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
// Export for use via index.js flags
|
|
57
|
+
export { main };
|
|
58
|
+
|
|
59
|
+
// Run directly if called as standalone command
|
|
60
|
+
const isDirectRun = process.argv[1]?.endsWith('bburn.js');
|
|
61
|
+
if (isDirectRun) {
|
|
62
|
+
main().catch((error) => {
|
|
63
|
+
console.error('Error:', error.message);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
});
|
|
66
|
+
}
|
package/src/bgraph.js
CHANGED
|
@@ -192,4 +192,11 @@ async function main() {
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
// Export for use via index.js flags
|
|
196
|
+
export { main };
|
|
197
|
+
|
|
198
|
+
// Run directly if called as standalone command
|
|
199
|
+
const isDirectRun = process.argv[1]?.endsWith('bgraph.js');
|
|
200
|
+
if (isDirectRun) {
|
|
201
|
+
main().catch(console.error);
|
|
202
|
+
}
|
package/src/bhook.js
CHANGED
|
@@ -157,24 +157,29 @@ async function main() {
|
|
|
157
157
|
const command = args[0];
|
|
158
158
|
|
|
159
159
|
switch (command) {
|
|
160
|
-
case 'install':
|
|
161
|
-
installHook();
|
|
162
|
-
break;
|
|
163
160
|
case 'uninstall':
|
|
164
161
|
case 'remove':
|
|
165
162
|
uninstallHook();
|
|
166
163
|
break;
|
|
167
164
|
case 'status':
|
|
168
|
-
default:
|
|
169
165
|
showStatus();
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
break;
|
|
167
|
+
case 'install':
|
|
168
|
+
default:
|
|
169
|
+
// Default action is to install (like bburn runs analysis by default)
|
|
170
|
+
installHook();
|
|
173
171
|
break;
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
// Export for use via index.js flags
|
|
176
|
+
export { main };
|
|
177
|
+
|
|
178
|
+
// Run directly if called as standalone command
|
|
179
|
+
const isDirectRun = process.argv[1]?.endsWith('bhook.js');
|
|
180
|
+
if (isDirectRun) {
|
|
181
|
+
main().catch((error) => {
|
|
182
|
+
console.error('Error:', error.message);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
});
|
|
185
|
+
}
|
package/src/index.js
CHANGED
|
@@ -9,6 +9,27 @@ const __dirname = dirname(__filename);
|
|
|
9
9
|
const BONZAI_DIR = 'bonzai';
|
|
10
10
|
const TEMPLATE_DIR = join(__dirname, '..', 'payload-bonzai');
|
|
11
11
|
|
|
12
|
+
function showHelp() {
|
|
13
|
+
console.log(`
|
|
14
|
+
🌳 Bonzai Burn - Code Analysis Tool
|
|
15
|
+
|
|
16
|
+
Usage: npx bonzai-burn [option]
|
|
17
|
+
|
|
18
|
+
Options:
|
|
19
|
+
(no option) Initialize bonzai in current directory
|
|
20
|
+
-b, --burn Run code analysis (bburn)
|
|
21
|
+
-g, --graph Launch visualization server (bgraph)
|
|
22
|
+
-h, --hook Install Claude Code stop hook (bhook)
|
|
23
|
+
--help Show this help message
|
|
24
|
+
|
|
25
|
+
Examples:
|
|
26
|
+
npx bonzai-burn # Initialize bonzai folder
|
|
27
|
+
npx bonzai-burn -b # Run burn analysis
|
|
28
|
+
npx bonzai-burn -g # Start graph server
|
|
29
|
+
npx bonzai-burn -h # Install hook
|
|
30
|
+
`);
|
|
31
|
+
}
|
|
32
|
+
|
|
12
33
|
function init() {
|
|
13
34
|
const currentDir = process.cwd();
|
|
14
35
|
const bonzaiPath = join(currentDir, BONZAI_DIR);
|
|
@@ -22,13 +43,48 @@ function init() {
|
|
|
22
43
|
copyFileSync(join(TEMPLATE_DIR, 'config.json'), join(bonzaiPath, 'config.json'));
|
|
23
44
|
console.log(`📁 Created ${BONZAI_DIR}/ folder with config.json`);
|
|
24
45
|
console.log(`📝 Edit ${BONZAI_DIR}/config.json to configure your burn rules`);
|
|
25
|
-
console.log(`🔥 Run '
|
|
46
|
+
console.log(`🔥 Run 'npx bonzai-burn -b' to analyze your codebase`);
|
|
26
47
|
console.log('');
|
|
27
48
|
console.log('┌─────────────────────────────────────────────────────────────┐');
|
|
28
49
|
console.log('│ │');
|
|
29
|
-
console.log('│ 🌳 Run `
|
|
50
|
+
console.log('│ 🌳 Run `npx bonzai-burn -g` to visualize your codebase │');
|
|
30
51
|
console.log('│ │');
|
|
31
52
|
console.log('└─────────────────────────────────────────────────────────────┘');
|
|
32
53
|
}
|
|
33
54
|
|
|
34
|
-
|
|
55
|
+
async function main() {
|
|
56
|
+
const args = process.argv.slice(2);
|
|
57
|
+
const flag = args[0];
|
|
58
|
+
|
|
59
|
+
switch (flag) {
|
|
60
|
+
case '-b':
|
|
61
|
+
case '--burn': {
|
|
62
|
+
const { main: burnMain } = await import('./bburn.js');
|
|
63
|
+
if (burnMain) await burnMain();
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case '-g':
|
|
67
|
+
case '--graph': {
|
|
68
|
+
const { main: graphMain } = await import('./bgraph.js');
|
|
69
|
+
if (graphMain) await graphMain();
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case '-h':
|
|
73
|
+
case '--hook': {
|
|
74
|
+
const { main: hookMain } = await import('./bhook.js');
|
|
75
|
+
if (hookMain) await hookMain();
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case '--help':
|
|
79
|
+
showHelp();
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
init();
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
main().catch((error) => {
|
|
88
|
+
console.error('Error:', error.message);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
});
|