bonzai-burn 1.0.9 → 1.0.10
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/README.md +5 -5
- package/package.json +4 -3
- package/payload-bonzai/config.json +1 -1
- package/payload-bonzai/specs.md +5 -4
- package/src/baccept.js +62 -0
- package/src/{btrim.js → bburn.js} +3 -3
- package/src/brevert.js +1 -1
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -12,10 +12,10 @@ Requires: [Claude Code CLI](https://github.com/anthropics/claude-code)
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
### 1. Run
|
|
15
|
+
### 1. Run burn
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npx
|
|
18
|
+
npx bburn
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Creates `bonzai/specs.md` on first run. Edit it to define your cleanup rules.
|
|
@@ -26,11 +26,11 @@ Creates `bonzai/specs.md` on first run. Edit it to define your cleanup rules.
|
|
|
26
26
|
git diff main
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
### 3.
|
|
29
|
+
### 3. Accept or discard
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
#
|
|
33
|
-
|
|
32
|
+
# Accept
|
|
33
|
+
baccept
|
|
34
34
|
|
|
35
35
|
# Discard
|
|
36
36
|
brevert
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bonzai-burn",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Git branch-based cleanup tool with
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "Git branch-based cleanup tool with bburn, baccept, and brevert commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"bonzai-burn": "./src/index.js",
|
|
9
|
-
"
|
|
9
|
+
"bburn": "./src/bburn.js",
|
|
10
|
+
"baccept": "./src/baccept.js",
|
|
10
11
|
"brevert": "./src/brevert.js"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [
|
package/payload-bonzai/specs.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Bonzai Specs
|
|
2
2
|
|
|
3
|
-
Define your cleanup requirements below.
|
|
3
|
+
Define your cleanup requirements below. bburn will follow these instructions.
|
|
4
4
|
|
|
5
5
|
## Requirements:
|
|
6
|
-
- Remove unused imports
|
|
7
|
-
-
|
|
8
|
-
-
|
|
6
|
+
- Remove unused imports and variables
|
|
7
|
+
- Split any folder with over 10 items into smaller, compartmentalized folders.
|
|
8
|
+
- Remove all console log statements
|
|
9
|
+
- Split any folder with over 100 lines into smaller files
|
package/src/baccept.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
|
|
4
|
+
function exec(command) {
|
|
5
|
+
return execSync(command, { encoding: 'utf-8', stdio: 'pipe' }).trim();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function execVisible(command) {
|
|
9
|
+
execSync(command, { stdio: 'inherit' });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function accept() {
|
|
13
|
+
try {
|
|
14
|
+
// Get saved metadata
|
|
15
|
+
let originalBranch;
|
|
16
|
+
let burnBranch;
|
|
17
|
+
let madeWipCommit;
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
originalBranch = exec('git config bonzai.originalBranch');
|
|
21
|
+
burnBranch = exec('git config bonzai.burnBranch');
|
|
22
|
+
madeWipCommit = exec('git config bonzai.madeWipCommit') === 'true';
|
|
23
|
+
} catch {
|
|
24
|
+
console.error('❌ No burn to accept');
|
|
25
|
+
console.error('Run bburn first');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
console.log(`✅ Accepting burn changes...`);
|
|
30
|
+
console.log(` Merging: ${burnBranch} → ${originalBranch}\n`);
|
|
31
|
+
|
|
32
|
+
// Checkout original branch
|
|
33
|
+
execVisible(`git checkout ${originalBranch}`);
|
|
34
|
+
|
|
35
|
+
// Merge burn branch into original
|
|
36
|
+
execVisible(`git merge ${burnBranch} -m "Accept bonzai burn from ${burnBranch}"`);
|
|
37
|
+
|
|
38
|
+
// Delete burn branch
|
|
39
|
+
execVisible(`git branch -D ${burnBranch}`);
|
|
40
|
+
|
|
41
|
+
// If we made a WIP commit, we need to handle it
|
|
42
|
+
// The merge already includes the burn changes on top of the WIP commit
|
|
43
|
+
// So we can optionally squash or leave as-is
|
|
44
|
+
if (madeWipCommit) {
|
|
45
|
+
console.log('\n💡 Note: Your pre-burn WIP commit was preserved in the history.');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Clean up metadata
|
|
49
|
+
exec('git config --unset bonzai.originalBranch');
|
|
50
|
+
exec('git config --unset bonzai.burnBranch');
|
|
51
|
+
exec('git config --unset bonzai.madeWipCommit');
|
|
52
|
+
|
|
53
|
+
console.log(`\n✓ Burn accepted and merged`);
|
|
54
|
+
console.log(`Now on: ${originalBranch}\n`);
|
|
55
|
+
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error('❌ Accept failed:', error.message);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
accept();
|
|
@@ -36,7 +36,7 @@ function initializeBonzai() {
|
|
|
36
36
|
if (!fs.existsSync(configPath)) {
|
|
37
37
|
fs.copyFileSync(join(TEMPLATE_DIR, CONFIG_FILE), configPath);
|
|
38
38
|
console.log(`⚙️ Created ${BONZAI_DIR}/${CONFIG_FILE}`);
|
|
39
|
-
console.log(`\n⚠️ Please edit ${BONZAI_DIR}/${SPECS_FILE} to define your cleanup rules before running
|
|
39
|
+
console.log(`\n⚠️ Please edit ${BONZAI_DIR}/${SPECS_FILE} to define your cleanup rules before running bburn.\n`);
|
|
40
40
|
process.exit(0);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -233,7 +233,7 @@ async function burn() {
|
|
|
233
233
|
try {
|
|
234
234
|
// Initialize bonzai folder and specs.md on first execution
|
|
235
235
|
initializeBonzai();
|
|
236
|
-
|
|
236
|
+
|
|
237
237
|
// Ensure bonzai directory and specs file exist
|
|
238
238
|
const { specsPath, configPath } = ensureBonzaiDir();
|
|
239
239
|
const specs = loadSpecs(specsPath);
|
|
@@ -304,7 +304,7 @@ async function burn() {
|
|
|
304
304
|
|
|
305
305
|
console.log(`\n✅ Changes applied on: ${burnBranch}`);
|
|
306
306
|
console.log(`📊 Full diff: git diff ${originalBranch}`);
|
|
307
|
-
console.log(`\n✓ Keep changes:
|
|
307
|
+
console.log(`\n✓ Keep changes: baccept`);
|
|
308
308
|
console.log(`✗ Discard: brevert\n`);
|
|
309
309
|
|
|
310
310
|
} catch (error) {
|
package/src/brevert.js
CHANGED
package/src/index.js
CHANGED
|
@@ -23,7 +23,7 @@ function init() {
|
|
|
23
23
|
copyFileSync(join(TEMPLATE_DIR, 'config.json'), join(bonzaiPath, 'config.json'));
|
|
24
24
|
console.log(`📁 Created ${BONZAI_DIR}/ folder with specs.md and config.json`);
|
|
25
25
|
console.log(`📝 Edit ${BONZAI_DIR}/specs.md to define your cleanup rules`);
|
|
26
|
-
console.log(`🔥 Run '
|
|
26
|
+
console.log(`🔥 Run 'bburn' to start a burn session`);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
init();
|