rrce-workflow 0.2.45 → 0.2.47
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 +233 -161
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -705,6 +705,38 @@ var init_autocomplete_prompt = __esm({
|
|
|
705
705
|
}
|
|
706
706
|
});
|
|
707
707
|
|
|
708
|
+
// src/lib/preferences.ts
|
|
709
|
+
import * as fs7 from "fs";
|
|
710
|
+
import * as path7 from "path";
|
|
711
|
+
function getPreferencesPath() {
|
|
712
|
+
const home = process.env.HOME || "~";
|
|
713
|
+
return path7.join(home, ".rrce-workflow", "preferences.json");
|
|
714
|
+
}
|
|
715
|
+
function loadUserPreferences() {
|
|
716
|
+
const prefPath = getPreferencesPath();
|
|
717
|
+
if (!fs7.existsSync(prefPath)) {
|
|
718
|
+
return {};
|
|
719
|
+
}
|
|
720
|
+
try {
|
|
721
|
+
return JSON.parse(fs7.readFileSync(prefPath, "utf-8"));
|
|
722
|
+
} catch {
|
|
723
|
+
return {};
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
function saveUserPreferences(prefs) {
|
|
727
|
+
const prefPath = getPreferencesPath();
|
|
728
|
+
ensureDir(path7.dirname(prefPath));
|
|
729
|
+
const current = loadUserPreferences();
|
|
730
|
+
const refined = { ...current, ...prefs };
|
|
731
|
+
fs7.writeFileSync(prefPath, JSON.stringify(refined, null, 2));
|
|
732
|
+
}
|
|
733
|
+
var init_preferences = __esm({
|
|
734
|
+
"src/lib/preferences.ts"() {
|
|
735
|
+
"use strict";
|
|
736
|
+
init_paths();
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
|
|
708
740
|
// src/lib/tui-utils.ts
|
|
709
741
|
var tui_utils_exports = {};
|
|
710
742
|
__export(tui_utils_exports, {
|
|
@@ -712,9 +744,10 @@ __export(tui_utils_exports, {
|
|
|
712
744
|
});
|
|
713
745
|
import { select, note, isCancel } from "@clack/prompts";
|
|
714
746
|
import pc2 from "picocolors";
|
|
715
|
-
import * as
|
|
747
|
+
import * as path8 from "path";
|
|
716
748
|
async function resolveGlobalPath() {
|
|
717
|
-
const
|
|
749
|
+
const prefs = loadUserPreferences();
|
|
750
|
+
const defaultPath = prefs.defaultGlobalPath || getDefaultRRCEHome();
|
|
718
751
|
const isDefaultWritable = checkWriteAccess(defaultPath);
|
|
719
752
|
const options = [
|
|
720
753
|
{
|
|
@@ -750,7 +783,7 @@ Please choose a custom path instead.`,
|
|
|
750
783
|
}
|
|
751
784
|
return defaultPath;
|
|
752
785
|
}
|
|
753
|
-
const suggestedPath =
|
|
786
|
+
const suggestedPath = path8.join(process.env.HOME || "~", ".local", "share", "rrce-workflow");
|
|
754
787
|
const customPath = await directoryPrompt({
|
|
755
788
|
message: "Enter custom global path (Tab to autocomplete):",
|
|
756
789
|
defaultValue: suggestedPath,
|
|
@@ -769,8 +802,9 @@ Please choose a custom path instead.`,
|
|
|
769
802
|
}
|
|
770
803
|
let expandedPath = customPath;
|
|
771
804
|
if (!expandedPath.endsWith(".rrce-workflow")) {
|
|
772
|
-
expandedPath =
|
|
805
|
+
expandedPath = path8.join(expandedPath, ".rrce-workflow");
|
|
773
806
|
}
|
|
807
|
+
saveUserPreferences({ defaultGlobalPath: expandedPath });
|
|
774
808
|
return expandedPath;
|
|
775
809
|
}
|
|
776
810
|
var init_tui_utils = __esm({
|
|
@@ -778,6 +812,7 @@ var init_tui_utils = __esm({
|
|
|
778
812
|
"use strict";
|
|
779
813
|
init_paths();
|
|
780
814
|
init_autocomplete_prompt();
|
|
815
|
+
init_preferences();
|
|
781
816
|
}
|
|
782
817
|
});
|
|
783
818
|
|
|
@@ -821,20 +856,20 @@ __export(config_exports, {
|
|
|
821
856
|
saveMCPConfig: () => saveMCPConfig,
|
|
822
857
|
setProjectConfig: () => setProjectConfig
|
|
823
858
|
});
|
|
824
|
-
import * as
|
|
825
|
-
import * as
|
|
859
|
+
import * as fs8 from "fs";
|
|
860
|
+
import * as path9 from "path";
|
|
826
861
|
function getMCPConfigPath() {
|
|
827
862
|
const workspaceRoot = detectWorkspaceRoot();
|
|
828
863
|
const rrceHome = getEffectiveRRCEHome(workspaceRoot);
|
|
829
|
-
return
|
|
864
|
+
return path9.join(rrceHome, "mcp.yaml");
|
|
830
865
|
}
|
|
831
866
|
function ensureMCPGlobalPath() {
|
|
832
867
|
const workspaceRoot = detectWorkspaceRoot();
|
|
833
868
|
const rrceHome = getEffectiveRRCEHome(workspaceRoot);
|
|
834
869
|
if (rrceHome.startsWith(".") || rrceHome.includes(".rrce-workflow/")) {
|
|
835
|
-
const configPath =
|
|
836
|
-
if (
|
|
837
|
-
const content =
|
|
870
|
+
const configPath = path9.join(workspaceRoot, ".rrce-workflow", "config.yaml");
|
|
871
|
+
if (fs8.existsSync(configPath)) {
|
|
872
|
+
const content = fs8.readFileSync(configPath, "utf-8");
|
|
838
873
|
const modeMatch = content.match(/mode:\s*(global|workspace)/);
|
|
839
874
|
if (modeMatch?.[1] === "workspace") {
|
|
840
875
|
return {
|
|
@@ -852,11 +887,11 @@ function ensureMCPGlobalPath() {
|
|
|
852
887
|
}
|
|
853
888
|
function loadMCPConfig() {
|
|
854
889
|
const configPath = getMCPConfigPath();
|
|
855
|
-
if (!
|
|
890
|
+
if (!fs8.existsSync(configPath)) {
|
|
856
891
|
return { ...DEFAULT_MCP_CONFIG };
|
|
857
892
|
}
|
|
858
893
|
try {
|
|
859
|
-
const content =
|
|
894
|
+
const content = fs8.readFileSync(configPath, "utf-8");
|
|
860
895
|
return parseMCPConfig(content);
|
|
861
896
|
} catch {
|
|
862
897
|
return { ...DEFAULT_MCP_CONFIG };
|
|
@@ -864,12 +899,12 @@ function loadMCPConfig() {
|
|
|
864
899
|
}
|
|
865
900
|
function saveMCPConfig(config) {
|
|
866
901
|
const configPath = getMCPConfigPath();
|
|
867
|
-
const dir =
|
|
868
|
-
if (!
|
|
869
|
-
|
|
902
|
+
const dir = path9.dirname(configPath);
|
|
903
|
+
if (!fs8.existsSync(dir)) {
|
|
904
|
+
fs8.mkdirSync(dir, { recursive: true });
|
|
870
905
|
}
|
|
871
906
|
const content = serializeMCPConfig(config);
|
|
872
|
-
|
|
907
|
+
fs8.writeFileSync(configPath, content);
|
|
873
908
|
}
|
|
874
909
|
function parseMCPConfig(content) {
|
|
875
910
|
const config = { ...DEFAULT_MCP_CONFIG, projects: [] };
|
|
@@ -1097,12 +1132,12 @@ var init_config = __esm({
|
|
|
1097
1132
|
});
|
|
1098
1133
|
|
|
1099
1134
|
// src/mcp/logger.ts
|
|
1100
|
-
import * as
|
|
1101
|
-
import * as
|
|
1135
|
+
import * as fs9 from "fs";
|
|
1136
|
+
import * as path10 from "path";
|
|
1102
1137
|
function getLogFilePath() {
|
|
1103
1138
|
const workspaceRoot = detectWorkspaceRoot();
|
|
1104
1139
|
const rrceHome = getEffectiveRRCEHome(workspaceRoot);
|
|
1105
|
-
return
|
|
1140
|
+
return path10.join(rrceHome, "mcp-server.log");
|
|
1106
1141
|
}
|
|
1107
1142
|
var Logger, logger;
|
|
1108
1143
|
var init_logger = __esm({
|
|
@@ -1133,11 +1168,11 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
1133
1168
|
}
|
|
1134
1169
|
logMessage += "\n";
|
|
1135
1170
|
try {
|
|
1136
|
-
const dir =
|
|
1137
|
-
if (!
|
|
1138
|
-
|
|
1171
|
+
const dir = path10.dirname(this.logPath);
|
|
1172
|
+
if (!fs9.existsSync(dir)) {
|
|
1173
|
+
fs9.mkdirSync(dir, { recursive: true });
|
|
1139
1174
|
}
|
|
1140
|
-
|
|
1175
|
+
fs9.appendFileSync(this.logPath, logMessage);
|
|
1141
1176
|
} catch (e) {
|
|
1142
1177
|
console.error(`[Logger Failure] Could not write to ${this.logPath}`, e);
|
|
1143
1178
|
console.error(logMessage);
|
|
@@ -1161,9 +1196,8 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
1161
1196
|
});
|
|
1162
1197
|
|
|
1163
1198
|
// src/mcp/services/rag.ts
|
|
1164
|
-
import
|
|
1165
|
-
import * as
|
|
1166
|
-
import * as path10 from "path";
|
|
1199
|
+
import * as fs10 from "fs";
|
|
1200
|
+
import * as path11 from "path";
|
|
1167
1201
|
var INDEX_VERSION, DEFAULT_MODEL, RAGService;
|
|
1168
1202
|
var init_rag = __esm({
|
|
1169
1203
|
"src/mcp/services/rag.ts"() {
|
|
@@ -1188,6 +1222,7 @@ var init_rag = __esm({
|
|
|
1188
1222
|
if (!this.pipe) {
|
|
1189
1223
|
logger.info(`RAG: Initializing model ${this.modelName}...`);
|
|
1190
1224
|
try {
|
|
1225
|
+
const { pipeline } = await import("@xenova/transformers");
|
|
1191
1226
|
this.pipe = await pipeline("feature-extraction", this.modelName);
|
|
1192
1227
|
logger.info(`RAG: Model ${this.modelName} initialized successfully.`);
|
|
1193
1228
|
} catch (error) {
|
|
@@ -1203,9 +1238,9 @@ var init_rag = __esm({
|
|
|
1203
1238
|
*/
|
|
1204
1239
|
loadIndex() {
|
|
1205
1240
|
if (this.index) return;
|
|
1206
|
-
if (
|
|
1241
|
+
if (fs10.existsSync(this.indexPath)) {
|
|
1207
1242
|
try {
|
|
1208
|
-
const data =
|
|
1243
|
+
const data = fs10.readFileSync(this.indexPath, "utf-8");
|
|
1209
1244
|
this.index = JSON.parse(data);
|
|
1210
1245
|
logger.info(`RAG: Loaded index from ${this.indexPath} with ${this.index?.chunks.length} chunks.`);
|
|
1211
1246
|
} catch (error) {
|
|
@@ -1231,11 +1266,11 @@ var init_rag = __esm({
|
|
|
1231
1266
|
saveIndex() {
|
|
1232
1267
|
if (!this.index) return;
|
|
1233
1268
|
try {
|
|
1234
|
-
const dir =
|
|
1235
|
-
if (!
|
|
1236
|
-
|
|
1269
|
+
const dir = path11.dirname(this.indexPath);
|
|
1270
|
+
if (!fs10.existsSync(dir)) {
|
|
1271
|
+
fs10.mkdirSync(dir, { recursive: true });
|
|
1237
1272
|
}
|
|
1238
|
-
|
|
1273
|
+
fs10.writeFileSync(this.indexPath, JSON.stringify(this.index, null, 2));
|
|
1239
1274
|
logger.info(`RAG: Saved index to ${this.indexPath} with ${this.index.chunks.length} chunks.`);
|
|
1240
1275
|
} catch (error) {
|
|
1241
1276
|
logger.error(`RAG: Failed to save index to ${this.indexPath}`, error);
|
|
@@ -1351,8 +1386,8 @@ var init_rag = __esm({
|
|
|
1351
1386
|
});
|
|
1352
1387
|
|
|
1353
1388
|
// src/mcp/resources.ts
|
|
1354
|
-
import * as
|
|
1355
|
-
import * as
|
|
1389
|
+
import * as fs11 from "fs";
|
|
1390
|
+
import * as path12 from "path";
|
|
1356
1391
|
function getExposedProjects() {
|
|
1357
1392
|
const config = loadMCPConfig();
|
|
1358
1393
|
const allProjects = scanForProjects();
|
|
@@ -1360,12 +1395,12 @@ function getExposedProjects() {
|
|
|
1360
1395
|
const activeProject = detectActiveProject(globalProjects);
|
|
1361
1396
|
let linkedProjects = [];
|
|
1362
1397
|
if (activeProject) {
|
|
1363
|
-
const localConfigPath =
|
|
1398
|
+
const localConfigPath = path12.join(activeProject.dataPath, "config.yaml");
|
|
1364
1399
|
let cfgContent = null;
|
|
1365
|
-
if (
|
|
1366
|
-
cfgContent =
|
|
1367
|
-
} else if (
|
|
1368
|
-
cfgContent =
|
|
1400
|
+
if (fs11.existsSync(path12.join(activeProject.dataPath, ".rrce-workflow", "config.yaml"))) {
|
|
1401
|
+
cfgContent = fs11.readFileSync(path12.join(activeProject.dataPath, ".rrce-workflow", "config.yaml"), "utf-8");
|
|
1402
|
+
} else if (fs11.existsSync(path12.join(activeProject.dataPath, ".rrce-workflow.yaml"))) {
|
|
1403
|
+
cfgContent = fs11.readFileSync(path12.join(activeProject.dataPath, ".rrce-workflow.yaml"), "utf-8");
|
|
1369
1404
|
}
|
|
1370
1405
|
if (cfgContent) {
|
|
1371
1406
|
if (cfgContent.includes("linked_projects:")) {
|
|
@@ -1425,11 +1460,11 @@ function getProjectContext(projectName) {
|
|
|
1425
1460
|
if (!project.knowledgePath) {
|
|
1426
1461
|
return null;
|
|
1427
1462
|
}
|
|
1428
|
-
const contextPath =
|
|
1429
|
-
if (!
|
|
1463
|
+
const contextPath = path12.join(project.knowledgePath, "project-context.md");
|
|
1464
|
+
if (!fs11.existsSync(contextPath)) {
|
|
1430
1465
|
return null;
|
|
1431
1466
|
}
|
|
1432
|
-
return
|
|
1467
|
+
return fs11.readFileSync(contextPath, "utf-8");
|
|
1433
1468
|
}
|
|
1434
1469
|
function getProjectTasks(projectName) {
|
|
1435
1470
|
const config = loadMCPConfig();
|
|
@@ -1442,18 +1477,18 @@ function getProjectTasks(projectName) {
|
|
|
1442
1477
|
if (!permissions.tasks) {
|
|
1443
1478
|
return [];
|
|
1444
1479
|
}
|
|
1445
|
-
if (!project.tasksPath || !
|
|
1480
|
+
if (!project.tasksPath || !fs11.existsSync(project.tasksPath)) {
|
|
1446
1481
|
return [];
|
|
1447
1482
|
}
|
|
1448
1483
|
const tasks = [];
|
|
1449
1484
|
try {
|
|
1450
|
-
const taskDirs =
|
|
1485
|
+
const taskDirs = fs11.readdirSync(project.tasksPath, { withFileTypes: true });
|
|
1451
1486
|
for (const dir of taskDirs) {
|
|
1452
1487
|
if (!dir.isDirectory()) continue;
|
|
1453
|
-
const metaPath =
|
|
1454
|
-
if (
|
|
1488
|
+
const metaPath = path12.join(project.tasksPath, dir.name, "meta.json");
|
|
1489
|
+
if (fs11.existsSync(metaPath)) {
|
|
1455
1490
|
try {
|
|
1456
|
-
const meta = JSON.parse(
|
|
1491
|
+
const meta = JSON.parse(fs11.readFileSync(metaPath, "utf-8"));
|
|
1457
1492
|
tasks.push(meta);
|
|
1458
1493
|
} catch {
|
|
1459
1494
|
}
|
|
@@ -1477,13 +1512,13 @@ async function searchKnowledge(query) {
|
|
|
1477
1512
|
const useRAG = projConfig?.semanticSearch?.enabled;
|
|
1478
1513
|
if (useRAG) {
|
|
1479
1514
|
try {
|
|
1480
|
-
const indexPath =
|
|
1515
|
+
const indexPath = path12.join(project.knowledgePath, "embeddings.json");
|
|
1481
1516
|
const rag = new RAGService(indexPath, projConfig?.semanticSearch?.model);
|
|
1482
1517
|
const ragResults = await rag.search(query, 5);
|
|
1483
1518
|
for (const r of ragResults) {
|
|
1484
1519
|
results.push({
|
|
1485
1520
|
project: project.name,
|
|
1486
|
-
file:
|
|
1521
|
+
file: path12.relative(project.knowledgePath, r.filePath),
|
|
1487
1522
|
matches: [r.content],
|
|
1488
1523
|
// The chunk content is the match
|
|
1489
1524
|
score: r.score
|
|
@@ -1494,11 +1529,11 @@ async function searchKnowledge(query) {
|
|
|
1494
1529
|
continue;
|
|
1495
1530
|
}
|
|
1496
1531
|
try {
|
|
1497
|
-
const files =
|
|
1532
|
+
const files = fs11.readdirSync(project.knowledgePath);
|
|
1498
1533
|
for (const file of files) {
|
|
1499
1534
|
if (!file.endsWith(".md")) continue;
|
|
1500
|
-
const filePath =
|
|
1501
|
-
const content =
|
|
1535
|
+
const filePath = path12.join(project.knowledgePath, file);
|
|
1536
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
1502
1537
|
const lines = content.split("\n");
|
|
1503
1538
|
const matches = [];
|
|
1504
1539
|
for (const line of lines) {
|
|
@@ -1533,18 +1568,18 @@ async function indexKnowledge(projectName, force = false) {
|
|
|
1533
1568
|
if (!projConfig?.semanticSearch?.enabled) {
|
|
1534
1569
|
return { success: false, message: "Semantic Search is not enabled for this project", filesIndexed: 0 };
|
|
1535
1570
|
}
|
|
1536
|
-
if (!project.knowledgePath || !
|
|
1571
|
+
if (!project.knowledgePath || !fs11.existsSync(project.knowledgePath)) {
|
|
1537
1572
|
return { success: false, message: "No knowledge directory found", filesIndexed: 0 };
|
|
1538
1573
|
}
|
|
1539
1574
|
try {
|
|
1540
|
-
const indexPath =
|
|
1575
|
+
const indexPath = path12.join(project.knowledgePath, "embeddings.json");
|
|
1541
1576
|
const rag = new RAGService(indexPath, projConfig.semanticSearch.model);
|
|
1542
|
-
const files =
|
|
1577
|
+
const files = fs11.readdirSync(project.knowledgePath).filter((f) => f.endsWith(".md"));
|
|
1543
1578
|
let count = 0;
|
|
1544
1579
|
for (const file of files) {
|
|
1545
|
-
const filePath =
|
|
1546
|
-
const content =
|
|
1547
|
-
await rag.indexFile(
|
|
1580
|
+
const filePath = path12.join(project.knowledgePath, file);
|
|
1581
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
1582
|
+
await rag.indexFile(path12.join(project.knowledgePath, file), content);
|
|
1548
1583
|
count++;
|
|
1549
1584
|
}
|
|
1550
1585
|
return { success: true, message: `Successfully indexed ${count} files`, filesIndexed: count };
|
|
@@ -2046,8 +2081,8 @@ var init_server = __esm({
|
|
|
2046
2081
|
});
|
|
2047
2082
|
|
|
2048
2083
|
// src/mcp/install.ts
|
|
2049
|
-
import * as
|
|
2050
|
-
import * as
|
|
2084
|
+
import * as fs12 from "fs";
|
|
2085
|
+
import * as path13 from "path";
|
|
2051
2086
|
import * as os from "os";
|
|
2052
2087
|
function checkInstallStatus(workspacePath) {
|
|
2053
2088
|
return {
|
|
@@ -2058,37 +2093,37 @@ function checkInstallStatus(workspacePath) {
|
|
|
2058
2093
|
};
|
|
2059
2094
|
}
|
|
2060
2095
|
function checkAntigravityConfig() {
|
|
2061
|
-
if (!
|
|
2096
|
+
if (!fs12.existsSync(ANTIGRAVITY_CONFIG)) return false;
|
|
2062
2097
|
try {
|
|
2063
|
-
const content = JSON.parse(
|
|
2098
|
+
const content = JSON.parse(fs12.readFileSync(ANTIGRAVITY_CONFIG, "utf-8"));
|
|
2064
2099
|
return !!content.mcpServers?.["rrce"];
|
|
2065
2100
|
} catch {
|
|
2066
2101
|
return false;
|
|
2067
2102
|
}
|
|
2068
2103
|
}
|
|
2069
2104
|
function checkClaudeConfig() {
|
|
2070
|
-
if (!
|
|
2105
|
+
if (!fs12.existsSync(CLAUDE_CONFIG)) return false;
|
|
2071
2106
|
try {
|
|
2072
|
-
const content = JSON.parse(
|
|
2107
|
+
const content = JSON.parse(fs12.readFileSync(CLAUDE_CONFIG, "utf-8"));
|
|
2073
2108
|
return !!content.mcpServers?.["rrce"];
|
|
2074
2109
|
} catch {
|
|
2075
2110
|
return false;
|
|
2076
2111
|
}
|
|
2077
2112
|
}
|
|
2078
2113
|
function checkVSCodeGlobalConfig() {
|
|
2079
|
-
if (!
|
|
2114
|
+
if (!fs12.existsSync(VSCODE_GLOBAL_CONFIG)) return false;
|
|
2080
2115
|
try {
|
|
2081
|
-
const content = JSON.parse(
|
|
2116
|
+
const content = JSON.parse(fs12.readFileSync(VSCODE_GLOBAL_CONFIG, "utf-8"));
|
|
2082
2117
|
return !!content["mcp.servers"]?.["rrce"];
|
|
2083
2118
|
} catch {
|
|
2084
2119
|
return false;
|
|
2085
2120
|
}
|
|
2086
2121
|
}
|
|
2087
2122
|
function checkVSCodeWorkspaceConfig(workspacePath) {
|
|
2088
|
-
const configPath =
|
|
2089
|
-
if (!
|
|
2123
|
+
const configPath = path13.join(workspacePath, ".vscode", "mcp.json");
|
|
2124
|
+
if (!fs12.existsSync(configPath)) return false;
|
|
2090
2125
|
try {
|
|
2091
|
-
const content = JSON.parse(
|
|
2126
|
+
const content = JSON.parse(fs12.readFileSync(configPath, "utf-8"));
|
|
2092
2127
|
return !!content.servers?.["rrce"];
|
|
2093
2128
|
} catch {
|
|
2094
2129
|
return false;
|
|
@@ -2113,14 +2148,14 @@ function installToConfig(target, workspacePath) {
|
|
|
2113
2148
|
}
|
|
2114
2149
|
}
|
|
2115
2150
|
function installToAntigravity() {
|
|
2116
|
-
const dir =
|
|
2117
|
-
if (!
|
|
2118
|
-
|
|
2151
|
+
const dir = path13.dirname(ANTIGRAVITY_CONFIG);
|
|
2152
|
+
if (!fs12.existsSync(dir)) {
|
|
2153
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
2119
2154
|
}
|
|
2120
2155
|
let config = { mcpServers: {} };
|
|
2121
|
-
if (
|
|
2156
|
+
if (fs12.existsSync(ANTIGRAVITY_CONFIG)) {
|
|
2122
2157
|
try {
|
|
2123
|
-
config = JSON.parse(
|
|
2158
|
+
config = JSON.parse(fs12.readFileSync(ANTIGRAVITY_CONFIG, "utf-8"));
|
|
2124
2159
|
} catch {
|
|
2125
2160
|
}
|
|
2126
2161
|
}
|
|
@@ -2130,21 +2165,21 @@ function installToAntigravity() {
|
|
|
2130
2165
|
args: ["-y", "rrce-workflow", "mcp", "start"]
|
|
2131
2166
|
};
|
|
2132
2167
|
try {
|
|
2133
|
-
|
|
2168
|
+
fs12.writeFileSync(ANTIGRAVITY_CONFIG, JSON.stringify(config, null, 2));
|
|
2134
2169
|
return true;
|
|
2135
2170
|
} catch {
|
|
2136
2171
|
return false;
|
|
2137
2172
|
}
|
|
2138
2173
|
}
|
|
2139
2174
|
function installToClaude() {
|
|
2140
|
-
const dir =
|
|
2141
|
-
if (!
|
|
2142
|
-
|
|
2175
|
+
const dir = path13.dirname(CLAUDE_CONFIG);
|
|
2176
|
+
if (!fs12.existsSync(dir)) {
|
|
2177
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
2143
2178
|
}
|
|
2144
2179
|
let config = { mcpServers: {} };
|
|
2145
|
-
if (
|
|
2180
|
+
if (fs12.existsSync(CLAUDE_CONFIG)) {
|
|
2146
2181
|
try {
|
|
2147
|
-
config = JSON.parse(
|
|
2182
|
+
config = JSON.parse(fs12.readFileSync(CLAUDE_CONFIG, "utf-8"));
|
|
2148
2183
|
} catch {
|
|
2149
2184
|
}
|
|
2150
2185
|
}
|
|
@@ -2154,21 +2189,21 @@ function installToClaude() {
|
|
|
2154
2189
|
args: ["-y", "rrce-workflow", "mcp", "start"]
|
|
2155
2190
|
};
|
|
2156
2191
|
try {
|
|
2157
|
-
|
|
2192
|
+
fs12.writeFileSync(CLAUDE_CONFIG, JSON.stringify(config, null, 2));
|
|
2158
2193
|
return true;
|
|
2159
2194
|
} catch {
|
|
2160
2195
|
return false;
|
|
2161
2196
|
}
|
|
2162
2197
|
}
|
|
2163
2198
|
function installToVSCodeGlobal() {
|
|
2164
|
-
const dir =
|
|
2165
|
-
if (!
|
|
2166
|
-
|
|
2199
|
+
const dir = path13.dirname(VSCODE_GLOBAL_CONFIG);
|
|
2200
|
+
if (!fs12.existsSync(dir)) {
|
|
2201
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
2167
2202
|
}
|
|
2168
2203
|
let settings = {};
|
|
2169
|
-
if (
|
|
2204
|
+
if (fs12.existsSync(VSCODE_GLOBAL_CONFIG)) {
|
|
2170
2205
|
try {
|
|
2171
|
-
settings = JSON.parse(
|
|
2206
|
+
settings = JSON.parse(fs12.readFileSync(VSCODE_GLOBAL_CONFIG, "utf-8"));
|
|
2172
2207
|
} catch {
|
|
2173
2208
|
}
|
|
2174
2209
|
}
|
|
@@ -2178,22 +2213,22 @@ function installToVSCodeGlobal() {
|
|
|
2178
2213
|
args: ["-y", "rrce-workflow", "mcp", "start"]
|
|
2179
2214
|
};
|
|
2180
2215
|
try {
|
|
2181
|
-
|
|
2216
|
+
fs12.writeFileSync(VSCODE_GLOBAL_CONFIG, JSON.stringify(settings, null, 2));
|
|
2182
2217
|
return true;
|
|
2183
2218
|
} catch {
|
|
2184
2219
|
return false;
|
|
2185
2220
|
}
|
|
2186
2221
|
}
|
|
2187
2222
|
function installToVSCodeWorkspace(workspacePath) {
|
|
2188
|
-
const vscodeDir =
|
|
2189
|
-
const configPath =
|
|
2190
|
-
if (!
|
|
2191
|
-
|
|
2223
|
+
const vscodeDir = path13.join(workspacePath, ".vscode");
|
|
2224
|
+
const configPath = path13.join(vscodeDir, "mcp.json");
|
|
2225
|
+
if (!fs12.existsSync(vscodeDir)) {
|
|
2226
|
+
fs12.mkdirSync(vscodeDir, { recursive: true });
|
|
2192
2227
|
}
|
|
2193
2228
|
let config = { servers: {} };
|
|
2194
|
-
if (
|
|
2229
|
+
if (fs12.existsSync(configPath)) {
|
|
2195
2230
|
try {
|
|
2196
|
-
config = JSON.parse(
|
|
2231
|
+
config = JSON.parse(fs12.readFileSync(configPath, "utf-8"));
|
|
2197
2232
|
} catch {
|
|
2198
2233
|
}
|
|
2199
2234
|
}
|
|
@@ -2203,7 +2238,7 @@ function installToVSCodeWorkspace(workspacePath) {
|
|
|
2203
2238
|
args: ["-y", "rrce-workflow", "mcp", "start"]
|
|
2204
2239
|
};
|
|
2205
2240
|
try {
|
|
2206
|
-
|
|
2241
|
+
fs12.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
2207
2242
|
return true;
|
|
2208
2243
|
} catch {
|
|
2209
2244
|
return false;
|
|
@@ -2227,9 +2262,9 @@ var ANTIGRAVITY_CONFIG, CLAUDE_CONFIG, VSCODE_GLOBAL_CONFIG;
|
|
|
2227
2262
|
var init_install = __esm({
|
|
2228
2263
|
"src/mcp/install.ts"() {
|
|
2229
2264
|
"use strict";
|
|
2230
|
-
ANTIGRAVITY_CONFIG =
|
|
2231
|
-
CLAUDE_CONFIG =
|
|
2232
|
-
VSCODE_GLOBAL_CONFIG =
|
|
2265
|
+
ANTIGRAVITY_CONFIG = path13.join(os.homedir(), ".gemini/antigravity/mcp_config.json");
|
|
2266
|
+
CLAUDE_CONFIG = path13.join(os.homedir(), ".config/claude/claude_desktop_config.json");
|
|
2267
|
+
VSCODE_GLOBAL_CONFIG = path13.join(os.homedir(), ".config/Code/User/settings.json");
|
|
2233
2268
|
}
|
|
2234
2269
|
});
|
|
2235
2270
|
|
|
@@ -2314,8 +2349,8 @@ Hidden projects: ${projects.length - exposedCount}`,
|
|
|
2314
2349
|
}
|
|
2315
2350
|
async function handleConfigureGlobalPath() {
|
|
2316
2351
|
const { resolveGlobalPath: resolveGlobalPath2 } = await Promise.resolve().then(() => (init_tui_utils(), tui_utils_exports));
|
|
2317
|
-
const
|
|
2318
|
-
const
|
|
2352
|
+
const fs19 = await import("fs");
|
|
2353
|
+
const path18 = await import("path");
|
|
2319
2354
|
note2(
|
|
2320
2355
|
`MCP Hub requires a ${pc3.bold("global storage path")} to store its configuration
|
|
2321
2356
|
and coordinate across projects.
|
|
@@ -2329,8 +2364,8 @@ locally in each project. MCP needs a central location.`,
|
|
|
2329
2364
|
return false;
|
|
2330
2365
|
}
|
|
2331
2366
|
try {
|
|
2332
|
-
if (!
|
|
2333
|
-
|
|
2367
|
+
if (!fs19.existsSync(resolvedPath)) {
|
|
2368
|
+
fs19.mkdirSync(resolvedPath, { recursive: true });
|
|
2334
2369
|
}
|
|
2335
2370
|
const config = loadMCPConfig();
|
|
2336
2371
|
saveMCPConfig(config);
|
|
@@ -2338,7 +2373,7 @@ locally in each project. MCP needs a central location.`,
|
|
|
2338
2373
|
`${pc3.green("\u2713")} Global path configured: ${pc3.cyan(resolvedPath)}
|
|
2339
2374
|
|
|
2340
2375
|
MCP config will be stored at:
|
|
2341
|
-
${
|
|
2376
|
+
${path18.join(resolvedPath, "mcp.yaml")}`,
|
|
2342
2377
|
"Configuration Saved"
|
|
2343
2378
|
);
|
|
2344
2379
|
return true;
|
|
@@ -2815,7 +2850,7 @@ __export(App_exports, {
|
|
|
2815
2850
|
});
|
|
2816
2851
|
import { useState as useState4, useEffect as useEffect4 } from "react";
|
|
2817
2852
|
import { Box as Box10, useInput as useInput3, useApp } from "ink";
|
|
2818
|
-
import
|
|
2853
|
+
import fs13 from "fs";
|
|
2819
2854
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2820
2855
|
var TABS, App;
|
|
2821
2856
|
var init_App = __esm({
|
|
@@ -2884,18 +2919,18 @@ var init_App = __esm({
|
|
|
2884
2919
|
useEffect4(() => {
|
|
2885
2920
|
const logPath = getLogFilePath();
|
|
2886
2921
|
let lastSize = 0;
|
|
2887
|
-
if (
|
|
2888
|
-
const stats =
|
|
2922
|
+
if (fs13.existsSync(logPath)) {
|
|
2923
|
+
const stats = fs13.statSync(logPath);
|
|
2889
2924
|
lastSize = stats.size;
|
|
2890
2925
|
}
|
|
2891
2926
|
const interval = setInterval(() => {
|
|
2892
|
-
if (
|
|
2893
|
-
const stats =
|
|
2927
|
+
if (fs13.existsSync(logPath)) {
|
|
2928
|
+
const stats = fs13.statSync(logPath);
|
|
2894
2929
|
if (stats.size > lastSize) {
|
|
2895
2930
|
const buffer = Buffer.alloc(stats.size - lastSize);
|
|
2896
|
-
const fd =
|
|
2897
|
-
|
|
2898
|
-
|
|
2931
|
+
const fd = fs13.openSync(logPath, "r");
|
|
2932
|
+
fs13.readSync(fd, buffer, 0, buffer.length, lastSize);
|
|
2933
|
+
fs13.closeSync(fd);
|
|
2899
2934
|
const newContent = buffer.toString("utf-8");
|
|
2900
2935
|
const newLines = newContent.split("\n").filter((l) => l.trim());
|
|
2901
2936
|
setLogs((prev) => {
|
|
@@ -3229,8 +3264,8 @@ var init_mcp = __esm({
|
|
|
3229
3264
|
// src/commands/wizard/setup-flow.ts
|
|
3230
3265
|
import { group, select as select2, multiselect as multiselect3, confirm as confirm4, spinner as spinner3, note as note7, outro as outro2, cancel as cancel2, isCancel as isCancel6 } from "@clack/prompts";
|
|
3231
3266
|
import pc8 from "picocolors";
|
|
3232
|
-
import * as
|
|
3233
|
-
import * as
|
|
3267
|
+
import * as fs14 from "fs";
|
|
3268
|
+
import * as path14 from "path";
|
|
3234
3269
|
async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
|
|
3235
3270
|
const s = spinner3();
|
|
3236
3271
|
const config = await group(
|
|
@@ -3279,7 +3314,21 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
|
|
|
3279
3314
|
exposeToMCP: () => confirm4({
|
|
3280
3315
|
message: "Expose this project to MCP (AI Agent) server?",
|
|
3281
3316
|
initialValue: true
|
|
3282
|
-
})
|
|
3317
|
+
}),
|
|
3318
|
+
enableRAG: () => confirm4({
|
|
3319
|
+
message: "Enable Semantic Search (Local Mini RAG)?",
|
|
3320
|
+
initialValue: false
|
|
3321
|
+
// Default false because it's heavy
|
|
3322
|
+
}),
|
|
3323
|
+
enableRAGConfirm: ({ results }) => {
|
|
3324
|
+
if (results.enableRAG) {
|
|
3325
|
+
return confirm4({
|
|
3326
|
+
message: `${pc8.yellow("Warning:")} This will download a ~100MB model (Xenova/all-MiniLM-L6-v2) on first use. Proceed?`,
|
|
3327
|
+
initialValue: true
|
|
3328
|
+
});
|
|
3329
|
+
}
|
|
3330
|
+
return Promise.resolve(true);
|
|
3331
|
+
}
|
|
3283
3332
|
},
|
|
3284
3333
|
{
|
|
3285
3334
|
onCancel: () => {
|
|
@@ -3308,7 +3357,8 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
|
|
|
3308
3357
|
tools: config.tools,
|
|
3309
3358
|
linkedProjects: config.linkedProjects,
|
|
3310
3359
|
addToGitignore: config.addToGitignore,
|
|
3311
|
-
exposeToMCP: config.exposeToMCP
|
|
3360
|
+
exposeToMCP: config.exposeToMCP,
|
|
3361
|
+
enableRAG: config.enableRAG && config.enableRAGConfirm
|
|
3312
3362
|
}, workspacePath, workspaceName, existingProjects);
|
|
3313
3363
|
s.stop("Configuration generated");
|
|
3314
3364
|
const dataPaths = getDataPaths(
|
|
@@ -3370,27 +3420,29 @@ async function generateConfiguration(config, workspacePath, workspaceName, allPr
|
|
|
3370
3420
|
const dataPaths = getDataPaths(config.storageMode, workspaceName, workspacePath, config.globalPath);
|
|
3371
3421
|
for (const dataPath of dataPaths) {
|
|
3372
3422
|
ensureDir(dataPath);
|
|
3373
|
-
ensureDir(
|
|
3374
|
-
ensureDir(
|
|
3375
|
-
ensureDir(
|
|
3376
|
-
ensureDir(
|
|
3423
|
+
ensureDir(path14.join(dataPath, "knowledge"));
|
|
3424
|
+
ensureDir(path14.join(dataPath, "refs"));
|
|
3425
|
+
ensureDir(path14.join(dataPath, "tasks"));
|
|
3426
|
+
ensureDir(path14.join(dataPath, "templates"));
|
|
3377
3427
|
}
|
|
3378
3428
|
const agentCoreDir = getAgentCoreDir();
|
|
3379
3429
|
syncMetadataToAll(agentCoreDir, dataPaths);
|
|
3380
|
-
copyDirToAllStoragePaths(
|
|
3430
|
+
copyDirToAllStoragePaths(path14.join(agentCoreDir, "templates"), "templates", dataPaths);
|
|
3381
3431
|
const prompts = loadPromptsFromDir(getAgentCorePromptsDir());
|
|
3382
|
-
if (config.
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3432
|
+
if (config.storageMode === "workspace") {
|
|
3433
|
+
if (config.tools.includes("copilot")) {
|
|
3434
|
+
const copilotPath = getAgentPromptPath(workspacePath, "copilot");
|
|
3435
|
+
ensureDir(copilotPath);
|
|
3436
|
+
copyPromptsToDir(prompts, copilotPath, ".agent.md");
|
|
3437
|
+
}
|
|
3438
|
+
if (config.tools.includes("antigravity")) {
|
|
3439
|
+
const antigravityPath = getAgentPromptPath(workspacePath, "antigravity");
|
|
3440
|
+
ensureDir(antigravityPath);
|
|
3441
|
+
copyPromptsToDir(prompts, antigravityPath, ".md");
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
const workspaceConfigPath = path14.join(workspacePath, ".rrce-workflow", "config.yaml");
|
|
3445
|
+
ensureDir(path14.dirname(workspaceConfigPath));
|
|
3394
3446
|
let configContent = `# RRCE-Workflow Configuration
|
|
3395
3447
|
version: 1
|
|
3396
3448
|
|
|
@@ -3418,7 +3470,7 @@ linked_projects:
|
|
|
3418
3470
|
`;
|
|
3419
3471
|
});
|
|
3420
3472
|
}
|
|
3421
|
-
|
|
3473
|
+
fs14.writeFileSync(workspaceConfigPath, configContent);
|
|
3422
3474
|
if (config.addToGitignore) {
|
|
3423
3475
|
updateGitignore(workspacePath, config.storageMode, config.tools);
|
|
3424
3476
|
}
|
|
@@ -3435,10 +3487,30 @@ linked_projects:
|
|
|
3435
3487
|
const mcpConfig = loadMCPConfig3();
|
|
3436
3488
|
const currentProjectName = workspaceName;
|
|
3437
3489
|
if (config.storageMode === "workspace") {
|
|
3438
|
-
setProjectConfig2(
|
|
3490
|
+
setProjectConfig2(
|
|
3491
|
+
mcpConfig,
|
|
3492
|
+
currentProjectName,
|
|
3493
|
+
true,
|
|
3494
|
+
void 0,
|
|
3495
|
+
// permissions
|
|
3496
|
+
void 0,
|
|
3497
|
+
// path
|
|
3498
|
+
config.enableRAG ? { enabled: true } : void 0
|
|
3499
|
+
// semanticSearch
|
|
3500
|
+
);
|
|
3439
3501
|
saveMCPConfig2(mcpConfig);
|
|
3440
3502
|
} else {
|
|
3441
|
-
setProjectConfig2(
|
|
3503
|
+
setProjectConfig2(
|
|
3504
|
+
mcpConfig,
|
|
3505
|
+
currentProjectName,
|
|
3506
|
+
true,
|
|
3507
|
+
void 0,
|
|
3508
|
+
// permissions
|
|
3509
|
+
void 0,
|
|
3510
|
+
// path
|
|
3511
|
+
config.enableRAG ? { enabled: true } : void 0
|
|
3512
|
+
// semanticSearch
|
|
3513
|
+
);
|
|
3442
3514
|
saveMCPConfig2(mcpConfig);
|
|
3443
3515
|
}
|
|
3444
3516
|
} catch (e) {
|
|
@@ -3447,8 +3519,8 @@ linked_projects:
|
|
|
3447
3519
|
}
|
|
3448
3520
|
}
|
|
3449
3521
|
function getDataPaths(mode, workspaceName, workspaceRoot, customGlobalPath) {
|
|
3450
|
-
const globalPath =
|
|
3451
|
-
const workspacePath =
|
|
3522
|
+
const globalPath = path14.join(customGlobalPath || getDefaultRRCEHome(), "workspaces", workspaceName);
|
|
3523
|
+
const workspacePath = path14.join(workspaceRoot, ".rrce-workflow");
|
|
3452
3524
|
switch (mode) {
|
|
3453
3525
|
case "global":
|
|
3454
3526
|
return [globalPath];
|
|
@@ -3459,7 +3531,7 @@ function getDataPaths(mode, workspaceName, workspaceRoot, customGlobalPath) {
|
|
|
3459
3531
|
}
|
|
3460
3532
|
}
|
|
3461
3533
|
function updateGitignore(workspacePath, storageMode, tools) {
|
|
3462
|
-
const gitignorePath =
|
|
3534
|
+
const gitignorePath = path14.join(workspacePath, ".gitignore");
|
|
3463
3535
|
const entries = [];
|
|
3464
3536
|
if (storageMode === "workspace") {
|
|
3465
3537
|
entries.push(".rrce-workflow/");
|
|
@@ -3475,8 +3547,8 @@ function updateGitignore(workspacePath, storageMode, tools) {
|
|
|
3475
3547
|
}
|
|
3476
3548
|
try {
|
|
3477
3549
|
let content = "";
|
|
3478
|
-
if (
|
|
3479
|
-
content =
|
|
3550
|
+
if (fs14.existsSync(gitignorePath)) {
|
|
3551
|
+
content = fs14.readFileSync(gitignorePath, "utf-8");
|
|
3480
3552
|
}
|
|
3481
3553
|
const lines = content.split("\n").map((line) => line.trim());
|
|
3482
3554
|
const newEntries = [];
|
|
@@ -3501,7 +3573,7 @@ function updateGitignore(workspacePath, storageMode, tools) {
|
|
|
3501
3573
|
newContent += "\n# rrce-workflow generated folders (uncomment to ignore)\n";
|
|
3502
3574
|
}
|
|
3503
3575
|
newContent += newEntries.map((e) => `# ${e}`).join("\n") + "\n";
|
|
3504
|
-
|
|
3576
|
+
fs14.writeFileSync(gitignorePath, newContent);
|
|
3505
3577
|
return true;
|
|
3506
3578
|
} catch {
|
|
3507
3579
|
return false;
|
|
@@ -3522,7 +3594,7 @@ var init_setup_flow = __esm({
|
|
|
3522
3594
|
// src/commands/wizard/link-flow.ts
|
|
3523
3595
|
import { multiselect as multiselect4, spinner as spinner4, note as note8, outro as outro3, cancel as cancel3, isCancel as isCancel7, confirm as confirm5 } from "@clack/prompts";
|
|
3524
3596
|
import pc9 from "picocolors";
|
|
3525
|
-
import * as
|
|
3597
|
+
import * as fs15 from "fs";
|
|
3526
3598
|
async function runLinkProjectsFlow(workspacePath, workspaceName) {
|
|
3527
3599
|
const projects = scanForProjects({
|
|
3528
3600
|
excludeWorkspace: workspaceName,
|
|
@@ -3560,7 +3632,7 @@ async function runLinkProjectsFlow(workspacePath, workspaceName) {
|
|
|
3560
3632
|
const s = spinner4();
|
|
3561
3633
|
s.start("Linking projects");
|
|
3562
3634
|
const configFilePath = getConfigPath(workspacePath);
|
|
3563
|
-
let configContent =
|
|
3635
|
+
let configContent = fs15.readFileSync(configFilePath, "utf-8");
|
|
3564
3636
|
if (configContent.includes("linked_projects:")) {
|
|
3565
3637
|
const lines = configContent.split("\n");
|
|
3566
3638
|
const linkedIndex = lines.findIndex((l) => l.trim() === "linked_projects:");
|
|
@@ -3587,7 +3659,7 @@ linked_projects:
|
|
|
3587
3659
|
`;
|
|
3588
3660
|
});
|
|
3589
3661
|
}
|
|
3590
|
-
|
|
3662
|
+
fs15.writeFileSync(configFilePath, configContent);
|
|
3591
3663
|
generateVSCodeWorkspace(workspacePath, workspaceName, selectedProjects, customGlobalPath);
|
|
3592
3664
|
s.stop("Projects linked");
|
|
3593
3665
|
const workspaceFile = `${workspaceName}.code-workspace`;
|
|
@@ -3629,15 +3701,15 @@ var init_link_flow = __esm({
|
|
|
3629
3701
|
// src/commands/wizard/sync-flow.ts
|
|
3630
3702
|
import { confirm as confirm6, spinner as spinner5, note as note9, outro as outro4, cancel as cancel4, isCancel as isCancel8 } from "@clack/prompts";
|
|
3631
3703
|
import pc10 from "picocolors";
|
|
3632
|
-
import * as
|
|
3633
|
-
import * as
|
|
3704
|
+
import * as fs16 from "fs";
|
|
3705
|
+
import * as path15 from "path";
|
|
3634
3706
|
async function runSyncToGlobalFlow(workspacePath, workspaceName) {
|
|
3635
3707
|
const localPath = getLocalWorkspacePath(workspacePath);
|
|
3636
3708
|
const customGlobalPath = getEffectiveRRCEHome(workspacePath);
|
|
3637
|
-
const globalPath =
|
|
3709
|
+
const globalPath = path15.join(customGlobalPath, "workspaces", workspaceName);
|
|
3638
3710
|
const subdirs = ["knowledge", "prompts", "templates", "tasks", "refs"];
|
|
3639
3711
|
const existingDirs = subdirs.filter(
|
|
3640
|
-
(dir) =>
|
|
3712
|
+
(dir) => fs16.existsSync(path15.join(localPath, dir))
|
|
3641
3713
|
);
|
|
3642
3714
|
if (existingDirs.length === 0) {
|
|
3643
3715
|
outro4(pc10.yellow("No data found in workspace storage to sync."));
|
|
@@ -3663,8 +3735,8 @@ Destination: ${pc10.cyan(globalPath)}`,
|
|
|
3663
3735
|
try {
|
|
3664
3736
|
ensureDir(globalPath);
|
|
3665
3737
|
for (const dir of existingDirs) {
|
|
3666
|
-
const srcDir =
|
|
3667
|
-
const destDir =
|
|
3738
|
+
const srcDir = path15.join(localPath, dir);
|
|
3739
|
+
const destDir = path15.join(globalPath, dir);
|
|
3668
3740
|
ensureDir(destDir);
|
|
3669
3741
|
copyDirRecursive(srcDir, destDir);
|
|
3670
3742
|
}
|
|
@@ -3696,8 +3768,8 @@ var init_sync_flow = __esm({
|
|
|
3696
3768
|
// src/commands/wizard/update-flow.ts
|
|
3697
3769
|
import { confirm as confirm7, spinner as spinner6, note as note10, outro as outro5, cancel as cancel5, isCancel as isCancel9 } from "@clack/prompts";
|
|
3698
3770
|
import pc11 from "picocolors";
|
|
3699
|
-
import * as
|
|
3700
|
-
import * as
|
|
3771
|
+
import * as fs17 from "fs";
|
|
3772
|
+
import * as path16 from "path";
|
|
3701
3773
|
async function runUpdateFlow(workspacePath, workspaceName, currentStorageMode) {
|
|
3702
3774
|
const s = spinner6();
|
|
3703
3775
|
s.start("Checking for updates");
|
|
@@ -3727,10 +3799,10 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
3727
3799
|
}
|
|
3728
3800
|
s.start("Updating from package");
|
|
3729
3801
|
for (const dataPath of dataPaths) {
|
|
3730
|
-
copyDirToAllStoragePaths(
|
|
3802
|
+
copyDirToAllStoragePaths(path16.join(agentCoreDir, "templates"), "templates", [dataPath]);
|
|
3731
3803
|
}
|
|
3732
3804
|
const configFilePath = getConfigPath(workspacePath);
|
|
3733
|
-
const configContent =
|
|
3805
|
+
const configContent = fs17.readFileSync(configFilePath, "utf-8");
|
|
3734
3806
|
if (configContent.includes("copilot: true")) {
|
|
3735
3807
|
const copilotPath = getAgentPromptPath(workspacePath, "copilot");
|
|
3736
3808
|
ensureDir(copilotPath);
|
|
@@ -3758,8 +3830,8 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
3758
3830
|
}
|
|
3759
3831
|
}
|
|
3760
3832
|
function resolveAllDataPathsWithCustomGlobal(mode, workspaceName, workspaceRoot, customGlobalPath) {
|
|
3761
|
-
const globalPath =
|
|
3762
|
-
const workspacePath =
|
|
3833
|
+
const globalPath = path16.join(customGlobalPath, "workspaces", workspaceName);
|
|
3834
|
+
const workspacePath = path16.join(workspaceRoot, ".rrce-workflow");
|
|
3763
3835
|
switch (mode) {
|
|
3764
3836
|
case "global":
|
|
3765
3837
|
return [globalPath];
|
|
@@ -3785,7 +3857,7 @@ __export(wizard_exports, {
|
|
|
3785
3857
|
});
|
|
3786
3858
|
import { intro as intro2, select as select3, spinner as spinner7, note as note11, outro as outro6, isCancel as isCancel10 } from "@clack/prompts";
|
|
3787
3859
|
import pc12 from "picocolors";
|
|
3788
|
-
import * as
|
|
3860
|
+
import * as fs18 from "fs";
|
|
3789
3861
|
async function runWizard() {
|
|
3790
3862
|
intro2(pc12.cyan(pc12.inverse(" RRCE-Workflow Setup ")));
|
|
3791
3863
|
const s = spinner7();
|
|
@@ -3805,18 +3877,18 @@ Workspace: ${pc12.bold(workspaceName)}`,
|
|
|
3805
3877
|
workspacePath
|
|
3806
3878
|
});
|
|
3807
3879
|
const configFilePath = getConfigPath(workspacePath);
|
|
3808
|
-
const isAlreadyConfigured =
|
|
3880
|
+
const isAlreadyConfigured = fs18.existsSync(configFilePath);
|
|
3809
3881
|
let currentStorageMode = null;
|
|
3810
3882
|
if (isAlreadyConfigured) {
|
|
3811
3883
|
try {
|
|
3812
|
-
const configContent =
|
|
3884
|
+
const configContent = fs18.readFileSync(configFilePath, "utf-8");
|
|
3813
3885
|
const modeMatch = configContent.match(/mode:\s*(global|workspace)/);
|
|
3814
3886
|
currentStorageMode = modeMatch?.[1] ?? null;
|
|
3815
3887
|
} catch {
|
|
3816
3888
|
}
|
|
3817
3889
|
}
|
|
3818
3890
|
const localDataPath = getLocalWorkspacePath(workspacePath);
|
|
3819
|
-
const hasLocalData =
|
|
3891
|
+
const hasLocalData = fs18.existsSync(localDataPath);
|
|
3820
3892
|
if (isAlreadyConfigured) {
|
|
3821
3893
|
const menuOptions = [];
|
|
3822
3894
|
menuOptions.push({
|
|
@@ -3891,9 +3963,9 @@ init_wizard();
|
|
|
3891
3963
|
init_prompts();
|
|
3892
3964
|
import { intro as intro3, select as select4, note as note12, cancel as cancel7, isCancel as isCancel11, outro as outro7 } from "@clack/prompts";
|
|
3893
3965
|
import pc13 from "picocolors";
|
|
3894
|
-
import * as
|
|
3966
|
+
import * as path17 from "path";
|
|
3895
3967
|
async function runSelector() {
|
|
3896
|
-
const workspaceName =
|
|
3968
|
+
const workspaceName = path17.basename(process.cwd());
|
|
3897
3969
|
intro3(pc13.cyan(pc13.inverse(` RRCE-Workflow | ${workspaceName} `)));
|
|
3898
3970
|
const prompts = loadPromptsFromDir(getAgentCorePromptsDir());
|
|
3899
3971
|
if (prompts.length === 0) {
|