@kawacode/mcp 5.0.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 (88) hide show
  1. package/CLAUDE.md.example +80 -0
  2. package/LICENSE +35 -0
  3. package/README.md +322 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.js +231 -0
  6. package/build/index.js.map +1 -0
  7. package/build/prompts/intent-first-workflow.d.ts +24 -0
  8. package/build/prompts/intent-first-workflow.js +204 -0
  9. package/build/prompts/intent-first-workflow.js.map +1 -0
  10. package/build/resources/active-intent.d.ts +9 -0
  11. package/build/resources/active-intent.js +52 -0
  12. package/build/resources/active-intent.js.map +1 -0
  13. package/build/services/active-intent-store.d.ts +36 -0
  14. package/build/services/active-intent-store.js +45 -0
  15. package/build/services/active-intent-store.js.map +1 -0
  16. package/build/services/kawa-api.d.ts +131 -0
  17. package/build/services/kawa-api.js +239 -0
  18. package/build/services/kawa-api.js.map +1 -0
  19. package/build/services/muninn-ipc.d.ts +45 -0
  20. package/build/services/muninn-ipc.js +275 -0
  21. package/build/services/muninn-ipc.js.map +1 -0
  22. package/build/services/repo-encryption.d.ts +46 -0
  23. package/build/services/repo-encryption.js +92 -0
  24. package/build/services/repo-encryption.js.map +1 -0
  25. package/build/services/storage-decryption.d.ts +52 -0
  26. package/build/services/storage-decryption.js +162 -0
  27. package/build/services/storage-decryption.js.map +1 -0
  28. package/build/tools/assign-blocks.d.ts +87 -0
  29. package/build/tools/assign-blocks.js +49 -0
  30. package/build/tools/assign-blocks.js.map +1 -0
  31. package/build/tools/check-active-intent.d.ts +50 -0
  32. package/build/tools/check-active-intent.js +48 -0
  33. package/build/tools/check-active-intent.js.map +1 -0
  34. package/build/tools/complete-intent.d.ts +48 -0
  35. package/build/tools/complete-intent.js +53 -0
  36. package/build/tools/complete-intent.js.map +1 -0
  37. package/build/tools/create-intent.d.ts +58 -0
  38. package/build/tools/create-intent.js +49 -0
  39. package/build/tools/create-intent.js.map +1 -0
  40. package/build/tools/detect-intent-conflicts.d.ts +361 -0
  41. package/build/tools/detect-intent-conflicts.js +91 -0
  42. package/build/tools/detect-intent-conflicts.js.map +1 -0
  43. package/build/tools/edit-session-decision.d.ts +201 -0
  44. package/build/tools/edit-session-decision.js +50 -0
  45. package/build/tools/edit-session-decision.js.map +1 -0
  46. package/build/tools/evolve-decisions.d.ts +50 -0
  47. package/build/tools/evolve-decisions.js +45 -0
  48. package/build/tools/evolve-decisions.js.map +1 -0
  49. package/build/tools/get-intent-changes.d.ts +49 -0
  50. package/build/tools/get-intent-changes.js +58 -0
  51. package/build/tools/get-intent-changes.js.map +1 -0
  52. package/build/tools/get-intents-for-file.d.ts +57 -0
  53. package/build/tools/get-intents-for-file.js +57 -0
  54. package/build/tools/get-intents-for-file.js.map +1 -0
  55. package/build/tools/get-intents-for-lines.d.ts +71 -0
  56. package/build/tools/get-intents-for-lines.js +64 -0
  57. package/build/tools/get-intents-for-lines.js.map +1 -0
  58. package/build/tools/get-project-context.d.ts +82 -0
  59. package/build/tools/get-project-context.js +73 -0
  60. package/build/tools/get-project-context.js.map +1 -0
  61. package/build/tools/get-project-decisions.d.ts +51 -0
  62. package/build/tools/get-project-decisions.js +56 -0
  63. package/build/tools/get-project-decisions.js.map +1 -0
  64. package/build/tools/get-relevant-context.d.ts +89 -0
  65. package/build/tools/get-relevant-context.js +104 -0
  66. package/build/tools/get-relevant-context.js.map +1 -0
  67. package/build/tools/get-session-decisions.d.ts +57 -0
  68. package/build/tools/get-session-decisions.js +48 -0
  69. package/build/tools/get-session-decisions.js.map +1 -0
  70. package/build/tools/index.d.ts +656 -0
  71. package/build/tools/index.js +57 -0
  72. package/build/tools/index.js.map +1 -0
  73. package/build/tools/infer-history.d.ts +85 -0
  74. package/build/tools/infer-history.js +69 -0
  75. package/build/tools/infer-history.js.map +1 -0
  76. package/build/tools/list-team-intents.d.ts +51 -0
  77. package/build/tools/list-team-intents.js +57 -0
  78. package/build/tools/list-team-intents.js.map +1 -0
  79. package/build/tools/log-work.d.ts +45 -0
  80. package/build/tools/log-work.js +30 -0
  81. package/build/tools/log-work.js.map +1 -0
  82. package/build/tools/record-decision.d.ts +132 -0
  83. package/build/tools/record-decision.js +66 -0
  84. package/build/tools/record-decision.js.map +1 -0
  85. package/build/tools/resolve-origin.d.ts +13 -0
  86. package/build/tools/resolve-origin.js +33 -0
  87. package/build/tools/resolve-origin.js.map +1 -0
  88. package/package.json +36 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complete-intent.js","sourceRoot":"","sources":["../../src/tools/complete-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yEAAyE,CAAC;IACpH,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;SAC9E,QAAQ,CAAC,wHAAwH,CAAC;CACtI,CAAC,CAAA;AAaF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAA0B;IAC7D,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IAEpE,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE;QAC9C,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAA;IACnC,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,IAAI,QAAQ,CAAA;IAC/C,MAAM,cAAc,GAAG,GAAG,CAAC,cAAc,IAAI,QAAQ,CAAA;IAErD,MAAM,cAAc,GAA2B;QAC7C,SAAS,EAAE,WAAW,WAAW,uBAAuB;QACxD,MAAM,EAAE,WAAW,WAAW,oBAAoB;QAClD,IAAI,EAAE,WAAW,WAAW,kBAAkB;QAC9C,SAAS,EAAE,WAAW,WAAW,aAAa;KAC/C,CAAA;IAED,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,KAAK;QAC9B,QAAQ;QACR,cAAc;QACd,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;KACjH,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;;;;;;;;;;qDAWsC;IACnD,WAAW,EAAE,oBAAoB;IACjC,OAAO,EAAE,cAAc;CACxB,CAAA"}
@@ -0,0 +1,58 @@
1
+ import { z } from 'zod';
2
+ export declare const createAndActivateIntentSchema: z.ZodObject<{
3
+ repoOrigin: z.ZodOptional<z.ZodString>;
4
+ repoPath: z.ZodString;
5
+ title: z.ZodString;
6
+ description: z.ZodString;
7
+ templateType: z.ZodDefault<z.ZodEnum<["feature", "refactor", "exploration"]>>;
8
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ repoPath: string;
11
+ title: string;
12
+ description: string;
13
+ templateType: "feature" | "refactor" | "exploration";
14
+ repoOrigin?: string | undefined;
15
+ constraints?: string[] | undefined;
16
+ }, {
17
+ repoPath: string;
18
+ title: string;
19
+ description: string;
20
+ repoOrigin?: string | undefined;
21
+ templateType?: "feature" | "refactor" | "exploration" | undefined;
22
+ constraints?: string[] | undefined;
23
+ }>;
24
+ export type CreateIntentInput = z.infer<typeof createAndActivateIntentSchema>;
25
+ export interface CreateIntentResponse {
26
+ success: boolean;
27
+ intentId: string;
28
+ localId: string;
29
+ message: string;
30
+ }
31
+ export declare function createAndActivateIntent(input: CreateIntentInput): Promise<CreateIntentResponse>;
32
+ export declare const createAndActivateIntentTool: {
33
+ name: string;
34
+ description: string;
35
+ inputSchema: z.ZodObject<{
36
+ repoOrigin: z.ZodOptional<z.ZodString>;
37
+ repoPath: z.ZodString;
38
+ title: z.ZodString;
39
+ description: z.ZodString;
40
+ templateType: z.ZodDefault<z.ZodEnum<["feature", "refactor", "exploration"]>>;
41
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ repoPath: string;
44
+ title: string;
45
+ description: string;
46
+ templateType: "feature" | "refactor" | "exploration";
47
+ repoOrigin?: string | undefined;
48
+ constraints?: string[] | undefined;
49
+ }, {
50
+ repoPath: string;
51
+ title: string;
52
+ description: string;
53
+ repoOrigin?: string | undefined;
54
+ templateType?: "feature" | "refactor" | "exploration" | undefined;
55
+ constraints?: string[] | undefined;
56
+ }>;
57
+ handler: typeof createAndActivateIntent;
58
+ };
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import { request } from '../services/muninn-ipc.js';
3
+ import { resolveOrigin } from './resolve-origin.js';
4
+ export const createAndActivateIntentSchema = z.object({
5
+ repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
6
+ repoPath: z.string().describe('Local path to the repository root'),
7
+ title: z.string().max(200).describe('Short, descriptive title for the intent'),
8
+ description: z.string().max(2000).describe('What this intent accomplishes'),
9
+ templateType: z.enum(['feature', 'refactor', 'exploration']).default('feature').describe('Type of work'),
10
+ constraints: z.array(z.string()).optional().describe('Requirements or constraints for this work')
11
+ });
12
+ export async function createAndActivateIntent(input) {
13
+ const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
14
+ // Step 1: Create the intent
15
+ const createRes = await request('intent', 'create', {
16
+ repoOrigin: actualOrigin,
17
+ title: input.title,
18
+ description: input.description,
19
+ templateType: input.templateType,
20
+ constraints: input.constraints || [],
21
+ scope: { type: 'repo', paths: [] },
22
+ });
23
+ const intentId = createRes.intent?.id || createRes.intentId || '';
24
+ // Step 2: Set it as active
25
+ await request('intent', 'set-active', {
26
+ repoOrigin: actualOrigin,
27
+ intentId,
28
+ });
29
+ return {
30
+ success: true,
31
+ intentId,
32
+ localId: intentId,
33
+ message: `Created and activated intent: "${input.title}"`
34
+ };
35
+ }
36
+ export const createAndActivateIntentTool = {
37
+ name: 'create_and_activate_intent',
38
+ description: `Create a new intent from the user's request and mark it as active.
39
+
40
+ Call this when check_active_intent returns no active intent. Before calling:
41
+ 1. Summarize what the user is asking for
42
+ 2. Ask the user to confirm the intent details (title, description, type)
43
+ 3. Then call this tool with the confirmed details
44
+
45
+ This ensures all AI-generated code gets properly tracked and attributed.`,
46
+ inputSchema: createAndActivateIntentSchema,
47
+ handler: createAndActivateIntent
48
+ };
49
+ //# sourceMappingURL=create-intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-intent.js","sourceRoot":"","sources":["../../src/tools/create-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,C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E,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;KACnC,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,IAAI,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAA;IAEjE,2BAA2B;IAC3B,MAAM,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE;QACpC,UAAU,EAAE,YAAY;QACxB,QAAQ;KACT,CAAC,CAAA;IAEF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,QAAQ;QACR,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,kCAAkC,KAAK,CAAC,KAAK,GAAG;KAC1D,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE;;;;;;;yEAO0D;IACvE,WAAW,EAAE,6BAA6B;IAC1C,OAAO,EAAE,uBAAuB;CACjC,CAAA"}
@@ -0,0 +1,361 @@
1
+ import { z } from 'zod';
2
+ export declare const detectIntentConflictsSchema: z.ZodObject<{
3
+ repoOrigin: z.ZodOptional<z.ZodString>;
4
+ repoPath: z.ZodString;
5
+ intentId: z.ZodString;
6
+ teamDecisions: z.ZodArray<z.ZodObject<{
7
+ decision: z.ZodObject<{
8
+ id: z.ZodString;
9
+ timestamp: z.ZodString;
10
+ type: z.ZodString;
11
+ summary: z.ZodString;
12
+ rationale: z.ZodString;
13
+ context: z.ZodOptional<z.ZodString>;
14
+ alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ consequences: z.ZodOptional<z.ZodString>;
16
+ relatedFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
17
+ constraintsChecked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18
+ constraintViolations: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ alternative: z.ZodString;
20
+ constraint: z.ZodString;
21
+ reason: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ alternative: string;
24
+ constraint: string;
25
+ reason: string;
26
+ }, {
27
+ alternative: string;
28
+ constraint: string;
29
+ reason: string;
30
+ }>, "many">>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ id: string;
33
+ type: string;
34
+ summary: string;
35
+ rationale: string;
36
+ timestamp: string;
37
+ context?: string | undefined;
38
+ alternatives?: string[] | undefined;
39
+ consequences?: string | undefined;
40
+ relatedFiles?: string[] | undefined;
41
+ constraintsChecked?: string[] | undefined;
42
+ constraintViolations?: {
43
+ alternative: string;
44
+ constraint: string;
45
+ reason: string;
46
+ }[] | undefined;
47
+ }, {
48
+ id: string;
49
+ type: string;
50
+ summary: string;
51
+ rationale: string;
52
+ timestamp: string;
53
+ context?: string | undefined;
54
+ alternatives?: string[] | undefined;
55
+ consequences?: string | undefined;
56
+ relatedFiles?: string[] | undefined;
57
+ constraintsChecked?: string[] | undefined;
58
+ constraintViolations?: {
59
+ alternative: string;
60
+ constraint: string;
61
+ reason: string;
62
+ }[] | undefined;
63
+ }>;
64
+ intentId: z.ZodString;
65
+ authorId: z.ZodString;
66
+ authorName: z.ZodString;
67
+ }, "strip", z.ZodTypeAny, {
68
+ decision: {
69
+ id: string;
70
+ type: string;
71
+ summary: string;
72
+ rationale: string;
73
+ timestamp: string;
74
+ context?: string | undefined;
75
+ alternatives?: string[] | undefined;
76
+ consequences?: string | undefined;
77
+ relatedFiles?: string[] | undefined;
78
+ constraintsChecked?: string[] | undefined;
79
+ constraintViolations?: {
80
+ alternative: string;
81
+ constraint: string;
82
+ reason: string;
83
+ }[] | undefined;
84
+ };
85
+ intentId: string;
86
+ authorId: string;
87
+ authorName: string;
88
+ }, {
89
+ decision: {
90
+ id: string;
91
+ type: string;
92
+ summary: string;
93
+ rationale: string;
94
+ timestamp: string;
95
+ context?: string | undefined;
96
+ alternatives?: string[] | undefined;
97
+ consequences?: string | undefined;
98
+ relatedFiles?: string[] | undefined;
99
+ constraintsChecked?: string[] | undefined;
100
+ constraintViolations?: {
101
+ alternative: string;
102
+ constraint: string;
103
+ reason: string;
104
+ }[] | undefined;
105
+ };
106
+ intentId: string;
107
+ authorId: string;
108
+ authorName: string;
109
+ }>, "many">;
110
+ }, "strip", z.ZodTypeAny, {
111
+ repoPath: string;
112
+ intentId: string;
113
+ teamDecisions: {
114
+ decision: {
115
+ id: string;
116
+ type: string;
117
+ summary: string;
118
+ rationale: string;
119
+ timestamp: string;
120
+ context?: string | undefined;
121
+ alternatives?: string[] | undefined;
122
+ consequences?: string | undefined;
123
+ relatedFiles?: string[] | undefined;
124
+ constraintsChecked?: string[] | undefined;
125
+ constraintViolations?: {
126
+ alternative: string;
127
+ constraint: string;
128
+ reason: string;
129
+ }[] | undefined;
130
+ };
131
+ intentId: string;
132
+ authorId: string;
133
+ authorName: string;
134
+ }[];
135
+ repoOrigin?: string | undefined;
136
+ }, {
137
+ repoPath: string;
138
+ intentId: string;
139
+ teamDecisions: {
140
+ decision: {
141
+ id: string;
142
+ type: string;
143
+ summary: string;
144
+ rationale: string;
145
+ timestamp: string;
146
+ context?: string | undefined;
147
+ alternatives?: string[] | undefined;
148
+ consequences?: string | undefined;
149
+ relatedFiles?: string[] | undefined;
150
+ constraintsChecked?: string[] | undefined;
151
+ constraintViolations?: {
152
+ alternative: string;
153
+ constraint: string;
154
+ reason: string;
155
+ }[] | undefined;
156
+ };
157
+ intentId: string;
158
+ authorId: string;
159
+ authorName: string;
160
+ }[];
161
+ repoOrigin?: string | undefined;
162
+ }>;
163
+ export type DetectIntentConflictsInput = z.infer<typeof detectIntentConflictsSchema>;
164
+ export interface ConflictInfo {
165
+ localDecision: DecisionInfo;
166
+ remoteDecision: DecisionInfo;
167
+ remoteAuthor: string;
168
+ conflictType: 'overlapping_code' | 'contradictory_rationale' | 'constraint_mismatch';
169
+ overlappingFiles: string[];
170
+ }
171
+ export interface DecisionInfo {
172
+ id: string;
173
+ timestamp: string;
174
+ type: string;
175
+ summary: string;
176
+ rationale: string;
177
+ context?: string;
178
+ alternatives?: string[];
179
+ consequences?: string;
180
+ relatedFiles?: string[];
181
+ constraintsChecked?: string[];
182
+ constraintViolations?: Array<{
183
+ alternative: string;
184
+ constraint: string;
185
+ reason: string;
186
+ }>;
187
+ }
188
+ export interface DetectIntentConflictsResponse {
189
+ hasConflicts: boolean;
190
+ conflictCount: number;
191
+ hasCriticalConflicts: boolean;
192
+ conflicts: ConflictInfo[];
193
+ overlappingFiles: string[];
194
+ }
195
+ export declare function detectIntentConflicts(input: DetectIntentConflictsInput): Promise<DetectIntentConflictsResponse>;
196
+ export declare const detectIntentConflictsTool: {
197
+ name: string;
198
+ description: string;
199
+ inputSchema: z.ZodObject<{
200
+ repoOrigin: z.ZodOptional<z.ZodString>;
201
+ repoPath: z.ZodString;
202
+ intentId: z.ZodString;
203
+ teamDecisions: z.ZodArray<z.ZodObject<{
204
+ decision: z.ZodObject<{
205
+ id: z.ZodString;
206
+ timestamp: z.ZodString;
207
+ type: z.ZodString;
208
+ summary: z.ZodString;
209
+ rationale: z.ZodString;
210
+ context: z.ZodOptional<z.ZodString>;
211
+ alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
212
+ consequences: z.ZodOptional<z.ZodString>;
213
+ relatedFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
214
+ constraintsChecked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
215
+ constraintViolations: z.ZodOptional<z.ZodArray<z.ZodObject<{
216
+ alternative: z.ZodString;
217
+ constraint: z.ZodString;
218
+ reason: z.ZodString;
219
+ }, "strip", z.ZodTypeAny, {
220
+ alternative: string;
221
+ constraint: string;
222
+ reason: string;
223
+ }, {
224
+ alternative: string;
225
+ constraint: string;
226
+ reason: string;
227
+ }>, "many">>;
228
+ }, "strip", z.ZodTypeAny, {
229
+ id: string;
230
+ type: string;
231
+ summary: string;
232
+ rationale: string;
233
+ timestamp: string;
234
+ context?: string | undefined;
235
+ alternatives?: string[] | undefined;
236
+ consequences?: string | undefined;
237
+ relatedFiles?: string[] | undefined;
238
+ constraintsChecked?: string[] | undefined;
239
+ constraintViolations?: {
240
+ alternative: string;
241
+ constraint: string;
242
+ reason: string;
243
+ }[] | undefined;
244
+ }, {
245
+ id: string;
246
+ type: string;
247
+ summary: string;
248
+ rationale: string;
249
+ timestamp: string;
250
+ context?: string | undefined;
251
+ alternatives?: string[] | undefined;
252
+ consequences?: string | undefined;
253
+ relatedFiles?: string[] | undefined;
254
+ constraintsChecked?: string[] | undefined;
255
+ constraintViolations?: {
256
+ alternative: string;
257
+ constraint: string;
258
+ reason: string;
259
+ }[] | undefined;
260
+ }>;
261
+ intentId: z.ZodString;
262
+ authorId: z.ZodString;
263
+ authorName: z.ZodString;
264
+ }, "strip", z.ZodTypeAny, {
265
+ decision: {
266
+ id: string;
267
+ type: string;
268
+ summary: string;
269
+ rationale: string;
270
+ timestamp: string;
271
+ context?: string | undefined;
272
+ alternatives?: string[] | undefined;
273
+ consequences?: string | undefined;
274
+ relatedFiles?: string[] | undefined;
275
+ constraintsChecked?: string[] | undefined;
276
+ constraintViolations?: {
277
+ alternative: string;
278
+ constraint: string;
279
+ reason: string;
280
+ }[] | undefined;
281
+ };
282
+ intentId: string;
283
+ authorId: string;
284
+ authorName: string;
285
+ }, {
286
+ decision: {
287
+ id: string;
288
+ type: string;
289
+ summary: string;
290
+ rationale: string;
291
+ timestamp: string;
292
+ context?: string | undefined;
293
+ alternatives?: string[] | undefined;
294
+ consequences?: string | undefined;
295
+ relatedFiles?: string[] | undefined;
296
+ constraintsChecked?: string[] | undefined;
297
+ constraintViolations?: {
298
+ alternative: string;
299
+ constraint: string;
300
+ reason: string;
301
+ }[] | undefined;
302
+ };
303
+ intentId: string;
304
+ authorId: string;
305
+ authorName: string;
306
+ }>, "many">;
307
+ }, "strip", z.ZodTypeAny, {
308
+ repoPath: string;
309
+ intentId: string;
310
+ teamDecisions: {
311
+ decision: {
312
+ id: string;
313
+ type: string;
314
+ summary: string;
315
+ rationale: string;
316
+ timestamp: string;
317
+ context?: string | undefined;
318
+ alternatives?: string[] | undefined;
319
+ consequences?: string | undefined;
320
+ relatedFiles?: string[] | undefined;
321
+ constraintsChecked?: string[] | undefined;
322
+ constraintViolations?: {
323
+ alternative: string;
324
+ constraint: string;
325
+ reason: string;
326
+ }[] | undefined;
327
+ };
328
+ intentId: string;
329
+ authorId: string;
330
+ authorName: string;
331
+ }[];
332
+ repoOrigin?: string | undefined;
333
+ }, {
334
+ repoPath: string;
335
+ intentId: string;
336
+ teamDecisions: {
337
+ decision: {
338
+ id: string;
339
+ type: string;
340
+ summary: string;
341
+ rationale: string;
342
+ timestamp: string;
343
+ context?: string | undefined;
344
+ alternatives?: string[] | undefined;
345
+ consequences?: string | undefined;
346
+ relatedFiles?: string[] | undefined;
347
+ constraintsChecked?: string[] | undefined;
348
+ constraintViolations?: {
349
+ alternative: string;
350
+ constraint: string;
351
+ reason: string;
352
+ }[] | undefined;
353
+ };
354
+ intentId: string;
355
+ authorId: string;
356
+ authorName: string;
357
+ }[];
358
+ repoOrigin?: string | undefined;
359
+ }>;
360
+ handler: typeof detectIntentConflicts;
361
+ };
@@ -0,0 +1,91 @@
1
+ import { z } from 'zod';
2
+ import { request } from '../services/muninn-ipc.js';
3
+ import { resolveOrigin } from './resolve-origin.js';
4
+ const constraintViolationSchema = z.object({
5
+ alternative: z.string().describe('The alternative that was rejected'),
6
+ constraint: z.string().describe('The constraint ID that was violated'),
7
+ reason: z.string().describe('Why the alternative violates the constraint')
8
+ });
9
+ const teamDecisionSchema = z.object({
10
+ decision: z.object({
11
+ id: z.string(),
12
+ timestamp: z.string(),
13
+ type: z.string(),
14
+ summary: z.string(),
15
+ rationale: z.string(),
16
+ context: z.string().optional(),
17
+ alternatives: z.array(z.string()).optional(),
18
+ consequences: z.string().optional(),
19
+ relatedFiles: z.array(z.string()).optional(),
20
+ constraintsChecked: z.array(z.string()).optional(),
21
+ constraintViolations: z.array(constraintViolationSchema).optional()
22
+ }),
23
+ intentId: z.string().describe('Intent ID this decision belongs to'),
24
+ authorId: z.string().describe('Author user ID'),
25
+ authorName: z.string().describe('Author display name')
26
+ });
27
+ export const detectIntentConflictsSchema = z.object({
28
+ repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
29
+ repoPath: z.string().describe('Local path to the repository root'),
30
+ intentId: z.string().describe('The active intent ID'),
31
+ teamDecisions: z.array(teamDecisionSchema).describe('Team decisions to check against')
32
+ });
33
+ export async function detectIntentConflicts(input) {
34
+ const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
35
+ const res = await request('decision', 'detect-conflicts', {
36
+ repoOrigin: actualOrigin,
37
+ intentId: input.intentId,
38
+ teamDecisions: input.teamDecisions,
39
+ });
40
+ const conflicts = (res.conflicts || []).map((c) => ({
41
+ localDecision: {
42
+ id: c.local_decision?.id || c.localDecision?.id || '',
43
+ timestamp: c.local_decision?.timestamp || c.localDecision?.timestamp || '',
44
+ type: c.local_decision?.type || c.localDecision?.type || '',
45
+ summary: c.local_decision?.summary || c.localDecision?.summary || '',
46
+ rationale: c.local_decision?.rationale || c.localDecision?.rationale || '',
47
+ relatedFiles: c.local_decision?.related_files || c.localDecision?.relatedFiles,
48
+ },
49
+ remoteDecision: {
50
+ id: c.remote_decision?.id || c.remoteDecision?.id || '',
51
+ timestamp: c.remote_decision?.timestamp || c.remoteDecision?.timestamp || '',
52
+ type: c.remote_decision?.type || c.remoteDecision?.type || '',
53
+ summary: c.remote_decision?.summary || c.remoteDecision?.summary || '',
54
+ rationale: c.remote_decision?.rationale || c.remoteDecision?.rationale || '',
55
+ relatedFiles: c.remote_decision?.related_files || c.remoteDecision?.relatedFiles,
56
+ },
57
+ remoteAuthor: c.remote_author || c.remoteAuthor || '',
58
+ conflictType: c.conflict_type || c.conflictType || 'overlapping_code',
59
+ overlappingFiles: c.overlapping_files || c.overlappingFiles || []
60
+ }));
61
+ const hasCriticalConflicts = conflicts.some(c => c.conflictType === 'constraint_mismatch');
62
+ return {
63
+ hasConflicts: conflicts.length > 0,
64
+ conflictCount: conflicts.length,
65
+ hasCriticalConflicts,
66
+ conflicts,
67
+ overlappingFiles: res.overlapping_files || res.overlappingFiles || [...new Set(conflicts.flatMap(c => c.overlappingFiles))]
68
+ };
69
+ }
70
+ export const detectIntentConflictsTool = {
71
+ name: 'detect_intent_conflicts',
72
+ description: `Detect conflicts between your local decisions and team members' decisions.
73
+
74
+ Call this before committing to check for potential conflicts.
75
+
76
+ The tool compares:
77
+ 1. **Overlapping code**: Decisions affecting the same files
78
+ 2. **Contradictory rationale**: Decisions with opposing reasoning
79
+ 3. **Constraint mismatch**: Decisions applying different constraints
80
+
81
+ Returns:
82
+ - hasConflicts: Whether any conflicts were detected
83
+ - hasCriticalConflicts: True if constraint mismatches found (high priority)
84
+ - conflicts: List of conflict details with affected files and authors
85
+ - overlappingFiles: All files affected by both local and team decisions
86
+
87
+ Note: Team decisions must be provided (fetched from API).`,
88
+ inputSchema: detectIntentConflictsSchema,
89
+ handler: detectIntentConflicts
90
+ };
91
+ //# sourceMappingURL=detect-intent-conflicts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-intent-conflicts.js","sourceRoot":"","sources":["../../src/tools/detect-intent-conflicts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IACrE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IACtE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CAC3E,CAAC,CAAA;AAEF,MAAM,kBAAkB,GAAG,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