@arcbridge/mcp-server 0.1.2 → 0.1.4
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 +64 -14
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// src/suppress-warnings.ts
|
|
4
|
+
import { suppressSqliteWarning } from "@arcbridge/core";
|
|
5
|
+
suppressSqliteWarning();
|
|
6
|
+
|
|
3
7
|
// src/index.ts
|
|
4
8
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
9
|
|
|
@@ -26,7 +30,8 @@ import {
|
|
|
26
30
|
generateAgentRoles,
|
|
27
31
|
generateDatabase,
|
|
28
32
|
generateSyncFiles,
|
|
29
|
-
indexProject
|
|
33
|
+
indexProject,
|
|
34
|
+
loadConfig
|
|
30
35
|
} from "@arcbridge/core";
|
|
31
36
|
import { getAdapter } from "@arcbridge/adapters";
|
|
32
37
|
function registerInitProject(server, ctx) {
|
|
@@ -35,7 +40,9 @@ function registerInitProject(server, ctx) {
|
|
|
35
40
|
"Initialize ArcBridge in a project directory. Creates .arcbridge/ with arc42 documentation, phase plan, agent roles, SQLite database, and platform-specific configs.",
|
|
36
41
|
{
|
|
37
42
|
name: z.string().min(1).describe("Project name"),
|
|
38
|
-
template: z.enum(["nextjs-app-router", "react-vite", "api-service", "dotnet-webapi"]).default("nextjs-app-router").describe(
|
|
43
|
+
template: z.enum(["nextjs-app-router", "react-vite", "api-service", "dotnet-webapi"]).default("nextjs-app-router").describe(
|
|
44
|
+
"Project template: nextjs-app-router (Next.js with App Router, SSR/SSG), react-vite (React SPA with Vite, client-only), api-service (Node.js API with Express/Fastify/Hono), dotnet-webapi (ASP.NET Core Web API, C#)"
|
|
45
|
+
),
|
|
39
46
|
features: z.array(z.enum(["auth", "database", "api"])).default([]).describe("Features to scaffold"),
|
|
40
47
|
quality_priorities: z.array(z.string()).default(["security", "performance", "accessibility"]).describe("Quality priorities in order"),
|
|
41
48
|
platforms: z.array(z.string()).default(["claude"]).describe("Target platforms for agent config generation"),
|
|
@@ -43,16 +50,51 @@ function registerInitProject(server, ctx) {
|
|
|
43
50
|
},
|
|
44
51
|
async (params) => {
|
|
45
52
|
const targetDir = params.target_dir;
|
|
46
|
-
|
|
53
|
+
const dbExists = existsSync(join(targetDir, ".arcbridge", "index.db"));
|
|
54
|
+
const configExists = existsSync(join(targetDir, ".arcbridge", "config.yaml"));
|
|
55
|
+
if (dbExists && configExists) {
|
|
56
|
+
const { error: validationError } = loadConfig(targetDir);
|
|
57
|
+
const msg = validationError ? `ArcBridge is initialized in ${targetDir} but config has issues: ${validationError}. Use \`arcbridge_get_project_status\` to see the current state, or delete \`.arcbridge/\` to reinitialize.` : `ArcBridge is already initialized in ${targetDir}. Use \`arcbridge_get_project_status\` to see the current state, or delete \`.arcbridge/\` to reinitialize.`;
|
|
58
|
+
return {
|
|
59
|
+
content: [{ type: "text", text: msg }]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (dbExists && !configExists) {
|
|
47
63
|
return {
|
|
48
64
|
content: [
|
|
49
65
|
{
|
|
50
66
|
type: "text",
|
|
51
|
-
text: `ArcBridge
|
|
67
|
+
text: `ArcBridge database exists in ${targetDir} but config.yaml is missing. Delete \`.arcbridge/\` to reinitialize, or restore config.yaml.`
|
|
52
68
|
}
|
|
53
69
|
]
|
|
54
70
|
};
|
|
55
71
|
}
|
|
72
|
+
if (configExists && !dbExists) {
|
|
73
|
+
const { config: existingConfig } = loadConfig(targetDir);
|
|
74
|
+
if (existingConfig) {
|
|
75
|
+
const recoverInput = {
|
|
76
|
+
name: existingConfig.project_name,
|
|
77
|
+
template: existingConfig.project_type,
|
|
78
|
+
features: [],
|
|
79
|
+
quality_priorities: existingConfig.quality_priorities,
|
|
80
|
+
platforms: existingConfig.platforms,
|
|
81
|
+
projectRoot: targetDir
|
|
82
|
+
};
|
|
83
|
+
const { db: recoveredDb } = generateDatabase(targetDir, recoverInput);
|
|
84
|
+
ctx.db = recoveredDb;
|
|
85
|
+
ctx.projectRoot = targetDir;
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: `ArcBridge database recovered from existing config in ${targetDir}. Your arc42 docs and plans were preserved.
|
|
91
|
+
|
|
92
|
+
Use \`arcbridge_get_project_status\` to see the current state.`
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
56
98
|
const input = {
|
|
57
99
|
name: params.name,
|
|
58
100
|
template: params.template,
|
|
@@ -133,6 +175,13 @@ function registerInitProject(server, ctx) {
|
|
|
133
175
|
...allWarnings.map((w) => `- ${w}`)
|
|
134
176
|
] : [],
|
|
135
177
|
"",
|
|
178
|
+
"## Next Steps",
|
|
179
|
+
"",
|
|
180
|
+
"1. **Review the phase plan** \u2014 run `arcbridge_get_phase_plan` to see all phases and their tasks",
|
|
181
|
+
"2. **Replace example tasks in Phase 2+** \u2014 Phase 0-1 tasks are ready to use, but Phase 2+ tasks are examples only. Replace them with real tasks from the project's requirements.",
|
|
182
|
+
"3. **Activate the architect role** \u2014 run `arcbridge_activate_role` with role `architect` to get full architectural context",
|
|
183
|
+
"4. **Start working** \u2014 use `arcbridge_get_current_tasks` to see what to do next",
|
|
184
|
+
"",
|
|
136
185
|
"Use `arcbridge_get_project_status` to see the full project status."
|
|
137
186
|
];
|
|
138
187
|
return {
|
|
@@ -633,6 +682,7 @@ function registerGetPhasePlan(server, ctx) {
|
|
|
633
682
|
lines.push(
|
|
634
683
|
`## ${icon} Phase ${phase.phase_number}: ${phase.name}`,
|
|
635
684
|
"",
|
|
685
|
+
`**ID:** \`${phase.id}\``,
|
|
636
686
|
`**Status:** ${phase.status}`,
|
|
637
687
|
`**Description:** ${phase.description}`
|
|
638
688
|
);
|
|
@@ -765,7 +815,7 @@ import { z as z8 } from "zod";
|
|
|
765
815
|
import { syncTaskToYaml } from "@arcbridge/core";
|
|
766
816
|
|
|
767
817
|
// src/auto-record.ts
|
|
768
|
-
import { loadConfig, insertActivity } from "@arcbridge/core";
|
|
818
|
+
import { loadConfig as loadConfig2, insertActivity } from "@arcbridge/core";
|
|
769
819
|
var configCache = /* @__PURE__ */ new Map();
|
|
770
820
|
var CACHE_TTL_MS = 3e4;
|
|
771
821
|
function isAutoRecordEnabled(projectRoot) {
|
|
@@ -773,7 +823,7 @@ function isAutoRecordEnabled(projectRoot) {
|
|
|
773
823
|
if (cached && Date.now() - cached.loadedAt < CACHE_TTL_MS) {
|
|
774
824
|
return cached.autoRecord;
|
|
775
825
|
}
|
|
776
|
-
const { config } =
|
|
826
|
+
const { config } = loadConfig2(projectRoot);
|
|
777
827
|
const autoRecord2 = config?.metrics?.auto_record ?? false;
|
|
778
828
|
configCache.set(projectRoot, { autoRecord: autoRecord2, loadedAt: Date.now() });
|
|
779
829
|
return autoRecord2;
|
|
@@ -941,7 +991,7 @@ function registerCreateTask(server, ctx) {
|
|
|
941
991
|
`Task created: **${taskId}**`,
|
|
942
992
|
"",
|
|
943
993
|
`**Title:** ${params.title}`,
|
|
944
|
-
`**Phase:** ${phase.name}`,
|
|
994
|
+
`**Phase:** ${phase.name} (\`${phase.id}\`)`,
|
|
945
995
|
`**Status:** todo`
|
|
946
996
|
];
|
|
947
997
|
if (params.building_block) {
|
|
@@ -2711,9 +2761,10 @@ import {
|
|
|
2711
2761
|
inferTaskStatuses,
|
|
2712
2762
|
applyInferences,
|
|
2713
2763
|
verifyScenarios,
|
|
2714
|
-
loadConfig as
|
|
2764
|
+
loadConfig as loadConfig3,
|
|
2715
2765
|
refreshFromDocs as refreshFromDocs5,
|
|
2716
|
-
syncPhaseToYaml
|
|
2766
|
+
syncPhaseToYaml,
|
|
2767
|
+
transaction
|
|
2717
2768
|
} from "@arcbridge/core";
|
|
2718
2769
|
function registerCompletePhase(server, ctx) {
|
|
2719
2770
|
server.tool(
|
|
@@ -2775,7 +2826,7 @@ function registerCompletePhase(server, ctx) {
|
|
|
2775
2826
|
const projectRoot = ctx.projectRoot ?? params.target_dir;
|
|
2776
2827
|
let testCommand = "npx vitest run";
|
|
2777
2828
|
let timeoutMs = 6e4;
|
|
2778
|
-
const configResult =
|
|
2829
|
+
const configResult = loadConfig3(params.target_dir);
|
|
2779
2830
|
if (configResult.config) {
|
|
2780
2831
|
testCommand = configResult.config.testing.test_command;
|
|
2781
2832
|
timeoutMs = configResult.config.testing.timeout_ms;
|
|
@@ -2870,7 +2921,7 @@ function registerCompletePhase(server, ctx) {
|
|
|
2870
2921
|
const nextPhase = db.prepare(
|
|
2871
2922
|
"SELECT id, name FROM phases WHERE phase_number = ? AND status = 'planned'"
|
|
2872
2923
|
).get(phase.phase_number + 1);
|
|
2873
|
-
|
|
2924
|
+
transaction(db, () => {
|
|
2874
2925
|
db.prepare(
|
|
2875
2926
|
"UPDATE phases SET status = 'complete', completed_at = ?, gate_status = ? WHERE id = ?"
|
|
2876
2927
|
).run(now, gateStatus, phase.id);
|
|
@@ -2880,7 +2931,6 @@ function registerCompletePhase(server, ctx) {
|
|
|
2880
2931
|
).run(now, nextPhase.id);
|
|
2881
2932
|
}
|
|
2882
2933
|
});
|
|
2883
|
-
transition();
|
|
2884
2934
|
const projectRoot = ctx.projectRoot ?? params.target_dir;
|
|
2885
2935
|
syncPhaseToYaml(projectRoot, phase.id, "complete", void 0, now);
|
|
2886
2936
|
if (nextPhase) {
|
|
@@ -3254,7 +3304,7 @@ function getRoleDefinition(roleId) {
|
|
|
3254
3304
|
|
|
3255
3305
|
// src/tools/verify-scenarios.ts
|
|
3256
3306
|
import { z as z25 } from "zod";
|
|
3257
|
-
import { verifyScenarios as verifyScenarios2, loadConfig as
|
|
3307
|
+
import { verifyScenarios as verifyScenarios2, loadConfig as loadConfig4 } from "@arcbridge/core";
|
|
3258
3308
|
function registerVerifyScenarios(server, ctx) {
|
|
3259
3309
|
server.tool(
|
|
3260
3310
|
"arcbridge_verify_scenarios",
|
|
@@ -3273,7 +3323,7 @@ function registerVerifyScenarios(server, ctx) {
|
|
|
3273
3323
|
if (!db) return notInitialized();
|
|
3274
3324
|
let testCommand = "npx vitest run";
|
|
3275
3325
|
let timeoutMs = 6e4;
|
|
3276
|
-
const configResult =
|
|
3326
|
+
const configResult = loadConfig4(params.target_dir);
|
|
3277
3327
|
if (configResult.config) {
|
|
3278
3328
|
testCommand = configResult.config.testing.test_command;
|
|
3279
3329
|
timeoutMs = configResult.config.testing.timeout_ms;
|