taskplane 0.21.0 → 0.21.1
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/bin/taskplane.mjs +26 -2
- package/package.json +1 -1
package/bin/taskplane.mjs
CHANGED
|
@@ -1112,9 +1112,33 @@ async function cmdInit(args) {
|
|
|
1112
1112
|
if (effectiveAlreadyInitialized && resolvedMode === "workspace" && effectiveConfigPath) {
|
|
1113
1113
|
const configRepo = path.basename(path.dirname(effectiveConfigPath));
|
|
1114
1114
|
const configRepoRoot = path.join(projectRoot, configRepo);
|
|
1115
|
+
// Read existing routing from config repo first, then fall back to
|
|
1116
|
+
// the workspace root's .pi/taskplane-workspace.yaml (which --force may overwrite).
|
|
1117
|
+
// This preserves user's tasks_root and default_repo on reinit.
|
|
1115
1118
|
const existingWorkspaceJson = readWorkspaceJson(configRepoRoot);
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1119
|
+
const existingRootYaml = (() => {
|
|
1120
|
+
try {
|
|
1121
|
+
const yamlPath = path.join(projectRoot, ".pi", "taskplane-workspace.yaml");
|
|
1122
|
+
if (fs.existsSync(yamlPath)) {
|
|
1123
|
+
const raw = fs.readFileSync(yamlPath, "utf-8");
|
|
1124
|
+
const tasksMatch = raw.match(/tasks_root:\s*"?([^"\n]+)"?/);
|
|
1125
|
+
const defaultMatch = raw.match(/default_repo:\s*"?([^"\n]+)"?/);
|
|
1126
|
+
return {
|
|
1127
|
+
routing: {
|
|
1128
|
+
tasks_root: tasksMatch?.[1]?.trim() || null,
|
|
1129
|
+
default_repo: defaultMatch?.[1]?.trim() || null,
|
|
1130
|
+
},
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
} catch {}
|
|
1134
|
+
return null;
|
|
1135
|
+
})();
|
|
1136
|
+
const workspaceTasksRoot = existingWorkspaceJson?.routing?.tasks_root
|
|
1137
|
+
|| existingRootYaml?.routing?.tasks_root
|
|
1138
|
+
|| "taskplane-tasks";
|
|
1139
|
+
const workspaceDefaultRepo = existingWorkspaceJson?.routing?.default_repo
|
|
1140
|
+
|| existingRootYaml?.routing?.default_repo
|
|
1141
|
+
|| configRepo;
|
|
1118
1142
|
const workspaceRepoNames = Array.from(
|
|
1119
1143
|
new Set([
|
|
1120
1144
|
...detection.subRepos,
|