@concord-ai/concord-mcp 0.1.1 → 0.3.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.
- package/README.md +34 -17
- package/dist/artifacts/work-state-json.js +1 -0
- package/dist/artifacts/work-state-json.js.map +1 -1
- package/dist/artifacts/work-state-view.d.ts +36 -0
- package/dist/artifacts/work-state-view.js +99 -0
- package/dist/artifacts/work-state-view.js.map +1 -0
- package/dist/cli/commands/check.d.ts +20 -0
- package/dist/cli/commands/check.js +66 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/doctor.js +2 -1
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/hook.d.ts +19 -0
- package/dist/cli/commands/hook.js +82 -0
- package/dist/cli/commands/hook.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.js +15 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.js +9 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/review-packet.js +1 -1
- package/dist/cli/commands/review-packet.js.map +1 -1
- package/dist/cli/commands/status.d.ts +0 -31
- package/dist/cli/commands/status.js +1 -95
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/watch.d.ts +5 -0
- package/dist/cli/commands/watch.js +35 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/index.js +6 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/db/index.d.ts +4 -1
- package/dist/db/index.js +2 -0
- package/dist/db/index.js.map +1 -1
- package/dist/db/repositories/task-updates.d.ts +13 -0
- package/dist/db/repositories/task-updates.js +32 -0
- package/dist/db/repositories/task-updates.js.map +1 -0
- package/dist/db/repositories/tasks.d.ts +10 -0
- package/dist/db/repositories/tasks.js +17 -2
- package/dist/db/repositories/tasks.js.map +1 -1
- package/dist/db/rows.d.ts +14 -1
- package/dist/db/rows.js +34 -1
- package/dist/db/rows.js.map +1 -1
- package/dist/db/schema.js +18 -0
- package/dist/db/schema.js.map +1 -1
- package/dist/domain/decomposition.d.ts +25 -0
- package/dist/domain/decomposition.js +32 -0
- package/dist/domain/decomposition.js.map +1 -0
- package/dist/domain/overlap.d.ts +11 -2
- package/dist/domain/overlap.js +51 -9
- package/dist/domain/overlap.js.map +1 -1
- package/dist/domain/schemas.d.ts +78 -0
- package/dist/domain/schemas.js +48 -2
- package/dist/domain/schemas.js.map +1 -1
- package/dist/install/claude-hooks.d.ts +13 -0
- package/dist/install/claude-hooks.js +48 -0
- package/dist/install/claude-hooks.js.map +1 -0
- package/dist/install/instructions.d.ts +1 -1
- package/dist/install/instructions.js +14 -4
- package/dist/install/instructions.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +14 -4
- package/dist/server.js.map +1 -1
- package/dist/tools/claim-work.d.ts +39 -2
- package/dist/tools/claim-work.js +99 -28
- package/dist/tools/claim-work.js.map +1 -1
- package/dist/tools/get-task-context.d.ts +13 -0
- package/dist/tools/get-task-context.js +77 -0
- package/dist/tools/get-task-context.js.map +1 -0
- package/dist/tools/get-work-state.d.ts +22 -0
- package/dist/tools/get-work-state.js +72 -0
- package/dist/tools/get-work-state.js.map +1 -0
- package/dist/tools/handoff.d.ts +2 -0
- package/dist/tools/handoff.js +28 -3
- package/dist/tools/handoff.js.map +1 -1
- package/dist/tools/review-ready.d.ts +3 -4
- package/dist/tools/review-ready.js +5 -23
- package/dist/tools/review-ready.js.map +1 -1
- package/dist/tools/update-task.d.ts +10 -0
- package/dist/tools/update-task.js +48 -0
- package/dist/tools/update-task.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
package/dist/domain/overlap.js
CHANGED
|
@@ -1,11 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
2
|
function sortedIntersection(a, b) {
|
|
3
3
|
const other = new Set(b);
|
|
4
4
|
const shared = new Set(a.filter((value) => other.has(value)));
|
|
5
5
|
return [...shared].sort((x, y) => x.localeCompare(y));
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Split a label (domain, module, risk tag) into normalized word tokens so that
|
|
9
|
+
* phrasing differences do not hide a real overlap: case, surrounding
|
|
10
|
+
* whitespace, and word separators (`-`, `_`, `/`, spaces) are all ignored.
|
|
11
|
+
* e.g. "Todo Frontend", "todo-frontend", and ["frontend", "todo"] all share the
|
|
12
|
+
* tokens {frontend, todo}.
|
|
13
|
+
*/
|
|
14
|
+
function tokenize(value) {
|
|
15
|
+
return value
|
|
16
|
+
.toLowerCase()
|
|
17
|
+
.split(/[^a-z0-9]+/)
|
|
18
|
+
.filter((token) => token.length > 0);
|
|
19
|
+
}
|
|
20
|
+
/** The deduplicated set of word tokens across a list of labels. */
|
|
21
|
+
function tokensOf(values) {
|
|
22
|
+
const tokens = new Set();
|
|
23
|
+
for (const value of values) {
|
|
24
|
+
for (const token of tokenize(value)) {
|
|
25
|
+
tokens.add(token);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return [...tokens];
|
|
29
|
+
}
|
|
30
|
+
/** Normalize a declared file path: drop a leading `./`, collapse `//`, resolve
|
|
31
|
+
* `.`/`..` segments, and strip a trailing slash, so `./app/page.tsx` and
|
|
32
|
+
* `app/page.tsx` compare equal. Paths stay case-sensitive. */
|
|
33
|
+
export function normalizePath(file) {
|
|
34
|
+
const trimmed = file.trim().replace(/^\.\//, '');
|
|
35
|
+
const normalized = posix.normalize(trimmed).replace(/\/$/, '');
|
|
36
|
+
return normalized === '.' ? '' : normalized;
|
|
37
|
+
}
|
|
7
38
|
function directories(files) {
|
|
8
|
-
return files
|
|
39
|
+
return files
|
|
40
|
+
.map((file) => normalizePath(file))
|
|
41
|
+
.filter((file) => file !== '')
|
|
42
|
+
.map((file) => posix.dirname(file))
|
|
43
|
+
.filter((dir) => dir !== '.' && dir !== '');
|
|
9
44
|
}
|
|
10
45
|
function surfaceOf(task) {
|
|
11
46
|
return {
|
|
@@ -14,11 +49,16 @@ function surfaceOf(task) {
|
|
|
14
49
|
modules: task.modules,
|
|
15
50
|
domains: task.domains,
|
|
16
51
|
riskTags: task.riskTags,
|
|
52
|
+
parentTaskId: task.parentTaskId,
|
|
17
53
|
};
|
|
18
54
|
}
|
|
55
|
+
/** True when the two tasks are in a direct parent/child relationship. */
|
|
56
|
+
function isParentChild(candidate, task) {
|
|
57
|
+
return candidate.parentTaskId === task.taskId || task.parentTaskId === candidate.taskId;
|
|
58
|
+
}
|
|
19
59
|
function reasonsFor(candidate, existing) {
|
|
20
60
|
const reasons = [];
|
|
21
|
-
const sameFiles = sortedIntersection(candidate.expectedFiles, existing.expectedFiles);
|
|
61
|
+
const sameFiles = sortedIntersection(candidate.expectedFiles.map(normalizePath).filter((file) => file !== ''), existing.expectedFiles.map(normalizePath).filter((file) => file !== ''));
|
|
22
62
|
if (sameFiles.length > 0) {
|
|
23
63
|
reasons.push(`same file(s): ${sameFiles.join(', ')}`);
|
|
24
64
|
}
|
|
@@ -26,15 +66,15 @@ function reasonsFor(candidate, existing) {
|
|
|
26
66
|
if (sameDirs.length > 0 && sameFiles.length === 0) {
|
|
27
67
|
reasons.push(`same directory: ${sameDirs.join(', ')}`);
|
|
28
68
|
}
|
|
29
|
-
const sameModules = sortedIntersection(candidate.modules, existing.modules);
|
|
69
|
+
const sameModules = sortedIntersection(tokensOf(candidate.modules), tokensOf(existing.modules));
|
|
30
70
|
if (sameModules.length > 0) {
|
|
31
71
|
reasons.push(`shared module(s): ${sameModules.join(', ')}`);
|
|
32
72
|
}
|
|
33
|
-
const sameDomains = sortedIntersection(candidate.domains, existing.domains);
|
|
73
|
+
const sameDomains = sortedIntersection(tokensOf(candidate.domains), tokensOf(existing.domains));
|
|
34
74
|
if (sameDomains.length > 0) {
|
|
35
75
|
reasons.push(`shared domain(s): ${sameDomains.join(', ')}`);
|
|
36
76
|
}
|
|
37
|
-
const sameRiskTags = sortedIntersection(candidate.riskTags, existing.riskTags);
|
|
77
|
+
const sameRiskTags = sortedIntersection(tokensOf(candidate.riskTags), tokensOf(existing.riskTags));
|
|
38
78
|
if (sameRiskTags.length > 0) {
|
|
39
79
|
reasons.push(`shared risk tag(s): ${sameRiskTags.join(', ')}`);
|
|
40
80
|
}
|
|
@@ -42,13 +82,15 @@ function reasonsFor(candidate, existing) {
|
|
|
42
82
|
}
|
|
43
83
|
/**
|
|
44
84
|
* Flag obvious overlaps between the candidate surface and existing tasks, based
|
|
45
|
-
* on declared files, directories, modules, domains, and risk tags.
|
|
46
|
-
*
|
|
85
|
+
* on declared files, directories, modules, domains, and risk tags. Labels are
|
|
86
|
+
* compared by normalized word tokens (case-, separator-, and order-insensitive)
|
|
87
|
+
* and files by normalized path, so phrasing differences do not hide an overlap.
|
|
88
|
+
* This remains deliberately naive: no stemming or semantic conflict detection.
|
|
47
89
|
*/
|
|
48
90
|
export function detectOverlaps(candidate, existing) {
|
|
49
91
|
const warnings = [];
|
|
50
92
|
for (const task of existing) {
|
|
51
|
-
if (task.taskId === candidate.taskId) {
|
|
93
|
+
if (task.taskId === candidate.taskId || isParentChild(candidate, task)) {
|
|
52
94
|
continue;
|
|
53
95
|
}
|
|
54
96
|
const reasons = reasonsFor(candidate, surfaceOf(task));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlap.js","sourceRoot":"","sources":["../../src/domain/overlap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"overlap.js","sourceRoot":"","sources":["../../src/domain/overlap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAuBlC,SAAS,kBAAkB,CAAC,CAAoB,EAAE,CAAoB;IACpE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KA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E,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAyB,EACzB,QAA+B;IAE/B,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,IAAI,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;YACvE,SAAS;QACX,CAAC;QACD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/domain/schemas.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const claimWorkInputShape: {
|
|
|
11
11
|
readonly agent: z.ZodOptional<z.ZodString>;
|
|
12
12
|
readonly branch: z.ZodOptional<z.ZodString>;
|
|
13
13
|
readonly worktree: z.ZodOptional<z.ZodString>;
|
|
14
|
+
readonly parent_task_id: z.ZodOptional<z.ZodString>;
|
|
14
15
|
readonly expected_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
16
|
readonly modules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16
17
|
readonly domains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -24,6 +25,7 @@ export declare const claimWorkInputSchema: z.ZodObject<{
|
|
|
24
25
|
readonly agent: z.ZodOptional<z.ZodString>;
|
|
25
26
|
readonly branch: z.ZodOptional<z.ZodString>;
|
|
26
27
|
readonly worktree: z.ZodOptional<z.ZodString>;
|
|
28
|
+
readonly parent_task_id: z.ZodOptional<z.ZodString>;
|
|
27
29
|
readonly expected_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
28
30
|
readonly modules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
29
31
|
readonly domains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -41,6 +43,7 @@ export declare const claimWorkInputSchema: z.ZodObject<{
|
|
|
41
43
|
domains?: string[] | undefined;
|
|
42
44
|
risk_tags?: string[] | undefined;
|
|
43
45
|
notes?: string | undefined;
|
|
46
|
+
parent_task_id?: string | undefined;
|
|
44
47
|
}, {
|
|
45
48
|
task_id: string;
|
|
46
49
|
title: string;
|
|
@@ -53,8 +56,43 @@ export declare const claimWorkInputSchema: z.ZodObject<{
|
|
|
53
56
|
domains?: string[] | undefined;
|
|
54
57
|
risk_tags?: string[] | undefined;
|
|
55
58
|
notes?: string | undefined;
|
|
59
|
+
parent_task_id?: string | undefined;
|
|
56
60
|
}>;
|
|
57
61
|
export type ClaimWorkInput = z.infer<typeof claimWorkInputSchema>;
|
|
62
|
+
export declare const updateTaskInputShape: {
|
|
63
|
+
readonly task_id: z.ZodString;
|
|
64
|
+
readonly kind: z.ZodEnum<["intent", "progress", "assumption", "decision", "question", "answer", "blocker", "finding"]>;
|
|
65
|
+
readonly content: z.ZodString;
|
|
66
|
+
readonly agent: z.ZodOptional<z.ZodString>;
|
|
67
|
+
};
|
|
68
|
+
export declare const updateTaskInputSchema: z.ZodObject<{
|
|
69
|
+
readonly task_id: z.ZodString;
|
|
70
|
+
readonly kind: z.ZodEnum<["intent", "progress", "assumption", "decision", "question", "answer", "blocker", "finding"]>;
|
|
71
|
+
readonly content: z.ZodString;
|
|
72
|
+
readonly agent: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
task_id: string;
|
|
75
|
+
kind: "intent" | "progress" | "assumption" | "decision" | "question" | "answer" | "blocker" | "finding";
|
|
76
|
+
content: string;
|
|
77
|
+
agent?: string | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
task_id: string;
|
|
80
|
+
kind: "intent" | "progress" | "assumption" | "decision" | "question" | "answer" | "blocker" | "finding";
|
|
81
|
+
content: string;
|
|
82
|
+
agent?: string | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
export type UpdateTaskInput = z.infer<typeof updateTaskInputSchema>;
|
|
85
|
+
export declare const getTaskContextInputShape: {
|
|
86
|
+
readonly task_id: z.ZodString;
|
|
87
|
+
};
|
|
88
|
+
export declare const getTaskContextInputSchema: z.ZodObject<{
|
|
89
|
+
readonly task_id: z.ZodString;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
task_id: string;
|
|
92
|
+
}, {
|
|
93
|
+
task_id: string;
|
|
94
|
+
}>;
|
|
95
|
+
export type GetTaskContextInput = z.infer<typeof getTaskContextInputSchema>;
|
|
58
96
|
export declare const handoffInputShape: {
|
|
59
97
|
readonly task_id: z.ZodString;
|
|
60
98
|
readonly status: z.ZodString;
|
|
@@ -67,6 +105,19 @@ export declare const handoffInputShape: {
|
|
|
67
105
|
readonly guardrails_checked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
68
106
|
readonly needs_review_from: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
69
107
|
readonly next_steps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
108
|
+
readonly ready_for_review: z.ZodOptional<z.ZodBoolean>;
|
|
109
|
+
readonly diff_size: z.ZodOptional<z.ZodString>;
|
|
110
|
+
readonly open_questions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
111
|
+
readonly provenance: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
112
|
+
field: z.ZodString;
|
|
113
|
+
source: z.ZodString;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
field: string;
|
|
116
|
+
source: string;
|
|
117
|
+
}, {
|
|
118
|
+
field: string;
|
|
119
|
+
source: string;
|
|
120
|
+
}>, "many">>;
|
|
70
121
|
};
|
|
71
122
|
export declare const handoffInputSchema: z.ZodObject<{
|
|
72
123
|
readonly task_id: z.ZodString;
|
|
@@ -80,6 +131,19 @@ export declare const handoffInputSchema: z.ZodObject<{
|
|
|
80
131
|
readonly guardrails_checked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
81
132
|
readonly needs_review_from: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
82
133
|
readonly next_steps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
134
|
+
readonly ready_for_review: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
readonly diff_size: z.ZodOptional<z.ZodString>;
|
|
136
|
+
readonly open_questions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
137
|
+
readonly provenance: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
138
|
+
field: z.ZodString;
|
|
139
|
+
source: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
field: string;
|
|
142
|
+
source: string;
|
|
143
|
+
}, {
|
|
144
|
+
field: string;
|
|
145
|
+
source: string;
|
|
146
|
+
}>, "many">>;
|
|
83
147
|
}, "strip", z.ZodTypeAny, {
|
|
84
148
|
status: string;
|
|
85
149
|
task_id: string;
|
|
@@ -92,6 +156,13 @@ export declare const handoffInputSchema: z.ZodObject<{
|
|
|
92
156
|
guardrails_checked?: string[] | undefined;
|
|
93
157
|
needs_review_from?: string[] | undefined;
|
|
94
158
|
next_steps?: string[] | undefined;
|
|
159
|
+
diff_size?: string | undefined;
|
|
160
|
+
open_questions?: string[] | undefined;
|
|
161
|
+
provenance?: {
|
|
162
|
+
field: string;
|
|
163
|
+
source: string;
|
|
164
|
+
}[] | undefined;
|
|
165
|
+
ready_for_review?: boolean | undefined;
|
|
95
166
|
}, {
|
|
96
167
|
status: string;
|
|
97
168
|
task_id: string;
|
|
@@ -104,6 +175,13 @@ export declare const handoffInputSchema: z.ZodObject<{
|
|
|
104
175
|
guardrails_checked?: string[] | undefined;
|
|
105
176
|
needs_review_from?: string[] | undefined;
|
|
106
177
|
next_steps?: string[] | undefined;
|
|
178
|
+
diff_size?: string | undefined;
|
|
179
|
+
open_questions?: string[] | undefined;
|
|
180
|
+
provenance?: {
|
|
181
|
+
field: string;
|
|
182
|
+
source: string;
|
|
183
|
+
}[] | undefined;
|
|
184
|
+
ready_for_review?: boolean | undefined;
|
|
107
185
|
}>;
|
|
108
186
|
export type HandoffInput = z.infer<typeof handoffInputSchema>;
|
|
109
187
|
export declare const reviewReadyInputShape: {
|
package/dist/domain/schemas.js
CHANGED
|
@@ -7,10 +7,20 @@ import { z } from 'zod';
|
|
|
7
7
|
export const claimWorkInputShape = {
|
|
8
8
|
task_id: z.string().min(1).describe('Stable identifier for the task, e.g. TASK-12'),
|
|
9
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
|
|
10
|
+
owner: z.string().optional().describe('Person or team accountable for the task (optional)'),
|
|
11
|
+
agent: z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('Stable identifier for the agent doing the work, e.g. claude-code or codex. Keep it ' +
|
|
15
|
+
'consistent across a session so the same agent is not recorded under different names.'),
|
|
12
16
|
branch: z.string().optional().describe('Git branch, if known'),
|
|
13
17
|
worktree: z.string().optional().describe('Git worktree path, if used'),
|
|
18
|
+
parent_task_id: z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Parent task id when this is a subtask of a larger effort, e.g. TODO-FRONTEND-001.1 ' +
|
|
22
|
+
'is a subtask of TODO-FRONTEND-001. Overlaps between a parent and its own child are ' +
|
|
23
|
+
'not flagged.'),
|
|
14
24
|
expected_files: z.array(z.string()).optional().describe('Files the task expects to touch'),
|
|
15
25
|
modules: z.array(z.string()).optional().describe('Logical modules touched, e.g. billing'),
|
|
16
26
|
domains: z.array(z.string()).optional().describe('Product domains touched, e.g. payments'),
|
|
@@ -18,6 +28,28 @@ export const claimWorkInputShape = {
|
|
|
18
28
|
notes: z.string().optional().describe('Freeform notes'),
|
|
19
29
|
};
|
|
20
30
|
export const claimWorkInputSchema = z.object(claimWorkInputShape);
|
|
31
|
+
export const updateTaskInputShape = {
|
|
32
|
+
task_id: z.string().min(1).describe('Claimed task receiving this memory entry'),
|
|
33
|
+
kind: z
|
|
34
|
+
.enum([
|
|
35
|
+
'intent',
|
|
36
|
+
'progress',
|
|
37
|
+
'assumption',
|
|
38
|
+
'decision',
|
|
39
|
+
'question',
|
|
40
|
+
'answer',
|
|
41
|
+
'blocker',
|
|
42
|
+
'finding',
|
|
43
|
+
])
|
|
44
|
+
.describe('The kind of task-scoped update'),
|
|
45
|
+
content: z.string().min(1).describe('Concise context another agent needs'),
|
|
46
|
+
agent: z.string().optional().describe('Agent recording the update; defaults to the claimant'),
|
|
47
|
+
};
|
|
48
|
+
export const updateTaskInputSchema = z.object(updateTaskInputShape);
|
|
49
|
+
export const getTaskContextInputShape = {
|
|
50
|
+
task_id: z.string().min(1).describe('Task whose shared context should be read'),
|
|
51
|
+
};
|
|
52
|
+
export const getTaskContextInputSchema = z.object(getTaskContextInputShape);
|
|
21
53
|
export const handoffInputShape = {
|
|
22
54
|
task_id: z.string().min(1).describe('The task being handed off, e.g. TASK-12'),
|
|
23
55
|
status: z.string().min(1).describe('Handoff status, e.g. done, blocked, in_progress'),
|
|
@@ -30,6 +62,20 @@ export const handoffInputShape = {
|
|
|
30
62
|
guardrails_checked: z.array(z.string()).optional().describe('Guardrails manually checked'),
|
|
31
63
|
needs_review_from: z.array(z.string()).optional().describe('Who should review'),
|
|
32
64
|
next_steps: z.array(z.string()).optional().describe('Remaining work or follow-ups'),
|
|
65
|
+
ready_for_review: z
|
|
66
|
+
.boolean()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe('Set true when this handoff also marks the task ready for review (before a PR). ' +
|
|
69
|
+
'This renders REVIEW_PACKET.md from the handoff.'),
|
|
70
|
+
diff_size: z
|
|
71
|
+
.string()
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('Rough diff size for the review packet, e.g. "+120 / -30"'),
|
|
74
|
+
open_questions: z.array(z.string()).optional().describe('Unresolved questions for the reviewer'),
|
|
75
|
+
provenance: z
|
|
76
|
+
.array(z.object({ field: z.string(), source: z.string() }))
|
|
77
|
+
.optional()
|
|
78
|
+
.describe('Where each claim came from, e.g. { field: "tests", source: "command output" }'),
|
|
33
79
|
};
|
|
34
80
|
export const handoffInputSchema = z.object(handoffInputShape);
|
|
35
81
|
export const reviewReadyInputShape = {
|
|
@@ -1 +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,GAAG;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;IACnF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAC/D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,
|
|
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,GAAG;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAA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IACxE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC1F,UAAU,EAAE,CAAC;SACV,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,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,13 @@
|
|
|
1
|
+
/** The command Claude Code runs on each matched PreToolUse event. */
|
|
2
|
+
export declare const PRE_TOOL_USE_HOOK_COMMAND = "concord hook pre-tool-use";
|
|
3
|
+
/**
|
|
4
|
+
* Idempotently add Concord's PreToolUse overlap hook to a `settings.json` string,
|
|
5
|
+
* preserving every other setting (and any other hook events). Returns the new
|
|
6
|
+
* file content. Passing the previous output back in is a no-op.
|
|
7
|
+
*/
|
|
8
|
+
export declare function upsertPreToolUseHook(existing: string | undefined): string;
|
|
9
|
+
/**
|
|
10
|
+
* Write the PreToolUse hook into `<repoRoot>/.claude/settings.json` (created if
|
|
11
|
+
* absent), preserving existing settings. Returns the relative path written.
|
|
12
|
+
*/
|
|
13
|
+
export declare function installClaudeHook(repoRoot: string): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/** Tools whose edits should be gated by the overlap check. */
|
|
5
|
+
const MATCHER = 'Edit|Write|MultiEdit';
|
|
6
|
+
/** The command Claude Code runs on each matched PreToolUse event. */
|
|
7
|
+
export const PRE_TOOL_USE_HOOK_COMMAND = 'concord hook pre-tool-use';
|
|
8
|
+
const settingsSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
hooks: z
|
|
11
|
+
.object({ PreToolUse: z.array(z.unknown()).optional() })
|
|
12
|
+
.passthrough()
|
|
13
|
+
.optional(),
|
|
14
|
+
})
|
|
15
|
+
.passthrough();
|
|
16
|
+
/**
|
|
17
|
+
* Idempotently add Concord's PreToolUse overlap hook to a `settings.json` string,
|
|
18
|
+
* preserving every other setting (and any other hook events). Returns the new
|
|
19
|
+
* file content. Passing the previous output back in is a no-op.
|
|
20
|
+
*/
|
|
21
|
+
export function upsertPreToolUseHook(existing) {
|
|
22
|
+
const source = existing === undefined || existing.trim() === '' ? {} : JSON.parse(existing);
|
|
23
|
+
const settings = settingsSchema.parse(source);
|
|
24
|
+
const hooks = settings.hooks ?? {};
|
|
25
|
+
const preToolUse = hooks.PreToolUse ?? [];
|
|
26
|
+
const alreadyInstalled = preToolUse.some((entry) => JSON.stringify(entry).includes(PRE_TOOL_USE_HOOK_COMMAND));
|
|
27
|
+
const nextPreToolUse = alreadyInstalled
|
|
28
|
+
? preToolUse
|
|
29
|
+
: [
|
|
30
|
+
...preToolUse,
|
|
31
|
+
{ matcher: MATCHER, hooks: [{ type: 'command', command: PRE_TOOL_USE_HOOK_COMMAND }] },
|
|
32
|
+
];
|
|
33
|
+
const next = { ...settings, hooks: { ...hooks, PreToolUse: nextPreToolUse } };
|
|
34
|
+
return `${JSON.stringify(next, null, 2)}\n`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Write the PreToolUse hook into `<repoRoot>/.claude/settings.json` (created if
|
|
38
|
+
* absent), preserving existing settings. Returns the relative path written.
|
|
39
|
+
*/
|
|
40
|
+
export function installClaudeHook(repoRoot) {
|
|
41
|
+
const relPath = join('.claude', 'settings.json');
|
|
42
|
+
const fullPath = join(repoRoot, relPath);
|
|
43
|
+
const existing = existsSync(fullPath) ? readFileSync(fullPath, 'utf8') : undefined;
|
|
44
|
+
mkdirSync(dirname(fullPath), { recursive: true });
|
|
45
|
+
writeFileSync(fullPath, upsertPreToolUseHook(existing));
|
|
46
|
+
return relPath;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=claude-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-hooks.js","sourceRoot":"","sources":["../../src/install/claude-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8DAA8D;AAC9D,MAAM,OAAO,GAAG,sBAAsB,CAAC;AACvC,qEAAqE;AACrE,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAErE,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,CAAC;IACN,KAAK,EAAE,CAAC;SACL,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;SACvD,WAAW,EAAE;SACb,QAAQ,EAAE;CACd,CAAC;KACD,WAAW,EAAE,CAAC;AAEjB;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA4B;IAC/D,MAAM,MAAM,GACV,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/E,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;IACnC,MAAM,UAAU,GAAG,KAAK,CAAC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|
-
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
|
|
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- **Keep each claim small.** Break work into the smallest independently\n handoff-able unit and `claim_work` each piece separately, rather than\n claiming one broad task. Concord flags claims that look too broad.\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- **While working**, call `update_task` for durable intent, progress,\n assumptions, decisions, questions, answers, blockers, and findings. When\n resuming or coordinating on a task, call `get_task_context` first.\n- **Before finishing or when blocked**, call `handoff` with what changed, tests\n run, assumptions, decisions, and guardrails you checked. **Before a PR**, set\n `ready_for_review` (with open questions and provenance) to also produce a\n review packet.\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. For edit-time enforcement, wire a PreToolUse\n(or git pre-commit) hook to `concord check <files> --task <your-task-id>`; it\nexits non-zero when your edits collide with another agent's active claim. On\nClaude Code, `concord install --claude-hooks` installs this automatically \u2014 set\n`CONCORD_TASK=<your task id>` so the hook excludes your own claim.";
|
|
3
3
|
/** MDC frontmatter used when creating a fresh Cursor rules file. */
|
|
4
4
|
export declare const CURSOR_MDC_HEADER = "---\ndescription: Concord shared work-state tools for coding agents\nalwaysApply: true\n---\n";
|
|
@@ -3,20 +3,30 @@ export const CONCORD_INSTRUCTIONS = `## Concord — shared work-state for coding
|
|
|
3
3
|
|
|
4
4
|
This project uses Concord MCP. Use its tools so your work is visible before PRs:
|
|
5
5
|
|
|
6
|
+
- **Keep each claim small.** Break work into the smallest independently
|
|
7
|
+
handoff-able unit and \`claim_work\` each piece separately, rather than
|
|
8
|
+
claiming one broad task. Concord flags claims that look too broad.
|
|
6
9
|
- **Before editing code**, call \`claim_work\` with the task id, title, and the
|
|
7
10
|
files/modules you expect to touch. Concord warns about overlaps with other
|
|
8
11
|
active work.
|
|
12
|
+
- **While working**, call \`update_task\` for durable intent, progress,
|
|
13
|
+
assumptions, decisions, questions, answers, blockers, and findings. When
|
|
14
|
+
resuming or coordinating on a task, call \`get_task_context\` first.
|
|
9
15
|
- **Before finishing or when blocked**, call \`handoff\` with what changed, tests
|
|
10
|
-
run, assumptions, decisions, and guardrails you checked.
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
run, assumptions, decisions, and guardrails you checked. **Before a PR**, set
|
|
17
|
+
\`ready_for_review\` (with open questions and provenance) to also produce a
|
|
18
|
+
review packet.
|
|
13
19
|
|
|
14
20
|
Concord regenerates human-readable \`HANDOFF.md\` and \`REVIEW_PACKET.md\` in
|
|
15
21
|
\`.concord/\` so humans can review your work.
|
|
16
22
|
|
|
17
23
|
Enforcement note: on clients with hooks/command registration this can be
|
|
18
24
|
enforced; elsewhere it is instruction-based and may be skipped. \`concord doctor\`
|
|
19
|
-
shows per-task adoption either way
|
|
25
|
+
shows per-task adoption either way. For edit-time enforcement, wire a PreToolUse
|
|
26
|
+
(or git pre-commit) hook to \`concord check <files> --task <your-task-id>\`; it
|
|
27
|
+
exits non-zero when your edits collide with another agent's active claim. On
|
|
28
|
+
Claude Code, \`concord install --claude-hooks\` installs this automatically — set
|
|
29
|
+
\`CONCORD_TASK=<your task id>\` so the hook excludes your own claim.`;
|
|
20
30
|
/** MDC frontmatter used when creating a fresh Cursor rules file. */
|
|
21
31
|
export const CURSOR_MDC_HEADER = `---
|
|
22
32
|
description: Concord shared work-state tools for coding agents
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/install/instructions.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/install/instructions.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;qEA2BiC,CAAC;AAEtE,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;CAIhC,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { Repositories } from './db/index.js';
|
|
3
3
|
/** Concord's advertised MCP server version. */
|
|
4
|
-
export declare const SERVER_VERSION = "0.
|
|
4
|
+
export declare const SERVER_VERSION = "0.3.0";
|
|
5
5
|
export interface ServerOptions {
|
|
6
6
|
/** Called after any tool writes to the database (used to regenerate artifacts). */
|
|
7
7
|
onToolWrite?: () => void;
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { registerClaimWork } from './tools/claim-work.js';
|
|
3
|
+
import { registerGetTaskContext } from './tools/get-task-context.js';
|
|
4
|
+
import { registerWorkState } from './tools/get-work-state.js';
|
|
3
5
|
import { registerHandoff } from './tools/handoff.js';
|
|
4
|
-
import {
|
|
6
|
+
import { registerUpdateTask } from './tools/update-task.js';
|
|
5
7
|
import { VERSION } from './version.js';
|
|
6
8
|
/** Concord's advertised MCP server version. */
|
|
7
9
|
export const SERVER_VERSION = VERSION;
|
|
@@ -11,9 +13,17 @@ export const SERVER_VERSION = VERSION;
|
|
|
11
13
|
*/
|
|
12
14
|
export function createServer(repos, options = {}) {
|
|
13
15
|
const server = new McpServer({ name: 'concord-mcp', version: SERVER_VERSION });
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
// Register the read surface first so we get the change-notifier, then run it
|
|
17
|
+
// (plus the caller's hook) after every write.
|
|
18
|
+
const notifyWorkStateChanged = registerWorkState(server, repos);
|
|
19
|
+
const onWrite = () => {
|
|
20
|
+
options.onToolWrite?.();
|
|
21
|
+
notifyWorkStateChanged();
|
|
22
|
+
};
|
|
23
|
+
registerGetTaskContext(server, repos);
|
|
24
|
+
registerClaimWork(server, repos, onWrite);
|
|
25
|
+
registerUpdateTask(server, repos, onWrite);
|
|
26
|
+
registerHandoff(server, repos, onWrite);
|
|
17
27
|
return server;
|
|
18
28
|
}
|
|
19
29
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +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,
|
|
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,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,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,6EAA6E;IAC7E,8CAA8C;IAC9C,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QACxB,sBAAsB,EAAE,CAAC;IAC3B,CAAC,CAAC;IACF,sBAAsB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1C,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3C,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -6,11 +6,48 @@ export interface ClaimWorkResult {
|
|
|
6
6
|
task: TaskRecord;
|
|
7
7
|
alreadyClaimed: boolean;
|
|
8
8
|
overlaps: OverlapWarning[];
|
|
9
|
+
/**
|
|
10
|
+
* How many other active tasks the overlap check compared against. Overlap
|
|
11
|
+
* detection is point-in-time: an empty `overlaps` only means nothing conflicts
|
|
12
|
+
* *right now*. A later overlapping claim will not appear here — it surfaces on
|
|
13
|
+
* read (e.g. `concord status`), which recomputes overlaps live.
|
|
14
|
+
*/
|
|
15
|
+
checkedAgainst: number;
|
|
16
|
+
/**
|
|
17
|
+
* Advisory reasons the claim looks too broad (empty when appropriately
|
|
18
|
+
* scoped). A non-empty list is a suggestion to split the work into smaller,
|
|
19
|
+
* independently-handoffable tasks — never a rejection.
|
|
20
|
+
*/
|
|
21
|
+
breadthReasons: string[];
|
|
22
|
+
/**
|
|
23
|
+
* On a re-claim, the scope entries this call added to the existing claim
|
|
24
|
+
* (e.g. `module: api-client`, `file: lib/todo-api.ts`). Empty on a first
|
|
25
|
+
* claim or when nothing new was declared.
|
|
26
|
+
*/
|
|
27
|
+
scopeAdded: string[];
|
|
9
28
|
}
|
|
10
29
|
/**
|
|
11
|
-
* Record that an agent is working on a task and flag
|
|
12
|
-
*
|
|
30
|
+
* Record that an agent is working on a task and flag overlaps with other active
|
|
31
|
+
* tasks. Re-claiming an existing task is idempotent for its identity (title,
|
|
32
|
+
* owner, agent) but *extends* its declared scope: the new files/modules/domains/
|
|
33
|
+
* risk tags are merged in and persisted, overlaps are recomputed against the
|
|
34
|
+
* merged scope, and the additions are reported back.
|
|
13
35
|
*/
|
|
14
36
|
export declare function handleClaimWork(repos: Repositories, input: ClaimWorkInput): ClaimWorkResult;
|
|
15
37
|
export declare function formatClaimWorkText(result: ClaimWorkResult): string;
|
|
38
|
+
/** The `claim_work` MCP structured output. All keys are snake_case, including
|
|
39
|
+
* overlap entries, so the payload is internally consistent. */
|
|
40
|
+
export declare function toClaimWorkStructured(result: ClaimWorkResult): {
|
|
41
|
+
task_id: string;
|
|
42
|
+
parent_task_id: string | null;
|
|
43
|
+
already_claimed: boolean;
|
|
44
|
+
overlaps: {
|
|
45
|
+
task_id: string;
|
|
46
|
+
title: string;
|
|
47
|
+
reasons: string[];
|
|
48
|
+
}[];
|
|
49
|
+
checked_against: number;
|
|
50
|
+
breadth_reasons: string[];
|
|
51
|
+
scope_added: string[];
|
|
52
|
+
};
|
|
16
53
|
export declare function registerClaimWork(server: McpServer, repos: Repositories, onWrite?: () => void): void;
|