@dezkareid/osddt 1.11.8 → 1.11.9

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -135,9 +135,11 @@ Use the following logic to determine the working directory:
135
135
  1. If arguments were provided, derive the feature name from them:
136
136
  - If the argument looks like a branch name (no spaces, kebab-case or slash-separated), use the last segment (after the last \`/\`, or the full value if no \`/\` is present).
137
137
  - Otherwise convert it to a feature name following the Feature Name Constraints.
138
- 2. Run \`${npxCommand} worktree-info\` (pass \`<feature-name>\` as argument if one was derived, otherwise run without arguments):
139
- - exit code **0**: parse the JSON and use the returned \`workingDir\` as the working directory.
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>\`).
138
+ 2. Run \`${npxCommand} worktree-info\` (pass \`<feature-name>\` as argument if one was derived, otherwise run without arguments). Parse the JSON from **stdout** and handle based on the output:
139
+ - JSON contains \`workingDir\`: use it as the working directory and continue.
140
+ - JSON contains \`{ "error": "multiple", "worktrees": [...] }\`: present the list to the user and ask them to choose a feature, then use the chosen entry's details as the working context do not re-run the command.
141
+ - JSON contains \`{ "error": "none" }\`: inform the user that no feature worktrees were found and stop.
142
+ - JSON contains \`{ "error": "not-found" }\`: inform the user that the specified feature was not found in any worktree and stop.
141
143
 
142
144
  **If \`worktree-repository\` is absent in \`.osddtrc\` (standard mode):**
143
145
 
@@ -800,7 +802,9 @@ function listFeatureWorktrees(barePath, mainBranch) {
800
802
  const featureName = path.basename(worktreePath);
801
803
  if (featureName === mainBranch)
802
804
  continue;
803
- const branch = branchMatch ? branchMatch[1].trim().replace(/^refs\/heads\//, '') : featureName;
805
+ if (!branchMatch)
806
+ continue;
807
+ const branch = branchMatch[1].trim().replace(/^refs\/heads\//, '');
804
808
  const workingDir = path.join(worktreePath, 'working-on', featureName);
805
809
  entries.push({ featureName, branch, worktreePath, workingDir });
806
810
  }
@@ -1313,21 +1317,20 @@ async function runWorktreeInfo(featureName) {
1313
1317
  if (featureName) {
1314
1318
  entry = entries.find(e => e.featureName === featureName);
1315
1319
  if (!entry) {
1316
- console.error(`No worktree found for feature: ${featureName}`);
1320
+ console.log(JSON.stringify({ error: 'not-found', featureName }));
1317
1321
  process.exit(1);
1318
1322
  }
1319
1323
  }
1320
1324
  else {
1321
1325
  if (entries.length === 0) {
1322
- console.error('No feature worktrees found.');
1326
+ console.log(JSON.stringify({ error: 'none' }));
1323
1327
  process.exit(1);
1324
1328
  }
1325
1329
  else if (entries.length === 1) {
1326
1330
  entry = entries[0];
1327
1331
  }
1328
1332
  else {
1329
- console.error('Multiple feature worktrees found. Re-run with a feature name:');
1330
- entries.forEach(e => console.error(` - ${e.featureName} (${e.branch})`));
1333
+ console.log(JSON.stringify({ error: 'multiple', worktrees: entries.map(e => ({ featureName: e.featureName, branch: e.branch })) }));
1331
1334
  process.exit(1);
1332
1335
  }
1333
1336
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dezkareid/osddt",
3
- "version": "1.11.8",
3
+ "version": "1.11.9",
4
4
  "description": "Package for Spec-Driven Development workflow",
5
5
  "keywords": [
6
6
  "spec-driven",