rrce-workflow 0.2.86 → 0.2.87
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 +72 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -249,10 +249,18 @@ var init_paths = __esm({
|
|
|
249
249
|
import * as fs3 from "fs";
|
|
250
250
|
import * as path3 from "path";
|
|
251
251
|
function scanForProjects(options = {}) {
|
|
252
|
-
const { excludeWorkspace, workspacePath, knownPaths } = options;
|
|
252
|
+
const { excludeWorkspace, workspacePath, knownPaths, knownProjects } = options;
|
|
253
253
|
const projects = [];
|
|
254
254
|
const seenPaths = /* @__PURE__ */ new Set();
|
|
255
|
-
if (
|
|
255
|
+
if (knownProjects && knownProjects.length > 0) {
|
|
256
|
+
const explicitProjects = scanKnownProjects(knownProjects, excludeWorkspace);
|
|
257
|
+
for (const project of explicitProjects) {
|
|
258
|
+
if (!seenPaths.has(project.dataPath)) {
|
|
259
|
+
seenPaths.add(project.dataPath);
|
|
260
|
+
projects.push(project);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
} else if (knownPaths && knownPaths.length > 0) {
|
|
256
264
|
const explicitProjects = scanKnownPaths(knownPaths, excludeWorkspace);
|
|
257
265
|
for (const project of explicitProjects) {
|
|
258
266
|
if (!seenPaths.has(project.dataPath)) {
|
|
@@ -277,6 +285,60 @@ function scanForProjects(options = {}) {
|
|
|
277
285
|
}
|
|
278
286
|
return projects;
|
|
279
287
|
}
|
|
288
|
+
function scanKnownProjects(projects, excludeWorkspace) {
|
|
289
|
+
const results = [];
|
|
290
|
+
const rrceHome = getEffectiveGlobalPath();
|
|
291
|
+
for (const p of projects) {
|
|
292
|
+
try {
|
|
293
|
+
if (!p.path || !fs3.existsSync(p.path)) continue;
|
|
294
|
+
if (p.name === excludeWorkspace) continue;
|
|
295
|
+
const localConfigPath = path3.join(p.path, ".rrce-workflow", "config.yaml");
|
|
296
|
+
if (fs3.existsSync(localConfigPath)) {
|
|
297
|
+
const config = parseWorkspaceConfig(localConfigPath);
|
|
298
|
+
const fullPath = path3.join(p.path, ".rrce-workflow");
|
|
299
|
+
const knowledgePath = path3.join(fullPath, "knowledge");
|
|
300
|
+
const refsPath = path3.join(fullPath, "refs");
|
|
301
|
+
const tasksPath = path3.join(fullPath, "tasks");
|
|
302
|
+
results.push({
|
|
303
|
+
name: p.name,
|
|
304
|
+
// Use MCP name
|
|
305
|
+
path: p.path,
|
|
306
|
+
dataPath: fullPath,
|
|
307
|
+
source: "local",
|
|
308
|
+
storageMode: config?.storageMode || "workspace",
|
|
309
|
+
knowledgePath: fs3.existsSync(knowledgePath) ? knowledgePath : void 0,
|
|
310
|
+
refsPath: fs3.existsSync(refsPath) ? refsPath : void 0,
|
|
311
|
+
tasksPath: fs3.existsSync(tasksPath) ? tasksPath : void 0,
|
|
312
|
+
semanticSearchEnabled: config?.semanticSearchEnabled
|
|
313
|
+
});
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
const globalDataPath = path3.join(rrceHome, "workspaces", p.name);
|
|
317
|
+
if (fs3.existsSync(globalDataPath)) {
|
|
318
|
+
const knowledgePath = path3.join(globalDataPath, "knowledge");
|
|
319
|
+
const refsPath = path3.join(globalDataPath, "refs");
|
|
320
|
+
const tasksPath = path3.join(globalDataPath, "tasks");
|
|
321
|
+
const configPath = path3.join(globalDataPath, "config.yaml");
|
|
322
|
+
const config = parseWorkspaceConfig(configPath);
|
|
323
|
+
results.push({
|
|
324
|
+
name: p.name,
|
|
325
|
+
path: p.path,
|
|
326
|
+
// We know this is the source path
|
|
327
|
+
sourcePath: p.path,
|
|
328
|
+
dataPath: globalDataPath,
|
|
329
|
+
source: "global",
|
|
330
|
+
storageMode: "global",
|
|
331
|
+
knowledgePath: fs3.existsSync(knowledgePath) ? knowledgePath : void 0,
|
|
332
|
+
refsPath: fs3.existsSync(refsPath) ? refsPath : void 0,
|
|
333
|
+
tasksPath: fs3.existsSync(tasksPath) ? tasksPath : void 0,
|
|
334
|
+
semanticSearchEnabled: config?.semanticSearchEnabled
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
} catch {
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return results;
|
|
341
|
+
}
|
|
280
342
|
function scanKnownPaths(paths, excludeWorkspace) {
|
|
281
343
|
const projects = [];
|
|
282
344
|
for (const p of paths) {
|
|
@@ -329,7 +391,7 @@ function scanGlobalStorage(excludeWorkspace) {
|
|
|
329
391
|
projects.push({
|
|
330
392
|
name: config?.name || entry.name,
|
|
331
393
|
path: projectDataPath,
|
|
332
|
-
//
|
|
394
|
+
// Default to dataPath if sourcePath unknown
|
|
333
395
|
sourcePath: config?.sourcePath,
|
|
334
396
|
// ...expose sourcePath if available
|
|
335
397
|
dataPath: projectDataPath,
|
|
@@ -393,11 +455,11 @@ function scanHomeDirectory(excludePath) {
|
|
|
393
455
|
function parseWorkspaceConfig(configPath) {
|
|
394
456
|
try {
|
|
395
457
|
const content = fs3.readFileSync(configPath, "utf-8");
|
|
396
|
-
const nameMatch = content.match(/name:\s*["']?([^"'\n]+)["']?/);
|
|
397
|
-
const sourcePathMatch = content.match(/sourcePath:\s*["']?([^"'\n]+)["']?/);
|
|
458
|
+
const nameMatch = content.match(/name:\s*["']?([^"'\n\r]+)["']?/);
|
|
459
|
+
const sourcePathMatch = content.match(/sourcePath:\s*["']?([^"'\n\r]+)["']?/);
|
|
398
460
|
const modeMatch = content.match(/mode:\s*(global|workspace)/);
|
|
399
461
|
const linkedProjects = [];
|
|
400
|
-
const linkedMatch = content.match(/linked_projects:\s*\n((?:\s+-\s+[^\n]+\n?)+)/);
|
|
462
|
+
const linkedMatch = content.match(/linked_projects:\s*\n((?:\s+-\s+[^\n\r]+\n?)+)/);
|
|
401
463
|
if (linkedMatch && linkedMatch[1]) {
|
|
402
464
|
const lines = linkedMatch[1].split("\n");
|
|
403
465
|
for (const line of lines) {
|
|
@@ -2247,8 +2309,8 @@ import * as path16 from "path";
|
|
|
2247
2309
|
import * as crypto from "crypto";
|
|
2248
2310
|
function getExposedProjects() {
|
|
2249
2311
|
const config = loadMCPConfig();
|
|
2250
|
-
const
|
|
2251
|
-
const allProjects = projectService.scan({
|
|
2312
|
+
const knownProjects = config.projects.filter((p) => !!p.path).map((p) => ({ name: p.name, path: p.path }));
|
|
2313
|
+
const allProjects = projectService.scan({ knownProjects });
|
|
2252
2314
|
const activeProject = detectActiveProject(allProjects);
|
|
2253
2315
|
const potentialProjects = [...allProjects];
|
|
2254
2316
|
if (activeProject) {
|
|
@@ -2298,8 +2360,8 @@ function detectActiveProject(knownProjects) {
|
|
|
2298
2360
|
let scanList = knownProjects;
|
|
2299
2361
|
if (!scanList) {
|
|
2300
2362
|
const config = loadMCPConfig();
|
|
2301
|
-
const
|
|
2302
|
-
const all = projectService.scan({
|
|
2363
|
+
const knownProjectsMap = config.projects.filter((p) => !!p.path).map((p) => ({ name: p.name, path: p.path }));
|
|
2364
|
+
const all = projectService.scan({ knownProjects: knownProjectsMap });
|
|
2303
2365
|
scanList = all.filter((project) => isProjectExposed(config, project.name, project.sourcePath || project.path));
|
|
2304
2366
|
}
|
|
2305
2367
|
return findClosestProject(scanList);
|