@arcbridge/mcp-server 0.1.3 → 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 CHANGED
@@ -30,7 +30,8 @@ import {
30
30
  generateAgentRoles,
31
31
  generateDatabase,
32
32
  generateSyncFiles,
33
- indexProject
33
+ indexProject,
34
+ loadConfig
34
35
  } from "@arcbridge/core";
35
36
  import { getAdapter } from "@arcbridge/adapters";
36
37
  function registerInitProject(server, ctx) {
@@ -39,7 +40,9 @@ function registerInitProject(server, ctx) {
39
40
  "Initialize ArcBridge in a project directory. Creates .arcbridge/ with arc42 documentation, phase plan, agent roles, SQLite database, and platform-specific configs.",
40
41
  {
41
42
  name: z.string().min(1).describe("Project name"),
42
- template: z.enum(["nextjs-app-router", "react-vite", "api-service", "dotnet-webapi"]).default("nextjs-app-router").describe("Project template"),
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
+ ),
43
46
  features: z.array(z.enum(["auth", "database", "api"])).default([]).describe("Features to scaffold"),
44
47
  quality_priorities: z.array(z.string()).default(["security", "performance", "accessibility"]).describe("Quality priorities in order"),
45
48
  platforms: z.array(z.string()).default(["claude"]).describe("Target platforms for agent config generation"),
@@ -47,16 +50,51 @@ function registerInitProject(server, ctx) {
47
50
  },
48
51
  async (params) => {
49
52
  const targetDir = params.target_dir;
50
- if (existsSync(join(targetDir, ".arcbridge", "config.yaml"))) {
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) {
51
63
  return {
52
64
  content: [
53
65
  {
54
66
  type: "text",
55
- text: `ArcBridge is already initialized in ${targetDir}. Use arcbridge_get_project_status to see the current state.`
67
+ text: `ArcBridge database exists in ${targetDir} but config.yaml is missing. Delete \`.arcbridge/\` to reinitialize, or restore config.yaml.`
56
68
  }
57
69
  ]
58
70
  };
59
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
+ }
60
98
  const input = {
61
99
  name: params.name,
62
100
  template: params.template,
@@ -137,6 +175,13 @@ function registerInitProject(server, ctx) {
137
175
  ...allWarnings.map((w) => `- ${w}`)
138
176
  ] : [],
139
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
+ "",
140
185
  "Use `arcbridge_get_project_status` to see the full project status."
141
186
  ];
142
187
  return {
@@ -637,6 +682,7 @@ function registerGetPhasePlan(server, ctx) {
637
682
  lines.push(
638
683
  `## ${icon} Phase ${phase.phase_number}: ${phase.name}`,
639
684
  "",
685
+ `**ID:** \`${phase.id}\``,
640
686
  `**Status:** ${phase.status}`,
641
687
  `**Description:** ${phase.description}`
642
688
  );
@@ -769,7 +815,7 @@ import { z as z8 } from "zod";
769
815
  import { syncTaskToYaml } from "@arcbridge/core";
770
816
 
771
817
  // src/auto-record.ts
772
- import { loadConfig, insertActivity } from "@arcbridge/core";
818
+ import { loadConfig as loadConfig2, insertActivity } from "@arcbridge/core";
773
819
  var configCache = /* @__PURE__ */ new Map();
774
820
  var CACHE_TTL_MS = 3e4;
775
821
  function isAutoRecordEnabled(projectRoot) {
@@ -777,7 +823,7 @@ function isAutoRecordEnabled(projectRoot) {
777
823
  if (cached && Date.now() - cached.loadedAt < CACHE_TTL_MS) {
778
824
  return cached.autoRecord;
779
825
  }
780
- const { config } = loadConfig(projectRoot);
826
+ const { config } = loadConfig2(projectRoot);
781
827
  const autoRecord2 = config?.metrics?.auto_record ?? false;
782
828
  configCache.set(projectRoot, { autoRecord: autoRecord2, loadedAt: Date.now() });
783
829
  return autoRecord2;
@@ -945,7 +991,7 @@ function registerCreateTask(server, ctx) {
945
991
  `Task created: **${taskId}**`,
946
992
  "",
947
993
  `**Title:** ${params.title}`,
948
- `**Phase:** ${phase.name}`,
994
+ `**Phase:** ${phase.name} (\`${phase.id}\`)`,
949
995
  `**Status:** todo`
950
996
  ];
951
997
  if (params.building_block) {
@@ -2715,7 +2761,7 @@ import {
2715
2761
  inferTaskStatuses,
2716
2762
  applyInferences,
2717
2763
  verifyScenarios,
2718
- loadConfig as loadConfig2,
2764
+ loadConfig as loadConfig3,
2719
2765
  refreshFromDocs as refreshFromDocs5,
2720
2766
  syncPhaseToYaml,
2721
2767
  transaction
@@ -2780,7 +2826,7 @@ function registerCompletePhase(server, ctx) {
2780
2826
  const projectRoot = ctx.projectRoot ?? params.target_dir;
2781
2827
  let testCommand = "npx vitest run";
2782
2828
  let timeoutMs = 6e4;
2783
- const configResult = loadConfig2(params.target_dir);
2829
+ const configResult = loadConfig3(params.target_dir);
2784
2830
  if (configResult.config) {
2785
2831
  testCommand = configResult.config.testing.test_command;
2786
2832
  timeoutMs = configResult.config.testing.timeout_ms;
@@ -3258,7 +3304,7 @@ function getRoleDefinition(roleId) {
3258
3304
 
3259
3305
  // src/tools/verify-scenarios.ts
3260
3306
  import { z as z25 } from "zod";
3261
- import { verifyScenarios as verifyScenarios2, loadConfig as loadConfig3 } from "@arcbridge/core";
3307
+ import { verifyScenarios as verifyScenarios2, loadConfig as loadConfig4 } from "@arcbridge/core";
3262
3308
  function registerVerifyScenarios(server, ctx) {
3263
3309
  server.tool(
3264
3310
  "arcbridge_verify_scenarios",
@@ -3277,7 +3323,7 @@ function registerVerifyScenarios(server, ctx) {
3277
3323
  if (!db) return notInitialized();
3278
3324
  let testCommand = "npx vitest run";
3279
3325
  let timeoutMs = 6e4;
3280
- const configResult = loadConfig3(params.target_dir);
3326
+ const configResult = loadConfig4(params.target_dir);
3281
3327
  if (configResult.config) {
3282
3328
  testCommand = configResult.config.testing.test_command;
3283
3329
  timeoutMs = configResult.config.testing.timeout_ms;