@arcbridge/mcp-server 0.6.0 → 0.6.2
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 +39 -22
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -230,17 +230,25 @@ Use \`arcbridge_get_project_status\` to see the current state.`
|
|
|
230
230
|
|
|
231
231
|
// src/tools/get-project-status.ts
|
|
232
232
|
import { z as z2 } from "zod";
|
|
233
|
-
import { refreshFromDocs } from "@arcbridge/core";
|
|
233
|
+
import { refreshFromDocs as refreshFromDocs2 } from "@arcbridge/core";
|
|
234
234
|
|
|
235
235
|
// src/helpers.ts
|
|
236
236
|
import { join as join2 } from "path";
|
|
237
237
|
import { existsSync as existsSync2 } from "fs";
|
|
238
|
-
import { openDatabase, migrate } from "@arcbridge/core";
|
|
238
|
+
import { openDatabase, migrate, initializeSchema, refreshFromDocs } from "@arcbridge/core";
|
|
239
239
|
function ensureDb(ctx, targetDir) {
|
|
240
240
|
if (ctx.db) return ctx.db;
|
|
241
241
|
const dbPath = join2(targetDir, ".arcbridge", "index.db");
|
|
242
242
|
if (!existsSync2(dbPath)) {
|
|
243
|
-
|
|
243
|
+
const configPath = join2(targetDir, ".arcbridge", "config.yaml");
|
|
244
|
+
if (!existsSync2(configPath)) return null;
|
|
245
|
+
const db = openDatabase(dbPath);
|
|
246
|
+
initializeSchema(db);
|
|
247
|
+
migrate(db);
|
|
248
|
+
refreshFromDocs(db, targetDir);
|
|
249
|
+
ctx.db = db;
|
|
250
|
+
ctx.projectRoot = targetDir;
|
|
251
|
+
return db;
|
|
244
252
|
}
|
|
245
253
|
ctx.db = openDatabase(dbPath);
|
|
246
254
|
migrate(ctx.db);
|
|
@@ -290,7 +298,7 @@ function registerGetProjectStatus(server, ctx) {
|
|
|
290
298
|
if (!db) {
|
|
291
299
|
return notInitialized();
|
|
292
300
|
}
|
|
293
|
-
|
|
301
|
+
refreshFromDocs2(db, params.target_dir);
|
|
294
302
|
const metaRows = db.prepare(
|
|
295
303
|
"SELECT key, value FROM arcbridge_meta WHERE key IN ('project_name', 'project_type', 'platforms')"
|
|
296
304
|
).all();
|
|
@@ -706,7 +714,7 @@ function registerGetQualityScenarios(server, ctx) {
|
|
|
706
714
|
|
|
707
715
|
// src/tools/get-phase-plan.ts
|
|
708
716
|
import { z as z6 } from "zod";
|
|
709
|
-
import { refreshFromDocs as
|
|
717
|
+
import { refreshFromDocs as refreshFromDocs3 } from "@arcbridge/core";
|
|
710
718
|
function registerGetPhasePlan(server, ctx) {
|
|
711
719
|
server.tool(
|
|
712
720
|
"arcbridge_get_phase_plan",
|
|
@@ -720,7 +728,7 @@ function registerGetPhasePlan(server, ctx) {
|
|
|
720
728
|
async (params) => {
|
|
721
729
|
const db = ensureDb(ctx, params.target_dir);
|
|
722
730
|
if (!db) return notInitialized();
|
|
723
|
-
|
|
731
|
+
refreshFromDocs3(db, params.target_dir);
|
|
724
732
|
let query = "SELECT id, name, phase_number, status, description, gate_status, started_at, completed_at FROM phases";
|
|
725
733
|
const conditions = [];
|
|
726
734
|
const queryParams = [];
|
|
@@ -809,7 +817,7 @@ function registerGetPhasePlan(server, ctx) {
|
|
|
809
817
|
|
|
810
818
|
// src/tools/get-current-tasks.ts
|
|
811
819
|
import { z as z7 } from "zod";
|
|
812
|
-
import { refreshFromDocs as
|
|
820
|
+
import { refreshFromDocs as refreshFromDocs4 } from "@arcbridge/core";
|
|
813
821
|
function registerGetCurrentTasks(server, ctx) {
|
|
814
822
|
server.tool(
|
|
815
823
|
"arcbridge_get_current_tasks",
|
|
@@ -822,7 +830,7 @@ function registerGetCurrentTasks(server, ctx) {
|
|
|
822
830
|
async (params) => {
|
|
823
831
|
const db = ensureDb(ctx, params.target_dir);
|
|
824
832
|
if (!db) return notInitialized();
|
|
825
|
-
|
|
833
|
+
refreshFromDocs4(db, params.target_dir);
|
|
826
834
|
let currentPhase;
|
|
827
835
|
if (params.phase_id) {
|
|
828
836
|
currentPhase = db.prepare("SELECT id, name FROM phases WHERE id = ?").get(params.phase_id);
|
|
@@ -1153,7 +1161,7 @@ If you need a new block, add it to \`.arcbridge/arc42/05-building-blocks.md\` an
|
|
|
1153
1161
|
|
|
1154
1162
|
// src/tools/delete-task.ts
|
|
1155
1163
|
import { z as z10 } from "zod";
|
|
1156
|
-
import { deleteTaskFromYaml, refreshFromDocs as
|
|
1164
|
+
import { deleteTaskFromYaml, refreshFromDocs as refreshFromDocs5 } from "@arcbridge/core";
|
|
1157
1165
|
function registerDeleteTask(server, ctx) {
|
|
1158
1166
|
server.tool(
|
|
1159
1167
|
"arcbridge_delete_task",
|
|
@@ -1189,7 +1197,7 @@ function registerDeleteTask(server, ctx) {
|
|
|
1189
1197
|
}
|
|
1190
1198
|
}
|
|
1191
1199
|
if (results.length > 0) {
|
|
1192
|
-
|
|
1200
|
+
refreshFromDocs5(db, params.target_dir);
|
|
1193
1201
|
}
|
|
1194
1202
|
const lines = [];
|
|
1195
1203
|
if (results.length > 0) {
|
|
@@ -1208,7 +1216,7 @@ function registerDeleteTask(server, ctx) {
|
|
|
1208
1216
|
|
|
1209
1217
|
// src/tools/create-phase.ts
|
|
1210
1218
|
import { z as z11 } from "zod";
|
|
1211
|
-
import { addPhaseToYaml, refreshFromDocs as
|
|
1219
|
+
import { addPhaseToYaml, refreshFromDocs as refreshFromDocs6 } from "@arcbridge/core";
|
|
1212
1220
|
function registerCreatePhase(server, ctx) {
|
|
1213
1221
|
server.tool(
|
|
1214
1222
|
"arcbridge_create_phase",
|
|
@@ -1223,7 +1231,7 @@ function registerCreatePhase(server, ctx) {
|
|
|
1223
1231
|
async (params) => {
|
|
1224
1232
|
const db = ensureDb(ctx, params.target_dir);
|
|
1225
1233
|
if (!db) return notInitialized();
|
|
1226
|
-
|
|
1234
|
+
refreshFromDocs6(db, params.target_dir);
|
|
1227
1235
|
const maxPhase = db.prepare("SELECT MAX(phase_number) as max FROM phases").get();
|
|
1228
1236
|
const phaseNumber = params.phase_number ?? (maxPhase.max ?? -1) + 1;
|
|
1229
1237
|
const existing = db.prepare("SELECT id FROM phases WHERE phase_number = ?").get(phaseNumber);
|
|
@@ -1246,7 +1254,7 @@ function registerCreatePhase(server, ctx) {
|
|
|
1246
1254
|
`Failed to create phase: ${yamlResult.warning ?? "YAML update failed"}`
|
|
1247
1255
|
);
|
|
1248
1256
|
}
|
|
1249
|
-
|
|
1257
|
+
refreshFromDocs6(db, params.target_dir);
|
|
1250
1258
|
const lines = [
|
|
1251
1259
|
`Phase created: **${phaseId}**`,
|
|
1252
1260
|
"",
|
|
@@ -1272,7 +1280,7 @@ function registerCreatePhase(server, ctx) {
|
|
|
1272
1280
|
|
|
1273
1281
|
// src/tools/delete-phase.ts
|
|
1274
1282
|
import { z as z12 } from "zod";
|
|
1275
|
-
import { deletePhaseFromYaml, refreshFromDocs as
|
|
1283
|
+
import { deletePhaseFromYaml, refreshFromDocs as refreshFromDocs7 } from "@arcbridge/core";
|
|
1276
1284
|
function registerDeletePhase(server, ctx) {
|
|
1277
1285
|
server.tool(
|
|
1278
1286
|
"arcbridge_delete_phase",
|
|
@@ -1302,7 +1310,7 @@ function registerDeletePhase(server, ctx) {
|
|
|
1302
1310
|
`Failed to delete phase: ${yamlResult.warning ?? "Unknown error"}`
|
|
1303
1311
|
);
|
|
1304
1312
|
}
|
|
1305
|
-
|
|
1313
|
+
refreshFromDocs7(db, params.target_dir);
|
|
1306
1314
|
const lines = [
|
|
1307
1315
|
`Phase **${phase.id}** deleted: "${phase.name}" (phase ${phase.phase_number})`
|
|
1308
1316
|
];
|
|
@@ -1408,7 +1416,7 @@ function formatAdrs(adrs, title) {
|
|
|
1408
1416
|
|
|
1409
1417
|
// src/tools/reindex.ts
|
|
1410
1418
|
import { z as z14 } from "zod";
|
|
1411
|
-
import { indexProject as indexProject2, refreshFromDocs as
|
|
1419
|
+
import { indexProject as indexProject2, refreshFromDocs as refreshFromDocs8 } from "@arcbridge/core";
|
|
1412
1420
|
function registerReindex(server, ctx) {
|
|
1413
1421
|
server.tool(
|
|
1414
1422
|
"arcbridge_reindex",
|
|
@@ -1424,7 +1432,7 @@ function registerReindex(server, ctx) {
|
|
|
1424
1432
|
const db = ensureDb(ctx, params.target_dir);
|
|
1425
1433
|
if (!db) return notInitialized();
|
|
1426
1434
|
try {
|
|
1427
|
-
const docWarnings =
|
|
1435
|
+
const docWarnings = refreshFromDocs8(db, params.target_dir);
|
|
1428
1436
|
const result = await indexProject2(db, {
|
|
1429
1437
|
projectRoot: params.target_dir,
|
|
1430
1438
|
tsconfigPath: params.tsconfig_path,
|
|
@@ -1577,6 +1585,7 @@ function registerSearchSymbols(server, ctx) {
|
|
|
1577
1585
|
import { z as z16 } from "zod";
|
|
1578
1586
|
import { readFileSync, existsSync as existsSync3 } from "fs";
|
|
1579
1587
|
import { join as join3 } from "path";
|
|
1588
|
+
import { logWarn } from "@arcbridge/core";
|
|
1580
1589
|
function registerGetSymbol(server, ctx) {
|
|
1581
1590
|
server.tool(
|
|
1582
1591
|
"arcbridge_get_symbol",
|
|
@@ -1635,7 +1644,14 @@ Use \`arcbridge_search_symbols\` to find symbols by name.`
|
|
|
1635
1644
|
return `${marker} ${String(lineNum).padStart(4)} | ${line}`;
|
|
1636
1645
|
}).join("\n");
|
|
1637
1646
|
lines.push("## Source", "", "```typescript", snippet, "```", "");
|
|
1638
|
-
} catch {
|
|
1647
|
+
} catch (err) {
|
|
1648
|
+
logWarn(`Could not read source for symbol ${symbol.id} (${symbol.file_path})`, err);
|
|
1649
|
+
lines.push(
|
|
1650
|
+
"## Source",
|
|
1651
|
+
"",
|
|
1652
|
+
`_Source unavailable: could not read \`${symbol.file_path}\` (${err instanceof Error ? err.message : String(err)})._`,
|
|
1653
|
+
""
|
|
1654
|
+
);
|
|
1639
1655
|
}
|
|
1640
1656
|
}
|
|
1641
1657
|
}
|
|
@@ -3098,7 +3114,7 @@ import {
|
|
|
3098
3114
|
applyInferences,
|
|
3099
3115
|
verifyScenarios,
|
|
3100
3116
|
loadConfig as loadConfig4,
|
|
3101
|
-
refreshFromDocs as
|
|
3117
|
+
refreshFromDocs as refreshFromDocs9,
|
|
3102
3118
|
syncPhaseToYaml,
|
|
3103
3119
|
transaction
|
|
3104
3120
|
} from "@arcbridge/core";
|
|
@@ -3117,7 +3133,7 @@ function registerCompletePhase(server, ctx) {
|
|
|
3117
3133
|
const start = Date.now();
|
|
3118
3134
|
const db = ensureDb(ctx, params.target_dir);
|
|
3119
3135
|
if (!db) return notInitialized();
|
|
3120
|
-
|
|
3136
|
+
refreshFromDocs9(db, params.target_dir);
|
|
3121
3137
|
let phase;
|
|
3122
3138
|
if (params.phase_id) {
|
|
3123
3139
|
phase = db.prepare("SELECT id, name, phase_number, status, gate_status FROM phases WHERE id = ?").get(params.phase_id);
|
|
@@ -4476,7 +4492,8 @@ You can commit this file to preserve the activity record in git.`
|
|
|
4476
4492
|
// src/tools/update-arc42-section.ts
|
|
4477
4493
|
import { z as z34 } from "zod";
|
|
4478
4494
|
import { join as join4 } from "path";
|
|
4479
|
-
import { existsSync as existsSync4, readFileSync as readFileSync2
|
|
4495
|
+
import { existsSync as existsSync4, readFileSync as readFileSync2 } from "fs";
|
|
4496
|
+
import { atomicWriteFileSync } from "@arcbridge/core";
|
|
4480
4497
|
function splitFrontmatter(raw) {
|
|
4481
4498
|
if (!raw.startsWith("---")) {
|
|
4482
4499
|
return { frontmatterBlock: "", body: raw };
|
|
@@ -4561,7 +4578,7 @@ function registerUpdateArc42Section(server, ctx) {
|
|
|
4561
4578
|
${params.content}
|
|
4562
4579
|
` : `${params.content}
|
|
4563
4580
|
`;
|
|
4564
|
-
|
|
4581
|
+
atomicWriteFileSync(filePath, updated);
|
|
4565
4582
|
const label = SECTION_LABELS[params.section];
|
|
4566
4583
|
return textResult(
|
|
4567
4584
|
`Updated **${label}** (\`${params.section}.md\`). Frontmatter preserved.`
|