jettypod 4.2.7 → 4.2.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/lib/worktree-manager.js +40 -0
- package/package.json +1 -1
package/lib/worktree-manager.js
CHANGED
|
@@ -84,6 +84,46 @@ async function createWorktree(workItem, options = {}) {
|
|
|
84
84
|
let worktreeCreated = false;
|
|
85
85
|
|
|
86
86
|
try {
|
|
87
|
+
// Step 0: Auto-commit untracked BDD files before creating worktree
|
|
88
|
+
// Feature planning creates .feature and step definition files in main repo
|
|
89
|
+
// These need to be committed so the worktree branch can access them
|
|
90
|
+
try {
|
|
91
|
+
// Find untracked BDD files
|
|
92
|
+
const untrackedOutput = execSync('git ls-files --others --exclude-standard', {
|
|
93
|
+
cwd: gitRoot,
|
|
94
|
+
encoding: 'utf8'
|
|
95
|
+
}).trim();
|
|
96
|
+
|
|
97
|
+
if (untrackedOutput) {
|
|
98
|
+
const untrackedFiles = untrackedOutput.split('\n');
|
|
99
|
+
const bddFiles = untrackedFiles.filter(f =>
|
|
100
|
+
f.endsWith('.feature') ||
|
|
101
|
+
f.includes('step_definitions/') ||
|
|
102
|
+
f.includes('steps/')
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
if (bddFiles.length > 0) {
|
|
106
|
+
// Stage and commit BDD files
|
|
107
|
+
for (const file of bddFiles) {
|
|
108
|
+
execSync(`git add "${file}"`, { cwd: gitRoot, stdio: 'pipe' });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
execSync(`git commit -m "Add BDD scenarios for work item #${workItem.id}"`, {
|
|
112
|
+
cwd: gitRoot,
|
|
113
|
+
stdio: 'pipe'
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
console.log(`📝 Auto-committed ${bddFiles.length} BDD file(s) before creating worktree`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
} catch (commitErr) {
|
|
120
|
+
// Non-fatal - log warning but continue
|
|
121
|
+
// Could fail if no BDD files or already committed
|
|
122
|
+
if (!commitErr.message.includes('nothing to commit')) {
|
|
123
|
+
console.warn(`Warning: Could not auto-commit BDD files: ${commitErr.message}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
87
127
|
// Step 1: Create database entry with status='active'
|
|
88
128
|
// Note: We use 'active' from the start because if anything fails,
|
|
89
129
|
// we'll delete the entire entry during rollback
|