rrce-workflow 0.2.19 → 0.2.20
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 +60 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -256,7 +256,7 @@ function parseWorkspaceConfig(configPath) {
|
|
|
256
256
|
try {
|
|
257
257
|
const content = fs2.readFileSync(configPath, "utf-8");
|
|
258
258
|
const nameMatch = content.match(/name:\s*["']?([^"'\n]+)["']?/);
|
|
259
|
-
const modeMatch = content.match(/mode:\s*(global|workspace
|
|
259
|
+
const modeMatch = content.match(/mode:\s*(global|workspace)/);
|
|
260
260
|
const linkedProjects = [];
|
|
261
261
|
const linkedMatch = content.match(/linked_projects:\s*\n((?:\s+-\s+[^\n]+\n?)+)/);
|
|
262
262
|
if (linkedMatch && linkedMatch[1]) {
|
|
@@ -578,9 +578,8 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
|
|
|
578
578
|
storageMode: () => select({
|
|
579
579
|
message: "Where should workflow data be stored?",
|
|
580
580
|
options: [
|
|
581
|
-
{ value: "global", label: "Global (~/.rrce-workflow/)" },
|
|
582
|
-
{ value: "workspace", label: "Workspace (.rrce-workflow/)" }
|
|
583
|
-
{ value: "both", label: "Both" }
|
|
581
|
+
{ value: "global", label: "Global (~/.rrce-workflow/)", hint: "Cross-project access, clean workspace" },
|
|
582
|
+
{ value: "workspace", label: "Workspace (.rrce-workflow/)", hint: "Self-contained, version with repo" }
|
|
584
583
|
],
|
|
585
584
|
initialValue: "global"
|
|
586
585
|
}),
|
|
@@ -609,6 +608,10 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
|
|
|
609
608
|
required: false
|
|
610
609
|
});
|
|
611
610
|
},
|
|
611
|
+
addToGitignore: () => confirm({
|
|
612
|
+
message: "Add generated folders to .gitignore?",
|
|
613
|
+
initialValue: true
|
|
614
|
+
}),
|
|
612
615
|
confirm: () => confirm({
|
|
613
616
|
message: "Create configuration?",
|
|
614
617
|
initialValue: true
|
|
@@ -626,7 +629,7 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
|
|
|
626
629
|
process.exit(0);
|
|
627
630
|
}
|
|
628
631
|
let customGlobalPath;
|
|
629
|
-
if (config.storageMode === "global"
|
|
632
|
+
if (config.storageMode === "global") {
|
|
630
633
|
customGlobalPath = await resolveGlobalPath();
|
|
631
634
|
if (!customGlobalPath) {
|
|
632
635
|
cancel("Setup cancelled - no writable global path available.");
|
|
@@ -639,7 +642,8 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
|
|
|
639
642
|
storageMode: config.storageMode,
|
|
640
643
|
globalPath: customGlobalPath,
|
|
641
644
|
tools: config.tools,
|
|
642
|
-
linkedProjects: config.linkedProjects
|
|
645
|
+
linkedProjects: config.linkedProjects,
|
|
646
|
+
addToGitignore: config.addToGitignore
|
|
643
647
|
}, workspacePath, workspaceName, existingProjects);
|
|
644
648
|
s.stop("Configuration generated");
|
|
645
649
|
const dataPaths = getDataPaths(
|
|
@@ -649,7 +653,7 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
|
|
|
649
653
|
customGlobalPath
|
|
650
654
|
);
|
|
651
655
|
const summary = [
|
|
652
|
-
`Storage: ${config.storageMode
|
|
656
|
+
`Storage: ${config.storageMode}`
|
|
653
657
|
];
|
|
654
658
|
if (customGlobalPath && customGlobalPath !== getDefaultRRCEHome()) {
|
|
655
659
|
summary.push(`Global path: ${pc2.cyan(customGlobalPath)}`);
|
|
@@ -791,6 +795,9 @@ linked_projects:
|
|
|
791
795
|
});
|
|
792
796
|
}
|
|
793
797
|
fs7.writeFileSync(workspaceConfigPath, configContent);
|
|
798
|
+
if (config.addToGitignore) {
|
|
799
|
+
updateGitignore(workspacePath, config.storageMode, config.tools);
|
|
800
|
+
}
|
|
794
801
|
if (config.tools.includes("copilot") || config.linkedProjects.length > 0) {
|
|
795
802
|
const selectedProjects = allProjects.filter(
|
|
796
803
|
(p) => config.linkedProjects.includes(`${p.name}:${p.source}`)
|
|
@@ -806,12 +813,55 @@ function getDataPaths(mode, workspaceName, workspaceRoot, customGlobalPath) {
|
|
|
806
813
|
return [globalPath];
|
|
807
814
|
case "workspace":
|
|
808
815
|
return [workspacePath];
|
|
809
|
-
case "both":
|
|
810
|
-
return [workspacePath, globalPath];
|
|
811
816
|
default:
|
|
812
817
|
return [globalPath];
|
|
813
818
|
}
|
|
814
819
|
}
|
|
820
|
+
function updateGitignore(workspacePath, storageMode, tools) {
|
|
821
|
+
const gitignorePath = path7.join(workspacePath, ".gitignore");
|
|
822
|
+
const entries = [];
|
|
823
|
+
if (storageMode === "workspace") {
|
|
824
|
+
entries.push(".rrce-workflow/");
|
|
825
|
+
}
|
|
826
|
+
if (tools.includes("copilot")) {
|
|
827
|
+
entries.push(".github/agents/");
|
|
828
|
+
}
|
|
829
|
+
if (tools.includes("antigravity")) {
|
|
830
|
+
entries.push(".agent/");
|
|
831
|
+
}
|
|
832
|
+
if (entries.length === 0) {
|
|
833
|
+
return false;
|
|
834
|
+
}
|
|
835
|
+
try {
|
|
836
|
+
let content = "";
|
|
837
|
+
if (fs7.existsSync(gitignorePath)) {
|
|
838
|
+
content = fs7.readFileSync(gitignorePath, "utf-8");
|
|
839
|
+
}
|
|
840
|
+
const lines = content.split("\n").map((line) => line.trim());
|
|
841
|
+
const newEntries = [];
|
|
842
|
+
for (const entry of entries) {
|
|
843
|
+
const entryWithoutSlash = entry.replace(/\/$/, "");
|
|
844
|
+
if (!lines.some((line) => line === entry || line === entryWithoutSlash)) {
|
|
845
|
+
newEntries.push(entry);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
if (newEntries.length === 0) {
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
let newContent = content;
|
|
852
|
+
if (!newContent.endsWith("\n") && newContent !== "") {
|
|
853
|
+
newContent += "\n";
|
|
854
|
+
}
|
|
855
|
+
if (newContent === "" || !content.includes("# rrce-workflow")) {
|
|
856
|
+
newContent += "\n# rrce-workflow generated folders\n";
|
|
857
|
+
}
|
|
858
|
+
newContent += newEntries.join("\n") + "\n";
|
|
859
|
+
fs7.writeFileSync(gitignorePath, newContent);
|
|
860
|
+
return true;
|
|
861
|
+
} catch {
|
|
862
|
+
return false;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
815
865
|
|
|
816
866
|
// src/commands/wizard/link-flow.ts
|
|
817
867
|
import { multiselect as multiselect2, spinner as spinner2, note as note2, outro as outro2, cancel as cancel2, isCancel as isCancel2 } from "@clack/prompts";
|
|
@@ -937,17 +987,12 @@ Destination: ${pc4.cyan(globalPath)}`,
|
|
|
937
987
|
ensureDir(destDir);
|
|
938
988
|
copyDirRecursive(srcDir, destDir);
|
|
939
989
|
}
|
|
940
|
-
const configFilePath = getConfigPath(workspacePath);
|
|
941
|
-
let configContent = fs9.readFileSync(configFilePath, "utf-8");
|
|
942
|
-
configContent = configContent.replace(/mode:\s*workspace/, "mode: both");
|
|
943
|
-
fs9.writeFileSync(configFilePath, configContent);
|
|
944
990
|
s.stop("Sync complete");
|
|
945
991
|
const summary = [
|
|
946
992
|
`Synced directories:`,
|
|
947
993
|
...existingDirs.map((d) => ` \u2713 ${d}/`),
|
|
948
994
|
``,
|
|
949
995
|
`Global path: ${pc4.cyan(globalPath)}`,
|
|
950
|
-
`Storage mode updated to: ${pc4.bold("both")}`,
|
|
951
996
|
``,
|
|
952
997
|
`Other projects can now link this knowledge!`
|
|
953
998
|
];
|
|
@@ -1032,8 +1077,6 @@ function resolveAllDataPathsWithCustomGlobal(mode, workspaceName, workspaceRoot,
|
|
|
1032
1077
|
return [globalPath];
|
|
1033
1078
|
case "workspace":
|
|
1034
1079
|
return [workspacePath];
|
|
1035
|
-
case "both":
|
|
1036
|
-
return [workspacePath, globalPath];
|
|
1037
1080
|
default:
|
|
1038
1081
|
return [globalPath];
|
|
1039
1082
|
}
|
|
@@ -1064,7 +1107,7 @@ Workspace: ${pc6.bold(workspaceName)}`,
|
|
|
1064
1107
|
if (isAlreadyConfigured) {
|
|
1065
1108
|
try {
|
|
1066
1109
|
const configContent = fs11.readFileSync(configFilePath, "utf-8");
|
|
1067
|
-
const modeMatch = configContent.match(/mode:\s*(global|workspace
|
|
1110
|
+
const modeMatch = configContent.match(/mode:\s*(global|workspace)/);
|
|
1068
1111
|
currentStorageMode = modeMatch?.[1] ?? null;
|
|
1069
1112
|
} catch {
|
|
1070
1113
|
}
|