rrce-workflow 0.2.57 → 0.2.59
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 +171 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49,6 +49,27 @@ function getConfigPath(workspaceRoot) {
|
|
|
49
49
|
if (fs.existsSync(legacyPath)) {
|
|
50
50
|
return legacyPath;
|
|
51
51
|
}
|
|
52
|
+
try {
|
|
53
|
+
const rrceHome = getDefaultRRCEHome();
|
|
54
|
+
const mcpConfigPath = path.join(rrceHome, "mcp.yaml");
|
|
55
|
+
if (fs.existsSync(mcpConfigPath)) {
|
|
56
|
+
const mcpContent = fs.readFileSync(mcpConfigPath, "utf-8");
|
|
57
|
+
const lines = mcpContent.split("\n");
|
|
58
|
+
let currentName = "";
|
|
59
|
+
for (let i = 0; i < lines.length; i++) {
|
|
60
|
+
const line = lines[i].trim();
|
|
61
|
+
if (line.startsWith("- name:")) {
|
|
62
|
+
currentName = line.replace("- name:", "").trim();
|
|
63
|
+
} else if (line.startsWith("path:")) {
|
|
64
|
+
const p = line.replace("path:", "").trim();
|
|
65
|
+
if (p === workspaceRoot || p === `"${workspaceRoot}"` || p === `'${workspaceRoot}'`) {
|
|
66
|
+
return path.join(rrceHome, "workspaces", currentName, "config.yaml");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} catch (e) {
|
|
72
|
+
}
|
|
52
73
|
return newPath;
|
|
53
74
|
}
|
|
54
75
|
function getWorkspaceName(workspaceRoot) {
|
|
@@ -1168,7 +1189,13 @@ function installAgentPrompts(config, workspacePath, dataPaths) {
|
|
|
1168
1189
|
}
|
|
1169
1190
|
}
|
|
1170
1191
|
function createWorkspaceConfig(config, workspacePath, workspaceName) {
|
|
1171
|
-
|
|
1192
|
+
let configPath;
|
|
1193
|
+
if (config.storageMode === "global") {
|
|
1194
|
+
const rrceHome = config.globalPath || getDefaultRRCEHome();
|
|
1195
|
+
configPath = path10.join(rrceHome, "workspaces", workspaceName, "config.yaml");
|
|
1196
|
+
} else {
|
|
1197
|
+
configPath = path10.join(workspacePath, ".rrce-workflow", "config.yaml");
|
|
1198
|
+
}
|
|
1172
1199
|
ensureDir(path10.dirname(configPath));
|
|
1173
1200
|
let content = `# RRCE-Workflow Configuration
|
|
1174
1201
|
version: 1
|
|
@@ -1188,6 +1215,12 @@ tools:
|
|
|
1188
1215
|
copilot: ${config.storageMode === "workspace" && config.tools.includes("copilot")}
|
|
1189
1216
|
antigravity: ${config.storageMode === "workspace" && config.tools.includes("antigravity")}
|
|
1190
1217
|
`;
|
|
1218
|
+
if (config.enableRAG) {
|
|
1219
|
+
content += `
|
|
1220
|
+
semantic_search:
|
|
1221
|
+
enabled: true
|
|
1222
|
+
`;
|
|
1223
|
+
}
|
|
1191
1224
|
if (config.linkedProjects.length > 0) {
|
|
1192
1225
|
content += `
|
|
1193
1226
|
linked_projects:
|
|
@@ -1663,6 +1696,10 @@ function getExposedProjects() {
|
|
|
1663
1696
|
}
|
|
1664
1697
|
return [...globalProjects, ...linkedProjects];
|
|
1665
1698
|
}
|
|
1699
|
+
function getRAGIndexPath(project) {
|
|
1700
|
+
const scanRoot = project.path || project.dataPath;
|
|
1701
|
+
return path14.join(project.knowledgePath || path14.join(scanRoot, ".rrce-workflow", "knowledge"), "embeddings.json");
|
|
1702
|
+
}
|
|
1666
1703
|
function detectActiveProject(knownProjects) {
|
|
1667
1704
|
let scanList = knownProjects;
|
|
1668
1705
|
if (!scanList) {
|
|
@@ -3133,10 +3170,93 @@ var init_StatusBoard = __esm({
|
|
|
3133
3170
|
}
|
|
3134
3171
|
});
|
|
3135
3172
|
|
|
3173
|
+
// src/mcp/ui/IndexingStatus.tsx
|
|
3174
|
+
import { useState as useState4, useEffect as useEffect3 } from "react";
|
|
3175
|
+
import { Box as Box9, Text as Text9 } from "ink";
|
|
3176
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3177
|
+
var IndexingStatus;
|
|
3178
|
+
var init_IndexingStatus = __esm({
|
|
3179
|
+
"src/mcp/ui/IndexingStatus.tsx"() {
|
|
3180
|
+
"use strict";
|
|
3181
|
+
init_rag();
|
|
3182
|
+
init_resources();
|
|
3183
|
+
init_config_utils();
|
|
3184
|
+
IndexingStatus = ({ projects, config }) => {
|
|
3185
|
+
const [stats, setStats] = useState4([]);
|
|
3186
|
+
const [loading, setLoading] = useState4(true);
|
|
3187
|
+
useEffect3(() => {
|
|
3188
|
+
const fetchStats = async () => {
|
|
3189
|
+
const newStats = [];
|
|
3190
|
+
for (const project of projects) {
|
|
3191
|
+
const projConfig = findProjectConfig(config, { name: project.name, path: project.path });
|
|
3192
|
+
const enabled = projConfig?.semanticSearch?.enabled ?? false;
|
|
3193
|
+
if (!enabled) {
|
|
3194
|
+
newStats.push({
|
|
3195
|
+
projectName: project.name,
|
|
3196
|
+
enabled: false,
|
|
3197
|
+
totalFiles: 0,
|
|
3198
|
+
totalChunks: 0
|
|
3199
|
+
});
|
|
3200
|
+
continue;
|
|
3201
|
+
}
|
|
3202
|
+
try {
|
|
3203
|
+
const indexPath = getRAGIndexPath(project);
|
|
3204
|
+
const rag = new RAGService(indexPath, "dummy");
|
|
3205
|
+
const s = rag.getStats();
|
|
3206
|
+
newStats.push({
|
|
3207
|
+
projectName: project.name,
|
|
3208
|
+
enabled: true,
|
|
3209
|
+
totalFiles: s.totalFiles,
|
|
3210
|
+
totalChunks: s.totalChunks,
|
|
3211
|
+
lastFullIndex: s.lastFullIndex
|
|
3212
|
+
});
|
|
3213
|
+
} catch (e) {
|
|
3214
|
+
newStats.push({
|
|
3215
|
+
projectName: project.name,
|
|
3216
|
+
enabled: true,
|
|
3217
|
+
totalFiles: 0,
|
|
3218
|
+
totalChunks: 0,
|
|
3219
|
+
error: String(e)
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
setStats(newStats);
|
|
3224
|
+
setLoading(false);
|
|
3225
|
+
};
|
|
3226
|
+
fetchStats();
|
|
3227
|
+
const interval = setInterval(fetchStats, 5e3);
|
|
3228
|
+
return () => clearInterval(interval);
|
|
3229
|
+
}, [projects, config]);
|
|
3230
|
+
if (loading && stats.length === 0) {
|
|
3231
|
+
return /* @__PURE__ */ jsx9(Text9, { children: "Loading indexing status..." });
|
|
3232
|
+
}
|
|
3233
|
+
return /* @__PURE__ */ jsxs8(Box9, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "blue", flexGrow: 1, children: [
|
|
3234
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, color: "blue", children: " RAG Indexing Status " }),
|
|
3235
|
+
/* @__PURE__ */ jsxs8(Box9, { marginTop: 1, flexDirection: "column", children: [
|
|
3236
|
+
/* @__PURE__ */ jsxs8(Box9, { children: [
|
|
3237
|
+
/* @__PURE__ */ jsx9(Box9, { width: 25, children: /* @__PURE__ */ jsx9(Text9, { underline: true, children: "Project" }) }),
|
|
3238
|
+
/* @__PURE__ */ jsx9(Box9, { width: 15, children: /* @__PURE__ */ jsx9(Text9, { underline: true, children: "Status" }) }),
|
|
3239
|
+
/* @__PURE__ */ jsx9(Box9, { width: 15, children: /* @__PURE__ */ jsx9(Text9, { underline: true, children: "Indexed Files" }) }),
|
|
3240
|
+
/* @__PURE__ */ jsx9(Box9, { width: 15, children: /* @__PURE__ */ jsx9(Text9, { underline: true, children: "Total Chunks" }) }),
|
|
3241
|
+
/* @__PURE__ */ jsx9(Box9, { children: /* @__PURE__ */ jsx9(Text9, { underline: true, children: "Last Index" }) })
|
|
3242
|
+
] }),
|
|
3243
|
+
stats.length === 0 ? /* @__PURE__ */ jsx9(Text9, { color: "dim", children: "No exposed projects found." }) : stats.map((s) => /* @__PURE__ */ jsxs8(Box9, { marginTop: 0, children: [
|
|
3244
|
+
/* @__PURE__ */ jsx9(Box9, { width: 25, children: /* @__PURE__ */ jsx9(Text9, { color: "white", children: s.projectName }) }),
|
|
3245
|
+
/* @__PURE__ */ jsx9(Box9, { width: 15, children: /* @__PURE__ */ jsx9(Text9, { color: s.enabled ? "green" : "dim", children: s.enabled ? "Enabled" : "Disabled" }) }),
|
|
3246
|
+
/* @__PURE__ */ jsx9(Box9, { width: 15, children: /* @__PURE__ */ jsx9(Text9, { children: s.enabled ? s.totalFiles : "-" }) }),
|
|
3247
|
+
/* @__PURE__ */ jsx9(Box9, { width: 15, children: /* @__PURE__ */ jsx9(Text9, { children: s.enabled ? s.totalChunks : "-" }) }),
|
|
3248
|
+
/* @__PURE__ */ jsx9(Box9, { children: /* @__PURE__ */ jsx9(Text9, { children: s.lastFullIndex ? new Date(s.lastFullIndex).toLocaleTimeString() : "-" }) })
|
|
3249
|
+
] }, s.projectName))
|
|
3250
|
+
] })
|
|
3251
|
+
] });
|
|
3252
|
+
};
|
|
3253
|
+
}
|
|
3254
|
+
});
|
|
3255
|
+
|
|
3136
3256
|
// src/mcp/ui/components/TabBar.tsx
|
|
3137
3257
|
import "react";
|
|
3138
|
-
import { Box as
|
|
3139
|
-
import { jsx as
|
|
3258
|
+
import { Box as Box10, Text as Text10, useInput as useInput2 } from "ink";
|
|
3259
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3140
3260
|
var TabBar;
|
|
3141
3261
|
var init_TabBar = __esm({
|
|
3142
3262
|
"src/mcp/ui/components/TabBar.tsx"() {
|
|
@@ -3163,11 +3283,11 @@ var init_TabBar = __esm({
|
|
|
3163
3283
|
if (tab) onChange(tab.id);
|
|
3164
3284
|
}
|
|
3165
3285
|
});
|
|
3166
|
-
return /* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ jsxs9(Box10, { borderStyle: "single", paddingX: 1, borderColor: "gray", children: [
|
|
3167
3287
|
tabs.map((tab, index) => {
|
|
3168
3288
|
const isActive = tab.id === activeTab;
|
|
3169
|
-
return /* @__PURE__ */
|
|
3170
|
-
|
|
3289
|
+
return /* @__PURE__ */ jsx10(Box10, { marginRight: 2, children: /* @__PURE__ */ jsx10(
|
|
3290
|
+
Text10,
|
|
3171
3291
|
{
|
|
3172
3292
|
color: isActive ? "cyan" : "white",
|
|
3173
3293
|
bold: isActive,
|
|
@@ -3176,8 +3296,8 @@ var init_TabBar = __esm({
|
|
|
3176
3296
|
}
|
|
3177
3297
|
) }, tab.id);
|
|
3178
3298
|
}),
|
|
3179
|
-
/* @__PURE__ */
|
|
3180
|
-
/* @__PURE__ */
|
|
3299
|
+
/* @__PURE__ */ jsx10(Box10, { flexGrow: 1 }),
|
|
3300
|
+
/* @__PURE__ */ jsx10(Text10, { color: "dim", children: "Use \u25C4/\u25BA arrows to navigate" })
|
|
3181
3301
|
] });
|
|
3182
3302
|
};
|
|
3183
3303
|
}
|
|
@@ -3188,11 +3308,11 @@ var App_exports = {};
|
|
|
3188
3308
|
__export(App_exports, {
|
|
3189
3309
|
App: () => App
|
|
3190
3310
|
});
|
|
3191
|
-
import { useState as
|
|
3192
|
-
import { Box as
|
|
3311
|
+
import { useState as useState5, useEffect as useEffect4, useMemo as useMemo2, useCallback } from "react";
|
|
3312
|
+
import { Box as Box11, useInput as useInput3, useApp } from "ink";
|
|
3193
3313
|
import fs15 from "fs";
|
|
3194
|
-
import { jsx as
|
|
3195
|
-
var
|
|
3314
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3315
|
+
var App;
|
|
3196
3316
|
var init_App = __esm({
|
|
3197
3317
|
"src/mcp/ui/App.tsx"() {
|
|
3198
3318
|
"use strict";
|
|
@@ -3201,6 +3321,7 @@ var init_App = __esm({
|
|
|
3201
3321
|
init_InstallView();
|
|
3202
3322
|
init_LogViewer();
|
|
3203
3323
|
init_StatusBoard();
|
|
3324
|
+
init_IndexingStatus();
|
|
3204
3325
|
init_TabBar();
|
|
3205
3326
|
init_config();
|
|
3206
3327
|
init_config_utils();
|
|
@@ -3209,23 +3330,17 @@ var init_App = __esm({
|
|
|
3209
3330
|
init_server();
|
|
3210
3331
|
init_install();
|
|
3211
3332
|
init_paths();
|
|
3212
|
-
TABS = [
|
|
3213
|
-
{ id: "overview", label: "Overview" },
|
|
3214
|
-
{ id: "logs", label: "Logs" },
|
|
3215
|
-
{ id: "projects", label: "Projects" },
|
|
3216
|
-
{ id: "install", label: "Install" }
|
|
3217
|
-
];
|
|
3218
3333
|
App = ({ onExit, initialPort }) => {
|
|
3219
3334
|
const { exit } = useApp();
|
|
3220
|
-
const [activeTab, setActiveTab] =
|
|
3221
|
-
const [logs, setLogs] =
|
|
3222
|
-
const [serverInfo, setServerInfo] =
|
|
3335
|
+
const [activeTab, setActiveTab] = useState5("overview");
|
|
3336
|
+
const [logs, setLogs] = useState5([]);
|
|
3337
|
+
const [serverInfo, setServerInfo] = useState5({
|
|
3223
3338
|
port: initialPort,
|
|
3224
3339
|
pid: process.pid,
|
|
3225
3340
|
running: false
|
|
3226
3341
|
});
|
|
3227
|
-
const [config, setConfig] =
|
|
3228
|
-
const [projects, setProjects] =
|
|
3342
|
+
const [config, setConfig] = useState5(() => loadMCPConfig());
|
|
3343
|
+
const [projects, setProjects] = useState5(() => scanForProjects());
|
|
3229
3344
|
const refreshData = useCallback(() => {
|
|
3230
3345
|
setConfig(loadMCPConfig());
|
|
3231
3346
|
setProjects(scanForProjects());
|
|
@@ -3239,6 +3354,24 @@ var init_App = __esm({
|
|
|
3239
3354
|
}),
|
|
3240
3355
|
[projects, config]
|
|
3241
3356
|
);
|
|
3357
|
+
const isRAGEnabled = useMemo2(() => {
|
|
3358
|
+
return exposedProjects.some((p) => {
|
|
3359
|
+
const cfg = findProjectConfig(config, { name: p.name, path: p.path });
|
|
3360
|
+
return cfg?.semanticSearch?.enabled;
|
|
3361
|
+
});
|
|
3362
|
+
}, [exposedProjects, config]);
|
|
3363
|
+
const tabs = useMemo2(() => {
|
|
3364
|
+
const baseTabs = [
|
|
3365
|
+
{ id: "overview", label: "Overview" },
|
|
3366
|
+
{ id: "logs", label: "Logs" },
|
|
3367
|
+
{ id: "projects", label: "Projects" },
|
|
3368
|
+
{ id: "install", label: "Install" }
|
|
3369
|
+
];
|
|
3370
|
+
if (isRAGEnabled) {
|
|
3371
|
+
baseTabs.splice(3, 0, { id: "indexing", label: "Indexing" });
|
|
3372
|
+
}
|
|
3373
|
+
return baseTabs;
|
|
3374
|
+
}, [isRAGEnabled]);
|
|
3242
3375
|
const workspacePath = detectWorkspaceRoot();
|
|
3243
3376
|
const installStatus = checkInstallStatus(workspacePath);
|
|
3244
3377
|
const installedCount = [
|
|
@@ -3247,7 +3380,7 @@ var init_App = __esm({
|
|
|
3247
3380
|
installStatus.vscodeGlobal,
|
|
3248
3381
|
installStatus.vscodeWorkspace
|
|
3249
3382
|
].filter(Boolean).length;
|
|
3250
|
-
|
|
3383
|
+
useEffect4(() => {
|
|
3251
3384
|
const start = async () => {
|
|
3252
3385
|
const status = getMCPServerStatus();
|
|
3253
3386
|
if (!status.running) {
|
|
@@ -3263,7 +3396,7 @@ var init_App = __esm({
|
|
|
3263
3396
|
};
|
|
3264
3397
|
start();
|
|
3265
3398
|
}, []);
|
|
3266
|
-
|
|
3399
|
+
useEffect4(() => {
|
|
3267
3400
|
const logPath = getLogFilePath();
|
|
3268
3401
|
let lastSize = 0;
|
|
3269
3402
|
if (fs15.existsSync(logPath)) {
|
|
@@ -3314,10 +3447,10 @@ var init_App = __esm({
|
|
|
3314
3447
|
const handleConfigChange = useCallback(() => {
|
|
3315
3448
|
refreshData();
|
|
3316
3449
|
}, [refreshData]);
|
|
3317
|
-
return /* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
/* @__PURE__ */
|
|
3320
|
-
activeTab === "overview" && /* @__PURE__ */
|
|
3450
|
+
return /* @__PURE__ */ jsxs10(Box11, { flexDirection: "column", padding: 0, height: termHeight, children: [
|
|
3451
|
+
/* @__PURE__ */ jsx11(TabBar, { tabs, activeTab, onChange: setActiveTab }),
|
|
3452
|
+
/* @__PURE__ */ jsxs10(Box11, { marginTop: 1, flexGrow: 1, children: [
|
|
3453
|
+
activeTab === "overview" && /* @__PURE__ */ jsx11(
|
|
3321
3454
|
Overview,
|
|
3322
3455
|
{
|
|
3323
3456
|
serverStatus: serverInfo,
|
|
@@ -3328,11 +3461,12 @@ var init_App = __esm({
|
|
|
3328
3461
|
}
|
|
3329
3462
|
}
|
|
3330
3463
|
),
|
|
3331
|
-
activeTab === "projects" && /* @__PURE__ */
|
|
3332
|
-
activeTab === "
|
|
3333
|
-
activeTab === "
|
|
3464
|
+
activeTab === "projects" && /* @__PURE__ */ jsx11(ProjectsView, { config, projects, onConfigChange: handleConfigChange }),
|
|
3465
|
+
activeTab === "indexing" && /* @__PURE__ */ jsx11(IndexingStatus, { config, projects: exposedProjects }),
|
|
3466
|
+
activeTab === "install" && /* @__PURE__ */ jsx11(InstallView, {}),
|
|
3467
|
+
activeTab === "logs" && /* @__PURE__ */ jsx11(LogViewer, { logs, height: contentHeight })
|
|
3334
3468
|
] }),
|
|
3335
|
-
/* @__PURE__ */
|
|
3469
|
+
/* @__PURE__ */ jsx11(Box11, { marginTop: 0, children: /* @__PURE__ */ jsx11(
|
|
3336
3470
|
StatusBoard,
|
|
3337
3471
|
{
|
|
3338
3472
|
exposedLabel: `${exposedProjects.length} / ${projects.length} projects`,
|
|
@@ -3349,7 +3483,7 @@ var init_App = __esm({
|
|
|
3349
3483
|
// src/mcp/commands/start.ts
|
|
3350
3484
|
import { confirm as confirm3, isCancel as isCancel5, text } from "@clack/prompts";
|
|
3351
3485
|
async function handleStartServer() {
|
|
3352
|
-
const
|
|
3486
|
+
const React12 = await import("react");
|
|
3353
3487
|
const { render } = await import("ink");
|
|
3354
3488
|
const { App: App2 } = await Promise.resolve().then(() => (init_App(), App_exports));
|
|
3355
3489
|
const config = loadMCPConfig();
|
|
@@ -3390,7 +3524,7 @@ async function handleStartServer() {
|
|
|
3390
3524
|
}
|
|
3391
3525
|
}
|
|
3392
3526
|
process.stdin.resume();
|
|
3393
|
-
const app = render(
|
|
3527
|
+
const app = render(React12.createElement(App2, {
|
|
3394
3528
|
initialPort,
|
|
3395
3529
|
onExit: () => {
|
|
3396
3530
|
}
|
|
@@ -3745,7 +3879,8 @@ async function executeSetup(config, workspacePath, workspaceName, allProjects, s
|
|
|
3745
3879
|
const { updateGitignore: updateGitignore2 } = await Promise.resolve().then(() => (init_gitignore(), gitignore_exports));
|
|
3746
3880
|
updateGitignore2(workspacePath, config.storageMode, config.tools);
|
|
3747
3881
|
}
|
|
3748
|
-
|
|
3882
|
+
const needsVSCodeWorkspace = config.storageMode === "workspace" && config.tools.includes("copilot") || config.linkedProjects.length > 0;
|
|
3883
|
+
if (needsVSCodeWorkspace) {
|
|
3749
3884
|
const selectedProjects = allProjects.filter(
|
|
3750
3885
|
(p) => config.linkedProjects.includes(`${p.name}:${p.source}`)
|
|
3751
3886
|
);
|