@concord-ai/concord-mcp 0.1.0

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.
Files changed (114) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +103 -0
  3. package/dist/artifacts/events-jsonl.d.ts +3 -0
  4. package/dist/artifacts/events-jsonl.js +16 -0
  5. package/dist/artifacts/events-jsonl.js.map +1 -0
  6. package/dist/artifacts/handoff-md.d.ts +3 -0
  7. package/dist/artifacts/handoff-md.js +49 -0
  8. package/dist/artifacts/handoff-md.js.map +1 -0
  9. package/dist/artifacts/index.d.ts +11 -0
  10. package/dist/artifacts/index.js +51 -0
  11. package/dist/artifacts/index.js.map +1 -0
  12. package/dist/artifacts/markdown.d.ts +5 -0
  13. package/dist/artifacts/markdown.js +17 -0
  14. package/dist/artifacts/markdown.js.map +1 -0
  15. package/dist/artifacts/review-packet-md.d.ts +6 -0
  16. package/dist/artifacts/review-packet-md.js +56 -0
  17. package/dist/artifacts/review-packet-md.js.map +1 -0
  18. package/dist/artifacts/work-state-json.d.ts +3 -0
  19. package/dist/artifacts/work-state-json.js +22 -0
  20. package/dist/artifacts/work-state-json.js.map +1 -0
  21. package/dist/cli/commands/doctor.d.ts +6 -0
  22. package/dist/cli/commands/doctor.js +51 -0
  23. package/dist/cli/commands/doctor.js.map +1 -0
  24. package/dist/cli/commands/export.d.ts +4 -0
  25. package/dist/cli/commands/export.js +27 -0
  26. package/dist/cli/commands/export.js.map +1 -0
  27. package/dist/cli/commands/handoff.d.ts +4 -0
  28. package/dist/cli/commands/handoff.js +25 -0
  29. package/dist/cli/commands/handoff.js.map +1 -0
  30. package/dist/cli/commands/init.d.ts +4 -0
  31. package/dist/cli/commands/init.js +18 -0
  32. package/dist/cli/commands/init.js.map +1 -0
  33. package/dist/cli/commands/install.d.ts +2 -0
  34. package/dist/cli/commands/install.js +16 -0
  35. package/dist/cli/commands/install.js.map +1 -0
  36. package/dist/cli/commands/review-packet.d.ts +4 -0
  37. package/dist/cli/commands/review-packet.js +25 -0
  38. package/dist/cli/commands/review-packet.js.map +1 -0
  39. package/dist/cli/commands/status.d.ts +34 -0
  40. package/dist/cli/commands/status.js +108 -0
  41. package/dist/cli/commands/status.js.map +1 -0
  42. package/dist/cli/commands/tasks.d.ts +6 -0
  43. package/dist/cli/commands/tasks.js +27 -0
  44. package/dist/cli/commands/tasks.js.map +1 -0
  45. package/dist/cli/context.d.ts +8 -0
  46. package/dist/cli/context.js +12 -0
  47. package/dist/cli/context.js.map +1 -0
  48. package/dist/cli/index.d.ts +2 -0
  49. package/dist/cli/index.js +23 -0
  50. package/dist/cli/index.js.map +1 -0
  51. package/dist/config/paths.d.ts +14 -0
  52. package/dist/config/paths.js +33 -0
  53. package/dist/config/paths.js.map +1 -0
  54. package/dist/db/connection.d.ts +9 -0
  55. package/dist/db/connection.js +37 -0
  56. package/dist/db/connection.js.map +1 -0
  57. package/dist/db/index.d.ts +24 -0
  58. package/dist/db/index.js +21 -0
  59. package/dist/db/index.js.map +1 -0
  60. package/dist/db/repositories/events.d.ts +15 -0
  61. package/dist/db/repositories/events.js +37 -0
  62. package/dist/db/repositories/events.js.map +1 -0
  63. package/dist/db/repositories/handoffs.d.ts +22 -0
  64. package/dist/db/repositories/handoffs.js +54 -0
  65. package/dist/db/repositories/handoffs.js.map +1 -0
  66. package/dist/db/repositories/reviews.d.ts +19 -0
  67. package/dist/db/repositories/reviews.js +49 -0
  68. package/dist/db/repositories/reviews.js.map +1 -0
  69. package/dist/db/repositories/tasks.d.ts +23 -0
  70. package/dist/db/repositories/tasks.js +62 -0
  71. package/dist/db/repositories/tasks.js.map +1 -0
  72. package/dist/db/rows.d.ts +82 -0
  73. package/dist/db/rows.js +149 -0
  74. package/dist/db/rows.js.map +1 -0
  75. package/dist/db/schema.d.ts +6 -0
  76. package/dist/db/schema.js +73 -0
  77. package/dist/db/schema.js.map +1 -0
  78. package/dist/domain/adoption.d.ts +13 -0
  79. package/dist/domain/adoption.js +22 -0
  80. package/dist/domain/adoption.js.map +1 -0
  81. package/dist/domain/overlap.d.ts +21 -0
  82. package/dist/domain/overlap.js +61 -0
  83. package/dist/domain/overlap.js.map +1 -0
  84. package/dist/domain/schemas.d.ts +171 -0
  85. package/dist/domain/schemas.js +49 -0
  86. package/dist/domain/schemas.js.map +1 -0
  87. package/dist/index.d.ts +2 -0
  88. package/dist/index.js +23 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/install/block.d.ts +8 -0
  91. package/dist/install/block.js +23 -0
  92. package/dist/install/block.js.map +1 -0
  93. package/dist/install/index.d.ts +6 -0
  94. package/dist/install/index.js +27 -0
  95. package/dist/install/index.js.map +1 -0
  96. package/dist/install/instructions.d.ts +4 -0
  97. package/dist/install/instructions.js +26 -0
  98. package/dist/install/instructions.js.map +1 -0
  99. package/dist/server.d.ts +13 -0
  100. package/dist/server.js +19 -0
  101. package/dist/server.js.map +1 -0
  102. package/dist/tools/claim-work.d.ts +16 -0
  103. package/dist/tools/claim-work.js +73 -0
  104. package/dist/tools/claim-work.js.map +1 -0
  105. package/dist/tools/handoff.d.ts +15 -0
  106. package/dist/tools/handoff.js +78 -0
  107. package/dist/tools/handoff.js.map +1 -0
  108. package/dist/tools/review-ready.d.ts +14 -0
  109. package/dist/tools/review-ready.js +77 -0
  110. package/dist/tools/review-ready.js.map +1 -0
  111. package/dist/version.d.ts +2 -0
  112. package/dist/version.js +3 -0
  113. package/dist/version.js.map +1 -0
  114. package/package.json +77 -0
@@ -0,0 +1,171 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Zod input schemas for the MCP tools. Each tool exposes its schema as a raw
4
+ * shape (the form `McpServer.registerTool` expects) plus an inferred input type.
5
+ * Fields use snake_case to match the tool's public JSON contract.
6
+ */
7
+ export declare const claimWorkInputShape: {
8
+ readonly task_id: z.ZodString;
9
+ readonly title: z.ZodString;
10
+ readonly owner: z.ZodOptional<z.ZodString>;
11
+ readonly agent: z.ZodOptional<z.ZodString>;
12
+ readonly branch: z.ZodOptional<z.ZodString>;
13
+ readonly worktree: z.ZodOptional<z.ZodString>;
14
+ readonly expected_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ readonly modules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
16
+ readonly domains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
17
+ readonly risk_tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18
+ readonly notes: z.ZodOptional<z.ZodString>;
19
+ };
20
+ export declare const claimWorkInputSchema: z.ZodObject<{
21
+ readonly task_id: z.ZodString;
22
+ readonly title: z.ZodString;
23
+ readonly owner: z.ZodOptional<z.ZodString>;
24
+ readonly agent: z.ZodOptional<z.ZodString>;
25
+ readonly branch: z.ZodOptional<z.ZodString>;
26
+ readonly worktree: z.ZodOptional<z.ZodString>;
27
+ readonly expected_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
28
+ readonly modules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
29
+ readonly domains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
30
+ readonly risk_tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
+ readonly notes: z.ZodOptional<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ task_id: string;
34
+ title: string;
35
+ owner?: string | undefined;
36
+ agent?: string | undefined;
37
+ branch?: string | undefined;
38
+ worktree?: string | undefined;
39
+ expected_files?: string[] | undefined;
40
+ modules?: string[] | undefined;
41
+ domains?: string[] | undefined;
42
+ risk_tags?: string[] | undefined;
43
+ notes?: string | undefined;
44
+ }, {
45
+ task_id: string;
46
+ title: string;
47
+ owner?: string | undefined;
48
+ agent?: string | undefined;
49
+ branch?: string | undefined;
50
+ worktree?: string | undefined;
51
+ expected_files?: string[] | undefined;
52
+ modules?: string[] | undefined;
53
+ domains?: string[] | undefined;
54
+ risk_tags?: string[] | undefined;
55
+ notes?: string | undefined;
56
+ }>;
57
+ export type ClaimWorkInput = z.infer<typeof claimWorkInputSchema>;
58
+ export declare const handoffInputShape: {
59
+ readonly task_id: z.ZodString;
60
+ readonly status: z.ZodString;
61
+ readonly what_changed: z.ZodString;
62
+ readonly changed_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
63
+ readonly tests_run: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
64
+ readonly known_risks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
65
+ readonly assumptions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
66
+ readonly decisions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
67
+ readonly guardrails_checked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
68
+ readonly needs_review_from: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
69
+ readonly next_steps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
70
+ };
71
+ export declare const handoffInputSchema: z.ZodObject<{
72
+ readonly task_id: z.ZodString;
73
+ readonly status: z.ZodString;
74
+ readonly what_changed: z.ZodString;
75
+ readonly changed_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
76
+ readonly tests_run: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
77
+ readonly known_risks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
78
+ readonly assumptions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
79
+ readonly decisions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
80
+ readonly guardrails_checked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
81
+ readonly needs_review_from: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
82
+ readonly next_steps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
83
+ }, "strip", z.ZodTypeAny, {
84
+ status: string;
85
+ task_id: string;
86
+ what_changed: string;
87
+ changed_files?: string[] | undefined;
88
+ tests_run?: string[] | undefined;
89
+ known_risks?: string[] | undefined;
90
+ assumptions?: string[] | undefined;
91
+ decisions?: string[] | undefined;
92
+ guardrails_checked?: string[] | undefined;
93
+ needs_review_from?: string[] | undefined;
94
+ next_steps?: string[] | undefined;
95
+ }, {
96
+ status: string;
97
+ task_id: string;
98
+ what_changed: string;
99
+ changed_files?: string[] | undefined;
100
+ tests_run?: string[] | undefined;
101
+ known_risks?: string[] | undefined;
102
+ assumptions?: string[] | undefined;
103
+ decisions?: string[] | undefined;
104
+ guardrails_checked?: string[] | undefined;
105
+ needs_review_from?: string[] | undefined;
106
+ next_steps?: string[] | undefined;
107
+ }>;
108
+ export type HandoffInput = z.infer<typeof handoffInputSchema>;
109
+ export declare const reviewReadyInputShape: {
110
+ readonly task_id: z.ZodString;
111
+ readonly plan_summary: z.ZodString;
112
+ readonly tests_run: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
113
+ readonly diff_size: z.ZodOptional<z.ZodString>;
114
+ readonly guardrails_checked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
115
+ readonly assumptions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
116
+ readonly open_questions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
117
+ readonly provenance: z.ZodOptional<z.ZodArray<z.ZodObject<{
118
+ field: z.ZodString;
119
+ source: z.ZodString;
120
+ }, "strip", z.ZodTypeAny, {
121
+ field: string;
122
+ source: string;
123
+ }, {
124
+ field: string;
125
+ source: string;
126
+ }>, "many">>;
127
+ };
128
+ export declare const reviewReadyInputSchema: z.ZodObject<{
129
+ readonly task_id: z.ZodString;
130
+ readonly plan_summary: z.ZodString;
131
+ readonly tests_run: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
132
+ readonly diff_size: z.ZodOptional<z.ZodString>;
133
+ readonly guardrails_checked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
134
+ readonly assumptions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
135
+ readonly open_questions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
136
+ readonly provenance: z.ZodOptional<z.ZodArray<z.ZodObject<{
137
+ field: z.ZodString;
138
+ source: z.ZodString;
139
+ }, "strip", z.ZodTypeAny, {
140
+ field: string;
141
+ source: string;
142
+ }, {
143
+ field: string;
144
+ source: string;
145
+ }>, "many">>;
146
+ }, "strip", z.ZodTypeAny, {
147
+ task_id: string;
148
+ plan_summary: string;
149
+ tests_run?: string[] | undefined;
150
+ assumptions?: string[] | undefined;
151
+ guardrails_checked?: string[] | undefined;
152
+ diff_size?: string | undefined;
153
+ open_questions?: string[] | undefined;
154
+ provenance?: {
155
+ field: string;
156
+ source: string;
157
+ }[] | undefined;
158
+ }, {
159
+ task_id: string;
160
+ plan_summary: string;
161
+ tests_run?: string[] | undefined;
162
+ assumptions?: string[] | undefined;
163
+ guardrails_checked?: string[] | undefined;
164
+ diff_size?: string | undefined;
165
+ open_questions?: string[] | undefined;
166
+ provenance?: {
167
+ field: string;
168
+ source: string;
169
+ }[] | undefined;
170
+ }>;
171
+ export type ReviewReadyInput = z.infer<typeof reviewReadyInputSchema>;
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Zod input schemas for the MCP tools. Each tool exposes its schema as a raw
4
+ * shape (the form `McpServer.registerTool` expects) plus an inferred input type.
5
+ * Fields use snake_case to match the tool's public JSON contract.
6
+ */
7
+ export const claimWorkInputShape = {
8
+ task_id: z.string().min(1).describe('Stable identifier for the task, e.g. TASK-12'),
9
+ title: z.string().min(1).describe('Short human-readable title'),
10
+ owner: z.string().optional().describe('Person accountable for the task'),
11
+ agent: z.string().optional().describe('Agent doing the work, e.g. claude-code'),
12
+ branch: z.string().optional().describe('Git branch, if known'),
13
+ worktree: z.string().optional().describe('Git worktree path, if used'),
14
+ expected_files: z.array(z.string()).optional().describe('Files the task expects to touch'),
15
+ modules: z.array(z.string()).optional().describe('Logical modules touched, e.g. billing'),
16
+ domains: z.array(z.string()).optional().describe('Product domains touched, e.g. payments'),
17
+ risk_tags: z.array(z.string()).optional().describe('Risk tags, e.g. payment-flow'),
18
+ notes: z.string().optional().describe('Freeform notes'),
19
+ };
20
+ export const claimWorkInputSchema = z.object(claimWorkInputShape);
21
+ export const handoffInputShape = {
22
+ task_id: z.string().min(1).describe('The task being handed off, e.g. TASK-12'),
23
+ status: z.string().min(1).describe('Handoff status, e.g. done, blocked, in_progress'),
24
+ what_changed: z.string().min(1).describe('Concise summary of what changed'),
25
+ changed_files: z.array(z.string()).optional().describe('Files that changed'),
26
+ tests_run: z.array(z.string()).optional().describe('Test commands run'),
27
+ known_risks: z.array(z.string()).optional().describe('Known risks introduced'),
28
+ assumptions: z.array(z.string()).optional().describe('Assumptions the agent made'),
29
+ decisions: z.array(z.string()).optional().describe('Notable decisions and why'),
30
+ guardrails_checked: z.array(z.string()).optional().describe('Guardrails manually checked'),
31
+ needs_review_from: z.array(z.string()).optional().describe('Who should review'),
32
+ next_steps: z.array(z.string()).optional().describe('Remaining work or follow-ups'),
33
+ };
34
+ export const handoffInputSchema = z.object(handoffInputShape);
35
+ export const reviewReadyInputShape = {
36
+ task_id: z.string().min(1).describe('The task being marked review-ready'),
37
+ plan_summary: z.string().min(1).describe('What the change intended to do'),
38
+ tests_run: z.array(z.string()).optional().describe('Test commands run'),
39
+ diff_size: z.string().optional().describe('Rough diff size, e.g. "+120 / -30"'),
40
+ guardrails_checked: z.array(z.string()).optional().describe('Guardrails checked'),
41
+ assumptions: z.array(z.string()).optional().describe('Assumptions made'),
42
+ open_questions: z.array(z.string()).optional().describe('Unresolved questions for review'),
43
+ provenance: z
44
+ .array(z.object({ field: z.string(), source: z.string() }))
45
+ .optional()
46
+ .describe('Where each claim came from, e.g. { field: "tests", source: "command output" }'),
47
+ };
48
+ export const reviewReadyInputSchema = z.object(reviewReadyInputShape);
49
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/domain/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GA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AE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SAC1D,QAAQ,EAAE;SACV,QAAQ,CAAC,+EAA+E,CAAC;CACpF,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { writeArtifacts } from './artifacts/index.js';
4
+ import { concordDir, databasePath, findRepoRoot } from './config/paths.js';
5
+ import { openRepositories } from './db/index.js';
6
+ import { createServer } from './server.js';
7
+ async function main() {
8
+ const repoRoot = findRepoRoot(process.cwd());
9
+ const repos = openRepositories(databasePath(repoRoot));
10
+ const artifactsDir = concordDir(repoRoot);
11
+ const server = createServer(repos, {
12
+ onToolWrite: () => {
13
+ writeArtifacts(artifactsDir, repos);
14
+ },
15
+ });
16
+ const transport = new StdioServerTransport();
17
+ await server.connect(transport);
18
+ }
19
+ main().catch((error) => {
20
+ process.stderr.write(`concord-mcp failed to start: ${String(error)}\n`);
21
+ process.exitCode = 1;
22
+ });
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,KAAK,UAAU,IAAI;IACjB,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,gBAAgB,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE;QACjC,WAAW,EAAE,GAAG,EAAE;YAChB,cAAc,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;KACF,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** Markers delimiting Concord's managed block within a client instruction file. */
2
+ export declare const BLOCK_START = "<!-- concord:start -->";
3
+ export declare const BLOCK_END = "<!-- concord:end -->";
4
+ /**
5
+ * Insert or replace Concord's managed block in `existing`, preserving all other
6
+ * content. Idempotent: running it again with the same block is a no-op.
7
+ */
8
+ export declare function upsertBlock(existing: string, block: string): string;
@@ -0,0 +1,23 @@
1
+ /** Markers delimiting Concord's managed block within a client instruction file. */
2
+ export const BLOCK_START = '<!-- concord:start -->';
3
+ export const BLOCK_END = '<!-- concord:end -->';
4
+ /**
5
+ * Insert or replace Concord's managed block in `existing`, preserving all other
6
+ * content. Idempotent: running it again with the same block is a no-op.
7
+ */
8
+ export function upsertBlock(existing, block) {
9
+ const wrapped = `${BLOCK_START}\n${block}\n${BLOCK_END}`;
10
+ const startIdx = existing.indexOf(BLOCK_START);
11
+ const endIdx = existing.indexOf(BLOCK_END);
12
+ if (startIdx !== -1 && endIdx > startIdx) {
13
+ const before = existing.slice(0, startIdx);
14
+ const after = existing.slice(endIdx + BLOCK_END.length);
15
+ return `${before}${wrapped}${after}`;
16
+ }
17
+ if (existing.length === 0) {
18
+ return `${wrapped}\n`;
19
+ }
20
+ const separator = existing.endsWith('\n') ? '\n' : '\n\n';
21
+ return `${existing}${separator}${wrapped}\n`;
22
+ }
23
+ //# sourceMappingURL=block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.js","sourceRoot":"","sources":["../../src/install/block.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,MAAM,WAAW,GAAG,wBAAwB,CAAC;AACpD,MAAM,CAAC,MAAM,SAAS,GAAG,sBAAsB,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,KAAa;IACzD,MAAM,OAAO,GAAG,GAAG,WAAW,KAAK,KAAK,KAAK,SAAS,EAAE,CAAC;IAEzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,QAAQ,KAAK,CAAC,CAAC,IAAI,MAAM,GAAG,QAAQ,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QACxD,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,OAAO,IAAI,CAAC;IACxB,CAAC;IACD,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1D,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,IAAI,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Write (or idempotently update) Concord's instructions into every supported
3
+ * client config, preserving any existing content. Returns the relative paths
4
+ * written.
5
+ */
6
+ export declare function installConcord(repoRoot: string): string[];
@@ -0,0 +1,27 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { upsertBlock } from './block.js';
4
+ import { CONCORD_INSTRUCTIONS, CURSOR_MDC_HEADER } from './instructions.js';
5
+ const TARGETS = [
6
+ { relPath: 'CLAUDE.md' },
7
+ { relPath: 'AGENTS.md' },
8
+ { relPath: join('.codex', 'concord.md') },
9
+ { relPath: join('.cursor', 'rules', 'concord.mdc'), header: CURSOR_MDC_HEADER },
10
+ ];
11
+ function writeTarget(repoRoot, target) {
12
+ const fullPath = join(repoRoot, target.relPath);
13
+ const existing = existsSync(fullPath) ? readFileSync(fullPath, 'utf8') : (target.header ?? '');
14
+ const updated = upsertBlock(existing, CONCORD_INSTRUCTIONS);
15
+ mkdirSync(dirname(fullPath), { recursive: true });
16
+ writeFileSync(fullPath, updated);
17
+ return target.relPath;
18
+ }
19
+ /**
20
+ * Write (or idempotently update) Concord's instructions into every supported
21
+ * client config, preserving any existing content. Returns the relative paths
22
+ * written.
23
+ */
24
+ export function installConcord(repoRoot) {
25
+ return TARGETS.map((target) => writeTarget(repoRoot, target));
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/install/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,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/** The canonical instruction block written into each client's config. */
2
+ export declare const CONCORD_INSTRUCTIONS = "## Concord \u2014 shared work-state for coding agents\n\nThis project uses Concord MCP. Use its tools so your work is visible before PRs:\n\n- **Before editing code**, call `claim_work` with the task id, title, and the\n files/modules you expect to touch. Concord warns about overlaps with other\n active work.\n- **Before finishing or when blocked**, call `handoff` with what changed, tests\n run, assumptions, decisions, and guardrails you checked.\n- **Before opening a PR**, call `review_ready` with a plan summary, tests, open\n questions, and provenance.\n\nConcord regenerates human-readable `HANDOFF.md` and `REVIEW_PACKET.md` in\n`.concord/` so humans can review your work.\n\nEnforcement note: on clients with hooks/command registration this can be\nenforced; elsewhere it is instruction-based and may be skipped. `concord doctor`\nshows per-task adoption either way.";
3
+ /** MDC frontmatter used when creating a fresh Cursor rules file. */
4
+ export declare const CURSOR_MDC_HEADER = "---\ndescription: Concord shared work-state tools for coding agents\nalwaysApply: true\n---\n";
@@ -0,0 +1,26 @@
1
+ /** The canonical instruction block written into each client's config. */
2
+ export const CONCORD_INSTRUCTIONS = `## Concord — shared work-state for coding agents
3
+
4
+ This project uses Concord MCP. Use its tools so your work is visible before PRs:
5
+
6
+ - **Before editing code**, call \`claim_work\` with the task id, title, and the
7
+ files/modules you expect to touch. Concord warns about overlaps with other
8
+ active work.
9
+ - **Before finishing or when blocked**, call \`handoff\` with what changed, tests
10
+ run, assumptions, decisions, and guardrails you checked.
11
+ - **Before opening a PR**, call \`review_ready\` with a plan summary, tests, open
12
+ questions, and provenance.
13
+
14
+ Concord regenerates human-readable \`HANDOFF.md\` and \`REVIEW_PACKET.md\` in
15
+ \`.concord/\` so humans can review your work.
16
+
17
+ Enforcement note: on clients with hooks/command registration this can be
18
+ enforced; elsewhere it is instruction-based and may be skipped. \`concord doctor\`
19
+ shows per-task adoption either way.`;
20
+ /** MDC frontmatter used when creating a fresh Cursor rules file. */
21
+ export const CURSOR_MDC_HEADER = `---
22
+ description: Concord shared work-state tools for coding agents
23
+ alwaysApply: true
24
+ ---
25
+ `;
26
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/install/instructions.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;oCAiBA,CAAC;AAErC,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;CAIhC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { Repositories } from './db/index.js';
3
+ /** Concord's advertised MCP server version. */
4
+ export declare const SERVER_VERSION = "0.1.0";
5
+ export interface ServerOptions {
6
+ /** Called after any tool writes to the database (used to regenerate artifacts). */
7
+ onToolWrite?: () => void;
8
+ }
9
+ /**
10
+ * Build the Concord MCP server and register the v0 tools against the given
11
+ * repositories. Transport wiring lives in the entry points.
12
+ */
13
+ export declare function createServer(repos: Repositories, options?: ServerOptions): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,19 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { registerClaimWork } from './tools/claim-work.js';
3
+ import { registerHandoff } from './tools/handoff.js';
4
+ import { registerReviewReady } from './tools/review-ready.js';
5
+ import { VERSION } from './version.js';
6
+ /** Concord's advertised MCP server version. */
7
+ export const SERVER_VERSION = VERSION;
8
+ /**
9
+ * Build the Concord MCP server and register the v0 tools against the given
10
+ * repositories. Transport wiring lives in the entry points.
11
+ */
12
+ export function createServer(repos, options = {}) {
13
+ const server = new McpServer({ name: 'concord-mcp', version: SERVER_VERSION });
14
+ registerClaimWork(server, repos, options.onToolWrite);
15
+ registerHandoff(server, repos, options.onToolWrite);
16
+ registerReviewReady(server, repos, options.onToolWrite);
17
+ return server;
18
+ }
19
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAOtC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAmB,EAAE,UAAyB,EAAE;IAC3E,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IAC/E,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACtD,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACpD,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { Repositories, TaskRecord } from '../db/index.js';
3
+ import { type OverlapWarning } from '../domain/overlap.js';
4
+ import { type ClaimWorkInput } from '../domain/schemas.js';
5
+ export interface ClaimWorkResult {
6
+ task: TaskRecord;
7
+ alreadyClaimed: boolean;
8
+ overlaps: OverlapWarning[];
9
+ }
10
+ /**
11
+ * Record that an agent is working on a task and flag any overlaps with other
12
+ * active tasks. Idempotent: re-claiming an existing task returns it unchanged.
13
+ */
14
+ export declare function handleClaimWork(repos: Repositories, input: ClaimWorkInput): ClaimWorkResult;
15
+ export declare function formatClaimWorkText(result: ClaimWorkResult): string;
16
+ export declare function registerClaimWork(server: McpServer, repos: Repositories, onWrite?: () => void): void;
@@ -0,0 +1,73 @@
1
+ import { detectOverlaps } from '../domain/overlap.js';
2
+ import { claimWorkInputShape } from '../domain/schemas.js';
3
+ /**
4
+ * Record that an agent is working on a task and flag any overlaps with other
5
+ * active tasks. Idempotent: re-claiming an existing task returns it unchanged.
6
+ */
7
+ export function handleClaimWork(repos, input) {
8
+ const activeOthers = repos.tasks
9
+ .list()
10
+ .filter((task) => task.taskId !== input.task_id && task.status === 'active');
11
+ const overlaps = detectOverlaps({
12
+ taskId: input.task_id,
13
+ expectedFiles: input.expected_files ?? [],
14
+ modules: input.modules ?? [],
15
+ domains: input.domains ?? [],
16
+ riskTags: input.risk_tags ?? [],
17
+ }, activeOthers);
18
+ const existing = repos.tasks.get(input.task_id);
19
+ const task = existing ??
20
+ repos.tasks.create({
21
+ taskId: input.task_id,
22
+ title: input.title,
23
+ owner: input.owner ?? null,
24
+ agent: input.agent ?? null,
25
+ branch: input.branch ?? null,
26
+ worktree: input.worktree ?? null,
27
+ expectedFiles: input.expected_files ?? [],
28
+ modules: input.modules ?? [],
29
+ domains: input.domains ?? [],
30
+ riskTags: input.risk_tags ?? [],
31
+ notes: input.notes ?? null,
32
+ });
33
+ repos.events.record({
34
+ taskId: input.task_id,
35
+ tool: 'claim_work',
36
+ status: 'success',
37
+ detail: overlaps.length > 0 ? `${String(overlaps.length)} overlap(s)` : null,
38
+ });
39
+ return { task, alreadyClaimed: existing !== undefined, overlaps };
40
+ }
41
+ export function formatClaimWorkText(result) {
42
+ const verb = result.alreadyClaimed ? 'Already claimed' : 'Claimed';
43
+ const lines = [`${verb} ${result.task.taskId} (${result.task.title}).`];
44
+ if (result.overlaps.length === 0) {
45
+ lines.push('No potential overlaps with active tasks.');
46
+ return lines.join('\n');
47
+ }
48
+ lines.push(`Potential overlaps (${String(result.overlaps.length)}):`);
49
+ for (const overlap of result.overlaps) {
50
+ lines.push(` - ${overlap.taskId} (${overlap.title}): ${overlap.reasons.join('; ')}`);
51
+ }
52
+ return lines.join('\n');
53
+ }
54
+ export function registerClaimWork(server, repos, onWrite) {
55
+ server.registerTool('claim_work', {
56
+ title: 'Claim work',
57
+ description: 'Record that an agent is starting a task and flag overlaps with other active tasks. ' +
58
+ 'Call this before editing code.',
59
+ inputSchema: claimWorkInputShape,
60
+ }, (args) => {
61
+ const result = handleClaimWork(repos, args);
62
+ onWrite?.();
63
+ return {
64
+ content: [{ type: 'text', text: formatClaimWorkText(result) }],
65
+ structuredContent: {
66
+ task_id: result.task.taskId,
67
+ already_claimed: result.alreadyClaimed,
68
+ overlaps: result.overlaps,
69
+ },
70
+ };
71
+ });
72
+ }
73
+ //# sourceMappingURL=claim-work.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-work.js","sourceRoot":"","sources":["../../src/tools/claim-work.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAuB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAQhF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAmB,EAAE,KAAqB;IACxE,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK;SAC7B,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;IAE/E,MAAM,QAAQ,GAAG,cAAc,CAC7B;QACE,MAAM,EAAE,KAAK,CAAC,OAAO;QACrB,aAAa,EAAE,KAAK,CAAC,cAAc,IAAI,EAAE;QACzC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE;QAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE;KAChC,EACD,YAAY,CACb,CAAC;IAEF,MAAM,QAAQ,GAAG,KAAK,CAA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,EAAE,MAAM,CAAC,QAAQ;aAC1B;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { HandoffRecord, Repositories } from '../db/index.js';
3
+ import { type HandoffInput } from '../domain/schemas.js';
4
+ export interface HandoffResult {
5
+ handoff: HandoffRecord;
6
+ taskAutoCreated: boolean;
7
+ }
8
+ /**
9
+ * Record a handoff for a task and mark the task handed off. If the task was
10
+ * never claimed, a minimal stub task is created so the handoff is never lost
11
+ * (the adoption tracker will still show that claim_work was skipped).
12
+ */
13
+ export declare function handleHandoff(repos: Repositories, input: HandoffInput): HandoffResult;
14
+ export declare function formatHandoffText(result: HandoffResult): string;
15
+ export declare function registerHandoff(server: McpServer, repos: Repositories, onWrite?: () => void): void;
@@ -0,0 +1,78 @@
1
+ import { handoffInputShape } from '../domain/schemas.js';
2
+ /**
3
+ * Record a handoff for a task and mark the task handed off. If the task was
4
+ * never claimed, a minimal stub task is created so the handoff is never lost
5
+ * (the adoption tracker will still show that claim_work was skipped).
6
+ */
7
+ export function handleHandoff(repos, input) {
8
+ const existing = repos.tasks.get(input.task_id);
9
+ const taskAutoCreated = existing === undefined;
10
+ if (existing === undefined) {
11
+ repos.tasks.create({
12
+ taskId: input.task_id,
13
+ title: input.task_id,
14
+ owner: null,
15
+ agent: null,
16
+ branch: null,
17
+ worktree: null,
18
+ expectedFiles: input.changed_files ?? [],
19
+ modules: [],
20
+ domains: [],
21
+ riskTags: [],
22
+ notes: null,
23
+ });
24
+ }
25
+ const handoff = repos.handoffs.create({
26
+ taskId: input.task_id,
27
+ status: input.status,
28
+ changedFiles: input.changed_files ?? [],
29
+ whatChanged: input.what_changed,
30
+ testsRun: input.tests_run ?? [],
31
+ knownRisks: input.known_risks ?? [],
32
+ assumptions: input.assumptions ?? [],
33
+ decisions: input.decisions ?? [],
34
+ guardrailsChecked: input.guardrails_checked ?? [],
35
+ needsReviewFrom: input.needs_review_from ?? [],
36
+ nextSteps: input.next_steps ?? [],
37
+ });
38
+ repos.tasks.updateStatus(input.task_id, 'handed_off');
39
+ repos.events.record({
40
+ taskId: input.task_id,
41
+ tool: 'handoff',
42
+ status: 'success',
43
+ detail: input.status,
44
+ });
45
+ return { handoff, taskAutoCreated };
46
+ }
47
+ export function formatHandoffText(result) {
48
+ const { handoff } = result;
49
+ const lines = [`Recorded handoff for ${handoff.taskId} (status: ${handoff.status}).`];
50
+ if (result.taskAutoCreated) {
51
+ lines.push('Note: task was not claimed first; created a stub task.');
52
+ }
53
+ lines.push(`Changed files: ${String(handoff.changedFiles.length)}`);
54
+ if (handoff.needsReviewFrom.length > 0) {
55
+ lines.push(`Needs review from: ${handoff.needsReviewFrom.join(', ')}`);
56
+ }
57
+ return lines.join('\n');
58
+ }
59
+ export function registerHandoff(server, repos, onWrite) {
60
+ server.registerTool('handoff', {
61
+ title: 'Hand off work',
62
+ description: 'Record a concise handoff when an agent finishes or is blocked: what changed, ' +
63
+ 'tests run, assumptions, decisions, and guardrails checked. Call this before finishing.',
64
+ inputSchema: handoffInputShape,
65
+ }, (args) => {
66
+ const result = handleHandoff(repos, args);
67
+ onWrite?.();
68
+ return {
69
+ content: [{ type: 'text', text: formatHandoffText(result) }],
70
+ structuredContent: {
71
+ task_id: result.handoff.taskId,
72
+ handoff_id: result.handoff.id,
73
+ task_auto_created: result.taskAutoCreated,
74
+ },
75
+ };
76
+ });
77
+ }
78
+ //# sourceMappingURL=handoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handoff.js","sourceRoot":"","sources":["../../src/tools/handoff.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAC;AAO5E;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAmB,EAAE,KAAmB;IACpE,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO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AM,CAAC,EAAE,CAAC;YAC5D,iBAAiB,EAAE;gBACjB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM;gBAC9B,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE;gBAC7B,iBAAiB,EAAE,MAAM,CAAC,eAAe;aAC1C;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { Repositories, ReviewRecord } from '../db/index.js';
3
+ import { type ReviewReadyInput } from '../domain/schemas.js';
4
+ export interface ReviewReadyResult {
5
+ review: ReviewRecord;
6
+ taskAutoCreated: boolean;
7
+ }
8
+ /**
9
+ * Record a review packet for a task and mark the task review-ready. Like
10
+ * handoff, this auto-creates a stub task if the work was never claimed.
11
+ */
12
+ export declare function handleReviewReady(repos: Repositories, input: ReviewReadyInput): ReviewReadyResult;
13
+ export declare function formatReviewReadyText(result: ReviewReadyResult): string;
14
+ export declare function registerReviewReady(server: McpServer, repos: Repositories, onWrite?: () => void): void;