rrce-workflow 0.3.24 → 0.3.26
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 +136 -122
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1813,6 +1813,7 @@ var init_utils2 = __esm({
|
|
|
1813
1813
|
|
|
1814
1814
|
// src/mcp/resources/paths.ts
|
|
1815
1815
|
import * as fs15 from "fs";
|
|
1816
|
+
import * as path17 from "path";
|
|
1816
1817
|
function resolveProjectPaths(project, pathInput) {
|
|
1817
1818
|
const config = loadMCPConfig();
|
|
1818
1819
|
let workspaceRoot = pathInput;
|
|
@@ -1823,6 +1824,19 @@ function resolveProjectPaths(project, pathInput) {
|
|
|
1823
1824
|
workspaceRoot = projConfig.path;
|
|
1824
1825
|
}
|
|
1825
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
|
+
}
|
|
1826
1840
|
if (!workspaceName && workspaceRoot) {
|
|
1827
1841
|
const projConfig = findProjectConfig(config, { path: workspaceRoot });
|
|
1828
1842
|
workspaceName = projConfig?.name || getWorkspaceName(workspaceRoot);
|
|
@@ -1870,7 +1884,7 @@ var init_paths2 = __esm({
|
|
|
1870
1884
|
|
|
1871
1885
|
// src/mcp/resources/projects.ts
|
|
1872
1886
|
import * as fs16 from "fs";
|
|
1873
|
-
import * as
|
|
1887
|
+
import * as path18 from "path";
|
|
1874
1888
|
function getExposedProjects() {
|
|
1875
1889
|
const config = loadMCPConfig();
|
|
1876
1890
|
const knownProjects = config.projects.filter((p) => !!p.path).map((p) => ({ name: p.name, path: p.path }));
|
|
@@ -1879,10 +1893,10 @@ function getExposedProjects() {
|
|
|
1879
1893
|
const potentialProjects = [...allProjects];
|
|
1880
1894
|
if (activeProject) {
|
|
1881
1895
|
let cfgContent = null;
|
|
1882
|
-
if (fs16.existsSync(
|
|
1883
|
-
cfgContent = fs16.readFileSync(
|
|
1884
|
-
} else if (fs16.existsSync(
|
|
1885
|
-
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");
|
|
1886
1900
|
}
|
|
1887
1901
|
if (cfgContent) {
|
|
1888
1902
|
if (cfgContent.includes("linked_projects:")) {
|
|
@@ -1940,7 +1954,7 @@ function getProjectContext(projectName) {
|
|
|
1940
1954
|
if (!project.knowledgePath) {
|
|
1941
1955
|
return null;
|
|
1942
1956
|
}
|
|
1943
|
-
const contextPath =
|
|
1957
|
+
const contextPath = path18.join(project.knowledgePath, "project-context.md");
|
|
1944
1958
|
if (!fs16.existsSync(contextPath)) {
|
|
1945
1959
|
return null;
|
|
1946
1960
|
}
|
|
@@ -1948,7 +1962,7 @@ function getProjectContext(projectName) {
|
|
|
1948
1962
|
}
|
|
1949
1963
|
function getCodeIndexPath(project) {
|
|
1950
1964
|
const scanRoot = project.path || project.dataPath;
|
|
1951
|
-
return
|
|
1965
|
+
return path18.join(project.knowledgePath || path18.join(scanRoot, ".rrce-workflow", "knowledge"), "code-embeddings.json");
|
|
1952
1966
|
}
|
|
1953
1967
|
var init_projects = __esm({
|
|
1954
1968
|
"src/mcp/resources/projects.ts"() {
|
|
@@ -1962,7 +1976,7 @@ var init_projects = __esm({
|
|
|
1962
1976
|
|
|
1963
1977
|
// src/mcp/resources/tasks.ts
|
|
1964
1978
|
import * as fs17 from "fs";
|
|
1965
|
-
import * as
|
|
1979
|
+
import * as path19 from "path";
|
|
1966
1980
|
import * as os3 from "os";
|
|
1967
1981
|
import * as crypto from "crypto";
|
|
1968
1982
|
function getProjectTasks(projectName) {
|
|
@@ -1984,7 +1998,7 @@ function getProjectTasks(projectName) {
|
|
|
1984
1998
|
const taskDirs = fs17.readdirSync(project.tasksPath, { withFileTypes: true });
|
|
1985
1999
|
for (const dir of taskDirs) {
|
|
1986
2000
|
if (!dir.isDirectory()) continue;
|
|
1987
|
-
const metaPath =
|
|
2001
|
+
const metaPath = path19.join(project.tasksPath, dir.name, "meta.json");
|
|
1988
2002
|
if (fs17.existsSync(metaPath)) {
|
|
1989
2003
|
try {
|
|
1990
2004
|
const meta = JSON.parse(fs17.readFileSync(metaPath, "utf-8"));
|
|
@@ -2004,7 +2018,7 @@ function getTask(projectName, taskSlug) {
|
|
|
2004
2018
|
const projects = projectService.scan();
|
|
2005
2019
|
const project = projects.find((p) => p.name === projectName && isProjectExposed(config, p.name, p.sourcePath || p.path));
|
|
2006
2020
|
if (!project || !project.tasksPath) return null;
|
|
2007
|
-
const metaPath =
|
|
2021
|
+
const metaPath = path19.join(project.tasksPath, taskSlug, "meta.json");
|
|
2008
2022
|
if (!fs17.existsSync(metaPath)) return null;
|
|
2009
2023
|
try {
|
|
2010
2024
|
return JSON.parse(fs17.readFileSync(metaPath, "utf-8"));
|
|
@@ -2020,17 +2034,17 @@ async function createTask(projectName, taskSlug, taskData) {
|
|
|
2020
2034
|
if (!project || !project.tasksPath) {
|
|
2021
2035
|
throw new Error(`Project '${projectName}' not found or not configured with a tasks path.`);
|
|
2022
2036
|
}
|
|
2023
|
-
const taskDir =
|
|
2037
|
+
const taskDir = path19.join(project.tasksPath, taskSlug);
|
|
2024
2038
|
if (fs17.existsSync(taskDir)) {
|
|
2025
2039
|
throw new Error(`Task with slug '${taskSlug}' already exists.`);
|
|
2026
2040
|
}
|
|
2027
2041
|
fs17.mkdirSync(taskDir, { recursive: true });
|
|
2028
|
-
fs17.mkdirSync(
|
|
2029
|
-
fs17.mkdirSync(
|
|
2030
|
-
fs17.mkdirSync(
|
|
2031
|
-
fs17.mkdirSync(
|
|
2032
|
-
const rrceHome = process.env.RRCE_HOME ||
|
|
2033
|
-
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");
|
|
2034
2048
|
let meta = {
|
|
2035
2049
|
task_id: crypto.randomUUID(),
|
|
2036
2050
|
task_slug: taskSlug,
|
|
@@ -2053,7 +2067,7 @@ async function createTask(projectName, taskSlug, taskData) {
|
|
|
2053
2067
|
hash: project.name
|
|
2054
2068
|
};
|
|
2055
2069
|
Object.assign(meta, taskData);
|
|
2056
|
-
const metaPath =
|
|
2070
|
+
const metaPath = path19.join(taskDir, "meta.json");
|
|
2057
2071
|
fs17.writeFileSync(metaPath, JSON.stringify(meta, null, 2));
|
|
2058
2072
|
return meta;
|
|
2059
2073
|
}
|
|
@@ -2073,7 +2087,7 @@ async function updateTask(projectName, taskSlug, taskData) {
|
|
|
2073
2087
|
const projects = projectService.scan();
|
|
2074
2088
|
const project = projects.find((p) => p.name === projectName && isProjectExposed(config, p.name, p.sourcePath || p.path));
|
|
2075
2089
|
if (!project || !project.tasksPath) return null;
|
|
2076
|
-
const metaPath =
|
|
2090
|
+
const metaPath = path19.join(project.tasksPath, taskSlug, "meta.json");
|
|
2077
2091
|
fs17.writeFileSync(metaPath, JSON.stringify(updatedMeta, null, 2));
|
|
2078
2092
|
return updatedMeta;
|
|
2079
2093
|
}
|
|
@@ -2082,7 +2096,7 @@ function deleteTask(projectName, taskSlug) {
|
|
|
2082
2096
|
const projects = projectService.scan();
|
|
2083
2097
|
const project = projects.find((p) => p.name === projectName && isProjectExposed(config, p.name, p.sourcePath || p.path));
|
|
2084
2098
|
if (!project || !project.tasksPath) return false;
|
|
2085
|
-
const taskDir =
|
|
2099
|
+
const taskDir = path19.join(project.tasksPath, taskSlug);
|
|
2086
2100
|
if (!fs17.existsSync(taskDir)) return false;
|
|
2087
2101
|
if (fs17.rmSync) {
|
|
2088
2102
|
fs17.rmSync(taskDir, { recursive: true, force: true });
|
|
@@ -2102,7 +2116,7 @@ var init_tasks = __esm({
|
|
|
2102
2116
|
|
|
2103
2117
|
// src/mcp/services/rag.ts
|
|
2104
2118
|
import * as fs18 from "fs";
|
|
2105
|
-
import * as
|
|
2119
|
+
import * as path20 from "path";
|
|
2106
2120
|
var INDEX_VERSION, DEFAULT_MODEL, RAGService;
|
|
2107
2121
|
var init_rag = __esm({
|
|
2108
2122
|
"src/mcp/services/rag.ts"() {
|
|
@@ -2184,7 +2198,7 @@ var init_rag = __esm({
|
|
|
2184
2198
|
saveIndex() {
|
|
2185
2199
|
if (!this.index) return;
|
|
2186
2200
|
try {
|
|
2187
|
-
const dir =
|
|
2201
|
+
const dir = path20.dirname(this.indexPath);
|
|
2188
2202
|
if (!fs18.existsSync(dir)) {
|
|
2189
2203
|
fs18.mkdirSync(dir, { recursive: true });
|
|
2190
2204
|
}
|
|
@@ -2199,7 +2213,7 @@ var init_rag = __esm({
|
|
|
2199
2213
|
*/
|
|
2200
2214
|
saveIndexAtomic() {
|
|
2201
2215
|
if (!this.index) return;
|
|
2202
|
-
const dir =
|
|
2216
|
+
const dir = path20.dirname(this.indexPath);
|
|
2203
2217
|
if (!fs18.existsSync(dir)) {
|
|
2204
2218
|
fs18.mkdirSync(dir, { recursive: true });
|
|
2205
2219
|
}
|
|
@@ -2739,9 +2753,9 @@ var init_context_extractor = __esm({
|
|
|
2739
2753
|
|
|
2740
2754
|
// src/mcp/services/dependency-graph.ts
|
|
2741
2755
|
import * as fs19 from "fs";
|
|
2742
|
-
import * as
|
|
2756
|
+
import * as path21 from "path";
|
|
2743
2757
|
function parseImports(filePath, content) {
|
|
2744
|
-
const ext =
|
|
2758
|
+
const ext = path21.extname(filePath).toLowerCase();
|
|
2745
2759
|
const language = getLanguageFromExtension(ext);
|
|
2746
2760
|
const edges = [];
|
|
2747
2761
|
const patterns = IMPORT_PATTERNS[language] || IMPORT_PATTERNS.javascript || [];
|
|
@@ -2771,15 +2785,15 @@ function parseImports(filePath, content) {
|
|
|
2771
2785
|
return edges;
|
|
2772
2786
|
}
|
|
2773
2787
|
function resolveImport(fromFile, importPath, language) {
|
|
2774
|
-
const fromDir =
|
|
2788
|
+
const fromDir = path21.dirname(fromFile);
|
|
2775
2789
|
if (importPath.startsWith(".")) {
|
|
2776
|
-
const candidates = generateCandidates(
|
|
2790
|
+
const candidates = generateCandidates(path21.resolve(fromDir, importPath), language);
|
|
2777
2791
|
for (const candidate of candidates) {
|
|
2778
2792
|
if (fs19.existsSync(candidate)) {
|
|
2779
2793
|
return { path: candidate, isResolved: true };
|
|
2780
2794
|
}
|
|
2781
2795
|
}
|
|
2782
|
-
return { path:
|
|
2796
|
+
return { path: path21.resolve(fromDir, importPath), isResolved: false };
|
|
2783
2797
|
}
|
|
2784
2798
|
if (importPath.startsWith("/")) {
|
|
2785
2799
|
const candidates = generateCandidates(importPath, language);
|
|
@@ -2794,7 +2808,7 @@ function resolveImport(fromFile, importPath, language) {
|
|
|
2794
2808
|
}
|
|
2795
2809
|
function generateCandidates(basePath, language) {
|
|
2796
2810
|
const candidates = [];
|
|
2797
|
-
if (
|
|
2811
|
+
if (path21.extname(basePath)) {
|
|
2798
2812
|
candidates.push(basePath);
|
|
2799
2813
|
}
|
|
2800
2814
|
switch (language) {
|
|
@@ -2911,13 +2925,13 @@ async function scanProjectDependencies(projectRoot, options = {}) {
|
|
|
2911
2925
|
try {
|
|
2912
2926
|
const entries = fs19.readdirSync(dir, { withFileTypes: true });
|
|
2913
2927
|
for (const entry of entries) {
|
|
2914
|
-
const fullPath =
|
|
2928
|
+
const fullPath = path21.join(dir, entry.name);
|
|
2915
2929
|
if (entry.isDirectory()) {
|
|
2916
2930
|
if (!skipDirs.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
2917
2931
|
scanDir(fullPath);
|
|
2918
2932
|
}
|
|
2919
2933
|
} else if (entry.isFile()) {
|
|
2920
|
-
const ext =
|
|
2934
|
+
const ext = path21.extname(entry.name).toLowerCase();
|
|
2921
2935
|
if (extensions.includes(ext)) {
|
|
2922
2936
|
try {
|
|
2923
2937
|
const content = fs19.readFileSync(fullPath, "utf-8");
|
|
@@ -3263,7 +3277,7 @@ var init_search_utils = __esm({
|
|
|
3263
3277
|
|
|
3264
3278
|
// src/mcp/resources/search.ts
|
|
3265
3279
|
import * as fs20 from "fs";
|
|
3266
|
-
import * as
|
|
3280
|
+
import * as path22 from "path";
|
|
3267
3281
|
async function searchCode(query, projectFilter, limit = 10, options) {
|
|
3268
3282
|
const config = loadMCPConfig();
|
|
3269
3283
|
const projects = getExposedProjects();
|
|
@@ -3291,7 +3305,7 @@ async function searchCode(query, projectFilter, limit = 10, options) {
|
|
|
3291
3305
|
const codeChunk = r;
|
|
3292
3306
|
results.push({
|
|
3293
3307
|
project: project.name,
|
|
3294
|
-
file:
|
|
3308
|
+
file: path22.relative(project.sourcePath || project.path || "", codeChunk.filePath),
|
|
3295
3309
|
snippet: codeChunk.content,
|
|
3296
3310
|
lineStart: codeChunk.lineStart ?? 1,
|
|
3297
3311
|
lineEnd: codeChunk.lineEnd ?? 1,
|
|
@@ -3351,13 +3365,13 @@ async function searchKnowledge(query, projectFilter, options) {
|
|
|
3351
3365
|
const useRAG = projConfig?.semanticSearch?.enabled;
|
|
3352
3366
|
if (useRAG) {
|
|
3353
3367
|
try {
|
|
3354
|
-
const indexPath =
|
|
3368
|
+
const indexPath = path22.join(project.knowledgePath, "embeddings.json");
|
|
3355
3369
|
const rag = new RAGService(indexPath, projConfig?.semanticSearch?.model);
|
|
3356
3370
|
const ragResults = await rag.search(query, 5);
|
|
3357
3371
|
for (const r of ragResults) {
|
|
3358
3372
|
results.push({
|
|
3359
3373
|
project: project.name,
|
|
3360
|
-
file:
|
|
3374
|
+
file: path22.relative(project.knowledgePath, r.filePath),
|
|
3361
3375
|
matches: [r.content],
|
|
3362
3376
|
score: r.score
|
|
3363
3377
|
});
|
|
@@ -3371,7 +3385,7 @@ async function searchKnowledge(query, projectFilter, options) {
|
|
|
3371
3385
|
const files = fs20.readdirSync(project.knowledgePath);
|
|
3372
3386
|
for (const file of files) {
|
|
3373
3387
|
if (!file.endsWith(".md")) continue;
|
|
3374
|
-
const filePath =
|
|
3388
|
+
const filePath = path22.join(project.knowledgePath, file);
|
|
3375
3389
|
const content = fs20.readFileSync(filePath, "utf-8");
|
|
3376
3390
|
const lines = content.split("\n");
|
|
3377
3391
|
const matches = [];
|
|
@@ -3439,8 +3453,8 @@ async function findRelatedFiles2(filePath, projectName, options = {}) {
|
|
|
3439
3453
|
}
|
|
3440
3454
|
const projectRoot = project.sourcePath || project.path || "";
|
|
3441
3455
|
let absoluteFilePath = filePath;
|
|
3442
|
-
if (!
|
|
3443
|
-
absoluteFilePath =
|
|
3456
|
+
if (!path22.isAbsolute(filePath)) {
|
|
3457
|
+
absoluteFilePath = path22.resolve(projectRoot, filePath);
|
|
3444
3458
|
}
|
|
3445
3459
|
if (!fs20.existsSync(absoluteFilePath)) {
|
|
3446
3460
|
return {
|
|
@@ -3459,13 +3473,13 @@ async function findRelatedFiles2(filePath, projectName, options = {}) {
|
|
|
3459
3473
|
depth: options.depth ?? 1
|
|
3460
3474
|
});
|
|
3461
3475
|
const relationships = related.map((r) => ({
|
|
3462
|
-
file:
|
|
3476
|
+
file: path22.relative(projectRoot, r.file),
|
|
3463
3477
|
relationship: r.relationship,
|
|
3464
3478
|
importPath: r.importPath
|
|
3465
3479
|
}));
|
|
3466
3480
|
return {
|
|
3467
3481
|
success: true,
|
|
3468
|
-
file:
|
|
3482
|
+
file: path22.relative(projectRoot, absoluteFilePath),
|
|
3469
3483
|
project: projectName,
|
|
3470
3484
|
relationships
|
|
3471
3485
|
};
|
|
@@ -3506,12 +3520,12 @@ async function searchSymbols2(name, projectName, options = {}) {
|
|
|
3506
3520
|
const scanDir = (dir) => {
|
|
3507
3521
|
const entries = fs20.readdirSync(dir, { withFileTypes: true });
|
|
3508
3522
|
for (const entry of entries) {
|
|
3509
|
-
const fullPath =
|
|
3523
|
+
const fullPath = path22.join(dir, entry.name);
|
|
3510
3524
|
if (entry.isDirectory()) {
|
|
3511
3525
|
if (SKIP_DIRS.includes(entry.name)) continue;
|
|
3512
3526
|
scanDir(fullPath);
|
|
3513
3527
|
} else if (entry.isFile()) {
|
|
3514
|
-
const ext =
|
|
3528
|
+
const ext = path22.extname(entry.name).toLowerCase();
|
|
3515
3529
|
if (CODE_EXTENSIONS.includes(ext)) {
|
|
3516
3530
|
codeFiles.push(fullPath);
|
|
3517
3531
|
}
|
|
@@ -3537,7 +3551,7 @@ async function searchSymbols2(name, projectName, options = {}) {
|
|
|
3537
3551
|
const results = matches.map((m) => ({
|
|
3538
3552
|
name: m.name,
|
|
3539
3553
|
type: m.type,
|
|
3540
|
-
file:
|
|
3554
|
+
file: path22.relative(projectRoot, m.file),
|
|
3541
3555
|
line: m.line,
|
|
3542
3556
|
signature: m.signature,
|
|
3543
3557
|
exported: m.exported,
|
|
@@ -3570,8 +3584,8 @@ async function getFileSummary(filePath, projectName) {
|
|
|
3570
3584
|
}
|
|
3571
3585
|
const projectRoot = project.sourcePath || project.path || "";
|
|
3572
3586
|
let absolutePath = filePath;
|
|
3573
|
-
if (!
|
|
3574
|
-
absolutePath =
|
|
3587
|
+
if (!path22.isAbsolute(filePath)) {
|
|
3588
|
+
absolutePath = path22.resolve(projectRoot, filePath);
|
|
3575
3589
|
}
|
|
3576
3590
|
if (!fs20.existsSync(absolutePath)) {
|
|
3577
3591
|
return {
|
|
@@ -3587,7 +3601,7 @@ async function getFileSummary(filePath, projectName) {
|
|
|
3587
3601
|
return {
|
|
3588
3602
|
success: true,
|
|
3589
3603
|
summary: {
|
|
3590
|
-
path:
|
|
3604
|
+
path: path22.relative(projectRoot, absolutePath),
|
|
3591
3605
|
language: symbolResult.language,
|
|
3592
3606
|
lines: lines.length,
|
|
3593
3607
|
size_bytes: stat.size,
|
|
@@ -3629,7 +3643,7 @@ var init_search = __esm({
|
|
|
3629
3643
|
|
|
3630
3644
|
// src/lib/drift-service.ts
|
|
3631
3645
|
import * as fs21 from "fs";
|
|
3632
|
-
import * as
|
|
3646
|
+
import * as path23 from "path";
|
|
3633
3647
|
import * as crypto2 from "crypto";
|
|
3634
3648
|
var DriftService;
|
|
3635
3649
|
var init_drift_service = __esm({
|
|
@@ -3642,7 +3656,7 @@ var init_drift_service = __esm({
|
|
|
3642
3656
|
return crypto2.createHash("md5").update(content).digest("hex");
|
|
3643
3657
|
}
|
|
3644
3658
|
static getManifestPath(projectPath) {
|
|
3645
|
-
return
|
|
3659
|
+
return path23.join(projectPath, this.CHECKSUM_FILENAME);
|
|
3646
3660
|
}
|
|
3647
3661
|
static loadManifest(projectPath) {
|
|
3648
3662
|
const manifestPath = this.getManifestPath(projectPath);
|
|
@@ -3665,7 +3679,7 @@ var init_drift_service = __esm({
|
|
|
3665
3679
|
static generateManifest(projectPath, files) {
|
|
3666
3680
|
const manifest = {};
|
|
3667
3681
|
for (const file of files) {
|
|
3668
|
-
const fullPath =
|
|
3682
|
+
const fullPath = path23.join(projectPath, file);
|
|
3669
3683
|
if (fs21.existsSync(fullPath)) {
|
|
3670
3684
|
const stats = fs21.statSync(fullPath);
|
|
3671
3685
|
manifest[file] = {
|
|
@@ -3684,7 +3698,7 @@ var init_drift_service = __esm({
|
|
|
3684
3698
|
const modified = [];
|
|
3685
3699
|
const deleted = [];
|
|
3686
3700
|
for (const [relPath, entry] of Object.entries(manifest)) {
|
|
3687
|
-
const fullPath =
|
|
3701
|
+
const fullPath = path23.join(projectPath, relPath);
|
|
3688
3702
|
if (!fs21.existsSync(fullPath)) {
|
|
3689
3703
|
deleted.push(relPath);
|
|
3690
3704
|
continue;
|
|
@@ -3707,7 +3721,7 @@ var init_drift_service = __esm({
|
|
|
3707
3721
|
const manifest = this.loadManifest(projectPath);
|
|
3708
3722
|
const deleted = [];
|
|
3709
3723
|
for (const relPath of Object.keys(manifest)) {
|
|
3710
|
-
const fullPath =
|
|
3724
|
+
const fullPath = path23.join(projectPath, relPath);
|
|
3711
3725
|
if (!fs21.existsSync(fullPath)) {
|
|
3712
3726
|
deleted.push(relPath);
|
|
3713
3727
|
}
|
|
@@ -3745,7 +3759,7 @@ var init_drift_service = __esm({
|
|
|
3745
3759
|
|
|
3746
3760
|
// src/mcp/resources/indexing.ts
|
|
3747
3761
|
import * as fs22 from "fs";
|
|
3748
|
-
import * as
|
|
3762
|
+
import * as path24 from "path";
|
|
3749
3763
|
async function indexKnowledge(projectName, force = false, clean = false) {
|
|
3750
3764
|
const config = loadMCPConfig();
|
|
3751
3765
|
const projects = getExposedProjects();
|
|
@@ -3788,9 +3802,9 @@ async function indexKnowledge(projectName, force = false, clean = false) {
|
|
|
3788
3802
|
}
|
|
3789
3803
|
const runIndexing = async () => {
|
|
3790
3804
|
const { shouldSkipEntryDir, shouldSkipEntryFile } = getScanContext(project, scanRoot);
|
|
3791
|
-
const knowledgeDir = project.knowledgePath ||
|
|
3792
|
-
const indexPath =
|
|
3793
|
-
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");
|
|
3794
3808
|
if (clean) {
|
|
3795
3809
|
logger.info(`[RAG] Cleaning knowledge index for ${project.name}`);
|
|
3796
3810
|
if (fs22.existsSync(indexPath)) fs22.unlinkSync(indexPath);
|
|
@@ -3807,12 +3821,12 @@ async function indexKnowledge(projectName, force = false, clean = false) {
|
|
|
3807
3821
|
const preCount = (dir) => {
|
|
3808
3822
|
const entries = fs22.readdirSync(dir, { withFileTypes: true });
|
|
3809
3823
|
for (const entry of entries) {
|
|
3810
|
-
const fullPath =
|
|
3824
|
+
const fullPath = path24.join(dir, entry.name);
|
|
3811
3825
|
if (entry.isDirectory()) {
|
|
3812
3826
|
if (shouldSkipEntryDir(fullPath)) continue;
|
|
3813
3827
|
preCount(fullPath);
|
|
3814
3828
|
} else if (entry.isFile()) {
|
|
3815
|
-
const ext =
|
|
3829
|
+
const ext = path24.extname(entry.name).toLowerCase();
|
|
3816
3830
|
if (!INDEXABLE_EXTENSIONS.includes(ext)) continue;
|
|
3817
3831
|
if (shouldSkipEntryFile(fullPath)) continue;
|
|
3818
3832
|
itemsTotal++;
|
|
@@ -3829,9 +3843,9 @@ async function indexKnowledge(projectName, force = false, clean = false) {
|
|
|
3829
3843
|
logger.info(`[RAG] ${project.name}: Detected ${deletedFiles.length} deleted files from manifest`);
|
|
3830
3844
|
}
|
|
3831
3845
|
for (const filePath of unique) {
|
|
3832
|
-
if (!
|
|
3833
|
-
const relFilePath = filePath.split(
|
|
3834
|
-
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("/");
|
|
3835
3849
|
const isInScanRoot = relFilePath === relScanRoot || relFilePath.startsWith(`${relScanRoot}/`);
|
|
3836
3850
|
if (!isInScanRoot) continue;
|
|
3837
3851
|
const isDeleted = deletedFiles.some((df) => filePath.endsWith(df));
|
|
@@ -3845,12 +3859,12 @@ async function indexKnowledge(projectName, force = false, clean = false) {
|
|
|
3845
3859
|
const scanDir = async (dir) => {
|
|
3846
3860
|
const entries = fs22.readdirSync(dir, { withFileTypes: true });
|
|
3847
3861
|
for (const entry of entries) {
|
|
3848
|
-
const fullPath =
|
|
3862
|
+
const fullPath = path24.join(dir, entry.name);
|
|
3849
3863
|
if (entry.isDirectory()) {
|
|
3850
3864
|
if (shouldSkipEntryDir(fullPath)) continue;
|
|
3851
3865
|
await scanDir(fullPath);
|
|
3852
3866
|
} else if (entry.isFile()) {
|
|
3853
|
-
const ext =
|
|
3867
|
+
const ext = path24.extname(entry.name).toLowerCase();
|
|
3854
3868
|
if (!INDEXABLE_EXTENSIONS.includes(ext)) continue;
|
|
3855
3869
|
if (shouldSkipEntryFile(fullPath)) continue;
|
|
3856
3870
|
try {
|
|
@@ -3934,7 +3948,7 @@ var init_indexing = __esm({
|
|
|
3934
3948
|
});
|
|
3935
3949
|
|
|
3936
3950
|
// src/mcp/resources/context.ts
|
|
3937
|
-
import * as
|
|
3951
|
+
import * as path25 from "path";
|
|
3938
3952
|
import * as os4 from "os";
|
|
3939
3953
|
function getContextPreamble() {
|
|
3940
3954
|
const activeProject = detectActiveProject();
|
|
@@ -3950,7 +3964,7 @@ If the above tools fail, ask the user for clarification.
|
|
|
3950
3964
|
---
|
|
3951
3965
|
`;
|
|
3952
3966
|
}
|
|
3953
|
-
const rrceHome = process.env.RRCE_HOME ||
|
|
3967
|
+
const rrceHome = process.env.RRCE_HOME || path25.join(os4.homedir(), ".rrce-workflow");
|
|
3954
3968
|
const workspaceRoot = activeProject.sourcePath || activeProject.path || activeProject.dataPath;
|
|
3955
3969
|
const rrceData = activeProject.dataPath;
|
|
3956
3970
|
return `## System Context
|
|
@@ -4246,7 +4260,7 @@ var init_validation = __esm({
|
|
|
4246
4260
|
|
|
4247
4261
|
// src/mcp/resources/sessions.ts
|
|
4248
4262
|
import * as fs23 from "fs";
|
|
4249
|
-
import * as
|
|
4263
|
+
import * as path26 from "path";
|
|
4250
4264
|
function startSession(projectName, taskSlug, agent, phase) {
|
|
4251
4265
|
const config = loadMCPConfig();
|
|
4252
4266
|
const projects = projectService.scan();
|
|
@@ -4254,7 +4268,7 @@ function startSession(projectName, taskSlug, agent, phase) {
|
|
|
4254
4268
|
if (!project || !project.tasksPath) {
|
|
4255
4269
|
return { success: false, message: `Project '${projectName}' not found or not exposed.` };
|
|
4256
4270
|
}
|
|
4257
|
-
const taskDir =
|
|
4271
|
+
const taskDir = path26.join(project.tasksPath, taskSlug);
|
|
4258
4272
|
if (!fs23.existsSync(taskDir)) {
|
|
4259
4273
|
return { success: false, message: `Task '${taskSlug}' not found.` };
|
|
4260
4274
|
}
|
|
@@ -4265,7 +4279,7 @@ function startSession(projectName, taskSlug, agent, phase) {
|
|
|
4265
4279
|
started_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4266
4280
|
heartbeat: (/* @__PURE__ */ new Date()).toISOString()
|
|
4267
4281
|
};
|
|
4268
|
-
const sessionPath =
|
|
4282
|
+
const sessionPath = path26.join(taskDir, "session.json");
|
|
4269
4283
|
fs23.writeFileSync(sessionPath, JSON.stringify(session, null, 2));
|
|
4270
4284
|
return { success: true, message: `Session started for ${agent} agent on task '${taskSlug}' (phase: ${phase})` };
|
|
4271
4285
|
}
|
|
@@ -4276,7 +4290,7 @@ function endSession(projectName, taskSlug) {
|
|
|
4276
4290
|
if (!project || !project.tasksPath) {
|
|
4277
4291
|
return { success: false, message: `Project '${projectName}' not found or not exposed.` };
|
|
4278
4292
|
}
|
|
4279
|
-
const sessionPath =
|
|
4293
|
+
const sessionPath = path26.join(project.tasksPath, taskSlug, "session.json");
|
|
4280
4294
|
if (!fs23.existsSync(sessionPath)) {
|
|
4281
4295
|
return { success: true, message: `No active session for task '${taskSlug}'.` };
|
|
4282
4296
|
}
|
|
@@ -4290,7 +4304,7 @@ function updateAgentTodos(projectName, taskSlug, phase, agent, items) {
|
|
|
4290
4304
|
if (!project || !project.tasksPath) {
|
|
4291
4305
|
return { success: false, message: `Project '${projectName}' not found or not exposed.` };
|
|
4292
4306
|
}
|
|
4293
|
-
const taskDir =
|
|
4307
|
+
const taskDir = path26.join(project.tasksPath, taskSlug);
|
|
4294
4308
|
if (!fs23.existsSync(taskDir)) {
|
|
4295
4309
|
fs23.mkdirSync(taskDir, { recursive: true });
|
|
4296
4310
|
}
|
|
@@ -4300,7 +4314,7 @@ function updateAgentTodos(projectName, taskSlug, phase, agent, items) {
|
|
|
4300
4314
|
items,
|
|
4301
4315
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
4302
4316
|
};
|
|
4303
|
-
const todosPath =
|
|
4317
|
+
const todosPath = path26.join(taskDir, "agent-todos.json");
|
|
4304
4318
|
fs23.writeFileSync(todosPath, JSON.stringify(todos, null, 2));
|
|
4305
4319
|
return { success: true, message: `Updated ${items.length} todo items for task '${taskSlug}'.`, count: items.length };
|
|
4306
4320
|
}
|
|
@@ -4970,13 +4984,13 @@ var init_session = __esm({
|
|
|
4970
4984
|
});
|
|
4971
4985
|
|
|
4972
4986
|
// src/mcp/prompts.ts
|
|
4973
|
-
import * as
|
|
4987
|
+
import * as path27 from "path";
|
|
4974
4988
|
import * as fs24 from "fs";
|
|
4975
4989
|
function loadBaseProtocol2() {
|
|
4976
4990
|
if (baseProtocolCache !== null) {
|
|
4977
4991
|
return baseProtocolCache;
|
|
4978
4992
|
}
|
|
4979
|
-
const basePath =
|
|
4993
|
+
const basePath = path27.join(getAgentCorePromptsDir(), "_base.md");
|
|
4980
4994
|
if (fs24.existsSync(basePath)) {
|
|
4981
4995
|
const content = fs24.readFileSync(basePath, "utf-8");
|
|
4982
4996
|
baseProtocolCache = content.replace(/^---[\s\S]*?---\n*/, "");
|
|
@@ -5041,14 +5055,14 @@ function renderPromptWithContext(content, args) {
|
|
|
5041
5055
|
resolvedWorkspaceRoot = activeProject.sourcePath || activeProject.path || activeProject.dataPath;
|
|
5042
5056
|
resolvedWorkspaceName = activeProject.name;
|
|
5043
5057
|
if (activeProject.source === "global") {
|
|
5044
|
-
const workspacesDir =
|
|
5045
|
-
resolvedRrceHome =
|
|
5058
|
+
const workspacesDir = path27.dirname(activeProject.dataPath);
|
|
5059
|
+
resolvedRrceHome = path27.dirname(workspacesDir);
|
|
5046
5060
|
}
|
|
5047
5061
|
} else {
|
|
5048
5062
|
try {
|
|
5049
5063
|
const workspaceRoot = detectWorkspaceRoot();
|
|
5050
|
-
const workspaceName =
|
|
5051
|
-
const globalWorkspacePath =
|
|
5064
|
+
const workspaceName = path27.basename(workspaceRoot);
|
|
5065
|
+
const globalWorkspacePath = path27.join(DEFAULT_RRCE_HOME, "workspaces", workspaceName);
|
|
5052
5066
|
if (fs24.existsSync(globalWorkspacePath)) {
|
|
5053
5067
|
resolvedRrceData = globalWorkspacePath;
|
|
5054
5068
|
resolvedWorkspaceRoot = workspaceRoot;
|
|
@@ -5446,7 +5460,7 @@ Hidden projects: ${projects.length - exposedCount}`,
|
|
|
5446
5460
|
async function handleConfigureGlobalPath() {
|
|
5447
5461
|
const { resolveGlobalPath: resolveGlobalPath2 } = await Promise.resolve().then(() => (init_tui_utils(), tui_utils_exports));
|
|
5448
5462
|
const fs34 = await import("fs");
|
|
5449
|
-
const
|
|
5463
|
+
const path34 = await import("path");
|
|
5450
5464
|
note3(
|
|
5451
5465
|
`MCP Hub requires a ${pc5.bold("global storage path")} to store its configuration
|
|
5452
5466
|
and coordinate across projects.
|
|
@@ -5469,7 +5483,7 @@ locally in each project. MCP needs a central location.`,
|
|
|
5469
5483
|
`${pc5.green("\u2713")} Global path configured: ${pc5.cyan(resolvedPath)}
|
|
5470
5484
|
|
|
5471
5485
|
MCP config will be stored at:
|
|
5472
|
-
${
|
|
5486
|
+
${path34.join(resolvedPath, "mcp.yaml")}`,
|
|
5473
5487
|
"Configuration Saved"
|
|
5474
5488
|
);
|
|
5475
5489
|
return true;
|
|
@@ -5574,12 +5588,12 @@ __export(ConfigContext_exports, {
|
|
|
5574
5588
|
});
|
|
5575
5589
|
import { createContext, useContext, useState, useCallback, useMemo, useEffect } from "react";
|
|
5576
5590
|
import * as fs25 from "fs";
|
|
5577
|
-
import * as
|
|
5591
|
+
import * as path28 from "path";
|
|
5578
5592
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
5579
5593
|
function getPackageVersion() {
|
|
5580
5594
|
try {
|
|
5581
5595
|
const agentCoreDir = getAgentCoreDir();
|
|
5582
|
-
const packageJsonPath =
|
|
5596
|
+
const packageJsonPath = path28.join(path28.dirname(agentCoreDir), "package.json");
|
|
5583
5597
|
if (fs25.existsSync(packageJsonPath)) {
|
|
5584
5598
|
return JSON.parse(fs25.readFileSync(packageJsonPath, "utf8")).version;
|
|
5585
5599
|
}
|
|
@@ -5649,10 +5663,10 @@ var init_ConfigContext = __esm({
|
|
|
5649
5663
|
|
|
5650
5664
|
// src/mcp/ui/lib/tasks-fs.ts
|
|
5651
5665
|
import * as fs26 from "fs";
|
|
5652
|
-
import * as
|
|
5666
|
+
import * as path29 from "path";
|
|
5653
5667
|
function readSession(project, taskSlug) {
|
|
5654
5668
|
const rrceData = getProjectRRCEData(project);
|
|
5655
|
-
const sessionPath =
|
|
5669
|
+
const sessionPath = path29.join(rrceData, "tasks", taskSlug, "session.json");
|
|
5656
5670
|
if (!fs26.existsSync(sessionPath)) {
|
|
5657
5671
|
return null;
|
|
5658
5672
|
}
|
|
@@ -5670,7 +5684,7 @@ function isSessionStale(session, thresholdMs = SESSION_STALE_THRESHOLD_MS) {
|
|
|
5670
5684
|
}
|
|
5671
5685
|
function readAgentTodos(project, taskSlug) {
|
|
5672
5686
|
const rrceData = getProjectRRCEData(project);
|
|
5673
|
-
const todosPath =
|
|
5687
|
+
const todosPath = path29.join(rrceData, "tasks", taskSlug, "agent-todos.json");
|
|
5674
5688
|
if (!fs26.existsSync(todosPath)) {
|
|
5675
5689
|
return null;
|
|
5676
5690
|
}
|
|
@@ -5699,7 +5713,7 @@ function detectStorageModeFromConfig(workspaceRoot) {
|
|
|
5699
5713
|
}
|
|
5700
5714
|
function getEffectiveGlobalBase() {
|
|
5701
5715
|
const dummy = resolveDataPath("global", "__rrce_dummy__", "");
|
|
5702
|
-
return
|
|
5716
|
+
return path29.dirname(path29.dirname(dummy));
|
|
5703
5717
|
}
|
|
5704
5718
|
function getProjectRRCEData(project) {
|
|
5705
5719
|
const workspaceRoot = project.sourcePath || project.path;
|
|
@@ -5708,7 +5722,7 @@ function getProjectRRCEData(project) {
|
|
|
5708
5722
|
}
|
|
5709
5723
|
function listProjectTasks(project) {
|
|
5710
5724
|
const rrceData = getProjectRRCEData(project);
|
|
5711
|
-
const tasksPath =
|
|
5725
|
+
const tasksPath = path29.join(rrceData, "tasks");
|
|
5712
5726
|
if (!fs26.existsSync(tasksPath)) {
|
|
5713
5727
|
return { projectName: project.name, tasksPath, tasks: [] };
|
|
5714
5728
|
}
|
|
@@ -5717,7 +5731,7 @@ function listProjectTasks(project) {
|
|
|
5717
5731
|
const entries = fs26.readdirSync(tasksPath, { withFileTypes: true });
|
|
5718
5732
|
for (const entry of entries) {
|
|
5719
5733
|
if (!entry.isDirectory()) continue;
|
|
5720
|
-
const metaPath =
|
|
5734
|
+
const metaPath = path29.join(tasksPath, entry.name, "meta.json");
|
|
5721
5735
|
if (!fs26.existsSync(metaPath)) continue;
|
|
5722
5736
|
try {
|
|
5723
5737
|
const raw = fs26.readFileSync(metaPath, "utf-8");
|
|
@@ -5739,7 +5753,7 @@ function listProjectTasks(project) {
|
|
|
5739
5753
|
}
|
|
5740
5754
|
function updateTaskStatus(project, taskSlug, status) {
|
|
5741
5755
|
const rrceData = getProjectRRCEData(project);
|
|
5742
|
-
const metaPath =
|
|
5756
|
+
const metaPath = path29.join(rrceData, "tasks", taskSlug, "meta.json");
|
|
5743
5757
|
if (!fs26.existsSync(metaPath)) {
|
|
5744
5758
|
return { ok: false, error: `meta.json not found for task '${taskSlug}'` };
|
|
5745
5759
|
}
|
|
@@ -6136,14 +6150,14 @@ var init_ProjectViews = __esm({
|
|
|
6136
6150
|
|
|
6137
6151
|
// src/mcp/ui/lib/projects.ts
|
|
6138
6152
|
import * as fs27 from "fs";
|
|
6139
|
-
import * as
|
|
6153
|
+
import * as path30 from "path";
|
|
6140
6154
|
function getIndexStats(project) {
|
|
6141
6155
|
const stats = { knowledgeCount: 0, codeCount: 0, lastIndexed: null };
|
|
6142
6156
|
try {
|
|
6143
6157
|
const knowledgePath = project.knowledgePath;
|
|
6144
6158
|
if (knowledgePath) {
|
|
6145
|
-
const embPath =
|
|
6146
|
-
const codeEmbPath =
|
|
6159
|
+
const embPath = path30.join(knowledgePath, "embeddings.json");
|
|
6160
|
+
const codeEmbPath = path30.join(knowledgePath, "code-embeddings.json");
|
|
6147
6161
|
if (fs27.existsSync(embPath)) {
|
|
6148
6162
|
const stat = fs27.statSync(embPath);
|
|
6149
6163
|
stats.lastIndexed = stat.mtime.toISOString();
|
|
@@ -7210,7 +7224,7 @@ __export(update_flow_exports, {
|
|
|
7210
7224
|
import { confirm as confirm5, spinner as spinner2, note as note6, outro as outro2, cancel as cancel2, isCancel as isCancel7 } from "@clack/prompts";
|
|
7211
7225
|
import pc8 from "picocolors";
|
|
7212
7226
|
import * as fs29 from "fs";
|
|
7213
|
-
import * as
|
|
7227
|
+
import * as path31 from "path";
|
|
7214
7228
|
import { stringify as stringify2, parse } from "yaml";
|
|
7215
7229
|
function backupFile(filePath) {
|
|
7216
7230
|
if (!fs29.existsSync(filePath)) return null;
|
|
@@ -7227,7 +7241,7 @@ function backupFile(filePath) {
|
|
|
7227
7241
|
function getPackageVersion2() {
|
|
7228
7242
|
try {
|
|
7229
7243
|
const agentCoreDir = getAgentCoreDir();
|
|
7230
|
-
const packageJsonPath =
|
|
7244
|
+
const packageJsonPath = path31.join(path31.dirname(agentCoreDir), "package.json");
|
|
7231
7245
|
if (fs29.existsSync(packageJsonPath)) {
|
|
7232
7246
|
return JSON.parse(fs29.readFileSync(packageJsonPath, "utf8")).version;
|
|
7233
7247
|
}
|
|
@@ -7264,14 +7278,14 @@ async function performUpdate(workspacePath, workspaceName, currentStorageMode, o
|
|
|
7264
7278
|
const dirs = ["templates", "prompts", "docs"];
|
|
7265
7279
|
const updatedFiles = [];
|
|
7266
7280
|
for (const dir of dirs) {
|
|
7267
|
-
const srcDir =
|
|
7281
|
+
const srcDir = path31.join(agentCoreDir, dir);
|
|
7268
7282
|
if (!fs29.existsSync(srcDir)) continue;
|
|
7269
7283
|
const syncFiles = (src, rel) => {
|
|
7270
7284
|
const entries = fs29.readdirSync(src, { withFileTypes: true });
|
|
7271
7285
|
for (const entry of entries) {
|
|
7272
|
-
const entrySrc =
|
|
7273
|
-
const entryRel =
|
|
7274
|
-
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);
|
|
7275
7289
|
if (entry.isDirectory()) {
|
|
7276
7290
|
ensureDir(entryDest);
|
|
7277
7291
|
syncFiles(entrySrc, entryRel);
|
|
@@ -7279,7 +7293,7 @@ async function performUpdate(workspacePath, workspaceName, currentStorageMode, o
|
|
|
7279
7293
|
if (driftReport.modifiedFiles.includes(entryRel)) {
|
|
7280
7294
|
backupFile(entryDest);
|
|
7281
7295
|
}
|
|
7282
|
-
ensureDir(
|
|
7296
|
+
ensureDir(path31.dirname(entryDest));
|
|
7283
7297
|
fs29.copyFileSync(entrySrc, entryDest);
|
|
7284
7298
|
updatedFiles.push(entryRel);
|
|
7285
7299
|
}
|
|
@@ -7291,10 +7305,10 @@ async function performUpdate(workspacePath, workspaceName, currentStorageMode, o
|
|
|
7291
7305
|
DriftService.saveManifest(dataPath, manifest);
|
|
7292
7306
|
}
|
|
7293
7307
|
const rrceHome = customGlobalPath || getDefaultRRCEHome2();
|
|
7294
|
-
ensureDir(
|
|
7295
|
-
ensureDir(
|
|
7296
|
-
copyDirRecursive(
|
|
7297
|
-
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"));
|
|
7298
7312
|
if (fs29.existsSync(configFilePath)) {
|
|
7299
7313
|
const configContent = fs29.readFileSync(configFilePath, "utf-8");
|
|
7300
7314
|
if (configContent.includes("copilot: true")) {
|
|
@@ -7323,7 +7337,7 @@ async function performUpdate(workspacePath, workspaceName, currentStorageMode, o
|
|
|
7323
7337
|
console.error("Failed to update config.yaml version:", e);
|
|
7324
7338
|
}
|
|
7325
7339
|
}
|
|
7326
|
-
const mcpPath =
|
|
7340
|
+
const mcpPath = path31.join(rrceHome, "mcp.yaml");
|
|
7327
7341
|
if (fs29.existsSync(mcpPath)) {
|
|
7328
7342
|
try {
|
|
7329
7343
|
const content = fs29.readFileSync(mcpPath, "utf-8");
|
|
@@ -7424,14 +7438,14 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7424
7438
|
const dirs = ["templates", "prompts", "docs"];
|
|
7425
7439
|
const updatedFiles = [];
|
|
7426
7440
|
for (const dir of dirs) {
|
|
7427
|
-
const srcDir =
|
|
7441
|
+
const srcDir = path31.join(agentCoreDir, dir);
|
|
7428
7442
|
if (!fs29.existsSync(srcDir)) continue;
|
|
7429
7443
|
const syncFiles = (src, rel) => {
|
|
7430
7444
|
const entries = fs29.readdirSync(src, { withFileTypes: true });
|
|
7431
7445
|
for (const entry of entries) {
|
|
7432
|
-
const entrySrc =
|
|
7433
|
-
const entryRel =
|
|
7434
|
-
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);
|
|
7435
7449
|
if (entry.isDirectory()) {
|
|
7436
7450
|
ensureDir(entryDest);
|
|
7437
7451
|
syncFiles(entrySrc, entryRel);
|
|
@@ -7439,7 +7453,7 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7439
7453
|
if (driftReport.modifiedFiles.includes(entryRel)) {
|
|
7440
7454
|
backupFile(entryDest);
|
|
7441
7455
|
}
|
|
7442
|
-
ensureDir(
|
|
7456
|
+
ensureDir(path31.dirname(entryDest));
|
|
7443
7457
|
fs29.copyFileSync(entrySrc, entryDest);
|
|
7444
7458
|
updatedFiles.push(entryRel);
|
|
7445
7459
|
}
|
|
@@ -7451,10 +7465,10 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7451
7465
|
DriftService.saveManifest(dataPath, manifest);
|
|
7452
7466
|
}
|
|
7453
7467
|
const rrceHome = customGlobalPath || getDefaultRRCEHome2();
|
|
7454
|
-
ensureDir(
|
|
7455
|
-
ensureDir(
|
|
7456
|
-
copyDirRecursive(
|
|
7457
|
-
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"));
|
|
7458
7472
|
if (fs29.existsSync(configFilePath)) {
|
|
7459
7473
|
const configContent = fs29.readFileSync(configFilePath, "utf-8");
|
|
7460
7474
|
if (configContent.includes("copilot: true")) {
|
|
@@ -7483,7 +7497,7 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7483
7497
|
console.error("Failed to update config.yaml version:", e);
|
|
7484
7498
|
}
|
|
7485
7499
|
}
|
|
7486
|
-
const mcpPath =
|
|
7500
|
+
const mcpPath = path31.join(rrceHome, "mcp.yaml");
|
|
7487
7501
|
if (fs29.existsSync(mcpPath)) {
|
|
7488
7502
|
try {
|
|
7489
7503
|
const content = fs29.readFileSync(mcpPath, "utf-8");
|
|
@@ -7527,8 +7541,8 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
7527
7541
|
}
|
|
7528
7542
|
}
|
|
7529
7543
|
function resolveAllDataPathsWithCustomGlobal(mode, workspaceName, workspaceRoot, customGlobalPath) {
|
|
7530
|
-
const globalPath =
|
|
7531
|
-
const workspacePath =
|
|
7544
|
+
const globalPath = path31.join(customGlobalPath, "workspaces", workspaceName);
|
|
7545
|
+
const workspacePath = path31.join(workspaceRoot, ".rrce-workflow");
|
|
7532
7546
|
switch (mode) {
|
|
7533
7547
|
case "global":
|
|
7534
7548
|
return [globalPath];
|
|
@@ -7552,7 +7566,7 @@ var init_update_flow = __esm({
|
|
|
7552
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";
|
|
7553
7567
|
import pc13 from "picocolors";
|
|
7554
7568
|
import * as fs33 from "fs";
|
|
7555
|
-
import * as
|
|
7569
|
+
import * as path33 from "path";
|
|
7556
7570
|
import { parse as parse2 } from "yaml";
|
|
7557
7571
|
|
|
7558
7572
|
// src/lib/git.ts
|
|
@@ -8332,14 +8346,14 @@ init_utils();
|
|
|
8332
8346
|
import { confirm as confirm8, spinner as spinner5, note as note9, outro as outro5, cancel as cancel5, isCancel as isCancel10 } from "@clack/prompts";
|
|
8333
8347
|
import pc11 from "picocolors";
|
|
8334
8348
|
import * as fs31 from "fs";
|
|
8335
|
-
import * as
|
|
8349
|
+
import * as path32 from "path";
|
|
8336
8350
|
async function runSyncToGlobalFlow(workspacePath, workspaceName) {
|
|
8337
8351
|
const localPath = getLocalWorkspacePath(workspacePath);
|
|
8338
8352
|
const customGlobalPath = getEffectiveRRCEHome(workspacePath);
|
|
8339
|
-
const globalPath =
|
|
8353
|
+
const globalPath = path32.join(customGlobalPath, "workspaces", workspaceName);
|
|
8340
8354
|
const subdirs = ["knowledge", "prompts", "templates", "tasks", "refs"];
|
|
8341
8355
|
const existingDirs = subdirs.filter(
|
|
8342
|
-
(dir) => fs31.existsSync(
|
|
8356
|
+
(dir) => fs31.existsSync(path32.join(localPath, dir))
|
|
8343
8357
|
);
|
|
8344
8358
|
if (existingDirs.length === 0) {
|
|
8345
8359
|
outro5(pc11.yellow("No data found in workspace storage to sync."));
|
|
@@ -8365,8 +8379,8 @@ Destination: ${pc11.cyan(globalPath)}`,
|
|
|
8365
8379
|
try {
|
|
8366
8380
|
ensureDir(globalPath);
|
|
8367
8381
|
for (const dir of existingDirs) {
|
|
8368
|
-
const srcDir =
|
|
8369
|
-
const destDir =
|
|
8382
|
+
const srcDir = path32.join(localPath, dir);
|
|
8383
|
+
const destDir = path32.join(globalPath, dir);
|
|
8370
8384
|
ensureDir(destDir);
|
|
8371
8385
|
copyDirRecursive(srcDir, destDir);
|
|
8372
8386
|
}
|
|
@@ -8461,7 +8475,7 @@ init_config();
|
|
|
8461
8475
|
function getPackageVersion3() {
|
|
8462
8476
|
try {
|
|
8463
8477
|
const agentCoreDir = getAgentCoreDir();
|
|
8464
|
-
const packageJsonPath =
|
|
8478
|
+
const packageJsonPath = path33.join(path33.dirname(agentCoreDir), "package.json");
|
|
8465
8479
|
if (fs33.existsSync(packageJsonPath)) {
|
|
8466
8480
|
return JSON.parse(fs33.readFileSync(packageJsonPath, "utf8")).version;
|
|
8467
8481
|
}
|
|
@@ -8482,7 +8496,7 @@ function getLastSyncedVersion(workspacePath, workspaceName) {
|
|
|
8482
8496
|
}
|
|
8483
8497
|
}
|
|
8484
8498
|
const rrceHome = getEffectiveRRCEHome(workspacePath) || getDefaultRRCEHome2();
|
|
8485
|
-
const mcpPath =
|
|
8499
|
+
const mcpPath = path33.join(rrceHome, "mcp.yaml");
|
|
8486
8500
|
if (fs33.existsSync(mcpPath)) {
|
|
8487
8501
|
try {
|
|
8488
8502
|
const content = fs33.readFileSync(mcpPath, "utf-8");
|