rrce-workflow 0.2.89 → 0.2.91

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 CHANGED
@@ -14,22 +14,6 @@ var __export = (target, all) => {
14
14
  __defProp(target, name, { get: all[name], enumerable: true });
15
15
  };
16
16
 
17
- // src/lib/git.ts
18
- import { execSync } from "child_process";
19
- function getGitUser() {
20
- try {
21
- const result = execSync("git config user.name", { encoding: "utf-8" });
22
- return result.trim() || null;
23
- } catch {
24
- return null;
25
- }
26
- }
27
- var init_git = __esm({
28
- "src/lib/git.ts"() {
29
- "use strict";
30
- }
31
- });
32
-
33
17
  // src/lib/preferences.ts
34
18
  import * as fs from "fs";
35
19
  import * as path from "path";
@@ -149,6 +133,17 @@ function getConfigPath(workspaceRoot) {
149
133
  function getWorkspaceName(workspaceRoot) {
150
134
  return path2.basename(workspaceRoot);
151
135
  }
136
+ function resolveDataPath(mode, workspaceName, workspaceRoot) {
137
+ const effectiveHome = getEffectiveGlobalPath();
138
+ switch (mode) {
139
+ case "global":
140
+ return path2.join(effectiveHome, "workspaces", workspaceName);
141
+ case "workspace":
142
+ return path2.join(workspaceRoot, ".rrce-workflow");
143
+ default:
144
+ return path2.join(effectiveHome, "workspaces", workspaceName);
145
+ }
146
+ }
152
147
  function getRRCEHome() {
153
148
  return RRCE_HOME;
154
149
  }
@@ -981,118 +976,6 @@ function installToOpenCode() {
981
976
  return false;
982
977
  }
983
978
  }
984
- function uninstallFromOpenCode() {
985
- if (!fs5.existsSync(OPENCODE_CONFIG)) {
986
- console.error("OpenCode config not found");
987
- return false;
988
- }
989
- try {
990
- const config = JSON.parse(fs5.readFileSync(OPENCODE_CONFIG, "utf-8"));
991
- if (!config.mcp?.["rrce"]) {
992
- console.warn("RRCE not found in OpenCode config");
993
- return false;
994
- }
995
- delete config.mcp["rrce"];
996
- fs5.writeFileSync(OPENCODE_CONFIG, JSON.stringify(config, null, 2) + "\n");
997
- return true;
998
- } catch (error) {
999
- console.error("Failed to uninstall from OpenCode:", error instanceof Error ? error.message : String(error));
1000
- return false;
1001
- }
1002
- }
1003
- function uninstallFromAntigravity() {
1004
- if (!fs5.existsSync(ANTIGRAVITY_CONFIG)) {
1005
- console.error("Antigravity config not found");
1006
- return false;
1007
- }
1008
- try {
1009
- const config = JSON.parse(fs5.readFileSync(ANTIGRAVITY_CONFIG, "utf-8"));
1010
- if (!config.mcpServers?.["rrce"]) {
1011
- console.warn("RRCE not found in Antigravity config");
1012
- return false;
1013
- }
1014
- delete config.mcpServers["rrce"];
1015
- fs5.writeFileSync(ANTIGRAVITY_CONFIG, JSON.stringify(config, null, 2) + "\n");
1016
- return true;
1017
- } catch (error) {
1018
- console.error("Failed to uninstall from Antigravity:", error instanceof Error ? error.message : String(error));
1019
- return false;
1020
- }
1021
- }
1022
- function uninstallFromClaude() {
1023
- if (!fs5.existsSync(CLAUDE_CONFIG)) {
1024
- console.error("Claude Desktop config not found");
1025
- return false;
1026
- }
1027
- try {
1028
- const config = JSON.parse(fs5.readFileSync(CLAUDE_CONFIG, "utf-8"));
1029
- if (!config.mcpServers?.["rrce"]) {
1030
- console.warn("RRCE not found in Claude Desktop config");
1031
- return false;
1032
- }
1033
- delete config.mcpServers["rrce"];
1034
- fs5.writeFileSync(CLAUDE_CONFIG, JSON.stringify(config, null, 2) + "\n");
1035
- return true;
1036
- } catch (error) {
1037
- console.error("Failed to uninstall from Claude Desktop:", error instanceof Error ? error.message : String(error));
1038
- return false;
1039
- }
1040
- }
1041
- function uninstallFromVSCodeGlobal() {
1042
- if (!fs5.existsSync(VSCODE_GLOBAL_CONFIG)) {
1043
- console.error("VSCode global config not found");
1044
- return false;
1045
- }
1046
- try {
1047
- const settings = JSON.parse(fs5.readFileSync(VSCODE_GLOBAL_CONFIG, "utf-8"));
1048
- if (!settings["mcp.servers"]?.["rrce"]) {
1049
- console.warn("RRCE not found in VSCode global settings");
1050
- return false;
1051
- }
1052
- delete settings["mcp.servers"]["rrce"];
1053
- fs5.writeFileSync(VSCODE_GLOBAL_CONFIG, JSON.stringify(settings, null, 2) + "\n");
1054
- return true;
1055
- } catch (error) {
1056
- console.error("Failed to uninstall from VSCode (Global):", error instanceof Error ? error.message : String(error));
1057
- return false;
1058
- }
1059
- }
1060
- function uninstallFromVSCodeWorkspace(workspacePath) {
1061
- const configPath = path6.join(workspacePath, ".vscode", "mcp.json");
1062
- if (!fs5.existsSync(configPath)) {
1063
- console.error("VSCode workspace config not found");
1064
- return false;
1065
- }
1066
- try {
1067
- const config = JSON.parse(fs5.readFileSync(configPath, "utf-8"));
1068
- if (!config.servers?.["rrce"]) {
1069
- console.warn("RRCE not found in VSCode workspace config");
1070
- return false;
1071
- }
1072
- delete config.servers["rrce"];
1073
- fs5.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
1074
- return true;
1075
- } catch (error) {
1076
- console.error("Failed to uninstall from VSCode (Workspace):", error instanceof Error ? error.message : String(error));
1077
- return false;
1078
- }
1079
- }
1080
- function uninstallFromConfig(target, workspacePath) {
1081
- switch (target) {
1082
- case "antigravity":
1083
- return uninstallFromAntigravity();
1084
- case "claude":
1085
- return uninstallFromClaude();
1086
- case "vscode-global":
1087
- return uninstallFromVSCodeGlobal();
1088
- case "vscode-workspace":
1089
- return workspacePath ? uninstallFromVSCodeWorkspace(workspacePath) : false;
1090
- case "opencode":
1091
- return uninstallFromOpenCode();
1092
- default:
1093
- return false;
1094
- }
1095
- }
1096
979
  function getTargetLabel(target) {
1097
980
  switch (target) {
1098
981
  case "antigravity":
@@ -1134,122 +1017,6 @@ var init_install = __esm({
1134
1017
  }
1135
1018
  });
1136
1019
 
1137
- // src/commands/wizard/setup-prompts.ts
1138
- import { select as select2, multiselect, confirm, isCancel as isCancel2, cancel } from "@clack/prompts";
1139
- import pc3 from "picocolors";
1140
- async function promptStorageMode() {
1141
- const result = await select2({
1142
- message: "Where should workflow data be stored?",
1143
- options: [
1144
- { value: "global", label: "Global (~/.rrce-workflow/)", hint: "Cross-project access, clean workspace" },
1145
- { value: "workspace", label: "Workspace (.rrce-workflow/)", hint: "Self-contained, version with repo" }
1146
- ],
1147
- initialValue: "global"
1148
- });
1149
- if (isCancel2(result)) {
1150
- cancel("Setup cancelled.");
1151
- process.exit(0);
1152
- }
1153
- return result;
1154
- }
1155
- async function promptTools() {
1156
- const options = [];
1157
- if (isOpenCodeInstalled()) {
1158
- options.push({ value: "opencode", label: "OpenCode" });
1159
- }
1160
- if (isVSCodeInstalled()) {
1161
- options.push({ value: "copilot", label: "GitHub Copilot", hint: "VSCode" });
1162
- }
1163
- if (isAntigravityInstalled()) {
1164
- options.push({ value: "antigravity", label: "Antigravity IDE" });
1165
- }
1166
- if (options.length === 0) {
1167
- options.push({ value: "none", label: "No supported IDEs detected", hint: "Skip" });
1168
- }
1169
- const result = await multiselect({
1170
- message: "Which AI tools do you use?",
1171
- options,
1172
- required: false
1173
- });
1174
- if (isCancel2(result)) {
1175
- cancel("Setup cancelled.");
1176
- process.exit(0);
1177
- }
1178
- return result.filter((t) => t !== "none");
1179
- }
1180
- async function promptMCPExposure() {
1181
- const result = await confirm({
1182
- message: "Expose this project to MCP (AI Agent) server?",
1183
- initialValue: true
1184
- });
1185
- if (isCancel2(result)) {
1186
- cancel("Setup cancelled.");
1187
- process.exit(0);
1188
- }
1189
- return result;
1190
- }
1191
- async function promptLinkedProjects(existingProjects) {
1192
- if (existingProjects.length === 0) {
1193
- return [];
1194
- }
1195
- const result = await multiselect({
1196
- message: "Link knowledge from other projects?",
1197
- options: existingProjects.map((project) => ({
1198
- value: `${project.name}:${project.source}`,
1199
- label: `${project.name} ${pc3.dim(`(${project.source})`)}`,
1200
- hint: pc3.dim(
1201
- project.source === "global" ? `~/.rrce-workflow/workspaces/${project.name}` : project.dataPath
1202
- )
1203
- })),
1204
- required: false
1205
- });
1206
- if (isCancel2(result)) {
1207
- cancel("Setup cancelled.");
1208
- process.exit(0);
1209
- }
1210
- return result;
1211
- }
1212
- async function promptGitignore() {
1213
- const result = await confirm({
1214
- message: "Add generated folders to .gitignore?",
1215
- initialValue: true
1216
- });
1217
- if (isCancel2(result)) {
1218
- cancel("Setup cancelled.");
1219
- process.exit(0);
1220
- }
1221
- return result;
1222
- }
1223
- async function promptRAG() {
1224
- const result = await confirm({
1225
- message: `Enable Semantic Search (Local Mini RAG)?
1226
- ${pc3.yellow("\u26A0 First use will download a ~100MB model")}`,
1227
- initialValue: true
1228
- });
1229
- if (isCancel2(result)) {
1230
- cancel("Setup cancelled.");
1231
- process.exit(0);
1232
- }
1233
- return result;
1234
- }
1235
- async function promptConfirmation() {
1236
- const result = await confirm({
1237
- message: "Create configuration?",
1238
- initialValue: true
1239
- });
1240
- if (isCancel2(result)) {
1241
- cancel("Setup cancelled.");
1242
- process.exit(0);
1243
- }
1244
- return result;
1245
- }
1246
- var init_setup_prompts = __esm({
1247
- "src/commands/wizard/setup-prompts.ts"() {
1248
- "use strict";
1249
- init_install();
1250
- }
1251
- });
1252
-
1253
1020
  // src/types/prompt.ts
1254
1021
  import { z } from "zod";
1255
1022
  var PromptArgSchema, AutoIdentitySchema, PromptFrontmatterSchema;
@@ -1337,195 +1104,52 @@ var init_prompts = __esm({
1337
1104
  }
1338
1105
  });
1339
1106
 
1340
- // src/commands/wizard/utils.ts
1341
- import * as fs7 from "fs";
1342
- import * as path8 from "path";
1343
- import "yaml";
1344
- function copyPromptsToDir(prompts, targetDir, extension) {
1345
- for (const prompt of prompts) {
1346
- const baseName = path8.basename(prompt.filePath, ".md");
1347
- const targetName = baseName + extension;
1348
- const targetPath = path8.join(targetDir, targetName);
1349
- const content = fs7.readFileSync(prompt.filePath, "utf-8");
1350
- fs7.writeFileSync(targetPath, content);
1107
+ // src/mcp/types.ts
1108
+ var DEFAULT_MCP_CONFIG, DEFAULT_PERMISSIONS;
1109
+ var init_types = __esm({
1110
+ "src/mcp/types.ts"() {
1111
+ "use strict";
1112
+ DEFAULT_MCP_CONFIG = {
1113
+ server: {
1114
+ port: 3e3,
1115
+ autoStart: false
1116
+ },
1117
+ projects: [],
1118
+ defaults: {
1119
+ includeNew: false,
1120
+ permissions: {
1121
+ knowledge: true,
1122
+ tasks: true,
1123
+ refs: true
1124
+ }
1125
+ }
1126
+ };
1127
+ DEFAULT_PERMISSIONS = {
1128
+ knowledge: true,
1129
+ tasks: true,
1130
+ refs: true
1131
+ };
1351
1132
  }
1133
+ });
1134
+
1135
+ // src/mcp/config-utils.ts
1136
+ import * as path10 from "path";
1137
+ function normalizeProjectPath(projectPath) {
1138
+ let normalized = projectPath;
1139
+ while (normalized.length > 1 && (normalized.endsWith("/") || normalized.endsWith("\\"))) {
1140
+ normalized = normalized.slice(0, -1);
1141
+ }
1142
+ if (normalized.endsWith(".rrce-workflow")) {
1143
+ return path10.dirname(normalized);
1144
+ }
1145
+ return normalized;
1352
1146
  }
1353
- function convertToOpenCodeAgent(prompt, useFileReference = false, promptFilePath) {
1354
- const { frontmatter, content } = prompt;
1355
- const tools = {};
1356
- const hostTools = ["read", "write", "edit", "bash", "grep", "glob", "webfetch", "terminalLastCommand"];
1357
- if (frontmatter.tools) {
1358
- for (const tool of frontmatter.tools) {
1359
- if (hostTools.includes(tool)) {
1360
- tools[tool] = true;
1361
- } else {
1362
- tools[`rrce_${tool}`] = true;
1363
- }
1364
- }
1365
- }
1366
- tools["webfetch"] = true;
1367
- return {
1368
- description: frontmatter.description,
1369
- mode: "primary",
1370
- prompt: useFileReference && promptFilePath ? `{file:${promptFilePath}}` : content,
1371
- tools
1372
- };
1373
- }
1374
- function copyDirRecursive(src, dest) {
1375
- const entries = fs7.readdirSync(src, { withFileTypes: true });
1376
- for (const entry of entries) {
1377
- const srcPath = path8.join(src, entry.name);
1378
- const destPath = path8.join(dest, entry.name);
1379
- if (entry.isDirectory()) {
1380
- ensureDir(destPath);
1381
- copyDirRecursive(srcPath, destPath);
1382
- } else {
1383
- fs7.copyFileSync(srcPath, destPath);
1384
- }
1385
- }
1386
- }
1387
- var init_utils = __esm({
1388
- "src/commands/wizard/utils.ts"() {
1389
- "use strict";
1390
- init_paths();
1391
- }
1392
- });
1393
-
1394
- // src/commands/wizard/vscode.ts
1395
- import * as fs8 from "fs";
1396
- import * as path9 from "path";
1397
- function generateVSCodeWorkspace(workspacePath, workspaceName, linkedProjects, customGlobalPath) {
1398
- const workspaceFilePath = path9.join(workspacePath, `${workspaceName}.code-workspace`);
1399
- let workspace;
1400
- if (fs8.existsSync(workspaceFilePath)) {
1401
- try {
1402
- const content = fs8.readFileSync(workspaceFilePath, "utf-8");
1403
- workspace = JSON.parse(content);
1404
- } catch {
1405
- workspace = { folders: [], settings: {} };
1406
- }
1407
- } else {
1408
- workspace = { folders: [], settings: {} };
1409
- }
1410
- if (!workspace.settings) {
1411
- workspace.settings = {};
1412
- }
1413
- workspace.folders = workspace.folders.filter(
1414
- (f) => f.path === "." || !f.name?.startsWith("\u{1F4C1}") && !f.name?.startsWith("\u{1F4DA}") && !f.name?.startsWith("\u{1F4CE}") && !f.name?.startsWith("\u{1F4CB}")
1415
- );
1416
- const mainFolderIndex = workspace.folders.findIndex((f) => f.path === ".");
1417
- if (mainFolderIndex === -1) {
1418
- workspace.folders.unshift({
1419
- path: ".",
1420
- name: `\u{1F3E0} ${workspaceName} (workspace)`
1421
- });
1422
- } else {
1423
- workspace.folders[mainFolderIndex] = {
1424
- path: ".",
1425
- name: `\u{1F3E0} ${workspaceName} (workspace)`
1426
- };
1427
- }
1428
- const referenceFolderPaths = [];
1429
- const isDetectedProjects = linkedProjects.length > 0 && typeof linkedProjects[0] === "object";
1430
- if (isDetectedProjects) {
1431
- const projects = linkedProjects;
1432
- for (const project of projects) {
1433
- const sourceLabel = project.source === "global" ? "global" : "local";
1434
- const folderPath = project.dataPath;
1435
- if (fs8.existsSync(folderPath)) {
1436
- referenceFolderPaths.push(folderPath);
1437
- workspace.folders.push({
1438
- path: folderPath,
1439
- name: `\u{1F4C1} ${project.name} [${sourceLabel}]`
1440
- });
1441
- }
1442
- }
1443
- } else {
1444
- const projectNames = linkedProjects;
1445
- const rrceHome = customGlobalPath || getRRCEHome();
1446
- for (const projectName of projectNames) {
1447
- const folderPath = path9.join(rrceHome, "workspaces", projectName);
1448
- if (fs8.existsSync(folderPath)) {
1449
- referenceFolderPaths.push(folderPath);
1450
- workspace.folders.push({
1451
- path: folderPath,
1452
- name: `\u{1F4C1} ${projectName} [global]`
1453
- });
1454
- }
1455
- }
1456
- }
1457
- if (referenceFolderPaths.length > 0) {
1458
- const readonlyPatterns = {};
1459
- for (const folderPath of referenceFolderPaths) {
1460
- readonlyPatterns[`${folderPath}/**`] = true;
1461
- }
1462
- const existingReadonly = workspace.settings["files.readonlyInclude"] || {};
1463
- const cleanedReadonly = {};
1464
- for (const [pattern, value] of Object.entries(existingReadonly)) {
1465
- if (!pattern.includes(".rrce-workflow") && !pattern.includes("rrce-workflow/workspaces")) {
1466
- cleanedReadonly[pattern] = value;
1467
- }
1468
- }
1469
- workspace.settings["files.readonlyInclude"] = {
1470
- ...cleanedReadonly,
1471
- ...readonlyPatterns
1472
- };
1473
- }
1474
- fs8.writeFileSync(workspaceFilePath, JSON.stringify(workspace, null, 2));
1475
- }
1476
- var init_vscode = __esm({
1477
- "src/commands/wizard/vscode.ts"() {
1478
- "use strict";
1479
- init_paths();
1480
- init_detection();
1481
- }
1482
- });
1483
-
1484
- // src/mcp/types.ts
1485
- var DEFAULT_MCP_CONFIG, DEFAULT_PERMISSIONS;
1486
- var init_types = __esm({
1487
- "src/mcp/types.ts"() {
1488
- "use strict";
1489
- DEFAULT_MCP_CONFIG = {
1490
- server: {
1491
- port: 3e3,
1492
- autoStart: false
1493
- },
1494
- projects: [],
1495
- defaults: {
1496
- includeNew: false,
1497
- permissions: {
1498
- knowledge: true,
1499
- tasks: true,
1500
- refs: true
1501
- }
1502
- }
1503
- };
1504
- DEFAULT_PERMISSIONS = {
1505
- knowledge: true,
1506
- tasks: true,
1507
- refs: true
1508
- };
1509
- }
1510
- });
1511
-
1512
- // src/mcp/config-utils.ts
1513
- import * as path10 from "path";
1514
- function normalizeProjectPath(projectPath) {
1515
- if (projectPath.endsWith(".rrce-workflow")) {
1516
- return path10.dirname(projectPath);
1517
- }
1518
- if (projectPath.endsWith(".rrce-workflow/")) {
1519
- return path10.dirname(projectPath.slice(0, -1));
1520
- }
1521
- return projectPath;
1522
- }
1523
- function findProjectConfig(config, identifier) {
1524
- const targetPath = identifier.path ? normalizeProjectPath(identifier.path) : void 0;
1525
- return config.projects.find((p) => {
1526
- const configPath = p.path ? normalizeProjectPath(p.path) : void 0;
1527
- if (targetPath && configPath) {
1528
- return configPath === targetPath;
1147
+ function findProjectConfig(config, identifier) {
1148
+ const targetPath = identifier.path ? normalizeProjectPath(identifier.path) : void 0;
1149
+ return config.projects.find((p) => {
1150
+ const configPath = p.path ? normalizeProjectPath(p.path) : void 0;
1151
+ if (targetPath && configPath) {
1152
+ return configPath === targetPath;
1529
1153
  }
1530
1154
  if (!targetPath && !configPath) {
1531
1155
  return p.name === identifier.name;
@@ -1738,231 +1362,26 @@ var init_config = __esm({
1738
1362
  }
1739
1363
  });
1740
1364
 
1741
- // src/commands/wizard/setup-actions.ts
1742
- import * as fs10 from "fs";
1743
- import * as path12 from "path";
1744
- import pc4 from "picocolors";
1745
- import { note as note2 } from "@clack/prompts";
1746
- import { stringify as stringify2 } from "yaml";
1747
- function createDirectoryStructure(dataPaths) {
1748
- for (const dataPath of dataPaths) {
1749
- ensureDir(dataPath);
1750
- ensureDir(path12.join(dataPath, "knowledge"));
1751
- ensureDir(path12.join(dataPath, "refs"));
1752
- ensureDir(path12.join(dataPath, "tasks"));
1753
- ensureDir(path12.join(dataPath, "templates"));
1754
- }
1755
- }
1756
- async function installAgentPrompts(config, workspacePath, dataPaths) {
1757
- const agentCoreDir = getAgentCoreDir();
1758
- syncMetadataToAll(agentCoreDir, dataPaths);
1759
- copyDirToAllStoragePaths(path12.join(agentCoreDir, "templates"), "templates", dataPaths);
1760
- copyDirToAllStoragePaths(path12.join(agentCoreDir, "prompts"), "prompts", dataPaths);
1761
- copyDirToAllStoragePaths(path12.join(agentCoreDir, "docs"), "docs", dataPaths);
1762
- const rrceHome = config.globalPath || getDefaultRRCEHome2();
1763
- ensureDir(path12.join(rrceHome, "templates"));
1764
- ensureDir(path12.join(rrceHome, "docs"));
1765
- copyDirRecursive(path12.join(agentCoreDir, "templates"), path12.join(rrceHome, "templates"));
1766
- copyDirRecursive(path12.join(agentCoreDir, "docs"), path12.join(rrceHome, "docs"));
1767
- const needsIDEPrompts = config.storageMode === "workspace" && (config.tools.includes("copilot") || config.tools.includes("antigravity")) || config.tools.includes("opencode");
1768
- if (needsIDEPrompts) {
1769
- const prompts = loadPromptsFromDir(getAgentCorePromptsDir());
1770
- if (config.storageMode === "workspace") {
1771
- if (config.tools.includes("copilot")) {
1772
- const copilotPath = getAgentPromptPath(workspacePath, "copilot");
1773
- ensureDir(copilotPath);
1774
- copyPromptsToDir(prompts, copilotPath, ".agent.md");
1775
- }
1776
- if (config.tools.includes("antigravity")) {
1777
- const antigravityPath = getAgentPromptPath(workspacePath, "antigravity");
1778
- ensureDir(antigravityPath);
1779
- copyPromptsToDir(prompts, antigravityPath, ".md");
1780
- }
1365
+ // src/commands/wizard/gitignore.ts
1366
+ var gitignore_exports = {};
1367
+ __export(gitignore_exports, {
1368
+ updateGitignore: () => updateGitignore
1369
+ });
1370
+ import * as fs11 from "fs";
1371
+ import * as path13 from "path";
1372
+ function updateGitignore(workspacePath, storageMode, tools) {
1373
+ const gitignorePath = path13.join(workspacePath, ".gitignore");
1374
+ const entries = [];
1375
+ if (storageMode === "workspace") {
1376
+ entries.push(".rrce-workflow/");
1377
+ if (tools.includes("opencode")) {
1378
+ entries.push(".opencode/");
1781
1379
  }
1782
- if (config.tools.includes("opencode")) {
1783
- const primaryDataPath = dataPaths[0];
1784
- if (primaryDataPath) {
1785
- if (config.storageMode === "global") {
1786
- try {
1787
- const promptsDir = path12.join(path12.dirname(OPENCODE_CONFIG), "prompts");
1788
- ensureDir(promptsDir);
1789
- let opencodeConfig = { $schema: "https://opencode.ai/config.json" };
1790
- if (fs10.existsSync(OPENCODE_CONFIG)) {
1791
- opencodeConfig = JSON.parse(fs10.readFileSync(OPENCODE_CONFIG, "utf-8"));
1792
- }
1793
- if (!opencodeConfig.agent) opencodeConfig.agent = {};
1794
- for (const prompt of prompts) {
1795
- const baseName = path12.basename(prompt.filePath, ".md");
1796
- const promptFileName = `rrce-${baseName}.md`;
1797
- const promptFilePath = path12.join(promptsDir, promptFileName);
1798
- fs10.writeFileSync(promptFilePath, prompt.content);
1799
- const agentConfig = convertToOpenCodeAgent(prompt, true, `./prompts/${promptFileName}`);
1800
- opencodeConfig.agent[baseName] = agentConfig;
1801
- }
1802
- fs10.writeFileSync(OPENCODE_CONFIG, JSON.stringify(opencodeConfig, null, 2) + "\n");
1803
- } catch (e) {
1804
- console.error("Failed to update global OpenCode config with agents:", e);
1805
- }
1806
- } else {
1807
- const opencodeBaseDir = path12.join(primaryDataPath, ".opencode", "agent");
1808
- ensureDir(opencodeBaseDir);
1809
- for (const prompt of prompts) {
1810
- const baseName = path12.basename(prompt.filePath, ".md");
1811
- const agentConfig = convertToOpenCodeAgent(prompt);
1812
- const content = `---
1813
- ${stringify2({
1814
- description: agentConfig.description,
1815
- mode: agentConfig.mode,
1816
- tools: agentConfig.tools
1817
- })}---
1818
- ${agentConfig.prompt}`;
1819
- fs10.writeFileSync(path12.join(opencodeBaseDir, `${baseName}.md`), content);
1820
- }
1821
- }
1822
- }
1823
- }
1824
- }
1825
- }
1826
- function createWorkspaceConfig(config, workspacePath, workspaceName) {
1827
- let configPath;
1828
- if (config.storageMode === "global") {
1829
- const rrceHome = config.globalPath || getDefaultRRCEHome2();
1830
- configPath = path12.join(rrceHome, "workspaces", workspaceName, "config.yaml");
1831
- } else {
1832
- configPath = path12.join(workspacePath, ".rrce-workflow", "config.yaml");
1833
- }
1834
- ensureDir(path12.dirname(configPath));
1835
- let content = `# RRCE-Workflow Configuration
1836
- version: 1
1837
-
1838
- storage:
1839
- mode: ${config.storageMode}`;
1840
- if (config.globalPath && config.globalPath !== getDefaultRRCEHome2()) {
1841
- content += `
1842
- globalPath: "${config.globalPath}"`;
1843
- }
1844
- content += `
1845
-
1846
- project:
1847
- name: "${workspaceName}"
1848
- sourcePath: "${workspacePath}"
1849
-
1850
- tools:
1851
- opencode: ${config.tools.includes("opencode")}
1852
- copilot: ${config.tools.includes("copilot")}
1853
- antigravity: ${config.tools.includes("antigravity")}
1854
- `;
1855
- if (config.enableRAG) {
1856
- content += `
1857
- semantic_search:
1858
- enabled: true
1859
- `;
1860
- }
1861
- if (config.linkedProjects.length > 0) {
1862
- content += `
1863
- linked_projects:
1864
- `;
1865
- config.linkedProjects.forEach((name) => {
1866
- content += ` - ${name}
1867
- `;
1868
- });
1869
- }
1870
- fs10.writeFileSync(configPath, content);
1871
- }
1872
- async function registerWithMCP(config, workspacePath, workspaceName) {
1873
- if (!config.exposeToMCP) return;
1874
- try {
1875
- const { loadMCPConfig: loadMCPConfig3, saveMCPConfig: saveMCPConfig2, setProjectConfig: setProjectConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
1876
- const mcpConfig = loadMCPConfig3();
1877
- setProjectConfig2(
1878
- mcpConfig,
1879
- workspaceName,
1880
- true,
1881
- void 0,
1882
- workspacePath,
1883
- config.enableRAG ? { enabled: true } : void 0
1884
- );
1885
- saveMCPConfig2(mcpConfig);
1886
- } catch (e) {
1887
- note2(
1888
- `${pc4.yellow("\u26A0")} Could not register project with MCP
1889
- Error: ${e instanceof Error ? e.message : String(e)}
1890
-
1891
- You can configure MCP later: ${pc4.cyan("npx rrce-workflow mcp")}`,
1892
- "MCP Registration Warning"
1893
- );
1894
- }
1895
- }
1896
- function getDataPaths(mode, workspaceName, workspaceRoot, customGlobalPath) {
1897
- const globalPath = path12.join(customGlobalPath || getDefaultRRCEHome2(), "workspaces", workspaceName);
1898
- const workspacePath = path12.join(workspaceRoot, ".rrce-workflow");
1899
- switch (mode) {
1900
- case "global":
1901
- return [globalPath];
1902
- case "workspace":
1903
- return [workspacePath];
1904
- default:
1905
- return [globalPath];
1906
- }
1907
- }
1908
- function installToSelectedIDEs(tools) {
1909
- const success = [];
1910
- const failed = [];
1911
- const toolToTarget = {
1912
- "opencode": "opencode",
1913
- "antigravity": "antigravity",
1914
- "copilot": "vscode-global"
1915
- };
1916
- for (const tool of tools) {
1917
- const target = toolToTarget[tool];
1918
- if (!target) continue;
1919
- try {
1920
- const result = installToConfig(target);
1921
- const label = getTargetLabel(target);
1922
- if (result) {
1923
- success.push(label);
1924
- } else {
1925
- failed.push(label);
1926
- }
1927
- } catch (error) {
1928
- const label = getTargetLabel(target);
1929
- console.error(`Failed to install to ${label}:`, error);
1930
- failed.push(label);
1931
- }
1932
- }
1933
- return { success, failed };
1934
- }
1935
- var init_setup_actions = __esm({
1936
- "src/commands/wizard/setup-actions.ts"() {
1937
- "use strict";
1938
- init_paths();
1939
- init_prompts();
1940
- init_utils();
1941
- init_vscode();
1942
- init_install();
1943
- }
1944
- });
1945
-
1946
- // src/commands/wizard/gitignore.ts
1947
- var gitignore_exports = {};
1948
- __export(gitignore_exports, {
1949
- updateGitignore: () => updateGitignore
1950
- });
1951
- import * as fs11 from "fs";
1952
- import * as path13 from "path";
1953
- function updateGitignore(workspacePath, storageMode, tools) {
1954
- const gitignorePath = path13.join(workspacePath, ".gitignore");
1955
- const entries = [];
1956
- if (storageMode === "workspace") {
1957
- entries.push(".rrce-workflow/");
1958
- if (tools.includes("opencode")) {
1959
- entries.push(".opencode/");
1960
- }
1961
- if (tools.includes("copilot")) {
1962
- entries.push(".github/agents/");
1963
- }
1964
- if (tools.includes("antigravity")) {
1965
- entries.push(".agent/workflows/");
1380
+ if (tools.includes("copilot")) {
1381
+ entries.push(".github/agents/");
1382
+ }
1383
+ if (tools.includes("antigravity")) {
1384
+ entries.push(".agent/workflows/");
1966
1385
  }
1967
1386
  }
1968
1387
  entries.push("*.code-workspace");
@@ -2307,6 +1726,52 @@ var init_rag = __esm({
2307
1726
  import * as fs14 from "fs";
2308
1727
  import * as path16 from "path";
2309
1728
  import * as crypto from "crypto";
1729
+ function resolveProjectPaths(project, pathInput) {
1730
+ const config = loadMCPConfig();
1731
+ let workspaceRoot = pathInput;
1732
+ let workspaceName = project;
1733
+ if (!workspaceRoot && project) {
1734
+ const projConfig = config.projects.find((p) => p.name === project);
1735
+ if (projConfig?.path) {
1736
+ workspaceRoot = projConfig.path;
1737
+ }
1738
+ }
1739
+ if (!workspaceName && workspaceRoot) {
1740
+ const projConfig = config.projects.find((p) => p.path && normalizeProjectPath(p.path) === normalizeProjectPath(workspaceRoot));
1741
+ workspaceName = projConfig?.name || getWorkspaceName(workspaceRoot);
1742
+ }
1743
+ if (!workspaceName) {
1744
+ workspaceName = "unknown";
1745
+ }
1746
+ let rrceData = "";
1747
+ let mode = "global";
1748
+ let configFilePath = "";
1749
+ if (workspaceRoot) {
1750
+ configFilePath = getConfigPath(workspaceRoot);
1751
+ const rrceHome = getEffectiveGlobalPath();
1752
+ if (configFilePath.startsWith(rrceHome)) {
1753
+ mode = "global";
1754
+ } else {
1755
+ mode = "workspace";
1756
+ if (fs14.existsSync(configFilePath)) {
1757
+ const content = fs14.readFileSync(configFilePath, "utf-8");
1758
+ if (content.includes("mode: global")) mode = "global";
1759
+ if (content.includes("mode: workspace")) mode = "workspace";
1760
+ }
1761
+ }
1762
+ rrceData = resolveDataPath(mode, workspaceName, workspaceRoot);
1763
+ } else {
1764
+ rrceData = resolveDataPath("global", workspaceName, "");
1765
+ }
1766
+ return {
1767
+ RRCE_HOME: getRRCEHome(),
1768
+ RRCE_DATA: rrceData,
1769
+ WORKSPACE_ROOT: workspaceRoot || null,
1770
+ WORKSPACE_NAME: workspaceName,
1771
+ storage_mode: mode,
1772
+ config_path: configFilePath || null
1773
+ };
1774
+ }
2310
1775
  function getExposedProjects() {
2311
1776
  const config = loadMCPConfig();
2312
1777
  const knownProjects = config.projects.filter((p) => !!p.path).map((p) => ({ name: p.name, path: p.path }));
@@ -2729,6 +2194,7 @@ var init_resources = __esm({
2729
2194
  init_detection();
2730
2195
  init_detection_service();
2731
2196
  init_rag();
2197
+ init_paths();
2732
2198
  }
2733
2199
  });
2734
2200
 
@@ -2933,6 +2399,17 @@ import {
2933
2399
  function registerToolHandlers(server) {
2934
2400
  server.setRequestHandler(ListToolsRequestSchema, async () => {
2935
2401
  const tools = [
2402
+ {
2403
+ name: "resolve_path",
2404
+ description: "Resolve configuration paths (RRCE_DATA, etc.) for a project. Helps determine if a project is using global or local storage.",
2405
+ inputSchema: {
2406
+ type: "object",
2407
+ properties: {
2408
+ project: { type: "string", description: "Name of the project" },
2409
+ path: { type: "string", description: "Absolute path to the project root (WORKSPACE_ROOT)" }
2410
+ }
2411
+ }
2412
+ },
2936
2413
  {
2937
2414
  name: "search_knowledge",
2938
2415
  description: "Search across all exposed project knowledge bases",
@@ -3064,6 +2541,11 @@ function registerToolHandlers(server) {
3064
2541
  logger.info(`Calling tool: ${name}`, args);
3065
2542
  try {
3066
2543
  switch (name) {
2544
+ case "resolve_path": {
2545
+ const params = args;
2546
+ const result = resolveProjectPaths(params.project, params.path);
2547
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2548
+ }
3067
2549
  case "search_knowledge": {
3068
2550
  const params = args;
3069
2551
  const results = await searchKnowledge(params.query, params.project);
@@ -3276,12 +2758,6 @@ var init_prompts3 = __esm({
3276
2758
  });
3277
2759
 
3278
2760
  // src/mcp/server.ts
3279
- var server_exports = {};
3280
- __export(server_exports, {
3281
- getMCPServerStatus: () => getMCPServerStatus,
3282
- startMCPServer: () => startMCPServer,
3283
- stopMCPServer: () => stopMCPServer
3284
- });
3285
2761
  import { Server as Server4 } from "@modelcontextprotocol/sdk/server/index.js";
3286
2762
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3287
2763
  async function startMCPServer(options = {}) {
@@ -3435,7 +2911,7 @@ Hidden projects: ${projects.length - exposedCount}`,
3435
2911
  async function handleConfigureGlobalPath() {
3436
2912
  const { resolveGlobalPath: resolveGlobalPath2 } = await Promise.resolve().then(() => (init_tui_utils(), tui_utils_exports));
3437
2913
  const fs22 = await import("fs");
3438
- const path21 = await import("path");
2914
+ const path20 = await import("path");
3439
2915
  note3(
3440
2916
  `MCP Hub requires a ${pc5.bold("global storage path")} to store its configuration
3441
2917
  and coordinate across projects.
@@ -3458,7 +2934,7 @@ locally in each project. MCP needs a central location.`,
3458
2934
  `${pc5.green("\u2713")} Global path configured: ${pc5.cyan(resolvedPath)}
3459
2935
 
3460
2936
  MCP config will be stored at:
3461
- ${path21.join(resolvedPath, "mcp.yaml")}`,
2937
+ ${path20.join(resolvedPath, "mcp.yaml")}`,
3462
2938
  "Configuration Saved"
3463
2939
  );
3464
2940
  return true;
@@ -4336,312 +3812,552 @@ var init_start = __esm({
4336
3812
  }
4337
3813
  });
4338
3814
 
4339
- // src/mcp/commands/status.ts
4340
- import { spinner as spinner2, note as note5 } from "@clack/prompts";
3815
+ // src/mcp/index.ts
3816
+ var mcp_exports = {};
3817
+ __export(mcp_exports, {
3818
+ handleConfigureGlobalPath: () => handleConfigureGlobalPath,
3819
+ handleStartServer: () => handleStartServer,
3820
+ runMCP: () => runMCP
3821
+ });
3822
+ import { intro, outro, confirm as confirm4, note as note5, isCancel as isCancel6 } from "@clack/prompts";
4341
3823
  import pc7 from "picocolors";
4342
- async function handleShowStatus() {
4343
- const s = spinner2();
4344
- s.start("Loading projects...");
4345
- const config = loadMCPConfig();
4346
- const projects = scanForProjects();
3824
+ async function runMCP(subcommand2) {
3825
+ if (subcommand2 === "start" && !process.stdout.isTTY) {
3826
+ await startMCPServer();
3827
+ await new Promise(() => {
3828
+ });
3829
+ return;
3830
+ }
4347
3831
  const workspacePath = detectWorkspaceRoot();
4348
- const installStatus = checkInstallStatus(workspacePath);
4349
- s.stop("Projects loaded");
4350
- if (projects.length === 0) {
4351
- note5('No RRCE projects detected. Run "rrce-workflow" in a project to set it up.', "No Projects");
3832
+ const globalPathCheck = await ensureMCPGlobalPath();
3833
+ if (!globalPathCheck.configured) {
3834
+ intro(pc7.bgCyan(pc7.black(" MCP Setup ")));
3835
+ const configured = await handleConfigureGlobalPath();
3836
+ if (!configured) {
3837
+ outro(pc7.yellow("MCP requires a global storage path. Setup cancelled."));
3838
+ return;
3839
+ }
3840
+ }
3841
+ const installed = isInstalledAnywhere(workspacePath);
3842
+ if (!installed) {
3843
+ intro(pc7.bgCyan(pc7.black(" Welcome to MCP Hub ")));
3844
+ note5(
3845
+ `${pc7.bold("Set up Model Context Protocol")}
3846
+ Allow AI assistants to access your project context.`,
3847
+ "Getting Started"
3848
+ );
3849
+ const shouldInstall = await confirm4({
3850
+ message: "Install MCP server integrations now?",
3851
+ initialValue: true
3852
+ });
3853
+ if (shouldInstall && !isCancel6(shouldInstall)) {
3854
+ await runInstallWizard(workspacePath);
3855
+ const shouldStart = await confirm4({
3856
+ message: "Start the MCP Dashboard?",
3857
+ initialValue: true
3858
+ });
3859
+ if (shouldStart && !isCancel6(shouldStart)) {
3860
+ await handleStartServer();
3861
+ }
3862
+ } else {
3863
+ outro(pc7.dim('Setup skipped. Run "npx rrce-workflow mcp" later to restart.'));
3864
+ }
4352
3865
  return;
4353
3866
  }
4354
- const lines = [
4355
- `${pc7.bold("Installation Status")}`,
4356
- "",
4357
- ` Antigravity: ${installStatus.antigravity ? pc7.green("\u2713 Installed") : pc7.dim("Not installed")}`,
4358
- ` VSCode (Global): ${installStatus.vscodeGlobal ? pc7.green("\u2713 Installed") : pc7.dim("Not installed")}`,
4359
- ` VSCode (Workspace): ${installStatus.vscodeWorkspace ? pc7.green("\u2713 Installed") : pc7.dim("Not installed")}`,
4360
- ` Claude Desktop: ${installStatus.claude ? pc7.green("\u2713 Installed") : pc7.dim("Not installed")}`,
4361
- "",
4362
- `${pc7.bold("Project Status")}`,
4363
- ""
4364
- ];
4365
- for (const project of projects) {
4366
- const projectConfig = config.projects.find((p) => p.name === project.name);
4367
- const isExposed = projectConfig?.expose ?? config.defaults.includeNew;
4368
- const status = isExposed ? pc7.green("\u2713 exposed") : pc7.dim("\u25CB hidden");
4369
- const source = pc7.dim(`(${project.source})`);
4370
- lines.push(` ${status} ${project.name} ${source}`);
4371
- }
4372
- lines.push("");
4373
- lines.push(pc7.dim(`Config: ${getMCPConfigPath()}`));
4374
- const serverStatus = getMCPServerStatus();
4375
- if (serverStatus.running) {
4376
- lines.push(pc7.green(`Server: running on port ${serverStatus.port}`));
4377
- } else {
4378
- lines.push(pc7.dim("Server: not running"));
3867
+ try {
3868
+ await handleStartServer();
3869
+ } catch (err) {
3870
+ console.error(err);
3871
+ outro(pc7.red("Failed to launch MCP Dashboard"));
4379
3872
  }
4380
- note5(lines.join("\n"), "MCP Hub Status");
4381
3873
  }
4382
- var init_status = __esm({
4383
- "src/mcp/commands/status.ts"() {
3874
+ var init_mcp = __esm({
3875
+ "src/mcp/index.ts"() {
4384
3876
  "use strict";
4385
3877
  init_config();
4386
- init_detection();
4387
- init_paths();
4388
3878
  init_server();
4389
3879
  init_install();
3880
+ init_paths();
3881
+ init_start();
3882
+ init_configure();
3883
+ init_install_wizard();
4390
3884
  }
4391
3885
  });
4392
3886
 
4393
- // src/mcp/commands/uninstall-wizard.ts
4394
- import { multiselect as multiselect4, note as note6, isCancel as isCancel6, confirm as confirm4 } from "@clack/prompts";
3887
+ // src/commands/wizard/index.ts
3888
+ import { intro as intro2, select as select5, spinner as spinner7, note as note11, outro as outro7, isCancel as isCancel12 } from "@clack/prompts";
3889
+ import pc13 from "picocolors";
3890
+ import * as fs21 from "fs";
3891
+
3892
+ // src/lib/git.ts
3893
+ import { execSync } from "child_process";
3894
+ function getGitUser() {
3895
+ try {
3896
+ const result = execSync("git config user.name", { encoding: "utf-8" });
3897
+ return result.trim() || null;
3898
+ } catch {
3899
+ return null;
3900
+ }
3901
+ }
3902
+
3903
+ // src/commands/wizard/index.ts
3904
+ init_paths();
3905
+ init_detection_service();
3906
+
3907
+ // src/commands/wizard/setup-flow.ts
3908
+ import { spinner as spinner2, note as note6, outro as outro2, cancel as cancel2, isCancel as isCancel7, confirm as confirm5, select as select3 } from "@clack/prompts";
4395
3909
  import pc8 from "picocolors";
4396
- async function runUninstallWizard(workspacePath) {
4397
- const status = checkInstallStatus(workspacePath);
4398
- const installedOptions = [];
4399
- if (status.opencode) {
4400
- installedOptions.push({
4401
- value: "opencode",
4402
- label: "OpenCode",
4403
- hint: pc8.green("Currently installed")
4404
- });
3910
+ init_detection();
3911
+ init_tui_utils();
3912
+ init_install();
3913
+
3914
+ // src/commands/wizard/setup-prompts.ts
3915
+ init_install();
3916
+ import { select as select2, multiselect, confirm, isCancel as isCancel2, cancel } from "@clack/prompts";
3917
+ import pc3 from "picocolors";
3918
+ async function promptStorageMode() {
3919
+ const result = await select2({
3920
+ message: "Where should workflow data be stored?",
3921
+ options: [
3922
+ { value: "global", label: "Global (~/.rrce-workflow/)", hint: "Cross-project access, clean workspace" },
3923
+ { value: "workspace", label: "Workspace (.rrce-workflow/)", hint: "Self-contained, version with repo" }
3924
+ ],
3925
+ initialValue: "global"
3926
+ });
3927
+ if (isCancel2(result)) {
3928
+ cancel("Setup cancelled.");
3929
+ process.exit(0);
4405
3930
  }
4406
- if (status.antigravity) {
4407
- installedOptions.push({
4408
- value: "antigravity",
4409
- label: "Antigravity IDE",
4410
- hint: pc8.green("Currently installed")
4411
- });
3931
+ return result;
3932
+ }
3933
+ async function promptTools() {
3934
+ const options = [];
3935
+ if (isOpenCodeInstalled()) {
3936
+ options.push({ value: "opencode", label: "OpenCode" });
4412
3937
  }
4413
- if (status.vscodeGlobal) {
4414
- installedOptions.push({
4415
- value: "vscode-global",
4416
- label: "VSCode (Global Settings)",
4417
- hint: pc8.green("Currently installed")
4418
- });
3938
+ if (isVSCodeInstalled()) {
3939
+ options.push({ value: "copilot", label: "GitHub Copilot", hint: "VSCode" });
4419
3940
  }
4420
- if (status.vscodeWorkspace) {
4421
- installedOptions.push({
4422
- value: "vscode-workspace",
4423
- label: "VSCode (Workspace Config)",
4424
- hint: pc8.green("Currently installed")
4425
- });
3941
+ if (isAntigravityInstalled()) {
3942
+ options.push({ value: "antigravity", label: "Antigravity IDE" });
4426
3943
  }
4427
- if (status.claude) {
4428
- installedOptions.push({
4429
- value: "claude",
4430
- label: "Claude Desktop",
4431
- hint: pc8.green("Currently installed")
4432
- });
3944
+ if (options.length === 0) {
3945
+ options.push({ value: "none", label: "No supported IDEs detected", hint: "Skip" });
4433
3946
  }
4434
- if (installedOptions.length === 0) {
4435
- note6(
4436
- pc8.yellow("RRCE MCP Server is not installed in any supported IDE."),
4437
- "Nothing to Uninstall"
4438
- );
4439
- return;
3947
+ const result = await multiselect({
3948
+ message: "Which AI tools do you use?",
3949
+ options,
3950
+ required: false
3951
+ });
3952
+ if (isCancel2(result)) {
3953
+ cancel("Setup cancelled.");
3954
+ process.exit(0);
4440
3955
  }
4441
- const selected = await multiselect4({
4442
- message: "Select IDEs to remove RRCE MCP Server from:",
4443
- options: installedOptions,
3956
+ return result.filter((t) => t !== "none");
3957
+ }
3958
+ async function promptMCPExposure() {
3959
+ const result = await confirm({
3960
+ message: "Expose this project to MCP (AI Agent) server?",
3961
+ initialValue: true
3962
+ });
3963
+ if (isCancel2(result)) {
3964
+ cancel("Setup cancelled.");
3965
+ process.exit(0);
3966
+ }
3967
+ return result;
3968
+ }
3969
+ async function promptLinkedProjects(existingProjects) {
3970
+ if (existingProjects.length === 0) {
3971
+ return [];
3972
+ }
3973
+ const result = await multiselect({
3974
+ message: "Link knowledge from other projects?",
3975
+ options: existingProjects.map((project) => ({
3976
+ value: `${project.name}:${project.source}`,
3977
+ label: `${project.name} ${pc3.dim(`(${project.source})`)}`,
3978
+ hint: pc3.dim(
3979
+ project.source === "global" ? `~/.rrce-workflow/workspaces/${project.name}` : project.dataPath
3980
+ )
3981
+ })),
4444
3982
  required: false
4445
3983
  });
4446
- if (isCancel6(selected) || selected.length === 0) {
4447
- return;
3984
+ if (isCancel2(result)) {
3985
+ cancel("Setup cancelled.");
3986
+ process.exit(0);
4448
3987
  }
4449
- const confirmed = await confirm4({
4450
- message: `Remove RRCE from ${selected.length} IDE(s)?`,
4451
- initialValue: false
3988
+ return result;
3989
+ }
3990
+ async function promptGitignore() {
3991
+ const result = await confirm({
3992
+ message: "Add generated folders to .gitignore?",
3993
+ initialValue: true
4452
3994
  });
4453
- if (isCancel6(confirmed) || !confirmed) {
4454
- note6(pc8.dim("Uninstall cancelled."), "Cancelled");
4455
- return;
3995
+ if (isCancel2(result)) {
3996
+ cancel("Setup cancelled.");
3997
+ process.exit(0);
4456
3998
  }
4457
- const targets = selected;
4458
- const results = [];
4459
- let successCount = 0;
4460
- let failureCount = 0;
4461
- for (const target of targets) {
4462
- const success = uninstallFromConfig(target, workspacePath);
4463
- const label = getTargetLabel(target);
4464
- if (success) {
4465
- results.push(`${label}: ${pc8.green("\u2713 Removed")}`);
4466
- successCount++;
3999
+ return result;
4000
+ }
4001
+ async function promptRAG() {
4002
+ const result = await confirm({
4003
+ message: `Enable Semantic Search (Local Mini RAG)?
4004
+ ${pc3.yellow("\u26A0 First use will download a ~100MB model")}`,
4005
+ initialValue: true
4006
+ });
4007
+ if (isCancel2(result)) {
4008
+ cancel("Setup cancelled.");
4009
+ process.exit(0);
4010
+ }
4011
+ return result;
4012
+ }
4013
+ async function promptConfirmation() {
4014
+ const result = await confirm({
4015
+ message: "Create configuration?",
4016
+ initialValue: true
4017
+ });
4018
+ if (isCancel2(result)) {
4019
+ cancel("Setup cancelled.");
4020
+ process.exit(0);
4021
+ }
4022
+ return result;
4023
+ }
4024
+
4025
+ // src/commands/wizard/setup-actions.ts
4026
+ init_paths();
4027
+ init_prompts();
4028
+ import * as fs10 from "fs";
4029
+ import * as path12 from "path";
4030
+ import pc4 from "picocolors";
4031
+ import { note as note2 } from "@clack/prompts";
4032
+ import { stringify as stringify2 } from "yaml";
4033
+
4034
+ // src/commands/wizard/utils.ts
4035
+ init_paths();
4036
+ import * as fs7 from "fs";
4037
+ import * as path8 from "path";
4038
+ import "yaml";
4039
+ function copyPromptsToDir(prompts, targetDir, extension) {
4040
+ for (const prompt of prompts) {
4041
+ const baseName = path8.basename(prompt.filePath, ".md");
4042
+ const targetName = baseName + extension;
4043
+ const targetPath = path8.join(targetDir, targetName);
4044
+ const content = fs7.readFileSync(prompt.filePath, "utf-8");
4045
+ fs7.writeFileSync(targetPath, content);
4046
+ }
4047
+ }
4048
+ function convertToOpenCodeAgent(prompt, useFileReference = false, promptFilePath) {
4049
+ const { frontmatter, content } = prompt;
4050
+ const tools = {};
4051
+ const hostTools = ["read", "write", "edit", "bash", "grep", "glob", "webfetch", "terminalLastCommand"];
4052
+ if (frontmatter.tools) {
4053
+ for (const tool of frontmatter.tools) {
4054
+ if (hostTools.includes(tool)) {
4055
+ tools[tool] = true;
4056
+ } else {
4057
+ tools[`rrce_${tool}`] = true;
4058
+ }
4059
+ }
4060
+ }
4061
+ tools["webfetch"] = true;
4062
+ return {
4063
+ description: frontmatter.description,
4064
+ mode: "primary",
4065
+ prompt: useFileReference && promptFilePath ? `{file:${promptFilePath}}` : content,
4066
+ tools
4067
+ };
4068
+ }
4069
+ function copyDirRecursive(src, dest) {
4070
+ const entries = fs7.readdirSync(src, { withFileTypes: true });
4071
+ for (const entry of entries) {
4072
+ const srcPath = path8.join(src, entry.name);
4073
+ const destPath = path8.join(dest, entry.name);
4074
+ if (entry.isDirectory()) {
4075
+ ensureDir(destPath);
4076
+ copyDirRecursive(srcPath, destPath);
4467
4077
  } else {
4468
- results.push(`${label}: ${pc8.red("\u2717 Failed")}`);
4469
- failureCount++;
4078
+ fs7.copyFileSync(srcPath, destPath);
4079
+ }
4080
+ }
4081
+ }
4082
+
4083
+ // src/commands/wizard/vscode.ts
4084
+ init_paths();
4085
+ init_detection();
4086
+ import * as fs8 from "fs";
4087
+ import * as path9 from "path";
4088
+ function generateVSCodeWorkspace(workspacePath, workspaceName, linkedProjects, customGlobalPath) {
4089
+ const workspaceFilePath = path9.join(workspacePath, `${workspaceName}.code-workspace`);
4090
+ let workspace;
4091
+ if (fs8.existsSync(workspaceFilePath)) {
4092
+ try {
4093
+ const content = fs8.readFileSync(workspaceFilePath, "utf-8");
4094
+ workspace = JSON.parse(content);
4095
+ } catch {
4096
+ workspace = { folders: [], settings: {} };
4097
+ }
4098
+ } else {
4099
+ workspace = { folders: [], settings: {} };
4100
+ }
4101
+ if (!workspace.settings) {
4102
+ workspace.settings = {};
4103
+ }
4104
+ workspace.folders = workspace.folders.filter(
4105
+ (f) => f.path === "." || !f.name?.startsWith("\u{1F4C1}") && !f.name?.startsWith("\u{1F4DA}") && !f.name?.startsWith("\u{1F4CE}") && !f.name?.startsWith("\u{1F4CB}")
4106
+ );
4107
+ const mainFolderIndex = workspace.folders.findIndex((f) => f.path === ".");
4108
+ if (mainFolderIndex === -1) {
4109
+ workspace.folders.unshift({
4110
+ path: ".",
4111
+ name: `\u{1F3E0} ${workspaceName} (workspace)`
4112
+ });
4113
+ } else {
4114
+ workspace.folders[mainFolderIndex] = {
4115
+ path: ".",
4116
+ name: `\u{1F3E0} ${workspaceName} (workspace)`
4117
+ };
4118
+ }
4119
+ const referenceFolderPaths = [];
4120
+ const isDetectedProjects = linkedProjects.length > 0 && typeof linkedProjects[0] === "object";
4121
+ if (isDetectedProjects) {
4122
+ const projects = linkedProjects;
4123
+ for (const project of projects) {
4124
+ const sourceLabel = project.source === "global" ? "global" : "local";
4125
+ const folderPath = project.dataPath;
4126
+ if (fs8.existsSync(folderPath)) {
4127
+ referenceFolderPaths.push(folderPath);
4128
+ workspace.folders.push({
4129
+ path: folderPath,
4130
+ name: `\u{1F4C1} ${project.name} [${sourceLabel}]`
4131
+ });
4132
+ }
4133
+ }
4134
+ } else {
4135
+ const projectNames = linkedProjects;
4136
+ const rrceHome = customGlobalPath || getRRCEHome();
4137
+ for (const projectName of projectNames) {
4138
+ const folderPath = path9.join(rrceHome, "workspaces", projectName);
4139
+ if (fs8.existsSync(folderPath)) {
4140
+ referenceFolderPaths.push(folderPath);
4141
+ workspace.folders.push({
4142
+ path: folderPath,
4143
+ name: `\u{1F4C1} ${projectName} [global]`
4144
+ });
4145
+ }
4146
+ }
4147
+ }
4148
+ if (referenceFolderPaths.length > 0) {
4149
+ const readonlyPatterns = {};
4150
+ for (const folderPath of referenceFolderPaths) {
4151
+ readonlyPatterns[`${folderPath}/**`] = true;
4152
+ }
4153
+ const existingReadonly = workspace.settings["files.readonlyInclude"] || {};
4154
+ const cleanedReadonly = {};
4155
+ for (const [pattern, value] of Object.entries(existingReadonly)) {
4156
+ if (!pattern.includes(".rrce-workflow") && !pattern.includes("rrce-workflow/workspaces")) {
4157
+ cleanedReadonly[pattern] = value;
4158
+ }
4159
+ }
4160
+ workspace.settings["files.readonlyInclude"] = {
4161
+ ...cleanedReadonly,
4162
+ ...readonlyPatterns
4163
+ };
4164
+ }
4165
+ fs8.writeFileSync(workspaceFilePath, JSON.stringify(workspace, null, 2));
4166
+ }
4167
+
4168
+ // src/commands/wizard/setup-actions.ts
4169
+ init_install();
4170
+ function createDirectoryStructure(dataPaths) {
4171
+ for (const dataPath of dataPaths) {
4172
+ ensureDir(dataPath);
4173
+ ensureDir(path12.join(dataPath, "knowledge"));
4174
+ ensureDir(path12.join(dataPath, "refs"));
4175
+ ensureDir(path12.join(dataPath, "tasks"));
4176
+ ensureDir(path12.join(dataPath, "templates"));
4177
+ }
4178
+ }
4179
+ async function installAgentPrompts(config, workspacePath, dataPaths) {
4180
+ const agentCoreDir = getAgentCoreDir();
4181
+ syncMetadataToAll(agentCoreDir, dataPaths);
4182
+ copyDirToAllStoragePaths(path12.join(agentCoreDir, "templates"), "templates", dataPaths);
4183
+ copyDirToAllStoragePaths(path12.join(agentCoreDir, "prompts"), "prompts", dataPaths);
4184
+ copyDirToAllStoragePaths(path12.join(agentCoreDir, "docs"), "docs", dataPaths);
4185
+ const rrceHome = config.globalPath || getDefaultRRCEHome2();
4186
+ ensureDir(path12.join(rrceHome, "templates"));
4187
+ ensureDir(path12.join(rrceHome, "docs"));
4188
+ copyDirRecursive(path12.join(agentCoreDir, "templates"), path12.join(rrceHome, "templates"));
4189
+ copyDirRecursive(path12.join(agentCoreDir, "docs"), path12.join(rrceHome, "docs"));
4190
+ const needsIDEPrompts = config.storageMode === "workspace" && (config.tools.includes("copilot") || config.tools.includes("antigravity")) || config.tools.includes("opencode");
4191
+ if (needsIDEPrompts) {
4192
+ const prompts = loadPromptsFromDir(getAgentCorePromptsDir());
4193
+ if (config.storageMode === "workspace") {
4194
+ if (config.tools.includes("copilot")) {
4195
+ const copilotPath = getAgentPromptPath(workspacePath, "copilot");
4196
+ ensureDir(copilotPath);
4197
+ copyPromptsToDir(prompts, copilotPath, ".agent.md");
4198
+ }
4199
+ if (config.tools.includes("antigravity")) {
4200
+ const antigravityPath = getAgentPromptPath(workspacePath, "antigravity");
4201
+ ensureDir(antigravityPath);
4202
+ copyPromptsToDir(prompts, antigravityPath, ".md");
4203
+ }
4204
+ }
4205
+ if (config.tools.includes("opencode")) {
4206
+ const primaryDataPath = dataPaths[0];
4207
+ if (primaryDataPath) {
4208
+ if (config.storageMode === "global") {
4209
+ try {
4210
+ const promptsDir = path12.join(path12.dirname(OPENCODE_CONFIG), "prompts");
4211
+ ensureDir(promptsDir);
4212
+ let opencodeConfig = { $schema: "https://opencode.ai/config.json" };
4213
+ if (fs10.existsSync(OPENCODE_CONFIG)) {
4214
+ opencodeConfig = JSON.parse(fs10.readFileSync(OPENCODE_CONFIG, "utf-8"));
4215
+ }
4216
+ if (!opencodeConfig.agent) opencodeConfig.agent = {};
4217
+ for (const prompt of prompts) {
4218
+ const baseName = path12.basename(prompt.filePath, ".md");
4219
+ const promptFileName = `rrce-${baseName}.md`;
4220
+ const promptFilePath = path12.join(promptsDir, promptFileName);
4221
+ fs10.writeFileSync(promptFilePath, prompt.content);
4222
+ const agentConfig = convertToOpenCodeAgent(prompt, true, `./prompts/${promptFileName}`);
4223
+ opencodeConfig.agent[baseName] = agentConfig;
4224
+ }
4225
+ fs10.writeFileSync(OPENCODE_CONFIG, JSON.stringify(opencodeConfig, null, 2) + "\n");
4226
+ } catch (e) {
4227
+ console.error("Failed to update global OpenCode config with agents:", e);
4228
+ }
4229
+ } else {
4230
+ const opencodeBaseDir = path12.join(primaryDataPath, ".opencode", "agent");
4231
+ ensureDir(opencodeBaseDir);
4232
+ for (const prompt of prompts) {
4233
+ const baseName = path12.basename(prompt.filePath, ".md");
4234
+ const agentConfig = convertToOpenCodeAgent(prompt);
4235
+ const content = `---
4236
+ ${stringify2({
4237
+ description: agentConfig.description,
4238
+ mode: agentConfig.mode,
4239
+ tools: agentConfig.tools
4240
+ })}---
4241
+ ${agentConfig.prompt}`;
4242
+ fs10.writeFileSync(path12.join(opencodeBaseDir, `${baseName}.md`), content);
4243
+ }
4244
+ }
4245
+ }
4470
4246
  }
4471
4247
  }
4472
- if (results.length > 0) {
4473
- const summary = failureCount > 0 ? `${successCount} succeeded, ${failureCount} failed` : `All ${successCount} uninstalled successfully`;
4474
- note6(results.join("\n"), `Uninstall Results (${summary})`);
4475
- }
4476
4248
  }
4477
- var init_uninstall_wizard = __esm({
4478
- "src/mcp/commands/uninstall-wizard.ts"() {
4479
- "use strict";
4480
- init_install();
4249
+ function createWorkspaceConfig(config, workspacePath, workspaceName) {
4250
+ let configPath;
4251
+ if (config.storageMode === "global") {
4252
+ const rrceHome = config.globalPath || getDefaultRRCEHome2();
4253
+ configPath = path12.join(rrceHome, "workspaces", workspaceName, "config.yaml");
4254
+ } else {
4255
+ configPath = path12.join(workspacePath, ".rrce-workflow", "config.yaml");
4481
4256
  }
4482
- });
4483
-
4484
- // src/mcp/commands/help.ts
4485
- import { note as note7 } from "@clack/prompts";
4486
- import pc9 from "picocolors";
4487
- function showHelp() {
4488
- const help = `
4489
- ${pc9.bold("RRCE MCP Hub")} - Cross-project AI assistant server
4490
-
4491
- ${pc9.bold("ABOUT")}
4492
- MCP (Model Context Protocol) allows AI assistants like Claude to
4493
- access your project knowledge in real-time. The RRCE MCP Hub
4494
- provides a central server that exposes selected projects.
4495
-
4496
- ${pc9.bold("MENU OPTIONS")}
4497
- ${pc9.cyan("Start MCP server")} Start the server for AI access
4498
- ${pc9.cyan("Configure projects")} Choose which projects to expose
4499
- ${pc9.cyan("Install to IDE")} Add to Antigravity, VSCode, or Claude
4500
- ${pc9.cyan("View status")} See which projects are exposed
4501
-
4502
- ${pc9.bold("DIRECT COMMANDS")}
4503
- ${pc9.dim("rrce-workflow mcp start")} Start server directly
4504
- ${pc9.dim("rrce-workflow mcp stop")} Stop server directly
4505
- ${pc9.dim("rrce-workflow mcp status")} Show status directly
4506
- ${pc9.dim("rrce-workflow mcp help")} Show this help
4257
+ ensureDir(path12.dirname(configPath));
4258
+ let content = `# RRCE-Workflow Configuration
4259
+ version: 1
4507
4260
 
4508
- ${pc9.bold("IDE INSTALLATION")}
4509
- ${pc9.cyan("Antigravity")} ~/.gemini/antigravity/mcp_config.json
4510
- ${pc9.cyan("VSCode Global")} ~/.config/Code/User/settings.json
4511
- ${pc9.cyan("VSCode Workspace")} .vscode/mcp.json
4512
- ${pc9.cyan("Claude Desktop")} ~/.config/claude/claude_desktop_config.json
4261
+ storage:
4262
+ mode: ${config.storageMode}`;
4263
+ if (config.globalPath && config.globalPath !== getDefaultRRCEHome2()) {
4264
+ content += `
4265
+ globalPath: "${config.globalPath}"`;
4266
+ }
4267
+ content += `
4513
4268
 
4514
- ${pc9.bold("SERVER COMMANDS")} (while running)
4515
- ${pc9.cyan("q")} Stop and quit ${pc9.cyan("p")} Reconfigure projects
4516
- ${pc9.cyan("i")} Install to IDE ${pc9.cyan("r")} Reload config
4517
- ${pc9.cyan("c")} Clear logs ${pc9.cyan("?")} Show help
4269
+ project:
4270
+ name: "${workspaceName}"
4271
+ sourcePath: "${workspacePath}"
4518
4272
 
4519
- ${pc9.bold("RESOURCES EXPOSED")}
4520
- ${pc9.cyan("rrce://projects")} List all exposed projects
4521
- ${pc9.cyan("rrce://projects/{name}/context")} Get project context
4522
- ${pc9.cyan("rrce://projects/{name}/tasks")} Get project tasks
4273
+ tools:
4274
+ opencode: ${config.tools.includes("opencode")}
4275
+ copilot: ${config.tools.includes("copilot")}
4276
+ antigravity: ${config.tools.includes("antigravity")}
4277
+ `;
4278
+ if (config.enableRAG) {
4279
+ content += `
4280
+ semantic_search:
4281
+ enabled: true
4523
4282
  `;
4524
- note7(help.trim(), "Help");
4525
- }
4526
- var init_help = __esm({
4527
- "src/mcp/commands/help.ts"() {
4528
- "use strict";
4529
- }
4530
- });
4531
-
4532
- // src/mcp/index.ts
4533
- var mcp_exports = {};
4534
- __export(mcp_exports, {
4535
- handleConfigure: () => handleConfigure,
4536
- handleConfigureGlobalPath: () => handleConfigureGlobalPath,
4537
- handleStartServer: () => handleStartServer,
4538
- runMCP: () => runMCP
4539
- });
4540
- import { intro, outro, confirm as confirm5, note as note8, isCancel as isCancel7 } from "@clack/prompts";
4541
- import pc10 from "picocolors";
4542
- async function runMCP(subcommand2) {
4543
- const workspacePath = detectWorkspaceRoot();
4544
- if (subcommand2) {
4545
- switch (subcommand2) {
4546
- case "start":
4547
- if (process.stdout.isTTY) {
4548
- await handleStartServer();
4549
- } else {
4550
- await startMCPServer();
4551
- await new Promise(() => {
4552
- });
4553
- }
4554
- return;
4555
- case "stop":
4556
- await handleStopServer();
4557
- return;
4558
- case "status":
4559
- await handleShowStatus();
4560
- return;
4561
- case "uninstall":
4562
- await runUninstallWizard(workspacePath);
4563
- return;
4564
- case "help":
4565
- showHelp();
4566
- return;
4567
- case "configure":
4568
- await handleConfigure();
4569
- return;
4570
- case "menu":
4571
- break;
4572
- }
4573
- }
4574
- const globalPathCheck = await ensureMCPGlobalPath();
4575
- if (!globalPathCheck.configured) {
4576
- intro(pc10.bgCyan(pc10.black(" MCP Setup ")));
4577
- const configured = await handleConfigureGlobalPath();
4578
- if (!configured) {
4579
- outro(pc10.yellow("MCP requires a global storage path. Setup cancelled."));
4580
- return;
4581
- }
4582
4283
  }
4583
- const installed = isInstalledAnywhere(workspacePath);
4584
- if (!installed) {
4585
- intro(pc10.bgCyan(pc10.black(" Welcome to MCP Hub ")));
4586
- note8(
4587
- `${pc10.bold("Set up Model Context Protocol")}
4588
- Allow AI assistants to access your project context.`,
4589
- "Getting Started"
4590
- );
4591
- const shouldInstall = await confirm5({
4592
- message: "Install MCP server integrations now?",
4593
- initialValue: true
4284
+ if (config.linkedProjects.length > 0) {
4285
+ content += `
4286
+ linked_projects:
4287
+ `;
4288
+ config.linkedProjects.forEach((name) => {
4289
+ content += ` - ${name}
4290
+ `;
4594
4291
  });
4595
- if (shouldInstall && !isCancel7(shouldInstall)) {
4596
- await runInstallWizard(workspacePath);
4597
- const shouldStart = await confirm5({
4598
- message: "Start the MCP Dashboard?",
4599
- initialValue: true
4600
- });
4601
- if (shouldStart && !isCancel7(shouldStart)) {
4602
- await handleStartServer();
4603
- }
4604
- } else {
4605
- outro(pc10.dim('Setup skipped. Run "npx rrce-workflow mcp" later to restart.'));
4606
- }
4607
- return;
4608
4292
  }
4293
+ fs10.writeFileSync(configPath, content);
4294
+ }
4295
+ async function registerWithMCP(config, workspacePath, workspaceName) {
4296
+ if (!config.exposeToMCP) return;
4609
4297
  try {
4610
- await handleStartServer();
4611
- } catch (err) {
4612
- console.error(err);
4613
- outro(pc10.red("Failed to launch MCP Dashboard"));
4298
+ const { loadMCPConfig: loadMCPConfig2, saveMCPConfig: saveMCPConfig2, setProjectConfig: setProjectConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
4299
+ const mcpConfig = loadMCPConfig2();
4300
+ setProjectConfig2(
4301
+ mcpConfig,
4302
+ workspaceName,
4303
+ true,
4304
+ void 0,
4305
+ workspacePath,
4306
+ config.enableRAG ? { enabled: true } : void 0
4307
+ );
4308
+ saveMCPConfig2(mcpConfig);
4309
+ } catch (e) {
4310
+ note2(
4311
+ `${pc4.yellow("\u26A0")} Could not register project with MCP
4312
+ Error: ${e instanceof Error ? e.message : String(e)}
4313
+
4314
+ You can configure MCP later: ${pc4.cyan("npx rrce-workflow mcp")}`,
4315
+ "MCP Registration Warning"
4316
+ );
4614
4317
  }
4615
4318
  }
4616
- async function handleStopServer() {
4617
- const { stopMCPServer: stopMCPServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
4618
- const status = getMCPServerStatus();
4619
- if (!status.running) {
4620
- console.log(pc10.dim("MCP server is already stopped."));
4621
- return;
4319
+ function getDataPaths(mode, workspaceName, workspaceRoot, customGlobalPath) {
4320
+ const globalPath = path12.join(customGlobalPath || getDefaultRRCEHome2(), "workspaces", workspaceName);
4321
+ const workspacePath = path12.join(workspaceRoot, ".rrce-workflow");
4322
+ switch (mode) {
4323
+ case "global":
4324
+ return [globalPath];
4325
+ case "workspace":
4326
+ return [workspacePath];
4327
+ default:
4328
+ return [globalPath];
4622
4329
  }
4623
- stopMCPServer2();
4624
- console.log(pc10.green("MCP server stopped."));
4625
4330
  }
4626
- var init_mcp = __esm({
4627
- "src/mcp/index.ts"() {
4628
- "use strict";
4629
- init_config();
4630
- init_server();
4631
- init_install();
4632
- init_paths();
4633
- init_start();
4634
- init_configure();
4635
- init_status();
4636
- init_install_wizard();
4637
- init_uninstall_wizard();
4638
- init_help();
4331
+ function installToSelectedIDEs(tools) {
4332
+ const success = [];
4333
+ const failed = [];
4334
+ const toolToTarget = {
4335
+ "opencode": "opencode",
4336
+ "antigravity": "antigravity",
4337
+ "copilot": "vscode-global"
4338
+ };
4339
+ for (const tool of tools) {
4340
+ const target = toolToTarget[tool];
4341
+ if (!target) continue;
4342
+ try {
4343
+ const result = installToConfig(target);
4344
+ const label = getTargetLabel(target);
4345
+ if (result) {
4346
+ success.push(label);
4347
+ } else {
4348
+ failed.push(label);
4349
+ }
4350
+ } catch (error) {
4351
+ const label = getTargetLabel(target);
4352
+ console.error(`Failed to install to ${label}:`, error);
4353
+ failed.push(label);
4354
+ }
4639
4355
  }
4640
- });
4356
+ return { success, failed };
4357
+ }
4641
4358
 
4642
4359
  // src/commands/wizard/setup-flow.ts
4643
- import { spinner as spinner3, note as note9, outro as outro2, cancel as cancel3, isCancel as isCancel8, confirm as confirm6, select as select3 } from "@clack/prompts";
4644
- import pc11 from "picocolors";
4360
+ init_gitignore();
4645
4361
  async function runExpressSetup(workspacePath, workspaceName, existingProjects, s) {
4646
4362
  const storageModeResult = await select3({
4647
4363
  message: "Where should workflow data be stored?",
@@ -4651,8 +4367,8 @@ async function runExpressSetup(workspacePath, workspaceName, existingProjects, s
4651
4367
  ],
4652
4368
  initialValue: "global"
4653
4369
  });
4654
- if (isCancel8(storageModeResult)) {
4655
- cancel3("Setup cancelled.");
4370
+ if (isCancel7(storageModeResult)) {
4371
+ cancel2("Setup cancelled.");
4656
4372
  process.exit(0);
4657
4373
  }
4658
4374
  const storageMode = storageModeResult;
@@ -4660,7 +4376,7 @@ async function runExpressSetup(workspacePath, workspaceName, existingProjects, s
4660
4376
  if (storageMode === "global") {
4661
4377
  customGlobalPath = await resolveGlobalPath();
4662
4378
  if (!customGlobalPath) {
4663
- cancel3("Setup cancelled - no global path selected.");
4379
+ cancel2("Setup cancelled - no global path selected.");
4664
4380
  process.exit(0);
4665
4381
  }
4666
4382
  }
@@ -4669,8 +4385,8 @@ async function runExpressSetup(workspacePath, workspaceName, existingProjects, s
4669
4385
  if (isVSCodeInstalled()) toolsPreview.push("GitHub Copilot");
4670
4386
  if (isAntigravityInstalled()) toolsPreview.push("Antigravity");
4671
4387
  const toolsText = toolsPreview.length > 0 ? toolsPreview.join(", ") : "None detected";
4672
- note9(
4673
- `${pc11.bold("Express Setup will configure:")}
4388
+ note6(
4389
+ `${pc8.bold("Express Setup will configure:")}
4674
4390
  \u2022 Storage: ${storageMode === "global" ? "Global" : "Workspace"}
4675
4391
  \u2022 MCP Server: Enabled
4676
4392
  \u2022 Semantic Search (RAG): Enabled
@@ -4678,12 +4394,12 @@ async function runExpressSetup(workspacePath, workspaceName, existingProjects, s
4678
4394
  ` : "") + `\u2022 AI Tools: ${toolsText}`,
4679
4395
  "Configuration Preview"
4680
4396
  );
4681
- const confirmed = await confirm6({
4397
+ const confirmed = await confirm5({
4682
4398
  message: "Proceed with express setup?",
4683
4399
  initialValue: true
4684
4400
  });
4685
- if (isCancel8(confirmed) || !confirmed) {
4686
- cancel3("Setup cancelled.");
4401
+ if (isCancel7(confirmed) || !confirmed) {
4402
+ cancel2("Setup cancelled.");
4687
4403
  process.exit(0);
4688
4404
  }
4689
4405
  const defaultTools = [];
@@ -4704,19 +4420,19 @@ async function runExpressSetup(workspacePath, workspaceName, existingProjects, s
4704
4420
  const { updateGitignore: updateGitignore2 } = await Promise.resolve().then(() => (init_gitignore(), gitignore_exports));
4705
4421
  updateGitignore2(workspacePath, config.storageMode, config.tools);
4706
4422
  }
4707
- const startMCP = await confirm6({
4423
+ const startMCP = await confirm5({
4708
4424
  message: "Start MCP server now?",
4709
4425
  initialValue: true
4710
4426
  });
4711
- if (startMCP && !isCancel8(startMCP)) {
4427
+ if (startMCP && !isCancel7(startMCP)) {
4712
4428
  const { runMCP: runMCP2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
4713
4429
  await runMCP2();
4714
4430
  } else {
4715
- outro2(pc11.green(`\u2713 Express setup complete! Run ${pc11.cyan("npx rrce-workflow mcp")} to start the server.`));
4431
+ outro2(pc8.green(`\u2713 Express setup complete! Run ${pc8.cyan("npx rrce-workflow mcp")} to start the server.`));
4716
4432
  }
4717
4433
  }
4718
4434
  async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
4719
- const s = spinner3();
4435
+ const s = spinner2();
4720
4436
  const setupModeResult = await select3({
4721
4437
  message: "Setup mode:",
4722
4438
  options: [
@@ -4725,8 +4441,8 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
4725
4441
  ],
4726
4442
  initialValue: "express"
4727
4443
  });
4728
- if (isCancel8(setupModeResult)) {
4729
- cancel3("Setup cancelled.");
4444
+ if (isCancel7(setupModeResult)) {
4445
+ cancel2("Setup cancelled.");
4730
4446
  process.exit(0);
4731
4447
  }
4732
4448
  if (setupModeResult === "express") {
@@ -4737,7 +4453,7 @@ async function runSetupFlow(workspacePath, workspaceName, existingProjects) {
4737
4453
  if (storageMode === "global") {
4738
4454
  customGlobalPath = await resolveGlobalPath();
4739
4455
  if (!customGlobalPath) {
4740
- cancel3("Setup cancelled - no global path selected.");
4456
+ cancel2("Setup cancelled - no global path selected.");
4741
4457
  process.exit(0);
4742
4458
  }
4743
4459
  }
@@ -4793,94 +4509,84 @@ async function executeSetup(config, workspacePath, workspaceName, allProjects, s
4793
4509
  s.stop("Configuration generated");
4794
4510
  const dataSummary = getDataPaths(config.storageMode, workspaceName, workspacePath, config.globalPath);
4795
4511
  const summary = [
4796
- `${pc11.green("\u2713")} Data stored at: ${pc11.dim(dataSummary[0])}`,
4797
- config.tools.length > 0 ? `${pc11.green("\u2713")} Tools: ${config.tools.join(", ")}` : null,
4798
- config.exposeToMCP ? `${pc11.green("\u2713")} MCP server configured` : null,
4799
- config.enableRAG ? `${pc11.green("\u2713")} Semantic Search enabled` : null,
4800
- config.linkedProjects.length > 0 ? `${pc11.green("\u2713")} Linked ${config.linkedProjects.length} project(s)` : null,
4801
- ideResults.success.length > 0 ? `${pc11.green("\u2713")} RRCE installed to: ${ideResults.success.join(", ")}` : null,
4802
- ideResults.failed.length > 0 ? `${pc11.yellow("\u26A0")} Failed to install to: ${ideResults.failed.join(", ")}` : null
4512
+ `${pc8.green("\u2713")} Data stored at: ${pc8.dim(dataSummary[0])}`,
4513
+ config.tools.length > 0 ? `${pc8.green("\u2713")} Tools: ${config.tools.join(", ")}` : null,
4514
+ config.exposeToMCP ? `${pc8.green("\u2713")} MCP server configured` : null,
4515
+ config.enableRAG ? `${pc8.green("\u2713")} Semantic Search enabled` : null,
4516
+ config.linkedProjects.length > 0 ? `${pc8.green("\u2713")} Linked ${config.linkedProjects.length} project(s)` : null,
4517
+ ideResults.success.length > 0 ? `${pc8.green("\u2713")} RRCE installed to: ${ideResults.success.join(", ")}` : null,
4518
+ ideResults.failed.length > 0 ? `${pc8.yellow("\u26A0")} Failed to install to: ${ideResults.failed.join(", ")}` : null
4803
4519
  ].filter(Boolean);
4804
4520
  if (ideResults.success.length > 0) {
4805
4521
  summary.push("");
4806
- summary.push(pc11.dim("\u{1F4A1} You may need to restart your IDE or refresh MCP config for changes to take effect."));
4522
+ summary.push(pc8.dim("\u{1F4A1} You may need to restart your IDE or refresh MCP config for changes to take effect."));
4807
4523
  }
4808
- note9(summary.join("\n"), "Setup Complete");
4524
+ note6(summary.join("\n"), "Setup Complete");
4809
4525
  } catch (error) {
4810
4526
  s.stop("Error occurred");
4811
- cancel3(
4527
+ cancel2(
4812
4528
  `Setup failed: ${error instanceof Error ? error.message : String(error)}
4813
4529
 
4814
- ${pc11.dim("Tip: You can re-run the wizard to try again.")}`
4530
+ ${pc8.dim("Tip: You can re-run the wizard to try again.")}`
4815
4531
  );
4816
4532
  process.exit(1);
4817
4533
  }
4818
4534
  }
4819
4535
  async function handlePostSetup(config, workspacePath, workspaceName, linkedProjects) {
4820
4536
  if (config.exposeToMCP) {
4821
- const shouldConfigureMCP = await confirm6({
4537
+ const shouldConfigureMCP = await confirm5({
4822
4538
  message: "Would you like to start the MCP server now?",
4823
4539
  initialValue: true
4824
4540
  });
4825
- if (shouldConfigureMCP && !isCancel8(shouldConfigureMCP)) {
4541
+ if (shouldConfigureMCP && !isCancel7(shouldConfigureMCP)) {
4826
4542
  const { runMCP: runMCP2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
4827
4543
  await runMCP2();
4828
4544
  } else {
4829
4545
  if (linkedProjects.length > 0) {
4830
- outro2(pc11.green(`\u2713 Setup complete! Open ${pc11.bold(`${workspaceName}.code-workspace`)} in VSCode.`));
4546
+ outro2(pc8.green(`\u2713 Setup complete! Open ${pc8.bold(`${workspaceName}.code-workspace`)} in VSCode.`));
4831
4547
  } else {
4832
- outro2(pc11.green(`\u2713 Setup complete! Run ${pc11.cyan("npx rrce-workflow mcp")} to start the server.`));
4548
+ outro2(pc8.green(`\u2713 Setup complete! Run ${pc8.cyan("npx rrce-workflow mcp")} to start the server.`));
4833
4549
  }
4834
4550
  }
4835
4551
  } else {
4836
4552
  if (linkedProjects.length > 0) {
4837
- outro2(pc11.green(`\u2713 Setup complete! Open ${pc11.bold(`${workspaceName}.code-workspace`)} in VSCode.`));
4553
+ outro2(pc8.green(`\u2713 Setup complete! Open ${pc8.bold(`${workspaceName}.code-workspace`)} in VSCode.`));
4838
4554
  } else {
4839
- outro2(pc11.green(`\u2713 Setup complete! Your agents are ready to use.`));
4555
+ outro2(pc8.green(`\u2713 Setup complete! Your agents are ready to use.`));
4840
4556
  }
4841
4557
  }
4842
4558
  }
4843
- var init_setup_flow = __esm({
4844
- "src/commands/wizard/setup-flow.ts"() {
4845
- "use strict";
4846
- init_detection();
4847
- init_tui_utils();
4848
- init_install();
4849
- init_setup_prompts();
4850
- init_setup_actions();
4851
- init_gitignore();
4852
- init_vscode();
4853
- }
4854
- });
4855
4559
 
4856
4560
  // src/commands/wizard/link-flow.ts
4857
- import { multiselect as multiselect5, spinner as spinner4, note as note10, outro as outro3, cancel as cancel4, isCancel as isCancel9, confirm as confirm7 } from "@clack/prompts";
4858
- import pc12 from "picocolors";
4561
+ init_paths();
4562
+ import { multiselect as multiselect4, spinner as spinner3, note as note7, outro as outro3, cancel as cancel3, isCancel as isCancel8, confirm as confirm6 } from "@clack/prompts";
4563
+ import pc9 from "picocolors";
4859
4564
  import * as fs17 from "fs";
4565
+ init_detection();
4860
4566
  async function runLinkProjectsFlow(workspacePath, workspaceName) {
4861
4567
  const projects = scanForProjects({
4862
4568
  excludeWorkspace: workspaceName,
4863
4569
  workspacePath
4864
4570
  });
4865
4571
  if (projects.length === 0) {
4866
- outro3(pc12.yellow("No other projects found. Try setting up another project first."));
4572
+ outro3(pc9.yellow("No other projects found. Try setting up another project first."));
4867
4573
  return;
4868
4574
  }
4869
4575
  const customGlobalPath = getEffectiveRRCEHome(workspacePath);
4870
- const linkedProjects = await multiselect5({
4576
+ const linkedProjects = await multiselect4({
4871
4577
  message: "Select projects to link:",
4872
4578
  options: projects.map((project) => ({
4873
4579
  value: `${project.name}:${project.source}`,
4874
4580
  // Unique key
4875
- label: `${project.name} ${pc12.dim(`(${project.source})`)}`,
4876
- hint: pc12.dim(
4581
+ label: `${project.name} ${pc9.dim(`(${project.source})`)}`,
4582
+ hint: pc9.dim(
4877
4583
  project.source === "global" ? `~/.rrce-workflow/workspaces/${project.name}` : project.dataPath
4878
4584
  )
4879
4585
  })),
4880
4586
  required: true
4881
4587
  });
4882
- if (isCancel9(linkedProjects)) {
4883
- cancel4("Cancelled.");
4588
+ if (isCancel8(linkedProjects)) {
4589
+ cancel3("Cancelled.");
4884
4590
  process.exit(0);
4885
4591
  }
4886
4592
  const selectedKeys = linkedProjects;
@@ -4891,7 +4597,7 @@ async function runLinkProjectsFlow(workspacePath, workspaceName) {
4891
4597
  const selectedProjects = projects.filter(
4892
4598
  (p) => selectedKeys.includes(`${p.name}:${p.source}`)
4893
4599
  );
4894
- const s = spinner4();
4600
+ const s = spinner3();
4895
4601
  s.start("Linking projects");
4896
4602
  const configFilePath = getConfigPath(workspacePath);
4897
4603
  let configContent = fs17.readFileSync(configFilePath, "utf-8");
@@ -4927,42 +4633,35 @@ linked_projects:
4927
4633
  const workspaceFile = `${workspaceName}.code-workspace`;
4928
4634
  const summary = [
4929
4635
  `Linked projects:`,
4930
- ...selectedProjects.map((p) => ` \u2713 ${p.name} ${pc12.dim(`(${p.source})`)}`),
4636
+ ...selectedProjects.map((p) => ` \u2713 ${p.name} ${pc9.dim(`(${p.source})`)}`),
4931
4637
  ``,
4932
- `Workspace file: ${pc12.cyan(workspaceFile)}`
4638
+ `Workspace file: ${pc9.cyan(workspaceFile)}`
4933
4639
  ];
4934
- note10(summary.join("\n"), "Link Summary");
4935
- outro3(pc12.green(`\u2713 Projects linked! Open ${pc12.bold(workspaceFile)} in VSCode to access linked data.`));
4936
- const shouldExpose = await confirm7({
4640
+ note7(summary.join("\n"), "Link Summary");
4641
+ outro3(pc9.green(`\u2713 Projects linked! Open ${pc9.bold(workspaceFile)} in VSCode to access linked data.`));
4642
+ const shouldExpose = await confirm6({
4937
4643
  message: "Also expose these linked projects to the MCP server (for Agent access)?",
4938
4644
  initialValue: true
4939
4645
  });
4940
- if (shouldExpose && !isCancel9(shouldExpose)) {
4646
+ if (shouldExpose && !isCancel8(shouldExpose)) {
4941
4647
  try {
4942
- const { loadMCPConfig: loadMCPConfig3, saveMCPConfig: saveMCPConfig2, setProjectConfig: setProjectConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
4943
- const mcpConfig = loadMCPConfig3();
4648
+ const { loadMCPConfig: loadMCPConfig2, saveMCPConfig: saveMCPConfig2, setProjectConfig: setProjectConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
4649
+ const mcpConfig = loadMCPConfig2();
4944
4650
  for (const project of selectedProjects) {
4945
4651
  setProjectConfig2(mcpConfig, project.name, true, void 0, project.dataPath);
4946
4652
  }
4947
4653
  saveMCPConfig2(mcpConfig);
4948
- note10("Projects have been added to the global MCP configuration.", "MCP Updated");
4654
+ note7("Projects have been added to the global MCP configuration.", "MCP Updated");
4949
4655
  } catch (err) {
4950
- note10(`Failed to update MCP config: ${err}`, "MCP Update Failed");
4656
+ note7(`Failed to update MCP config: ${err}`, "MCP Update Failed");
4951
4657
  }
4952
4658
  }
4953
4659
  }
4954
- var init_link_flow = __esm({
4955
- "src/commands/wizard/link-flow.ts"() {
4956
- "use strict";
4957
- init_paths();
4958
- init_vscode();
4959
- init_detection();
4960
- }
4961
- });
4962
4660
 
4963
4661
  // src/commands/wizard/sync-flow.ts
4964
- import { confirm as confirm8, spinner as spinner5, note as note11, outro as outro4, cancel as cancel5, isCancel as isCancel10 } from "@clack/prompts";
4965
- import pc13 from "picocolors";
4662
+ init_paths();
4663
+ import { confirm as confirm7, spinner as spinner4, note as note8, outro as outro4, cancel as cancel4, isCancel as isCancel9 } from "@clack/prompts";
4664
+ import pc10 from "picocolors";
4966
4665
  import * as fs18 from "fs";
4967
4666
  import * as path18 from "path";
4968
4667
  async function runSyncToGlobalFlow(workspacePath, workspaceName) {
@@ -4974,25 +4673,25 @@ async function runSyncToGlobalFlow(workspacePath, workspaceName) {
4974
4673
  (dir) => fs18.existsSync(path18.join(localPath, dir))
4975
4674
  );
4976
4675
  if (existingDirs.length === 0) {
4977
- outro4(pc13.yellow("No data found in workspace storage to sync."));
4676
+ outro4(pc10.yellow("No data found in workspace storage to sync."));
4978
4677
  return;
4979
4678
  }
4980
- note11(
4679
+ note8(
4981
4680
  `The following will be copied to global storage:
4982
4681
  ${existingDirs.map((d) => ` \u2022 ${d}/`).join("\n")}
4983
4682
 
4984
- Destination: ${pc13.cyan(globalPath)}`,
4683
+ Destination: ${pc10.cyan(globalPath)}`,
4985
4684
  "Sync Preview"
4986
4685
  );
4987
- const shouldSync = await confirm8({
4686
+ const shouldSync = await confirm7({
4988
4687
  message: "Proceed with sync to global storage?",
4989
4688
  initialValue: true
4990
4689
  });
4991
- if (isCancel10(shouldSync) || !shouldSync) {
4690
+ if (isCancel9(shouldSync) || !shouldSync) {
4992
4691
  outro4("Sync cancelled.");
4993
4692
  return;
4994
4693
  }
4995
- const s = spinner5();
4694
+ const s = spinner4();
4996
4695
  s.start("Syncing to global storage");
4997
4696
  try {
4998
4697
  ensureDir(globalPath);
@@ -5007,34 +4706,30 @@ Destination: ${pc13.cyan(globalPath)}`,
5007
4706
  `Synced directories:`,
5008
4707
  ...existingDirs.map((d) => ` \u2713 ${d}/`),
5009
4708
  ``,
5010
- `Global path: ${pc13.cyan(globalPath)}`,
4709
+ `Global path: ${pc10.cyan(globalPath)}`,
5011
4710
  ``,
5012
4711
  `Other projects can now link this knowledge!`
5013
4712
  ];
5014
- note11(summary.join("\n"), "Sync Summary");
5015
- outro4(pc13.green("\u2713 Workspace knowledge synced to global storage!"));
4713
+ note8(summary.join("\n"), "Sync Summary");
4714
+ outro4(pc10.green("\u2713 Workspace knowledge synced to global storage!"));
5016
4715
  } catch (error) {
5017
4716
  s.stop("Error occurred");
5018
- cancel5(`Failed to sync: ${error instanceof Error ? error.message : String(error)}`);
4717
+ cancel4(`Failed to sync: ${error instanceof Error ? error.message : String(error)}`);
5019
4718
  process.exit(1);
5020
4719
  }
5021
4720
  }
5022
- var init_sync_flow = __esm({
5023
- "src/commands/wizard/sync-flow.ts"() {
5024
- "use strict";
5025
- init_paths();
5026
- init_utils();
5027
- }
5028
- });
5029
4721
 
5030
4722
  // src/commands/wizard/update-flow.ts
5031
- import { confirm as confirm9, spinner as spinner6, note as note12, outro as outro5, cancel as cancel6, isCancel as isCancel11 } from "@clack/prompts";
5032
- import pc14 from "picocolors";
4723
+ init_paths();
4724
+ init_prompts();
4725
+ import { confirm as confirm8, spinner as spinner5, note as note9, outro as outro5, cancel as cancel5, isCancel as isCancel10 } from "@clack/prompts";
4726
+ import pc11 from "picocolors";
5033
4727
  import * as fs19 from "fs";
5034
4728
  import * as path19 from "path";
5035
4729
  import { stringify as stringify3 } from "yaml";
4730
+ init_install();
5036
4731
  async function runUpdateFlow(workspacePath, workspaceName, currentStorageMode) {
5037
- const s = spinner6();
4732
+ const s = spinner5();
5038
4733
  s.start("Checking for updates");
5039
4734
  try {
5040
4735
  const agentCoreDir = getAgentCoreDir();
@@ -5059,7 +4754,7 @@ async function runUpdateFlow(workspacePath, workspaceName, currentStorageMode) {
5059
4754
  if (ideTargets.length > 0) {
5060
4755
  updateTargets.push(` \u2022 IDE integrations: ${ideTargets.join(", ")}`);
5061
4756
  }
5062
- note12(
4757
+ note9(
5063
4758
  `The following will be updated from the package:
5064
4759
  ${updateTargets.join("\n")}
5065
4760
 
@@ -5067,11 +4762,11 @@ Target locations:
5067
4762
  ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
5068
4763
  "Update Preview"
5069
4764
  );
5070
- const shouldUpdate = await confirm9({
4765
+ const shouldUpdate = await confirm8({
5071
4766
  message: "Proceed with update?",
5072
4767
  initialValue: true
5073
4768
  });
5074
- if (isCancel11(shouldUpdate) || !shouldUpdate) {
4769
+ if (isCancel10(shouldUpdate) || !shouldUpdate) {
5075
4770
  outro5("Update cancelled.");
5076
4771
  return;
5077
4772
  }
@@ -5121,13 +4816,13 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
5121
4816
  ``,
5122
4817
  `Your configuration and knowledge files were preserved.`,
5123
4818
  ``,
5124
- pc14.dim(`\u{1F4A1} If using OpenCode, you may need to reload for changes to take effect.`)
4819
+ pc11.dim(`\u{1F4A1} If using OpenCode, you may need to reload for changes to take effect.`)
5125
4820
  );
5126
- note12(summary.join("\n"), "Update Summary");
5127
- outro5(pc14.green("\u2713 Successfully updated from package!"));
4821
+ note9(summary.join("\n"), "Update Summary");
4822
+ outro5(pc11.green("\u2713 Successfully updated from package!"));
5128
4823
  } catch (error) {
5129
4824
  s.stop("Error occurred");
5130
- cancel6(`Failed to update: ${error instanceof Error ? error.message : String(error)}`);
4825
+ cancel5(`Failed to update: ${error instanceof Error ? error.message : String(error)}`);
5131
4826
  process.exit(1);
5132
4827
  }
5133
4828
  }
@@ -5206,27 +4901,20 @@ function resolveAllDataPathsWithCustomGlobal(mode, workspaceName, workspaceRoot,
5206
4901
  return [globalPath];
5207
4902
  }
5208
4903
  }
5209
- var init_update_flow = __esm({
5210
- "src/commands/wizard/update-flow.ts"() {
5211
- "use strict";
5212
- init_paths();
5213
- init_prompts();
5214
- init_utils();
5215
- init_install();
5216
- }
5217
- });
5218
4904
 
5219
4905
  // src/commands/wizard/delete-flow.ts
5220
- import { multiselect as multiselect6, confirm as confirm10, spinner as spinner7, note as note13, cancel as cancel7, isCancel as isCancel12 } from "@clack/prompts";
5221
- import pc15 from "picocolors";
4906
+ import { multiselect as multiselect5, confirm as confirm9, spinner as spinner6, note as note10, cancel as cancel6, isCancel as isCancel11 } from "@clack/prompts";
4907
+ import pc12 from "picocolors";
5222
4908
  import * as fs20 from "fs";
4909
+ init_detection();
4910
+ init_config();
5223
4911
  async function runDeleteGlobalProjectFlow(availableProjects) {
5224
4912
  const globalProjects = availableProjects.filter((p) => p.source === "global");
5225
4913
  if (globalProjects.length === 0) {
5226
- note13("No globally stored projects found to delete.", "Info");
4914
+ note10("No globally stored projects found to delete.", "Info");
5227
4915
  return;
5228
4916
  }
5229
- const selectedProjects = await multiselect6({
4917
+ const selectedProjects = await multiselect5({
5230
4918
  message: "Select global projects to DELETE (Irreversible)",
5231
4919
  options: globalProjects.map((p) => ({
5232
4920
  value: p.name,
@@ -5235,25 +4923,25 @@ async function runDeleteGlobalProjectFlow(availableProjects) {
5235
4923
  })),
5236
4924
  required: false
5237
4925
  });
5238
- if (isCancel12(selectedProjects)) {
5239
- cancel7("Deletion cancelled.");
4926
+ if (isCancel11(selectedProjects)) {
4927
+ cancel6("Deletion cancelled.");
5240
4928
  return;
5241
4929
  }
5242
4930
  const projectsToDelete = selectedProjects;
5243
4931
  if (projectsToDelete.length === 0) {
5244
- note13("No projects selected.", "Cancelled");
4932
+ note10("No projects selected.", "Cancelled");
5245
4933
  return;
5246
4934
  }
5247
- const confirmed = await confirm10({
5248
- message: `${pc15.red("WARNING:")} This will PERMANENTLY DELETE the knowledge/config for ${projectsToDelete.length} detected global projects.
4935
+ const confirmed = await confirm9({
4936
+ message: `${pc12.red("WARNING:")} This will PERMANENTLY DELETE the knowledge/config for ${projectsToDelete.length} detected global projects.
5249
4937
  Are you sure?`,
5250
4938
  initialValue: false
5251
4939
  });
5252
- if (!confirmed || isCancel12(confirmed)) {
5253
- cancel7("Deletion cancelled.");
4940
+ if (!confirmed || isCancel11(confirmed)) {
4941
+ cancel6("Deletion cancelled.");
5254
4942
  return;
5255
4943
  }
5256
- const s = spinner7();
4944
+ const s = spinner6();
5257
4945
  s.start("Deleting projects...");
5258
4946
  try {
5259
4947
  const mcpConfig = loadMCPConfig();
@@ -5274,28 +4962,16 @@ Are you sure?`,
5274
4962
  await new Promise((r) => setTimeout(r, 1e3));
5275
4963
  } catch (error) {
5276
4964
  s.stop("Error occurred during deletion");
5277
- note13(`Failed to delete some projects: ${error}`, "Error");
4965
+ note10(`Failed to delete some projects: ${error}`, "Error");
5278
4966
  }
5279
4967
  }
5280
- var init_delete_flow = __esm({
5281
- "src/commands/wizard/delete-flow.ts"() {
5282
- "use strict";
5283
- init_detection();
5284
- init_config();
5285
- }
5286
- });
5287
4968
 
5288
4969
  // src/commands/wizard/index.ts
5289
- var wizard_exports = {};
5290
- __export(wizard_exports, {
5291
- runWizard: () => runWizard
5292
- });
5293
- import { intro as intro2, select as select5, spinner as spinner8, note as note14, outro as outro7, isCancel as isCancel13 } from "@clack/prompts";
5294
- import pc16 from "picocolors";
5295
- import * as fs21 from "fs";
4970
+ init_mcp();
4971
+ init_config();
5296
4972
  async function runWizard() {
5297
- intro2(pc16.cyan(pc16.inverse(" RRCE-Workflow Setup ")));
5298
- const s = spinner8();
4973
+ intro2(pc13.cyan(pc13.inverse(" RRCE-Workflow Setup ")));
4974
+ const s = spinner7();
5299
4975
  s.start("Detecting environment");
5300
4976
  const workspacePath = detectWorkspaceRoot();
5301
4977
  const workspaceName = getWorkspaceName(workspacePath);
@@ -5310,9 +4986,9 @@ async function runWizard() {
5310
4986
  }
5311
4987
  await new Promise((r) => setTimeout(r, 800));
5312
4988
  s.stop("Environment detected");
5313
- note14(
5314
- `Git User: ${pc16.bold(gitUser || "(not found)")}
5315
- Workspace: ${pc16.bold(workspaceName)}`,
4989
+ note11(
4990
+ `Git User: ${pc13.bold(gitUser || "(not found)")}
4991
+ Workspace: ${pc13.bold(workspaceName)}`,
5316
4992
  "Context"
5317
4993
  );
5318
4994
  const detectedProjects = projectService.scan({
@@ -5377,7 +5053,7 @@ Workspace: ${pc16.bold(workspaceName)}`,
5377
5053
  message: "This workspace is already configured. What would you like to do?",
5378
5054
  options: menuOptions
5379
5055
  });
5380
- if (isCancel13(action) || action === "exit") {
5056
+ if (isCancel12(action) || action === "exit") {
5381
5057
  outro7("Exited.");
5382
5058
  process.exit(0);
5383
5059
  }
@@ -5406,80 +5082,6 @@ Workspace: ${pc16.bold(workspaceName)}`,
5406
5082
  }
5407
5083
  await runSetupFlow(workspacePath, workspaceName, detectedProjects);
5408
5084
  }
5409
- var init_wizard = __esm({
5410
- "src/commands/wizard/index.ts"() {
5411
- "use strict";
5412
- init_git();
5413
- init_paths();
5414
- init_detection_service();
5415
- init_setup_flow();
5416
- init_link_flow();
5417
- init_sync_flow();
5418
- init_update_flow();
5419
- init_delete_flow();
5420
- init_mcp();
5421
- init_config();
5422
- }
5423
- });
5424
-
5425
- // src/index.ts
5426
- init_wizard();
5427
-
5428
- // src/commands/selector.ts
5429
- init_prompts();
5430
- import { intro as intro3, select as select6, note as note15, cancel as cancel9, isCancel as isCancel14, outro as outro8 } from "@clack/prompts";
5431
- import pc17 from "picocolors";
5432
- import * as path20 from "path";
5433
- async function runSelector() {
5434
- const workspaceName = path20.basename(process.cwd());
5435
- intro3(pc17.cyan(pc17.inverse(` RRCE-Workflow | ${workspaceName} `)));
5436
- const prompts = loadPromptsFromDir(getAgentCorePromptsDir());
5437
- if (prompts.length === 0) {
5438
- cancel9("No agents found. Run `rrce-workflow` to set up.");
5439
- process.exit(0);
5440
- }
5441
- const selection = await select6({
5442
- message: "Select an agent:",
5443
- options: [
5444
- {
5445
- value: "mcp",
5446
- label: "\u{1F50C} Manage MCP Hub",
5447
- hint: "Configure & Start MCP Server"
5448
- },
5449
- {
5450
- value: "wizard",
5451
- label: "\u2728 Run Setup Wizard",
5452
- hint: "Configure workspace & agents"
5453
- },
5454
- ...prompts.map((p) => ({
5455
- value: p,
5456
- label: p.frontmatter.name,
5457
- hint: p.frontmatter.description
5458
- }))
5459
- ]
5460
- });
5461
- if (isCancel14(selection)) {
5462
- cancel9("Selection cancelled.");
5463
- process.exit(0);
5464
- }
5465
- if (selection === "mcp") {
5466
- const { runMCP: runMCP2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
5467
- await runMCP2();
5468
- return;
5469
- }
5470
- if (selection === "wizard") {
5471
- const { runWizard: runWizard2 } = await Promise.resolve().then(() => (init_wizard(), wizard_exports));
5472
- await runWizard2();
5473
- return;
5474
- }
5475
- const prompt = selection;
5476
- note15(
5477
- `Use this agent in your IDE by invoking:
5478
- ${pc17.bold(pc17.cyan(`@${prompt.frontmatter.name}`))}`,
5479
- "Agent Selected"
5480
- );
5481
- outro8("Done");
5482
- }
5483
5085
 
5484
5086
  // src/index.ts
5485
5087
  init_mcp();
@@ -5490,5 +5092,7 @@ if (!command || command === "wizard") {
5490
5092
  } else if (command === "mcp") {
5491
5093
  runMCP(subcommand);
5492
5094
  } else {
5493
- runSelector();
5095
+ console.error(`Unknown command: ${command}`);
5096
+ console.error("Usage: rrce-workflow [wizard|mcp]");
5097
+ process.exit(1);
5494
5098
  }