taskplane 0.5.1 → 0.5.3
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.
|
@@ -155,20 +155,30 @@ export function buildLaneEnvVars(
|
|
|
155
155
|
repoRoot: string,
|
|
156
156
|
workspaceRoot?: string,
|
|
157
157
|
): Record<string, string> {
|
|
158
|
-
// TASK_AUTOSTART
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
158
|
+
// TASK_AUTOSTART: resolve the prompt path for the lane session.
|
|
159
|
+
//
|
|
160
|
+
// In workspace mode, tasks may live in a different repo than the lane's
|
|
161
|
+
// worktree (e.g., task PROMPT.md in shared-libs, worker runs in api-service).
|
|
162
|
+
// Always use the absolute path — task-runner's resolve(cwd, autoPath) handles
|
|
163
|
+
// absolute paths correctly, and this avoids broken relative paths when the
|
|
164
|
+
// task folder is outside the lane's repo.
|
|
165
|
+
//
|
|
166
|
+
// In repo mode (no workspace), we still use relative paths from repoRoot
|
|
167
|
+
// because the worktree mirrors the repo structure and the task folder is
|
|
168
|
+
// inside the repo.
|
|
162
169
|
const repoRootNorm = resolve(repoRoot).replace(/\\/g, "/");
|
|
163
170
|
const promptNorm = resolve(promptPath).replace(/\\/g, "/");
|
|
164
171
|
|
|
165
172
|
let relativePath: string;
|
|
166
|
-
if (
|
|
173
|
+
if (workspaceRoot) {
|
|
174
|
+
// Workspace mode: always use absolute path for cross-repo safety
|
|
175
|
+
relativePath = resolve(promptPath);
|
|
176
|
+
} else if (promptNorm.startsWith(repoRootNorm + "/")) {
|
|
177
|
+
// Repo mode: relative path from repo root (mirrors into worktree)
|
|
167
178
|
relativePath = promptNorm.slice(repoRootNorm.length + 1);
|
|
168
179
|
} else {
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
relativePath = promptPath;
|
|
180
|
+
// Fallback: absolute path
|
|
181
|
+
relativePath = resolve(promptPath);
|
|
172
182
|
}
|
|
173
183
|
|
|
174
184
|
const nodePathEntries: string[] = [join(repoRoot, "node_modules")];
|
|
@@ -189,9 +199,11 @@ export function buildLaneEnvVars(
|
|
|
189
199
|
};
|
|
190
200
|
|
|
191
201
|
// In workspace mode, the worktree cwd is inside a repo — not the workspace root.
|
|
192
|
-
// The task-runner needs TASKPLANE_WORKSPACE_ROOT to find .pi/
|
|
202
|
+
// The task-runner needs TASKPLANE_WORKSPACE_ROOT to find .pi/ config
|
|
193
203
|
// and resolve task area paths from the correct base directory.
|
|
194
|
-
|
|
204
|
+
// Always set when workspaceRoot is provided (workspace mode), regardless of
|
|
205
|
+
// whether it equals repoRoot (it often does — cwd is the workspace root).
|
|
206
|
+
if (workspaceRoot) {
|
|
195
207
|
vars.TASKPLANE_WORKSPACE_ROOT = workspaceRoot;
|
|
196
208
|
}
|
|
197
209
|
|