@dezkareid/osddt 1.11.9 → 1.11.11
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 +35 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -152,7 +152,7 @@ Use the following logic to determine the working directory:
|
|
|
152
152
|
|
|
153
153
|
## Instructions
|
|
154
154
|
|
|
155
|
-
Check the working directory
|
|
155
|
+
Check the working directory for the files listed below **in order** to determine the current phase. Use the \`workingDir\` resolved above (from \`worktree-info\` in worktree mode, or \`{project-path}/working-on/{feature-name}\` in standard mode). Use the first matching condition:
|
|
156
156
|
|
|
157
157
|
| Condition | Current phase | Run next |
|
|
158
158
|
| --------- | ------------- | -------- |
|
|
@@ -1302,6 +1302,38 @@ function startWorktreeCommand() {
|
|
|
1302
1302
|
return cmd;
|
|
1303
1303
|
}
|
|
1304
1304
|
|
|
1305
|
+
async function resolveWorkingDir(worktreePath, featureName) {
|
|
1306
|
+
const target = path.join('working-on', featureName);
|
|
1307
|
+
// Check root first (single repo)
|
|
1308
|
+
if (await fs.pathExists(path.join(worktreePath, target))) {
|
|
1309
|
+
return path.join(worktreePath, target);
|
|
1310
|
+
}
|
|
1311
|
+
// Search up to two levels deep (monorepo packages, e.g. apps/my-app or packages/my-pkg)
|
|
1312
|
+
try {
|
|
1313
|
+
const topEntries = await fs.readdir(worktreePath);
|
|
1314
|
+
for (const top of topEntries) {
|
|
1315
|
+
const topCandidate = path.join(worktreePath, top, target);
|
|
1316
|
+
if (await fs.pathExists(topCandidate)) {
|
|
1317
|
+
return topCandidate;
|
|
1318
|
+
}
|
|
1319
|
+
// Second level (e.g. apps/collectstory/working-on/...)
|
|
1320
|
+
const topStat = await fs.stat(path.join(worktreePath, top)).catch(() => null);
|
|
1321
|
+
if (topStat?.isDirectory()) {
|
|
1322
|
+
const subEntries = await fs.readdir(path.join(worktreePath, top)).catch(() => []);
|
|
1323
|
+
for (const sub of subEntries) {
|
|
1324
|
+
const subCandidate = path.join(worktreePath, top, sub, target);
|
|
1325
|
+
if (await fs.pathExists(subCandidate)) {
|
|
1326
|
+
return subCandidate;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
catch {
|
|
1333
|
+
// worktreePath not accessible — fall through to default
|
|
1334
|
+
}
|
|
1335
|
+
return path.join(worktreePath, target);
|
|
1336
|
+
}
|
|
1305
1337
|
async function runWorktreeInfo(featureName) {
|
|
1306
1338
|
const cwd = process.cwd();
|
|
1307
1339
|
const barePath = await resolveBarePath(cwd);
|
|
@@ -1334,7 +1366,8 @@ async function runWorktreeInfo(featureName) {
|
|
|
1334
1366
|
process.exit(1);
|
|
1335
1367
|
}
|
|
1336
1368
|
}
|
|
1337
|
-
|
|
1369
|
+
const workingDir = await resolveWorkingDir(entry.worktreePath, entry.featureName);
|
|
1370
|
+
console.log(JSON.stringify({ worktreePath: entry.worktreePath, workingDir, branch: entry.branch }));
|
|
1338
1371
|
}
|
|
1339
1372
|
function worktreeInfoCommand() {
|
|
1340
1373
|
const cmd = new Command('worktree-info');
|