taskplane 0.21.6 → 0.21.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.
|
@@ -928,7 +928,40 @@ export function resolveTaskRouting(
|
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
930
|
|
|
931
|
-
// Precedence 3:
|
|
931
|
+
// Precedence 3: file scope inference — match file path prefixes against
|
|
932
|
+
// known workspace repo IDs. If file scope entries like "web-client/src/..."
|
|
933
|
+
// start with a repo name, route the task to that repo.
|
|
934
|
+
if (!resolvedId && task.fileScope && task.fileScope.length > 0) {
|
|
935
|
+
const repoIds = [...validRepoIds.keys()];
|
|
936
|
+
const repoCounts = new Map<string, number>();
|
|
937
|
+
for (const filePath of task.fileScope) {
|
|
938
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
939
|
+
for (const repoId of repoIds) {
|
|
940
|
+
if (normalized.startsWith(repoId + "/") || normalized === repoId) {
|
|
941
|
+
repoCounts.set(repoId, (repoCounts.get(repoId) || 0) + 1);
|
|
942
|
+
break; // first matching repo wins for this path
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
// Use the repo with the most file scope matches (majority vote)
|
|
947
|
+
if (repoCounts.size === 1) {
|
|
948
|
+
resolvedId = repoCounts.keys().next().value!;
|
|
949
|
+
source = "file-scope";
|
|
950
|
+
} else if (repoCounts.size > 1) {
|
|
951
|
+
// Multiple repos in file scope — pick the one with most entries.
|
|
952
|
+
// (Future: #51 will handle multi-repo tasks properly)
|
|
953
|
+
let maxCount = 0;
|
|
954
|
+
for (const [repoId, count] of repoCounts) {
|
|
955
|
+
if (count > maxCount) {
|
|
956
|
+
maxCount = count;
|
|
957
|
+
resolvedId = repoId;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
source = "file-scope";
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
// Precedence 4: workspace default repo
|
|
932
965
|
if (!resolvedId) {
|
|
933
966
|
resolvedId = workspaceConfig.routing.defaultRepo;
|
|
934
967
|
source = "default";
|
|
@@ -940,7 +973,8 @@ export function resolveTaskRouting(
|
|
|
940
973
|
code: "TASK_REPO_UNRESOLVED",
|
|
941
974
|
message:
|
|
942
975
|
`Task ${task.taskId} has no resolved repo. ` +
|
|
943
|
-
`Add
|
|
976
|
+
`Add file scope paths prefixed with the repo name (e.g., "web-client/src/..."), ` +
|
|
977
|
+
`set repo_id on area "${task.areaName}", ` +
|
|
944
978
|
`or set routing.default_repo in the workspace config.`,
|
|
945
979
|
taskId: task.taskId,
|
|
946
980
|
taskPath: task.promptPath,
|
|
@@ -431,8 +431,16 @@ export function buildLaneEnvVars(
|
|
|
431
431
|
|
|
432
432
|
let relativePath: string;
|
|
433
433
|
if (workspaceRoot) {
|
|
434
|
-
// Workspace mode:
|
|
435
|
-
|
|
434
|
+
// Workspace mode: use worktree-relative path when the task folder is
|
|
435
|
+
// inside the lane's repo. This ensures STATUS.md, .DONE, and git commits
|
|
436
|
+
// all operate in the worktree (not the original source directory).
|
|
437
|
+
// Falls back to absolute path for cross-repo tasks (task in repo A,
|
|
438
|
+
// worker in repo B — future: issue #51).
|
|
439
|
+
if (promptNorm.startsWith(repoRootNorm + "/")) {
|
|
440
|
+
relativePath = promptNorm.slice(repoRootNorm.length + 1);
|
|
441
|
+
} else {
|
|
442
|
+
relativePath = resolve(promptPath);
|
|
443
|
+
}
|
|
436
444
|
} else if (promptNorm.startsWith(repoRootNorm + "/")) {
|
|
437
445
|
// Repo mode: relative path from repo root (mirrors into worktree)
|
|
438
446
|
relativePath = promptNorm.slice(repoRootNorm.length + 1);
|
|
@@ -764,28 +772,16 @@ export function resolveCanonicalTaskPaths(
|
|
|
764
772
|
let resolvedFolder: string;
|
|
765
773
|
|
|
766
774
|
if (isWorkspaceMode) {
|
|
767
|
-
// Workspace mode:
|
|
768
|
-
//
|
|
769
|
-
//
|
|
770
|
-
//
|
|
771
|
-
const candidatePaths: string[] = [];
|
|
772
|
-
|
|
773
|
-
// Candidate 1: worktree-relative (task folder mirrored in worktree)
|
|
775
|
+
// Workspace mode: use worktree-relative path when the task folder is
|
|
776
|
+
// inside the lane's repo (same logic as TASK_AUTOSTART resolution).
|
|
777
|
+
// The worker writes .DONE and STATUS.md in the worktree, so the engine
|
|
778
|
+
// must look there too.
|
|
774
779
|
if (folderNorm.startsWith(repoRootNorm + "/")) {
|
|
775
780
|
const relPath = folderNorm.slice(repoRootNorm.length + 1);
|
|
776
|
-
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
candidatePaths.push(resolve(taskFolder));
|
|
781
|
-
|
|
782
|
-
// Use whichever has .DONE or STATUS.md; default to first candidate
|
|
783
|
-
resolvedFolder = candidatePaths[0];
|
|
784
|
-
for (const candidate of candidatePaths) {
|
|
785
|
-
if (existsSync(join(candidate, ".DONE")) || existsSync(join(candidate, "STATUS.md"))) {
|
|
786
|
-
resolvedFolder = candidate;
|
|
787
|
-
break;
|
|
788
|
-
}
|
|
781
|
+
resolvedFolder = join(worktreePath, relPath);
|
|
782
|
+
} else {
|
|
783
|
+
// Cross-repo fallback: use absolute path (future: #51)
|
|
784
|
+
resolvedFolder = resolve(taskFolder);
|
|
789
785
|
}
|
|
790
786
|
} else if (folderNorm.startsWith(repoRootNorm + "/")) {
|
|
791
787
|
// Repo mode: task folder is inside the repo root.
|