rrce-workflow 0.2.16 → 0.2.17

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.
Files changed (2) hide show
  1. package/dist/index.js +62 -97
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -247,41 +247,6 @@ function parseWorkspaceConfig(configPath) {
247
247
  return null;
248
248
  }
249
249
  }
250
- function getProjectDisplayLabel(project) {
251
- switch (project.source) {
252
- case "global":
253
- return `global: ~/.rrce-workflow/workspaces/${project.name}`;
254
- case "sibling":
255
- return `sibling: ${project.path}/.rrce-workflow`;
256
- default:
257
- return project.dataPath;
258
- }
259
- }
260
- function getProjectFolders(project) {
261
- const folders = [];
262
- if (project.knowledgePath) {
263
- folders.push({
264
- path: project.knowledgePath,
265
- type: "knowledge",
266
- displayName: `\u{1F4DA} ${project.name} (knowledge)`
267
- });
268
- }
269
- if (project.refsPath) {
270
- folders.push({
271
- path: project.refsPath,
272
- type: "refs",
273
- displayName: `\u{1F4CE} ${project.name} (refs)`
274
- });
275
- }
276
- if (project.tasksPath) {
277
- folders.push({
278
- path: project.tasksPath,
279
- type: "tasks",
280
- displayName: `\u{1F4CB} ${project.name} (tasks)`
281
- });
282
- }
283
- return folders;
284
- }
285
250
 
286
251
  // src/commands/wizard/setup-flow.ts
287
252
  import { group, select, multiselect, confirm, spinner, note, outro, cancel, isCancel as isCancel2 } from "@clack/prompts";
@@ -388,7 +353,6 @@ function copyDirRecursive(src, dest) {
388
353
  // src/commands/wizard/vscode.ts
389
354
  import * as fs5 from "fs";
390
355
  import * as path5 from "path";
391
- var REFERENCE_GROUP_PREFIX = "\u{1F4C1} References";
392
356
  function generateVSCodeWorkspace(workspacePath, workspaceName, linkedProjects, customGlobalPath) {
393
357
  const workspaceFilePath = path5.join(workspacePath, `${workspaceName}.code-workspace`);
394
358
  let workspace;
@@ -405,60 +369,47 @@ function generateVSCodeWorkspace(workspacePath, workspaceName, linkedProjects, c
405
369
  if (!workspace.settings) {
406
370
  workspace.settings = {};
407
371
  }
408
- const existingNonReferencesFolders = workspace.folders.filter(
409
- (f) => f.path === "." || !f.name?.includes(REFERENCE_GROUP_PREFIX) && !f.name?.startsWith("\u{1F4DA}") && !f.name?.startsWith("\u{1F4CE}") && !f.name?.startsWith("\u{1F4CB}")
372
+ workspace.folders = workspace.folders.filter(
373
+ (f) => f.path === "." || !f.name?.startsWith("\u{1F4C1}") && !f.name?.startsWith("\u{1F4DA}") && !f.name?.startsWith("\u{1F4CE}") && !f.name?.startsWith("\u{1F4CB}")
410
374
  );
411
- workspace.folders = [];
412
- const mainFolder = {
413
- path: ".",
414
- name: `\u{1F3E0} ${workspaceName} (workspace)`
415
- };
416
- workspace.folders.push(mainFolder);
417
- for (const folder of existingNonReferencesFolders) {
418
- if (folder.path !== ".") {
419
- workspace.folders.push(folder);
420
- }
375
+ const mainFolderIndex = workspace.folders.findIndex((f) => f.path === ".");
376
+ if (mainFolderIndex === -1) {
377
+ workspace.folders.unshift({
378
+ path: ".",
379
+ name: `\u{1F3E0} ${workspaceName} (workspace)`
380
+ });
381
+ } else {
382
+ workspace.folders[mainFolderIndex] = {
383
+ path: ".",
384
+ name: `\u{1F3E0} ${workspaceName} (workspace)`
385
+ };
421
386
  }
422
387
  const referenceFolderPaths = [];
423
388
  const isDetectedProjects = linkedProjects.length > 0 && typeof linkedProjects[0] === "object";
424
389
  if (isDetectedProjects) {
425
390
  const projects = linkedProjects;
426
391
  for (const project of projects) {
427
- const folders = getProjectFolders(project);
428
392
  const sourceLabel = project.source === "global" ? "global" : "local";
429
- for (const folder of folders) {
430
- referenceFolderPaths.push(folder.path);
431
- const existingIndex = workspace.folders.findIndex((f) => f.path === folder.path);
432
- if (existingIndex === -1) {
433
- workspace.folders.push({
434
- path: folder.path,
435
- name: `${folder.displayName} [${sourceLabel}]`
436
- });
437
- }
393
+ const folderPath = project.dataPath;
394
+ if (fs5.existsSync(folderPath)) {
395
+ referenceFolderPaths.push(folderPath);
396
+ workspace.folders.push({
397
+ path: folderPath,
398
+ name: `\u{1F4C1} ${project.name} [${sourceLabel}]`
399
+ });
438
400
  }
439
401
  }
440
402
  } else {
441
403
  const projectNames = linkedProjects;
442
404
  const rrceHome = customGlobalPath || getRRCEHome();
443
405
  for (const projectName of projectNames) {
444
- const projectDataPath = path5.join(rrceHome, "workspaces", projectName);
445
- const folderTypes = [
446
- { subpath: "knowledge", icon: "\u{1F4DA}", type: "knowledge" },
447
- { subpath: "refs", icon: "\u{1F4CE}", type: "refs" },
448
- { subpath: "tasks", icon: "\u{1F4CB}", type: "tasks" }
449
- ];
450
- for (const { subpath, icon, type } of folderTypes) {
451
- const folderPath = path5.join(projectDataPath, subpath);
452
- if (fs5.existsSync(folderPath)) {
453
- referenceFolderPaths.push(folderPath);
454
- const existingIndex = workspace.folders.findIndex((f) => f.path === folderPath);
455
- if (existingIndex === -1) {
456
- workspace.folders.push({
457
- path: folderPath,
458
- name: `${icon} ${projectName} (${type}) [global]`
459
- });
460
- }
461
- }
406
+ const folderPath = path5.join(rrceHome, "workspaces", projectName);
407
+ if (fs5.existsSync(folderPath)) {
408
+ referenceFolderPaths.push(folderPath);
409
+ workspace.folders.push({
410
+ path: folderPath,
411
+ name: `\u{1F4C1} ${projectName} [global]`
412
+ });
462
413
  }
463
414
  }
464
415
  }
@@ -468,12 +419,17 @@ function generateVSCodeWorkspace(workspacePath, workspaceName, linkedProjects, c
468
419
  readonlyPatterns[`${folderPath}/**`] = true;
469
420
  }
470
421
  const existingReadonly = workspace.settings["files.readonlyInclude"] || {};
422
+ const cleanedReadonly = {};
423
+ for (const [pattern, value] of Object.entries(existingReadonly)) {
424
+ if (!pattern.includes(".rrce-workflow") && !pattern.includes("rrce-workflow/workspaces")) {
425
+ cleanedReadonly[pattern] = value;
426
+ }
427
+ }
471
428
  workspace.settings["files.readonlyInclude"] = {
472
- ...existingReadonly,
429
+ ...cleanedReadonly,
473
430
  ...readonlyPatterns
474
431
  };
475
432
  }
476
- workspace.settings["explorer.sortOrder"] = workspace.settings["explorer.sortOrder"] || "default";
477
433
  fs5.writeFileSync(workspaceFilePath, JSON.stringify(workspace, null, 2));
478
434
  }
479
435
 
@@ -634,9 +590,12 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
634
590
  return multiselect({
635
591
  message: "Link knowledge from other projects?",
636
592
  options: existingProjects.map((project) => ({
637
- value: project.name,
638
- label: project.name,
639
- hint: pc2.dim(getProjectDisplayLabel(project))
593
+ value: `${project.name}:${project.source}`,
594
+ // Unique key
595
+ label: `${project.name} ${pc2.dim(`(${project.source})`)}`,
596
+ hint: pc2.dim(
597
+ project.source === "global" ? `~/.rrce-workflow/workspaces/${project.name}` : project.dataPath
598
+ )
640
599
  })),
641
600
  required: false
642
601
  });
@@ -822,7 +781,9 @@ linked_projects:
822
781
  }
823
782
  fs7.writeFileSync(workspaceConfigPath, configContent);
824
783
  if (config.tools.includes("copilot") || config.linkedProjects.length > 0) {
825
- const selectedProjects = allProjects.filter((p) => config.linkedProjects.includes(p.name));
784
+ const selectedProjects = allProjects.filter(
785
+ (p) => config.linkedProjects.includes(`${p.name}:${p.source}`)
786
+ );
826
787
  generateVSCodeWorkspace(workspacePath, workspaceName, selectedProjects, config.globalPath);
827
788
  }
828
789
  }
@@ -859,9 +820,12 @@ async function runLinkProjectsFlow(workspacePath, workspaceName) {
859
820
  const linkedProjects = await multiselect2({
860
821
  message: "Select projects to link:",
861
822
  options: projects.map((project) => ({
862
- value: project.name,
863
- label: project.name,
864
- hint: pc3.dim(getProjectDisplayLabel(project))
823
+ value: `${project.name}:${project.source}`,
824
+ // Unique key
825
+ label: `${project.name} ${pc3.dim(`(${project.source})`)}`,
826
+ hint: pc3.dim(
827
+ project.source === "global" ? `~/.rrce-workflow/workspaces/${project.name}` : project.dataPath
828
+ )
865
829
  })),
866
830
  required: true
867
831
  });
@@ -869,12 +833,14 @@ async function runLinkProjectsFlow(workspacePath, workspaceName) {
869
833
  cancel2("Cancelled.");
870
834
  process.exit(0);
871
835
  }
872
- const selectedProjectNames = linkedProjects;
873
- if (selectedProjectNames.length === 0) {
836
+ const selectedKeys = linkedProjects;
837
+ if (selectedKeys.length === 0) {
874
838
  outro2("No projects selected.");
875
839
  return;
876
840
  }
877
- const selectedProjects = projects.filter((p) => selectedProjectNames.includes(p.name));
841
+ const selectedProjects = projects.filter(
842
+ (p) => selectedKeys.includes(`${p.name}:${p.source}`)
843
+ );
878
844
  const s = spinner2();
879
845
  s.start("Linking projects");
880
846
  const configFilePath = getConfigPath(workspacePath);
@@ -887,9 +853,10 @@ async function runLinkProjectsFlow(workspacePath, workspaceName) {
887
853
  while (insertIndex < lines.length && lines[insertIndex]?.startsWith(" - ")) {
888
854
  insertIndex++;
889
855
  }
890
- for (const name of selectedProjectNames) {
891
- if (!configContent.includes(` - ${name}`)) {
892
- lines.splice(insertIndex, 0, ` - ${name}`);
856
+ for (const project of selectedProjects) {
857
+ const entry = ` - ${project.name}:${project.source}`;
858
+ if (!configContent.includes(entry)) {
859
+ lines.splice(insertIndex, 0, entry);
893
860
  insertIndex++;
894
861
  }
895
862
  }
@@ -899,8 +866,8 @@ async function runLinkProjectsFlow(workspacePath, workspaceName) {
899
866
  configContent += `
900
867
  linked_projects:
901
868
  `;
902
- selectedProjectNames.forEach((name) => {
903
- configContent += ` - ${name}
869
+ selectedProjects.forEach((project) => {
870
+ configContent += ` - ${project.name}:${project.source}
904
871
  `;
905
872
  });
906
873
  }
@@ -912,12 +879,10 @@ linked_projects:
912
879
  `Linked projects:`,
913
880
  ...selectedProjects.map((p) => ` \u2713 ${p.name} ${pc3.dim(`(${p.source})`)}`),
914
881
  ``,
915
- `Workspace file: ${pc3.cyan(workspaceFile)}`,
916
- ``,
917
- pc3.dim("Includes: knowledge, refs, tasks folders")
882
+ `Workspace file: ${pc3.cyan(workspaceFile)}`
918
883
  ];
919
884
  note2(summary.join("\n"), "Link Summary");
920
- outro2(pc3.green(`\u2713 Projects linked! Open ${pc3.bold(workspaceFile)} in VSCode to access linked knowledge.`));
885
+ outro2(pc3.green(`\u2713 Projects linked! Open ${pc3.bold(workspaceFile)} in VSCode to access linked data.`));
921
886
  }
922
887
 
923
888
  // src/commands/wizard/sync-flow.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrce-workflow",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "RRCE-Workflow TUI - Agentic code workflow generator for AI-assisted development",
5
5
  "author": "RRCE Team",
6
6
  "license": "MIT",