@dezkareid/osddt 1.11.7 → 1.11.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/dist/index.js +11 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -137,15 +137,15 @@ Use the following logic to determine the working directory:
|
|
|
137
137
|
- Otherwise convert it to a feature name following the Feature Name Constraints.
|
|
138
138
|
2. Run \`${npxCommand} worktree-info\` (pass \`<feature-name>\` as argument if one was derived, otherwise run without arguments):
|
|
139
139
|
- exit code **0**: parse the JSON and use the returned \`workingDir\` as the working directory.
|
|
140
|
-
- exit code **1**:
|
|
140
|
+
- exit code **1**: display the error output from \`worktree-info\` to the user, then **stop** and instruct them to re-run the command with the chosen feature name as an explicit argument (e.g. \`/osddt.continue <feature-name>\`).
|
|
141
141
|
|
|
142
|
-
**If \`worktree-repository\` is absent in \`.osddtrc\` (standard mode)
|
|
142
|
+
**If \`worktree-repository\` is absent in \`.osddtrc\` (standard mode):**
|
|
143
143
|
|
|
144
144
|
1. If arguments were provided, derive the feature name (same rules as above).
|
|
145
145
|
2. If **no arguments were provided**:
|
|
146
146
|
- List all folders under \`<project-path>/working-on/\`.
|
|
147
147
|
- If there is **only one folder**, use it automatically and inform the user.
|
|
148
|
-
- If there are **multiple folders**,
|
|
148
|
+
- If there are **multiple folders**, display the list as a numbered enumeration, then **stop** and instruct the user to re-run the command with the chosen feature name as an explicit argument (e.g. \`/osddt.continue <feature-name>\`).
|
|
149
149
|
- If there are **no folders**, inform the user that no in-progress features were found and stop.
|
|
150
150
|
|
|
151
151
|
## Instructions
|
|
@@ -1196,7 +1196,7 @@ function remoteBranchExists(branch, cwd) {
|
|
|
1196
1196
|
return false;
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
async function prompt
|
|
1199
|
+
async function prompt(question) {
|
|
1200
1200
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
1201
1201
|
return new Promise((resolve) => {
|
|
1202
1202
|
rl.question(question, (answer) => {
|
|
@@ -1208,7 +1208,7 @@ async function prompt$1(question) {
|
|
|
1208
1208
|
async function createWorktree(branch, worktreePath, repoRoot, mainBranch) {
|
|
1209
1209
|
if (await fs.pathExists(worktreePath)) {
|
|
1210
1210
|
console.log(`\nDirectory already exists at: ${worktreePath}`);
|
|
1211
|
-
const answer = await prompt
|
|
1211
|
+
const answer = await prompt('Resume or Abort? [R/a] ');
|
|
1212
1212
|
if (answer.toLowerCase() === 'a') {
|
|
1213
1213
|
console.log('Aborted.');
|
|
1214
1214
|
process.exit(0);
|
|
@@ -1219,7 +1219,7 @@ async function createWorktree(branch, worktreePath, repoRoot, mainBranch) {
|
|
|
1219
1219
|
const remoteExists = !localExists && remoteBranchExists(branch, repoRoot);
|
|
1220
1220
|
if (localExists || remoteExists) {
|
|
1221
1221
|
console.log(`\nBranch "${branch}" already exists ${localExists ? 'locally' : 'on remote'}.`);
|
|
1222
|
-
const answer = await prompt
|
|
1222
|
+
const answer = await prompt('Resume or Abort? [R/a] ');
|
|
1223
1223
|
if (answer.toLowerCase() === 'a') {
|
|
1224
1224
|
console.log('Aborted.');
|
|
1225
1225
|
process.exit(0);
|
|
@@ -1253,7 +1253,7 @@ async function runStartWorktree(featureName, options) {
|
|
|
1253
1253
|
if (existingPath) {
|
|
1254
1254
|
const workingDir = path.join(existingPath, 'working-on', featureName);
|
|
1255
1255
|
console.log(`\nWorktree for "${featureName}" already exists at: ${existingPath}`);
|
|
1256
|
-
const answer = await prompt
|
|
1256
|
+
const answer = await prompt('Resume or Abort? [R/a] ');
|
|
1257
1257
|
if (answer.toLowerCase() === 'a') {
|
|
1258
1258
|
console.log('Aborted.');
|
|
1259
1259
|
process.exit(0);
|
|
@@ -1272,7 +1272,7 @@ async function runStartWorktree(featureName, options) {
|
|
|
1272
1272
|
// Resolve working dir
|
|
1273
1273
|
let projectPath;
|
|
1274
1274
|
if (rc['repoType'] === 'monorepo') {
|
|
1275
|
-
const pkg = options.dir ?? await prompt
|
|
1275
|
+
const pkg = options.dir ?? await prompt('Package path (e.g. packages/my-package): ');
|
|
1276
1276
|
projectPath = path.join(worktreePath, pkg);
|
|
1277
1277
|
}
|
|
1278
1278
|
else {
|
|
@@ -1298,28 +1298,6 @@ function startWorktreeCommand() {
|
|
|
1298
1298
|
return cmd;
|
|
1299
1299
|
}
|
|
1300
1300
|
|
|
1301
|
-
async function prompt(question) {
|
|
1302
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
1303
|
-
return new Promise((resolve) => {
|
|
1304
|
-
rl.question(question, (answer) => {
|
|
1305
|
-
rl.close();
|
|
1306
|
-
resolve(answer.trim());
|
|
1307
|
-
});
|
|
1308
|
-
});
|
|
1309
|
-
}
|
|
1310
|
-
async function selectWorktree(entries) {
|
|
1311
|
-
console.log('\nMultiple feature worktrees found:');
|
|
1312
|
-
entries.forEach((e, i) => {
|
|
1313
|
-
console.log(` ${i + 1}) ${e.featureName} (${e.branch})`);
|
|
1314
|
-
});
|
|
1315
|
-
const answer = await prompt(`Select a feature [1-${entries.length}]: `);
|
|
1316
|
-
const index = parseInt(answer, 10) - 1;
|
|
1317
|
-
if (index < 0 || index >= entries.length || isNaN(index)) {
|
|
1318
|
-
console.error('Invalid selection.');
|
|
1319
|
-
process.exit(1);
|
|
1320
|
-
}
|
|
1321
|
-
return entries[index];
|
|
1322
|
-
}
|
|
1323
1301
|
async function runWorktreeInfo(featureName) {
|
|
1324
1302
|
const cwd = process.cwd();
|
|
1325
1303
|
const barePath = await resolveBarePath(cwd);
|
|
@@ -1348,7 +1326,9 @@ async function runWorktreeInfo(featureName) {
|
|
|
1348
1326
|
entry = entries[0];
|
|
1349
1327
|
}
|
|
1350
1328
|
else {
|
|
1351
|
-
|
|
1329
|
+
console.error('Multiple feature worktrees found. Re-run with a feature name:');
|
|
1330
|
+
entries.forEach(e => console.error(` - ${e.featureName} (${e.branch})`));
|
|
1331
|
+
process.exit(1);
|
|
1352
1332
|
}
|
|
1353
1333
|
}
|
|
1354
1334
|
console.log(JSON.stringify({ worktreePath: entry.worktreePath, workingDir: entry.workingDir, branch: entry.branch }));
|