bonzai-burn 1.0.7 ā 1.0.8
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/bonzai/config.json +4 -0
- package/bonzai/specs.md +8 -0
- package/package.json +3 -2
- package/src/btrim.js +8 -35
package/bonzai/specs.md
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bonzai-burn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Git branch-based cleanup tool with btrim and brevert commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"node": ">=16.0.0"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"src"
|
|
22
|
+
"src",
|
|
23
|
+
"bonzai"
|
|
23
24
|
]
|
|
24
25
|
}
|
package/src/btrim.js
CHANGED
|
@@ -15,28 +15,6 @@ const CONFIG_FILE = 'config.json';
|
|
|
15
15
|
// Template folder in the package
|
|
16
16
|
const TEMPLATE_DIR = join(__dirname, '..', 'bonzai');
|
|
17
17
|
|
|
18
|
-
function getTemplate(filename) {
|
|
19
|
-
const templatePath = join(TEMPLATE_DIR, filename);
|
|
20
|
-
if (fs.existsSync(templatePath)) {
|
|
21
|
-
return fs.readFileSync(templatePath, 'utf-8');
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const DEFAULT_SPECS = `# Bonzai Specs
|
|
27
|
-
|
|
28
|
-
Define your cleanup requirements below. btrim will follow these instructions.
|
|
29
|
-
|
|
30
|
-
## Requirements:
|
|
31
|
-
- Remove unused imports
|
|
32
|
-
- Delete files matching pattern "*.tmp"
|
|
33
|
-
- Clean up console.log statements
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
const DEFAULT_CONFIG = {
|
|
37
|
-
headlessClaude: true
|
|
38
|
-
};
|
|
39
|
-
|
|
40
18
|
function initializeBonzai() {
|
|
41
19
|
const bonzaiPath = join(process.cwd(), BONZAI_DIR);
|
|
42
20
|
const specsPath = join(bonzaiPath, SPECS_FILE);
|
|
@@ -44,22 +22,19 @@ function initializeBonzai() {
|
|
|
44
22
|
|
|
45
23
|
// Check if bonzai/ folder exists
|
|
46
24
|
if (!fs.existsSync(bonzaiPath)) {
|
|
47
|
-
// Create bonzai/ folder
|
|
48
25
|
fs.mkdirSync(bonzaiPath, { recursive: true });
|
|
49
26
|
console.log(`š Created ${BONZAI_DIR}/ folder`);
|
|
50
27
|
}
|
|
51
28
|
|
|
52
|
-
//
|
|
29
|
+
// Copy specs.md from package template
|
|
53
30
|
if (!fs.existsSync(specsPath)) {
|
|
54
|
-
|
|
55
|
-
fs.writeFileSync(specsPath, specsContent);
|
|
31
|
+
fs.copyFileSync(join(TEMPLATE_DIR, SPECS_FILE), specsPath);
|
|
56
32
|
console.log(`š Created ${BONZAI_DIR}/${SPECS_FILE}`);
|
|
57
33
|
}
|
|
58
34
|
|
|
59
|
-
//
|
|
35
|
+
// Copy config.json from package template
|
|
60
36
|
if (!fs.existsSync(configPath)) {
|
|
61
|
-
|
|
62
|
-
fs.writeFileSync(configPath, configContent);
|
|
37
|
+
fs.copyFileSync(join(TEMPLATE_DIR, CONFIG_FILE), configPath);
|
|
63
38
|
console.log(`āļø Created ${BONZAI_DIR}/${CONFIG_FILE}`);
|
|
64
39
|
console.log(`\nā ļø Please edit ${BONZAI_DIR}/${SPECS_FILE} to define your cleanup rules before running btrim.\n`);
|
|
65
40
|
process.exit(0);
|
|
@@ -77,14 +52,12 @@ function ensureBonzaiDir() {
|
|
|
77
52
|
}
|
|
78
53
|
|
|
79
54
|
if (!fs.existsSync(specsPath)) {
|
|
80
|
-
|
|
81
|
-
fs.writeFileSync(specsPath, specsContent);
|
|
55
|
+
fs.copyFileSync(join(TEMPLATE_DIR, SPECS_FILE), specsPath);
|
|
82
56
|
console.log(`š Created ${BONZAI_DIR}/${SPECS_FILE} - edit this file to define your cleanup specs\n`);
|
|
83
57
|
}
|
|
84
58
|
|
|
85
59
|
if (!fs.existsSync(configPath)) {
|
|
86
|
-
|
|
87
|
-
fs.writeFileSync(configPath, configContent);
|
|
60
|
+
fs.copyFileSync(join(TEMPLATE_DIR, CONFIG_FILE), configPath);
|
|
88
61
|
console.log(`āļø Created ${BONZAI_DIR}/${CONFIG_FILE}\n`);
|
|
89
62
|
}
|
|
90
63
|
|
|
@@ -94,9 +67,9 @@ function ensureBonzaiDir() {
|
|
|
94
67
|
function loadConfig(configPath) {
|
|
95
68
|
try {
|
|
96
69
|
const content = fs.readFileSync(configPath, 'utf-8');
|
|
97
|
-
return
|
|
70
|
+
return JSON.parse(content);
|
|
98
71
|
} catch {
|
|
99
|
-
return
|
|
72
|
+
return { headlessClaude: true };
|
|
100
73
|
}
|
|
101
74
|
}
|
|
102
75
|
|