rrce-workflow 0.3.23 → 0.3.25
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/agent-core/prompts/orchestrator.md +5 -0
- package/dist/index.js +151 -125
- package/package.json +1 -1
|
@@ -13,6 +13,11 @@ optional-args:
|
|
|
13
13
|
auto-identity:
|
|
14
14
|
user: "$GIT_USER"
|
|
15
15
|
model: "$AGENT_MODEL"
|
|
16
|
+
permission:
|
|
17
|
+
read: allow
|
|
18
|
+
write: allow
|
|
19
|
+
edit: allow
|
|
20
|
+
bash: allow
|
|
16
21
|
---
|
|
17
22
|
|
|
18
23
|
You are the RRCE Phase Coordinator. Guide users through workflow phases with minimal token overhead.
|
package/dist/index.js
CHANGED
|
@@ -576,7 +576,7 @@ var init_detection_service = __esm({
|
|
|
576
576
|
|
|
577
577
|
// src/types/prompt.ts
|
|
578
578
|
import { z } from "zod";
|
|
579
|
-
var PromptArgSchema, AutoIdentitySchema, PromptFrontmatterSchema;
|
|
579
|
+
var PromptArgSchema, AutoIdentitySchema, PermissionSchema, PromptFrontmatterSchema;
|
|
580
580
|
var init_prompt = __esm({
|
|
581
581
|
"src/types/prompt.ts"() {
|
|
582
582
|
"use strict";
|
|
@@ -589,6 +589,13 @@ var init_prompt = __esm({
|
|
|
589
589
|
user: z.string(),
|
|
590
590
|
model: z.string()
|
|
591
591
|
});
|
|
592
|
+
PermissionSchema = z.object({
|
|
593
|
+
read: z.union([z.literal("allow"), z.literal("ask"), z.literal("deny")]).optional(),
|
|
594
|
+
write: z.union([z.literal("allow"), z.literal("ask"), z.literal("deny")]).optional(),
|
|
595
|
+
edit: z.union([z.literal("allow"), z.literal("ask"), z.literal("deny")]).optional(),
|
|
596
|
+
bash: z.union([z.literal("allow"), z.literal("ask"), z.literal("deny")]).optional(),
|
|
597
|
+
webfetch: z.union([z.literal("allow"), z.literal("ask"), z.literal("deny")]).optional()
|
|
598
|
+
}).passthrough();
|
|
592
599
|
PromptFrontmatterSchema = z.object({
|
|
593
600
|
name: z.string(),
|
|
594
601
|
description: z.string(),
|
|
@@ -597,7 +604,8 @@ var init_prompt = __esm({
|
|
|
597
604
|
mode: z.enum(["primary", "subagent"]).optional(),
|
|
598
605
|
"required-args": z.array(PromptArgSchema).optional(),
|
|
599
606
|
"optional-args": z.array(PromptArgSchema).optional(),
|
|
600
|
-
"auto-identity": AutoIdentitySchema.optional()
|
|
607
|
+
"auto-identity": AutoIdentitySchema.optional(),
|
|
608
|
+
permission: PermissionSchema.optional()
|
|
601
609
|
});
|
|
602
610
|
}
|
|
603
611
|
});
|
|
@@ -1177,12 +1185,16 @@ function convertToOpenCodeAgent(prompt, useFileReference = false, promptFilePath
|
|
|
1177
1185
|
tools["webfetch"] = true;
|
|
1178
1186
|
const mode = frontmatter.mode || "subagent";
|
|
1179
1187
|
const invocationHint = mode === "primary" ? "" : " (Invoke via @rrce_*)";
|
|
1180
|
-
|
|
1188
|
+
const agentConfig = {
|
|
1181
1189
|
description: `${frontmatter.description}${invocationHint}`,
|
|
1182
1190
|
mode,
|
|
1183
1191
|
prompt: useFileReference && promptFilePath ? `{file:${promptFilePath}}` : content,
|
|
1184
1192
|
tools
|
|
1185
1193
|
};
|
|
1194
|
+
if (frontmatter.permission) {
|
|
1195
|
+
agentConfig.permission = frontmatter.permission;
|
|
1196
|
+
}
|
|
1197
|
+
return agentConfig;
|
|
1186
1198
|
}
|
|
1187
1199
|
function surgicalUpdateOpenCodeAgents(prompts, mode, dataPath) {
|
|
1188
1200
|
const agentPrompts = prompts.filter((p) => {
|
|
@@ -1801,6 +1813,7 @@ var init_utils2 = __esm({
|
|
|
1801
1813
|
|
|
1802
1814
|
// src/mcp/resources/paths.ts
|
|
1803
1815
|
import * as fs15 from "fs";
|
|
1816
|
+
import * as path17 from "path";
|
|
1804
1817
|
function resolveProjectPaths(project, pathInput) {
|
|
1805
1818
|
const config = loadMCPConfig();
|
|
1806
1819
|
let workspaceRoot = pathInput;
|
|
@@ -1811,6 +1824,19 @@ function resolveProjectPaths(project, pathInput) {
|
|
|
1811
1824
|
workspaceRoot = projConfig.path;
|
|
1812
1825
|
}
|
|
1813
1826
|
}
|
|
1827
|
+
if (workspaceRoot && workspaceRoot.includes("/workspaces/")) {
|
|
1828
|
+
try {
|
|
1829
|
+
const workspaceConfigPath = path17.join(workspaceRoot, "config.yaml");
|
|
1830
|
+
if (fs15.existsSync(workspaceConfigPath)) {
|
|
1831
|
+
const content = fs15.readFileSync(workspaceConfigPath, "utf-8");
|
|
1832
|
+
const sourcePathMatch = content.match(/sourcePath:\s*["']?([^"'\n\r]+)/);
|
|
1833
|
+
if (sourcePathMatch?.[1]) {
|
|
1834
|
+
workspaceRoot = sourcePathMatch[1].trim();
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
} catch (err) {
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1814
1840
|
if (!workspaceName && workspaceRoot) {
|
|
1815
1841
|
const projConfig = findProjectConfig(config, { path: workspaceRoot });
|
|
1816
1842
|
workspaceName = projConfig?.name || getWorkspaceName(workspaceRoot);
|
|
@@ -1858,7 +1884,7 @@ var init_paths2 = __esm({
|
|
|
1858
1884
|
|
|
1859
1885
|
// src/mcp/resources/projects.ts
|
|
1860
1886
|
import * as fs16 from "fs";
|
|
1861
|
-
import * as
|
|
1887
|
+
import * as path18 from "path";
|
|
1862
1888
|
function getExposedProjects() {
|
|
1863
1889
|
const config = loadMCPConfig();
|
|
1864
1890
|
const knownProjects = config.projects.filter((p) => !!p.path).map((p) => ({ name: p.name, path: p.path }));
|
|
@@ -1867,10 +1893,10 @@ function getExposedProjects() {
|
|
|
1867
1893
|
const potentialProjects = [...allProjects];
|
|
1868
1894
|
if (activeProject) {
|
|
1869
1895
|
let cfgContent = null;
|
|
1870
|
-
if (fs16.existsSync(
|
|
1871
|
-
cfgContent = fs16.readFileSync(
|
|
1872
|
-
} else if (fs16.existsSync(
|
|
1873
|
-
cfgContent = fs16.readFileSync(
|
|
1896
|
+
if (fs16.existsSync(path18.join(activeProject.dataPath, ".rrce-workflow", "config.yaml"))) {
|
|
1897
|
+
cfgContent = fs16.readFileSync(path18.join(activeProject.dataPath, ".rrce-workflow", "config.yaml"), "utf-8");
|
|
1898
|
+
} else if (fs16.existsSync(path18.join(activeProject.dataPath, ".rrce-workflow.yaml"))) {
|
|
1899
|
+
cfgContent = fs16.readFileSync(path18.join(activeProject.dataPath, ".rrce-workflow.yaml"), "utf-8");
|
|
1874
1900
|
}
|
|
1875
1901
|
if (cfgContent) {
|
|
1876
1902
|
if (cfgContent.includes("linked_projects:")) {
|
|
@@ -1928,7 +1954,7 @@ function getProjectContext(projectName) {
|
|
|
1928
1954
|
if (!project.knowledgePath) {
|
|
1929
1955
|
return null;
|
|
1930
1956
|
}
|
|
1931
|
-
const contextPath =
|
|
1957
|
+
const contextPath = path18.join(project.knowledgePath, "project-context.md");
|
|
1932
1958
|
if (!fs16.existsSync(contextPath)) {
|
|
1933
1959
|
return null;
|
|
1934
1960
|
}
|
|
@@ -1936,7 +1962,7 @@ function getProjectContext(projectName) {
|
|
|
1936
1962
|
}
|
|
1937
1963
|
function getCodeIndexPath(project) {
|
|
1938
1964
|
const scanRoot = project.path || project.dataPath;
|
|
1939
|
-
return
|
|
1965
|
+
return path18.join(project.knowledgePath || path18.join(scanRoot, ".rrce-workflow", "knowledge"), "code-embeddings.json");
|
|
1940
1966
|
}
|
|
1941
1967
|
var init_projects = __esm({
|
|
1942
1968
|
"src/mcp/resources/projects.ts"() {
|
|
@@ -1950,7 +1976,7 @@ var init_projects = __esm({
|
|
|
1950
1976
|
|
|
1951
1977
|
// src/mcp/resources/tasks.ts
|
|
1952
1978
|
import * as fs17 from "fs";
|
|
1953
|
-
import * as
|
|
1979
|
+
import * as path19 from "path";
|
|
1954
1980
|
import * as os3 from "os";
|
|
1955
1981
|
import * as crypto from "crypto";
|
|
1956
1982
|
function getProjectTasks(projectName) {
|
|
@@ -1972,7 +1998,7 @@ function getProjectTasks(projectName) {
|
|
|
1972
1998
|
const taskDirs = fs17.readdirSync(project.tasksPath, { withFileTypes: true });
|
|
1973
1999
|
for (const dir of taskDirs) {
|
|
1974
2000
|
if (!dir.isDirectory()) continue;
|
|
1975
|
-
const metaPath =
|
|
2001
|
+
const metaPath = path19.join(project.tasksPath, dir.name, "meta.json");
|
|
1976
2002
|
if (fs17.existsSync(metaPath)) {
|
|
1977
2003
|
try {
|
|
1978
2004
|
const meta = JSON.parse(fs17.readFileSync(metaPath, "utf-8"));
|
|
@@ -1992,7 +2018,7 @@ function getTask(projectName, taskSlug) {
|
|
|
1992
2018
|
const projects = projectService.scan();
|
|
1993
2019
|
const project = projects.find((p) => p.name === projectName && isProjectExposed(config, p.name, p.sourcePath || p.path));
|
|
1994
2020
|
if (!project || !project.tasksPath) return null;
|
|
1995
|
-
const metaPath =
|
|
2021
|
+
const metaPath = path19.join(project.tasksPath, taskSlug, "meta.json");
|
|
1996
2022
|
if (!fs17.existsSync(metaPath)) return null;
|
|
1997
2023
|
try {
|
|
1998
2024
|
return JSON.parse(fs17.readFileSync(metaPath, "utf-8"));
|
|
@@ -2008,17 +2034,17 @@ async function createTask(projectName, taskSlug, taskData) {
|
|
|
2008
2034
|
if (!project || !project.tasksPath) {
|
|
2009
2035
|
throw new Error(`Project '${projectName}' not found or not configured with a tasks path.`);
|
|
2010
2036
|
}
|
|
2011
|
-
const taskDir =
|
|
2037
|
+
const taskDir = path19.join(project.tasksPath, taskSlug);
|
|
2012
2038
|
if (fs17.existsSync(taskDir)) {
|
|
2013
2039
|
throw new Error(`Task with slug '${taskSlug}' already exists.`);
|
|
2014
2040
|
}
|
|
2015
2041
|
fs17.mkdirSync(taskDir, { recursive: true });
|
|
2016
|
-
fs17.mkdirSync(
|
|
2017
|
-
fs17.mkdirSync(
|
|
2018
|
-
fs17.mkdirSync(
|
|
2019
|
-
fs17.mkdirSync(
|
|
2020
|
-
const rrceHome = process.env.RRCE_HOME ||
|
|
2021
|
-
const templatePath =
|
|
2042
|
+
fs17.mkdirSync(path19.join(taskDir, "research"), { recursive: true });
|
|
2043
|
+
fs17.mkdirSync(path19.join(taskDir, "planning"), { recursive: true });
|
|
2044
|
+
fs17.mkdirSync(path19.join(taskDir, "execution"), { recursive: true });
|
|
2045
|
+
fs17.mkdirSync(path19.join(taskDir, "docs"), { recursive: true });
|
|
2046
|
+
const rrceHome = process.env.RRCE_HOME || path19.join(os3.homedir(), ".rrce-workflow");
|
|
2047
|
+
const templatePath = path19.join(rrceHome, "templates", "meta.template.json");
|
|
2022
2048
|
let meta = {
|
|
2023
2049
|
task_id: crypto.randomUUID(),
|
|
2024
2050
|
task_slug: taskSlug,
|
|
@@ -2041,7 +2067,7 @@ async function createTask(projectName, taskSlug, taskData) {
|
|
|
2041
2067
|
hash: project.name
|
|
2042
2068
|
};
|
|
2043
2069
|
Object.assign(meta, taskData);
|
|
2044
|
-
const metaPath =
|
|
2070
|
+
const metaPath = path19.join(taskDir, "meta.json");
|
|
2045
2071
|
fs17.writeFileSync(metaPath, JSON.stringify(meta, null, 2));
|
|
2046
2072
|
return meta;
|
|
2047
2073
|
}
|
|
@@ -2061,7 +2087,7 @@ async function updateTask(projectName, taskSlug, taskData) {
|
|
|
2061
2087
|
const projects = projectService.scan();
|
|
2062
2088
|
const project = projects.find((p) => p.name === projectName && isProjectExposed(config, p.name, p.sourcePath || p.path));
|
|
2063
2089
|
if (!project || !project.tasksPath) return null;
|
|
2064
|
-
const metaPath =
|
|
2090
|
+
const metaPath = path19.join(project.tasksPath, taskSlug, "meta.json");
|
|
2065
2091
|
fs17.writeFileSync(metaPath, JSON.stringify(updatedMeta, null, 2));
|
|
2066
2092
|
return updatedMeta;
|
|
2067
2093
|
}
|
|
@@ -2070,7 +2096,7 @@ function deleteTask(projectName, taskSlug) {
|
|
|
2070
2096
|
const projects = projectService.scan();
|
|
2071
2097
|
const project = projects.find((p) => p.name === projectName && isProjectExposed(config, p.name, p.sourcePath || p.path));
|
|
2072
2098
|
if (!project || !project.tasksPath) return false;
|
|
2073
|
-
const taskDir =
|
|
2099
|
+
const taskDir = path19.join(project.tasksPath, taskSlug);
|
|
2074
2100
|
if (!fs17.existsSync(taskDir)) return false;
|
|
2075
2101
|
if (fs17.rmSync) {
|
|
2076
2102
|
fs17.rmSync(taskDir, { recursive: true, force: true });
|
|
@@ -2090,7 +2116,7 @@ var init_tasks = __esm({
|
|
|
2090
2116
|
|
|
2091
2117
|
// src/mcp/services/rag.ts
|
|
2092
2118
|
import * as fs18 from "fs";
|
|
2093
|
-
import * as
|
|
2119
|
+
import * as path20 from "path";
|
|
2094
2120
|
var INDEX_VERSION, DEFAULT_MODEL, RAGService;
|
|
2095
2121
|
var init_rag = __esm({
|
|
2096
2122
|
"src/mcp/services/rag.ts"() {
|
|
@@ -2172,7 +2198,7 @@ var init_rag = __esm({
|
|
|
2172
2198
|
saveIndex() {
|
|
2173
2199
|
if (!this.index) return;
|
|
2174
2200
|
try {
|
|
2175
|
-
const dir =
|
|
2201
|
+
const dir = path20.dirname(this.indexPath);
|
|
2176
2202
|
if (!fs18.existsSync(dir)) {
|
|
2177
2203
|
fs18.mkdirSync(dir, { recursive: true });
|
|
2178
2204
|
}
|
|
@@ -2187,7 +2213,7 @@ var init_rag = __esm({
|
|
|
2187
2213
|
*/
|
|
2188
2214
|
saveIndexAtomic() {
|
|
2189
2215
|
if (!this.index) return;
|
|
2190
|
-
const dir =
|
|
2216
|
+
const dir = path20.dirname(this.indexPath);
|
|
2191
2217
|
if (!fs18.existsSync(dir)) {
|
|
2192
2218
|
fs18.mkdirSync(dir, { recursive: true });
|
|
2193
2219
|
}
|
|
@@ -2727,9 +2753,9 @@ var init_context_extractor = __esm({
|
|
|
2727
2753
|
|
|
2728
2754
|
// src/mcp/services/dependency-graph.ts
|
|
2729
2755
|
import * as fs19 from "fs";
|
|
2730
|
-
import * as
|
|
2756
|
+
import * as path21 from "path";
|
|
2731
2757
|
function parseImports(filePath, content) {
|
|
2732
|
-
const ext =
|
|
2758
|
+
const ext = path21.extname(filePath).toLowerCase();
|
|
2733
2759
|
const language = getLanguageFromExtension(ext);
|
|
2734
2760
|
const edges = [];
|
|
2735
2761
|
const patterns = IMPORT_PATTERNS[language] || IMPORT_PATTERNS.javascript || [];
|
|
@@ -2759,15 +2785,15 @@ function parseImports(filePath, content) {
|
|
|
2759
2785
|
return edges;
|
|
2760
2786
|
}
|
|
2761
2787
|
function resolveImport(fromFile, importPath, language) {
|
|
2762
|
-
const fromDir =
|
|
2788
|
+
const fromDir = path21.dirname(fromFile);
|
|
2763
2789
|
if (importPath.startsWith(".")) {
|
|
2764
|
-
const candidates = generateCandidates(
|
|
2790
|
+
const candidates = generateCandidates(path21.resolve(fromDir, importPath), language);
|
|
2765
2791
|
for (const candidate of candidates) {
|
|
2766
2792
|
if (fs19.existsSync(candidate)) {
|
|
2767
2793
|
return { path: candidate, isResolved: true };
|
|
2768
2794
|
}
|
|
2769
2795
|
}
|
|
2770
|
-
return { path:
|
|
2796
|
+
return { path: path21.resolve(fromDir, importPath), isResolved: false };
|
|
2771
2797
|
}
|
|
2772
2798
|
if (importPath.startsWith("/")) {
|
|
2773
2799
|
const candidates = generateCandidates(importPath, language);
|
|
@@ -2782,7 +2808,7 @@ function resolveImport(fromFile, importPath, language) {
|
|
|
2782
2808
|
}
|
|
2783
2809
|
function generateCandidates(basePath, language) {
|
|
2784
2810
|
const candidates = [];
|
|
2785
|
-
if (
|
|
2811
|
+
if (path21.extname(basePath)) {
|
|
2786
2812
|
candidates.push(basePath);
|
|
2787
2813
|
}
|
|
2788
2814
|
switch (language) {
|
|
@@ -2899,13 +2925,13 @@ async function scanProjectDependencies(projectRoot, options = {}) {
|
|
|
2899
2925
|
try {
|
|
2900
2926
|
const entries = fs19.readdirSync(dir, { withFileTypes: true });
|
|
2901
2927
|
for (const entry of entries) {
|
|
2902
|
-
const fullPath =
|
|
2928
|
+
const fullPath = path21.join(dir, entry.name);
|
|
2903
2929
|
if (entry.isDirectory()) {
|
|
2904
2930
|
if (!skipDirs.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
2905
2931
|
scanDir(fullPath);
|
|
2906
2932
|
}
|
|
2907
2933
|
} else if (entry.isFile()) {
|
|
2908
|
-
const ext =
|
|
2934
|
+
const ext = path21.extname(entry.name).toLowerCase();
|
|
2909
2935
|
if (extensions.includes(ext)) {
|
|
2910
2936
|
try {
|
|
2911
2937
|
const content = fs19.readFileSync(fullPath, "utf-8");
|
|
@@ -3251,7 +3277,7 @@ var init_search_utils = __esm({
|
|
|
3251
3277
|
|
|
3252
3278
|
// src/mcp/resources/search.ts
|
|
3253
3279
|
import * as fs20 from "fs";
|
|
3254
|
-
import * as
|
|
3280
|
+
import * as path22 from "path";
|
|
3255
3281
|
async function searchCode(query, projectFilter, limit = 10, options) {
|
|
3256
3282
|
const config = loadMCPConfig();
|
|
3257
3283
|
const projects = getExposedProjects();
|
|
@@ -3279,7 +3305,7 @@ async function searchCode(query, projectFilter, limit = 10, options) {
|
|
|
3279
3305
|
const codeChunk = r;
|
|
3280
3306
|
results.push({
|
|
3281
3307
|
project: project.name,
|
|
3282
|
-
file:
|
|
3308
|
+
file: path22.relative(project.sourcePath || project.path || "", codeChunk.filePath),
|
|
3283
3309
|
snippet: codeChunk.content,
|
|
3284
3310
|
lineStart: codeChunk.lineStart ?? 1,
|
|
3285
3311
|
lineEnd: codeChunk.lineEnd ?? 1,
|
|
@@ -3339,13 +3365,13 @@ async function searchKnowledge(query, projectFilter, options) {
|
|
|
3339
3365
|
const useRAG = projConfig?.semanticSearch?.enabled;
|
|
3340
3366
|
if (useRAG) {
|
|
3341
3367
|
try {
|
|
3342
|
-
const indexPath =
|
|
3368
|
+
const indexPath = path22.join(project.knowledgePath, "embeddings.json");
|
|
3343
3369
|
const rag = new RAGService(indexPath, projConfig?.semanticSearch?.model);
|
|
3344
3370
|
const ragResults = await rag.search(query, 5);
|
|
3345
3371
|
for (const r of ragResults) {
|
|
3346
3372
|
results.push({
|
|
3347
3373
|
project: project.name,
|
|
3348
|
-
file:
|
|
3374
|
+
file: path22.relative(project.knowledgePath, r.filePath),
|
|
3349
3375
|
matches: [r.content],
|
|
3350
3376
|
score: r.score
|
|
3351
3377
|
});
|
|
@@ -3359,7 +3385,7 @@ async function searchKnowledge(query, projectFilter, options) {
|
|
|
3359
3385
|
const files = fs20.readdirSync(project.knowledgePath);
|
|
3360
3386
|
for (const file of files) {
|
|
3361
3387
|
if (!file.endsWith(".md")) continue;
|
|
3362
|
-
const filePath =
|
|
3388
|
+
const filePath = path22.join(project.knowledgePath, file);
|
|
3363
3389
|
const content = fs20.readFileSync(filePath, "utf-8");
|
|
3364
3390
|
const lines = content.split("\n");
|
|
3365
3391
|
const matches = [];
|
|
@@ -3427,8 +3453,8 @@ async function findRelatedFiles2(filePath, projectName, options = {}) {
|
|
|
3427
3453
|
}
|
|
3428
3454
|
const projectRoot = project.sourcePath || project.path || "";
|
|
3429
3455
|
let absoluteFilePath = filePath;
|
|
3430
|
-
if (!
|
|
3431
|
-
absoluteFilePath =
|
|
3456
|
+
if (!path22.isAbsolute(filePath)) {
|
|
3457
|
+
absoluteFilePath = path22.resolve(projectRoot, filePath);
|
|
3432
3458
|
}
|
|
3433
3459
|
if (!fs20.existsSync(absoluteFilePath)) {
|
|
3434
3460
|
return {
|
|
@@ -3447,13 +3473,13 @@ async function findRelatedFiles2(filePath, projectName, options = {}) {
|
|
|
3447
3473
|
depth: options.depth ?? 1
|
|
3448
3474
|
});
|
|
3449
3475
|
const relationships = related.map((r) => ({
|
|
3450
|
-
file:
|
|
3476
|
+
file: path22.relative(projectRoot, r.file),
|
|
3451
3477
|
relationship: r.relationship,
|
|
3452
3478
|
importPath: r.importPath
|
|
3453
3479
|
}));
|
|
3454
3480
|
return {
|
|
3455
3481
|
success: true,
|
|
3456
|
-
file:
|
|
3482
|
+
file: path22.relative(projectRoot, absoluteFilePath),
|
|
3457
3483
|
project: projectName,
|
|
3458
3484
|
relationships
|
|
3459
3485
|
};
|
|
@@ -3494,12 +3520,12 @@ async function searchSymbols2(name, projectName, options = {}) {
|
|
|
3494
3520
|
const scanDir = (dir) => {
|
|
3495
3521
|
const entries = fs20.readdirSync(dir, { withFileTypes: true });
|
|
3496
3522
|
for (const entry of entries) {
|
|
3497
|
-
const fullPath =
|
|
3523
|
+
const fullPath = path22.join(dir, entry.name);
|
|
3498
3524
|
if (entry.isDirectory()) {
|
|
3499
3525
|
if (SKIP_DIRS.includes(entry.name)) continue;
|
|
3500
3526
|
scanDir(fullPath);
|
|
3501
3527
|
} else if (entry.isFile()) {
|
|
3502
|
-
const ext =
|
|
3528
|
+
const ext = path22.extname(entry.name).toLowerCase();
|
|
3503
3529
|
if (CODE_EXTENSIONS.includes(ext)) {
|
|
3504
3530
|
codeFiles.push(fullPath);
|
|
3505
3531
|
}
|
|
@@ -3525,7 +3551,7 @@ async function searchSymbols2(name, projectName, options = {}) {
|
|
|
3525
3551
|
const results = matches.map((m) => ({
|
|
3526
3552
|
name: m.name,
|
|
3527
3553
|
type: m.type,
|
|
3528
|
-
file:
|
|
3554
|
+
file: path22.relative(projectRoot, m.file),
|
|
3529
3555
|
line: m.line,
|
|
3530
3556
|
signature: m.signature,
|
|
3531
3557
|
exported: m.exported,
|
|
@@ -3558,8 +3584,8 @@ async function getFileSummary(filePath, projectName) {
|
|
|
3558
3584
|
}
|
|
3559
3585
|
const projectRoot = project.sourcePath || project.path || "";
|
|
3560
3586
|
let absolutePath = filePath;
|
|
3561
|
-
if (!
|
|
3562
|
-
absolutePath =
|
|
3587
|
+
if (!path22.isAbsolute(filePath)) {
|
|
3588
|
+
absolutePath = path22.resolve(projectRoot, filePath);
|
|
3563
3589
|
}
|
|
3564
3590
|
if (!fs20.existsSync(absolutePath)) {
|
|
3565
3591
|
return {
|
|
@@ -3575,7 +3601,7 @@ async function getFileSummary(filePath, projectName) {
|
|
|
3575
3601
|
return {
|
|
3576
3602
|
success: true,
|
|
3577
3603
|
summary: {
|
|
3578
|
-
path:
|
|
3604
|
+
path: path22.relative(projectRoot, absolutePath),
|
|
3579
3605
|
language: symbolResult.language,
|
|
3580
3606
|
lines: lines.length,
|
|
3581
3607
|
size_bytes: stat.size,
|
|
@@ -3617,7 +3643,7 @@ var init_search = __esm({
|
|
|
3617
3643
|
|
|
3618
3644
|
// src/lib/drift-service.ts
|
|
3619
3645
|
import * as fs21 from "fs";
|
|
3620
|
-
import * as
|
|
3646
|
+
import * as path23 from "path";
|
|
3621
3647
|
import * as crypto2 from "crypto";
|
|
3622
3648
|
var DriftService;
|
|
3623
3649
|
var init_drift_service = __esm({
|
|
@@ -3630,7 +3656,7 @@ var init_drift_service = __esm({
|
|
|
3630
3656
|
return crypto2.createHash("md5").update(content).digest("hex");
|
|
3631
3657
|
}
|
|
3632
3658
|
static getManifestPath(projectPath) {
|
|
3633
|
-
return
|
|
3659
|
+
return path23.join(projectPath, this.CHECKSUM_FILENAME);
|
|
3634
3660
|
}
|
|
3635
3661
|
static loadManifest(projectPath) {
|
|
3636
3662
|
const manifestPath = this.getManifestPath(projectPath);
|
|
@@ -3653,7 +3679,7 @@ var init_drift_service = __esm({
|
|
|
3653
3679
|
static generateManifest(projectPath, files) {
|
|
3654
3680
|
const manifest = {};
|
|
3655
3681
|
for (const file of files) {
|
|
3656
|
-
const fullPath =
|
|
3682
|
+
const fullPath = path23.join(projectPath, file);
|
|
3657
3683
|
if (fs21.existsSync(fullPath)) {
|
|
3658
3684
|
const stats = fs21.statSync(fullPath);
|
|
3659
3685
|
manifest[file] = {
|
|
@@ -3672,7 +3698,7 @@ var init_drift_service = __esm({
|
|
|
3672
3698
|
const modified = [];
|
|
3673
3699
|
const deleted = [];
|
|
3674
3700
|
for (const [relPath, entry] of Object.entries(manifest)) {
|
|
3675
|
-
const fullPath =
|
|
3701
|
+
const fullPath = path23.join(projectPath, relPath);
|
|
3676
3702
|
if (!fs21.existsSync(fullPath)) {
|
|
3677
3703
|
deleted.push(relPath);
|
|
3678
3704
|
continue;
|
|
@@ -3695,7 +3721,7 @@ var init_drift_service = __esm({
|
|
|
3695
3721
|
const manifest = this.loadManifest(projectPath);
|
|
3696
3722
|
const deleted = [];
|
|
3697
3723
|
for (const relPath of Object.keys(manifest)) {
|
|
3698
|
-
const fullPath =
|
|
3724
|
+
const fullPath = path23.join(projectPath, relPath);
|
|
3699
3725
|
if (!fs21.existsSync(fullPath)) {
|
|
3700
3726
|
deleted.push(relPath);
|
|
3701
3727
|
}
|
|
@@ -3733,7 +3759,7 @@ var init_drift_service = __esm({
|
|
|
3733
3759
|
|
|
3734
3760
|
// src/mcp/resources/indexing.ts
|
|
3735
3761
|
import * as fs22 from "fs";
|
|
3736
|
-
import * as
|
|
3762
|
+
import * as path24 from "path";
|
|
3737
3763
|
async function indexKnowledge(projectName, force = false, clean = false) {
|
|
3738
3764
|
const config = loadMCPConfig();
|
|
3739
3765
|
const projects = getExposedProjects();
|
|
@@ -3776,9 +3802,9 @@ async function indexKnowledge(projectName, force = false, clean = false) {
|
|
|
3776
3802
|
}
|
|
3777
3803
|
const runIndexing = async () => {
|
|
3778
3804
|
const { shouldSkipEntryDir, shouldSkipEntryFile } = getScanContext(project, scanRoot);
|
|
3779
|
-
const knowledgeDir = project.knowledgePath ||
|
|
3780
|
-
const indexPath =
|
|
3781
|
-
const codeIndexPath =
|
|
3805
|
+
const knowledgeDir = project.knowledgePath || path24.join(scanRoot, ".rrce-workflow", "knowledge");
|
|
3806
|
+
const indexPath = path24.join(knowledgeDir, "embeddings.json");
|
|
3807
|
+
const codeIndexPath = path24.join(knowledgeDir, "code-embeddings.json");
|
|
3782
3808
|
if (clean) {
|
|
3783
3809
|
logger.info(`[RAG] Cleaning knowledge index for ${project.name}`);
|
|
3784
3810
|
if (fs22.existsSync(indexPath)) fs22.unlinkSync(indexPath);
|
|
@@ -3795,12 +3821,12 @@ async function indexKnowledge(projectName, force = false, clean = false) {
|
|
|
3795
3821
|
const preCount = (dir) => {
|
|
3796
3822
|
const entries = fs22.readdirSync(dir, { withFileTypes: true });
|
|
3797
3823
|
for (const entry of entries) {
|
|
3798
|
-
const fullPath =
|
|
3824
|
+
const fullPath = path24.join(dir, entry.name);
|
|
3799
3825
|
if (entry.isDirectory()) {
|
|
3800
3826
|
if (shouldSkipEntryDir(fullPath)) continue;
|
|
3801
3827
|
preCount(fullPath);
|
|
3802
3828
|
} else if (entry.isFile()) {
|
|
3803
|
-
const ext =
|
|
3829
|
+
const ext = path24.extname(entry.name).toLowerCase();
|
|
3804
3830
|
if (!INDEXABLE_EXTENSIONS.includes(ext)) continue;
|
|
3805
3831
|
if (shouldSkipEntryFile(fullPath)) continue;
|
|
3806
3832
|
itemsTotal++;
|
|
@@ -3817,9 +3843,9 @@ async function indexKnowledge(projectName, force = false, clean = false) {
|
|
|
3817
3843
|
logger.info(`[RAG] ${project.name}: Detected ${deletedFiles.length} deleted files from manifest`);
|
|
3818
3844
|
}
|
|
3819
3845
|
for (const filePath of unique) {
|
|
3820
|
-
if (!
|
|
3821
|
-
const relFilePath = filePath.split(
|
|
3822
|
-
const relScanRoot = scanRoot.split(
|
|
3846
|
+
if (!path24.isAbsolute(filePath)) continue;
|
|
3847
|
+
const relFilePath = filePath.split(path24.sep).join("/");
|
|
3848
|
+
const relScanRoot = scanRoot.split(path24.sep).join("/");
|
|
3823
3849
|
const isInScanRoot = relFilePath === relScanRoot || relFilePath.startsWith(`${relScanRoot}/`);
|
|
3824
3850
|
if (!isInScanRoot) continue;
|
|
3825
3851
|
const isDeleted = deletedFiles.some((df) => filePath.endsWith(df));
|
|
@@ -3833,12 +3859,12 @@ async function indexKnowledge(projectName, force = false, clean = false) {
|
|
|
3833
3859
|
const scanDir = async (dir) => {
|
|
3834
3860
|
const entries = fs22.readdirSync(dir, { withFileTypes: true });
|
|
3835
3861
|
for (const entry of entries) {
|
|
3836
|
-
const fullPath =
|
|
3862
|
+
const fullPath = path24.join(dir, entry.name);
|
|
3837
3863
|
if (entry.isDirectory()) {
|
|
3838
3864
|
if (shouldSkipEntryDir(fullPath)) continue;
|
|
3839
3865
|
await scanDir(fullPath);
|
|
3840
3866
|
} else if (entry.isFile()) {
|
|
3841
|
-
const ext =
|
|
3867
|
+
const ext = path24.extname(entry.name).toLowerCase();
|
|
3842
3868
|
if (!INDEXABLE_EXTENSIONS.includes(ext)) continue;
|
|
3843
3869
|
if (shouldSkipEntryFile(fullPath)) continue;
|
|
3844
3870
|
try {
|
|
@@ -3922,7 +3948,7 @@ var init_indexing = __esm({
|
|
|
3922
3948
|
});
|
|
3923
3949
|
|
|
3924
3950
|
// src/mcp/resources/context.ts
|
|
3925
|
-
import * as
|
|
3951
|
+
import * as path25 from "path";
|
|
3926
3952
|
import * as os4 from "os";
|
|
3927
3953
|
function getContextPreamble() {
|
|
3928
3954
|
const activeProject = detectActiveProject();
|
|
@@ -3938,7 +3964,7 @@ If the above tools fail, ask the user for clarification.
|
|
|
3938
3964
|
---
|
|
3939
3965
|
`;
|
|
3940
3966
|
}
|
|
3941
|
-
const rrceHome = process.env.RRCE_HOME ||
|
|
3967
|
+
const rrceHome = process.env.RRCE_HOME || path25.join(os4.homedir(), ".rrce-workflow");
|
|
3942
3968
|
const workspaceRoot = activeProject.sourcePath || activeProject.path || activeProject.dataPath;
|
|
3943
3969
|
const rrceData = activeProject.dataPath;
|
|
3944
3970
|
return `## System Context
|
|
@@ -4234,7 +4260,7 @@ var init_validation = __esm({
|
|
|
4234
4260
|
|
|
4235
4261
|
// src/mcp/resources/sessions.ts
|
|
4236
4262
|
import * as fs23 from "fs";
|
|
4237
|
-
import * as
|
|
4263
|
+
import * as path26 from "path";
|
|
4238
4264
|
function startSession(projectName, taskSlug, agent, phase) {
|
|
4239
4265
|
const config = loadMCPConfig();
|
|
4240
4266
|
const projects = projectService.scan();
|
|
@@ -4242,7 +4268,7 @@ function startSession(projectName, taskSlug, agent, phase) {
|
|
|
4242
4268
|
if (!project || !project.tasksPath) {
|
|
4243
4269
|
return { success: false, message: `Project '${projectName}' not found or not exposed.` };
|
|
4244
4270
|
}
|
|
4245
|
-
const taskDir =
|
|
4271
|
+
const taskDir = path26.join(project.tasksPath, taskSlug);
|
|
4246
4272
|
if (!fs23.existsSync(taskDir)) {
|
|
4247
4273
|
return { success: false, message: `Task '${taskSlug}' not found.` };
|
|
4248
4274
|
}
|
|
@@ -4253,7 +4279,7 @@ function startSession(projectName, taskSlug, agent, phase) {
|
|
|
4253
4279
|
started_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4254
4280
|
heartbeat: (/* @__PURE__ */ new Date()).toISOString()
|
|
4255
4281
|
};
|
|
4256
|
-
const sessionPath =
|
|
4282
|
+
const sessionPath = path26.join(taskDir, "session.json");
|
|
4257
4283
|
fs23.writeFileSync(sessionPath, JSON.stringify(session, null, 2));
|
|
4258
4284
|
return { success: true, message: `Session started for ${agent} agent on task '${taskSlug}' (phase: ${phase})` };
|
|
4259
4285
|
}
|
|
@@ -4264,7 +4290,7 @@ function endSession(projectName, taskSlug) {
|
|
|
4264
4290
|
if (!project || !project.tasksPath) {
|
|
4265
4291
|
return { success: false, message: `Project '${projectName}' not found or not exposed.` };
|
|
4266
4292
|
}
|
|
4267
|
-
const sessionPath =
|
|
4293
|
+
const sessionPath = path26.join(project.tasksPath, taskSlug, "session.json");
|
|
4268
4294
|
if (!fs23.existsSync(sessionPath)) {
|
|
4269
4295
|
return { success: true, message: `No active session for task '${taskSlug}'.` };
|
|
4270
4296
|
}
|
|
@@ -4278,7 +4304,7 @@ function updateAgentTodos(projectName, taskSlug, phase, agent, items) {
|
|
|
4278
4304
|
if (!project || !project.tasksPath) {
|
|
4279
4305
|
return { success: false, message: `Project '${projectName}' not found or not exposed.` };
|
|
4280
4306
|
}
|
|
4281
|
-
const taskDir =
|
|
4307
|
+
const taskDir = path26.join(project.tasksPath, taskSlug);
|
|
4282
4308
|
if (!fs23.existsSync(taskDir)) {
|
|
4283
4309
|
fs23.mkdirSync(taskDir, { recursive: true });
|
|
4284
4310
|
}
|
|
@@ -4288,7 +4314,7 @@ function updateAgentTodos(projectName, taskSlug, phase, agent, items) {
|
|
|
4288
4314
|
items,
|
|
4289
4315
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
4290
4316
|
};
|
|
4291
|
-
const todosPath =
|
|
4317
|
+
const todosPath = path26.join(taskDir, "agent-todos.json");
|
|
4292
4318
|
fs23.writeFileSync(todosPath, JSON.stringify(todos, null, 2));
|
|
4293
4319
|
return { success: true, message: `Updated ${items.length} todo items for task '${taskSlug}'.`, count: items.length };
|
|
4294
4320
|
}
|
|
@@ -4958,13 +4984,13 @@ var init_session = __esm({
|
|
|
4958
4984
|
});
|
|
4959
4985
|
|
|
4960
4986
|
// src/mcp/prompts.ts
|
|
4961
|
-
import * as
|
|
4987
|
+
import * as path27 from "path";
|
|
4962
4988
|
import * as fs24 from "fs";
|
|
4963
4989
|
function loadBaseProtocol2() {
|
|
4964
4990
|
if (baseProtocolCache !== null) {
|
|
4965
4991
|
return baseProtocolCache;
|
|
4966
4992
|
}
|
|
4967
|
-
const basePath =
|
|
4993
|
+
const basePath = path27.join(getAgentCorePromptsDir(), "_base.md");
|
|
4968
4994
|
if (fs24.existsSync(basePath)) {
|
|
4969
4995
|
const content = fs24.readFileSync(basePath, "utf-8");
|
|
4970
4996
|
baseProtocolCache = content.replace(/^---[\s\S]*?---\n*/, "");
|
|
@@ -5029,14 +5055,14 @@ function renderPromptWithContext(content, args) {
|
|
|
5029
5055
|
resolvedWorkspaceRoot = activeProject.sourcePath || activeProject.path || activeProject.dataPath;
|
|
5030
5056
|
resolvedWorkspaceName = activeProject.name;
|
|
5031
5057
|
if (activeProject.source === "global") {
|
|
5032
|
-
const workspacesDir =
|
|
5033
|
-
resolvedRrceHome =
|
|
5058
|
+
const workspacesDir = path27.dirname(activeProject.dataPath);
|
|
5059
|
+
resolvedRrceHome = path27.dirname(workspacesDir);
|
|
5034
5060
|
}
|
|
5035
5061
|
} else {
|
|
5036
5062
|
try {
|
|
5037
5063
|
const workspaceRoot = detectWorkspaceRoot();
|
|
5038
|
-
const workspaceName =
|
|
5039
|
-
const globalWorkspacePath =
|
|
5064
|
+
const workspaceName = path27.basename(workspaceRoot);
|
|
5065
|
+
const globalWorkspacePath = path27.join(DEFAULT_RRCE_HOME, "workspaces", workspaceName);
|
|
5040
5066
|
if (fs24.existsSync(globalWorkspacePath)) {
|
|
5041
5067
|
resolvedRrceData = globalWorkspacePath;
|
|
5042
5068
|
resolvedWorkspaceRoot = workspaceRoot;
|
|
@@ -5434,7 +5460,7 @@ Hidden projects: ${projects.length - exposedCount}`,
|
|
|
5434
5460
|
async function handleConfigureGlobalPath() {
|
|
5435
5461
|
const { resolveGlobalPath: resolveGlobalPath2 } = await Promise.resolve().then(() => (init_tui_utils(), tui_utils_exports));
|
|
5436
5462
|
const fs34 = await import("fs");
|
|
5437
|
-
const
|
|
5463
|
+
const path34 = await import("path");
|
|
5438
5464
|
note3(
|
|
5439
5465
|
`MCP Hub requires a ${pc5.bold("global storage path")} to store its configuration
|
|
5440
5466
|
and coordinate across projects.
|
|
@@ -5457,7 +5483,7 @@ locally in each project. MCP needs a central location.`,
|
|
|
5457
5483
|
`${pc5.green("\u2713")} Global path configured: ${pc5.cyan(resolvedPath)}
|
|
5458
5484
|
|
|
5459
5485
|
MCP config will be stored at:
|
|
5460
|
-
${
|
|
5486
|
+
${path34.join(resolvedPath, "mcp.yaml")}`,
|
|
5461
5487
|
"Configuration Saved"
|
|
5462
5488
|
);
|
|
5463
5489
|
return true;
|
|
@@ -5562,12 +5588,12 @@ __export(ConfigContext_exports, {
|
|
|
5562
5588
|
});
|
|
5563
5589
|
import { createContext, useContext, useState, useCallback, useMemo, useEffect } from "react";
|
|
5564
5590
|
import * as fs25 from "fs";
|
|
5565
|
-
import * as
|
|
5591
|
+
import * as path28 from "path";
|
|
5566
5592
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
5567
5593
|
function getPackageVersion() {
|
|
5568
5594
|
try {
|
|
5569
5595
|
const agentCoreDir = getAgentCoreDir();
|
|
5570
|
-
const packageJsonPath =
|
|
5596
|
+
const packageJsonPath = path28.join(path28.dirname(agentCoreDir), "package.json");
|
|
5571
5597
|
if (fs25.existsSync(packageJsonPath)) {
|
|
5572
5598
|
return JSON.parse(fs25.readFileSync(packageJsonPath, "utf8")).version;
|
|
5573
5599
|
}
|
|
@@ -5637,10 +5663,10 @@ var init_ConfigContext = __esm({
|
|
|
5637
5663
|
|
|
5638
5664
|
// src/mcp/ui/lib/tasks-fs.ts
|
|
5639
5665
|
import * as fs26 from "fs";
|
|
5640
|
-
import * as
|
|
5666
|
+
import * as path29 from "path";
|
|
5641
5667
|
function readSession(project, taskSlug) {
|
|
5642
5668
|
const rrceData = getProjectRRCEData(project);
|
|
5643
|
-
const sessionPath =
|
|
5669
|
+
const sessionPath = path29.join(rrceData, "tasks", taskSlug, "session.json");
|
|
5644
5670
|
if (!fs26.existsSync(sessionPath)) {
|
|
5645
5671
|
return null;
|
|
5646
5672
|
}
|
|
@@ -5658,7 +5684,7 @@ function isSessionStale(session, thresholdMs = SESSION_STALE_THRESHOLD_MS) {
|
|
|
5658
5684
|
}
|
|
5659
5685
|
function readAgentTodos(project, taskSlug) {
|
|
5660
5686
|
const rrceData = getProjectRRCEData(project);
|
|
5661
|
-
const todosPath =
|
|
5687
|
+
const todosPath = path29.join(rrceData, "tasks", taskSlug, "agent-todos.json");
|
|
5662
5688
|
if (!fs26.existsSync(todosPath)) {
|
|
5663
5689
|
return null;
|
|
5664
5690
|
}
|
|
@@ -5687,7 +5713,7 @@ function detectStorageModeFromConfig(workspaceRoot) {
|
|
|
5687
5713
|
}
|
|
5688
5714
|
function getEffectiveGlobalBase() {
|
|
5689
5715
|
const dummy = resolveDataPath("global", "__rrce_dummy__", "");
|
|
5690
|
-
return
|
|
5716
|
+
return path29.dirname(path29.dirname(dummy));
|
|
5691
5717
|
}
|
|
5692
5718
|
function getProjectRRCEData(project) {
|
|
5693
5719
|
const workspaceRoot = project.sourcePath || project.path;
|
|
@@ -5696,7 +5722,7 @@ function getProjectRRCEData(project) {
|
|
|
5696
5722
|
}
|
|
5697
5723
|
function listProjectTasks(project) {
|
|
5698
5724
|
const rrceData = getProjectRRCEData(project);
|
|
5699
|
-
const tasksPath =
|
|
5725
|
+
const tasksPath = path29.join(rrceData, "tasks");
|
|
5700
5726
|
if (!fs26.existsSync(tasksPath)) {
|
|
5701
5727
|
return { projectName: project.name, tasksPath, tasks: [] };
|
|
5702
5728
|
}
|
|
@@ -5705,7 +5731,7 @@ function listProjectTasks(project) {
|
|
|
5705
5731
|
const entries = fs26.readdirSync(tasksPath, { withFileTypes: true });
|
|
5706
5732
|
for (const entry of entries) {
|
|
5707
5733
|
if (!entry.isDirectory()) continue;
|
|
5708
|
-
const metaPath =
|
|
5734
|
+
const metaPath = path29.join(tasksPath, entry.name, "meta.json");
|
|
5709
5735
|
if (!fs26.existsSync(metaPath)) continue;
|
|
5710
5736
|
try {
|
|
5711
5737
|
const raw = fs26.readFileSync(metaPath, "utf-8");
|
|
@@ -5727,7 +5753,7 @@ function listProjectTasks(project) {
|
|
|
5727
5753
|
}
|
|
5728
5754
|
function updateTaskStatus(project, taskSlug, status) {
|
|
5729
5755
|
const rrceData = getProjectRRCEData(project);
|
|
5730
|
-
const metaPath =
|
|
5756
|
+
const metaPath = path29.join(rrceData, "tasks", taskSlug, "meta.json");
|
|
5731
5757
|
if (!fs26.existsSync(metaPath)) {
|
|
5732
5758
|
return { ok: false, error: `meta.json not found for task '${taskSlug}'` };
|
|
5733
5759
|
}
|
|
@@ -6124,14 +6150,14 @@ var init_ProjectViews = __esm({
|
|
|
6124
6150
|
|
|
6125
6151
|
// src/mcp/ui/lib/projects.ts
|
|
6126
6152
|
import * as fs27 from "fs";
|
|
6127
|
-
import * as
|
|
6153
|
+
import * as path30 from "path";
|
|
6128
6154
|
function getIndexStats(project) {
|
|
6129
6155
|
const stats = { knowledgeCount: 0, codeCount: 0, lastIndexed: null };
|
|
6130
6156
|
try {
|
|
6131
6157
|
const knowledgePath = project.knowledgePath;
|
|
6132
6158
|
if (knowledgePath) {
|
|
6133
|
-
const embPath =
|
|
6134
|
-
const codeEmbPath =
|
|
6159
|
+
const embPath = path30.join(knowledgePath, "embeddings.json");
|
|
6160
|
+
const codeEmbPath = path30.join(knowledgePath, "code-embeddings.json");
|
|
6135
6161
|
if (fs27.existsSync(embPath)) {
|
|
6136
6162
|
const stat = fs27.statSync(embPath);
|
|
6137
6163
|
stats.lastIndexed = stat.mtime.toISOString();
|
|
@@ -7198,7 +7224,7 @@ __export(update_flow_exports, {
|
|
|
7198
7224
|
import { confirm as confirm5, spinner as spinner2, note as note6, outro as outro2, cancel as cancel2, isCancel as isCancel7 } from "@clack/prompts";
|
|
7199
7225
|
import pc8 from "picocolors";
|
|
7200
7226
|
import * as fs29 from "fs";
|
|
7201
|
-
import * as
|
|
7227
|
+
import * as path31 from "path";
|
|
7202
7228
|
import { stringify as stringify2, parse } from "yaml";
|
|
7203
7229
|
function backupFile(filePath) {
|
|
7204
7230
|
if (!fs29.existsSync(filePath)) return null;
|
|
@@ -7215,7 +7241,7 @@ function backupFile(filePath) {
|
|
|
7215
7241
|
function getPackageVersion2() {
|
|
7216
7242
|
try {
|
|
7217
7243
|
const agentCoreDir = getAgentCoreDir();
|
|
7218
|
-
const packageJsonPath =
|
|
7244
|
+
const packageJsonPath = path31.join(path31.dirname(agentCoreDir), "package.json");
|
|
7219
7245
|
if (fs29.existsSync(packageJsonPath)) {
|
|
7220
7246
|
return JSON.parse(fs29.readFileSync(packageJsonPath, "utf8")).version;
|
|
7221
7247
|
}
|
|
@@ -7252,14 +7278,14 @@ async function performUpdate(workspacePath, workspaceName, currentStorageMode, o
|
|
|
7252
7278
|
const dirs = ["templates", "prompts", "docs"];
|
|
7253
7279
|
const updatedFiles = [];
|
|
7254
7280
|
for (const dir of dirs) {
|
|
7255
|
-
const srcDir =
|
|
7281
|
+
const srcDir = path31.join(agentCoreDir, dir);
|
|
7256
7282
|
if (!fs29.existsSync(srcDir)) continue;
|
|
7257
7283
|
const syncFiles = (src, rel) => {
|
|
7258
7284
|
const entries = fs29.readdirSync(src, { withFileTypes: true });
|
|
7259
7285
|
for (const entry of entries) {
|
|
7260
|
-
const entrySrc =
|
|
7261
|
-
const entryRel =
|
|
7262
|
-
const entryDest =
|
|
7286
|
+
const entrySrc = path31.join(src, entry.name);
|
|
7287
|
+
const entryRel = path31.join(rel, entry.name);
|
|
7288
|
+
const entryDest = path31.join(dataPath, entryRel);
|
|
7263
7289
|
if (entry.isDirectory()) {
|
|
7264
7290
|
ensureDir(entryDest);
|
|
7265
7291
|
syncFiles(entrySrc, entryRel);
|
|
@@ -7267,7 +7293,7 @@ async function performUpdate(workspacePath, workspaceName, currentStorageMode, o
|
|
|
7267
7293
|
if (driftReport.modifiedFiles.includes(entryRel)) {
|
|
7268
7294
|
backupFile(entryDest);
|
|
7269
7295
|
}
|
|
7270
|
-
ensureDir(
|
|
7296
|
+
ensureDir(path31.dirname(entryDest));
|
|
7271
7297
|
fs29.copyFileSync(entrySrc, entryDest);
|
|
7272
7298
|
updatedFiles.push(entryRel);
|
|
7273
7299
|
}
|
|
@@ -7279,10 +7305,10 @@ async function performUpdate(workspacePath, workspaceName, currentStorageMode, o
|
|
|
7279
7305
|
DriftService.saveManifest(dataPath, manifest);
|
|
7280
7306
|
}
|
|
7281
7307
|
const rrceHome = customGlobalPath || getDefaultRRCEHome2();
|
|
7282
|
-
ensureDir(
|
|
7283
|
-
ensureDir(
|
|
7284
|
-
copyDirRecursive(
|
|
7285
|
-
copyDirRecursive(
|
|
7308
|
+
ensureDir(path31.join(rrceHome, "templates"));
|
|
7309
|
+
ensureDir(path31.join(rrceHome, "docs"));
|
|
7310
|
+
copyDirRecursive(path31.join(agentCoreDir, "templates"), path31.join(rrceHome, "templates"));
|
|
7311
|
+
copyDirRecursive(path31.join(agentCoreDir, "docs"), path31.join(rrceHome, "docs"));
|
|
7286
7312
|
if (fs29.existsSync(configFilePath)) {
|
|
7287
7313
|
const configContent = fs29.readFileSync(configFilePath, "utf-8");
|
|
7288
7314
|
if (configContent.includes("copilot: true")) {
|
|
@@ -7311,7 +7337,7 @@ async function performUpdate(workspacePath, workspaceName, currentStorageMode, o
|
|
|
7311
7337
|
console.error("Failed to update config.yaml version:", e);
|
|
7312
7338
|
}
|
|
7313
7339
|
}
|
|
7314
|
-
const mcpPath =
|
|
7340
|
+
const mcpPath = path31.join(rrceHome, "mcp.yaml");
|
|
7315
7341
|
if (fs29.existsSync(mcpPath)) {
|
|
7316
7342
|
try {
|
|
7317
7343
|
const content = fs29.readFileSync(mcpPath, "utf-8");
|
|
@@ -7412,14 +7438,14 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7412
7438
|
const dirs = ["templates", "prompts", "docs"];
|
|
7413
7439
|
const updatedFiles = [];
|
|
7414
7440
|
for (const dir of dirs) {
|
|
7415
|
-
const srcDir =
|
|
7441
|
+
const srcDir = path31.join(agentCoreDir, dir);
|
|
7416
7442
|
if (!fs29.existsSync(srcDir)) continue;
|
|
7417
7443
|
const syncFiles = (src, rel) => {
|
|
7418
7444
|
const entries = fs29.readdirSync(src, { withFileTypes: true });
|
|
7419
7445
|
for (const entry of entries) {
|
|
7420
|
-
const entrySrc =
|
|
7421
|
-
const entryRel =
|
|
7422
|
-
const entryDest =
|
|
7446
|
+
const entrySrc = path31.join(src, entry.name);
|
|
7447
|
+
const entryRel = path31.join(rel, entry.name);
|
|
7448
|
+
const entryDest = path31.join(dataPath, entryRel);
|
|
7423
7449
|
if (entry.isDirectory()) {
|
|
7424
7450
|
ensureDir(entryDest);
|
|
7425
7451
|
syncFiles(entrySrc, entryRel);
|
|
@@ -7427,7 +7453,7 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7427
7453
|
if (driftReport.modifiedFiles.includes(entryRel)) {
|
|
7428
7454
|
backupFile(entryDest);
|
|
7429
7455
|
}
|
|
7430
|
-
ensureDir(
|
|
7456
|
+
ensureDir(path31.dirname(entryDest));
|
|
7431
7457
|
fs29.copyFileSync(entrySrc, entryDest);
|
|
7432
7458
|
updatedFiles.push(entryRel);
|
|
7433
7459
|
}
|
|
@@ -7439,10 +7465,10 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7439
7465
|
DriftService.saveManifest(dataPath, manifest);
|
|
7440
7466
|
}
|
|
7441
7467
|
const rrceHome = customGlobalPath || getDefaultRRCEHome2();
|
|
7442
|
-
ensureDir(
|
|
7443
|
-
ensureDir(
|
|
7444
|
-
copyDirRecursive(
|
|
7445
|
-
copyDirRecursive(
|
|
7468
|
+
ensureDir(path31.join(rrceHome, "templates"));
|
|
7469
|
+
ensureDir(path31.join(rrceHome, "docs"));
|
|
7470
|
+
copyDirRecursive(path31.join(agentCoreDir, "templates"), path31.join(rrceHome, "templates"));
|
|
7471
|
+
copyDirRecursive(path31.join(agentCoreDir, "docs"), path31.join(rrceHome, "docs"));
|
|
7446
7472
|
if (fs29.existsSync(configFilePath)) {
|
|
7447
7473
|
const configContent = fs29.readFileSync(configFilePath, "utf-8");
|
|
7448
7474
|
if (configContent.includes("copilot: true")) {
|
|
@@ -7471,7 +7497,7 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7471
7497
|
console.error("Failed to update config.yaml version:", e);
|
|
7472
7498
|
}
|
|
7473
7499
|
}
|
|
7474
|
-
const mcpPath =
|
|
7500
|
+
const mcpPath = path31.join(rrceHome, "mcp.yaml");
|
|
7475
7501
|
if (fs29.existsSync(mcpPath)) {
|
|
7476
7502
|
try {
|
|
7477
7503
|
const content = fs29.readFileSync(mcpPath, "utf-8");
|
|
@@ -7515,8 +7541,8 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7515
7541
|
}
|
|
7516
7542
|
}
|
|
7517
7543
|
function resolveAllDataPathsWithCustomGlobal(mode, workspaceName, workspaceRoot, customGlobalPath) {
|
|
7518
|
-
const globalPath =
|
|
7519
|
-
const workspacePath =
|
|
7544
|
+
const globalPath = path31.join(customGlobalPath, "workspaces", workspaceName);
|
|
7545
|
+
const workspacePath = path31.join(workspaceRoot, ".rrce-workflow");
|
|
7520
7546
|
switch (mode) {
|
|
7521
7547
|
case "global":
|
|
7522
7548
|
return [globalPath];
|
|
@@ -7540,7 +7566,7 @@ var init_update_flow = __esm({
|
|
|
7540
7566
|
import { intro as intro2, select as select5, spinner as spinner7, note as note11, outro as outro7, isCancel as isCancel12, confirm as confirm10 } from "@clack/prompts";
|
|
7541
7567
|
import pc13 from "picocolors";
|
|
7542
7568
|
import * as fs33 from "fs";
|
|
7543
|
-
import * as
|
|
7569
|
+
import * as path33 from "path";
|
|
7544
7570
|
import { parse as parse2 } from "yaml";
|
|
7545
7571
|
|
|
7546
7572
|
// src/lib/git.ts
|
|
@@ -8320,14 +8346,14 @@ init_utils();
|
|
|
8320
8346
|
import { confirm as confirm8, spinner as spinner5, note as note9, outro as outro5, cancel as cancel5, isCancel as isCancel10 } from "@clack/prompts";
|
|
8321
8347
|
import pc11 from "picocolors";
|
|
8322
8348
|
import * as fs31 from "fs";
|
|
8323
|
-
import * as
|
|
8349
|
+
import * as path32 from "path";
|
|
8324
8350
|
async function runSyncToGlobalFlow(workspacePath, workspaceName) {
|
|
8325
8351
|
const localPath = getLocalWorkspacePath(workspacePath);
|
|
8326
8352
|
const customGlobalPath = getEffectiveRRCEHome(workspacePath);
|
|
8327
|
-
const globalPath =
|
|
8353
|
+
const globalPath = path32.join(customGlobalPath, "workspaces", workspaceName);
|
|
8328
8354
|
const subdirs = ["knowledge", "prompts", "templates", "tasks", "refs"];
|
|
8329
8355
|
const existingDirs = subdirs.filter(
|
|
8330
|
-
(dir) => fs31.existsSync(
|
|
8356
|
+
(dir) => fs31.existsSync(path32.join(localPath, dir))
|
|
8331
8357
|
);
|
|
8332
8358
|
if (existingDirs.length === 0) {
|
|
8333
8359
|
outro5(pc11.yellow("No data found in workspace storage to sync."));
|
|
@@ -8353,8 +8379,8 @@ Destination: ${pc11.cyan(globalPath)}`,
|
|
|
8353
8379
|
try {
|
|
8354
8380
|
ensureDir(globalPath);
|
|
8355
8381
|
for (const dir of existingDirs) {
|
|
8356
|
-
const srcDir =
|
|
8357
|
-
const destDir =
|
|
8382
|
+
const srcDir = path32.join(localPath, dir);
|
|
8383
|
+
const destDir = path32.join(globalPath, dir);
|
|
8358
8384
|
ensureDir(destDir);
|
|
8359
8385
|
copyDirRecursive(srcDir, destDir);
|
|
8360
8386
|
}
|
|
@@ -8449,7 +8475,7 @@ init_config();
|
|
|
8449
8475
|
function getPackageVersion3() {
|
|
8450
8476
|
try {
|
|
8451
8477
|
const agentCoreDir = getAgentCoreDir();
|
|
8452
|
-
const packageJsonPath =
|
|
8478
|
+
const packageJsonPath = path33.join(path33.dirname(agentCoreDir), "package.json");
|
|
8453
8479
|
if (fs33.existsSync(packageJsonPath)) {
|
|
8454
8480
|
return JSON.parse(fs33.readFileSync(packageJsonPath, "utf8")).version;
|
|
8455
8481
|
}
|
|
@@ -8470,7 +8496,7 @@ function getLastSyncedVersion(workspacePath, workspaceName) {
|
|
|
8470
8496
|
}
|
|
8471
8497
|
}
|
|
8472
8498
|
const rrceHome = getEffectiveRRCEHome(workspacePath) || getDefaultRRCEHome2();
|
|
8473
|
-
const mcpPath =
|
|
8499
|
+
const mcpPath = path33.join(rrceHome, "mcp.yaml");
|
|
8474
8500
|
if (fs33.existsSync(mcpPath)) {
|
|
8475
8501
|
try {
|
|
8476
8502
|
const content = fs33.readFileSync(mcpPath, "utf-8");
|