@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.
- package/CLAUDE.md.example +80 -0
- package/LICENSE +35 -0
- package/README.md +322 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +231 -0
- package/build/index.js.map +1 -0
- package/build/prompts/intent-first-workflow.d.ts +24 -0
- package/build/prompts/intent-first-workflow.js +204 -0
- package/build/prompts/intent-first-workflow.js.map +1 -0
- package/build/resources/active-intent.d.ts +9 -0
- package/build/resources/active-intent.js +52 -0
- package/build/resources/active-intent.js.map +1 -0
- package/build/services/active-intent-store.d.ts +36 -0
- package/build/services/active-intent-store.js +45 -0
- package/build/services/active-intent-store.js.map +1 -0
- package/build/services/kawa-api.d.ts +131 -0
- package/build/services/kawa-api.js +239 -0
- package/build/services/kawa-api.js.map +1 -0
- package/build/services/muninn-ipc.d.ts +45 -0
- package/build/services/muninn-ipc.js +275 -0
- package/build/services/muninn-ipc.js.map +1 -0
- package/build/services/repo-encryption.d.ts +46 -0
- package/build/services/repo-encryption.js +92 -0
- package/build/services/repo-encryption.js.map +1 -0
- package/build/services/storage-decryption.d.ts +52 -0
- package/build/services/storage-decryption.js +162 -0
- package/build/services/storage-decryption.js.map +1 -0
- package/build/tools/assign-blocks.d.ts +87 -0
- package/build/tools/assign-blocks.js +49 -0
- package/build/tools/assign-blocks.js.map +1 -0
- package/build/tools/check-active-intent.d.ts +50 -0
- package/build/tools/check-active-intent.js +48 -0
- package/build/tools/check-active-intent.js.map +1 -0
- package/build/tools/complete-intent.d.ts +48 -0
- package/build/tools/complete-intent.js +53 -0
- package/build/tools/complete-intent.js.map +1 -0
- package/build/tools/create-intent.d.ts +58 -0
- package/build/tools/create-intent.js +49 -0
- package/build/tools/create-intent.js.map +1 -0
- package/build/tools/detect-intent-conflicts.d.ts +361 -0
- package/build/tools/detect-intent-conflicts.js +91 -0
- package/build/tools/detect-intent-conflicts.js.map +1 -0
- package/build/tools/edit-session-decision.d.ts +201 -0
- package/build/tools/edit-session-decision.js +50 -0
- package/build/tools/edit-session-decision.js.map +1 -0
- package/build/tools/evolve-decisions.d.ts +50 -0
- package/build/tools/evolve-decisions.js +45 -0
- package/build/tools/evolve-decisions.js.map +1 -0
- package/build/tools/get-intent-changes.d.ts +49 -0
- package/build/tools/get-intent-changes.js +58 -0
- package/build/tools/get-intent-changes.js.map +1 -0
- package/build/tools/get-intents-for-file.d.ts +57 -0
- package/build/tools/get-intents-for-file.js +57 -0
- package/build/tools/get-intents-for-file.js.map +1 -0
- package/build/tools/get-intents-for-lines.d.ts +71 -0
- package/build/tools/get-intents-for-lines.js +64 -0
- package/build/tools/get-intents-for-lines.js.map +1 -0
- package/build/tools/get-project-context.d.ts +82 -0
- package/build/tools/get-project-context.js +73 -0
- package/build/tools/get-project-context.js.map +1 -0
- package/build/tools/get-project-decisions.d.ts +51 -0
- package/build/tools/get-project-decisions.js +56 -0
- package/build/tools/get-project-decisions.js.map +1 -0
- package/build/tools/get-relevant-context.d.ts +89 -0
- package/build/tools/get-relevant-context.js +104 -0
- package/build/tools/get-relevant-context.js.map +1 -0
- package/build/tools/get-session-decisions.d.ts +57 -0
- package/build/tools/get-session-decisions.js +48 -0
- package/build/tools/get-session-decisions.js.map +1 -0
- package/build/tools/index.d.ts +656 -0
- package/build/tools/index.js +57 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/infer-history.d.ts +85 -0
- package/build/tools/infer-history.js +69 -0
- package/build/tools/infer-history.js.map +1 -0
- package/build/tools/list-team-intents.d.ts +51 -0
- package/build/tools/list-team-intents.js +57 -0
- package/build/tools/list-team-intents.js.map +1 -0
- package/build/tools/log-work.d.ts +45 -0
- package/build/tools/log-work.js +30 -0
- package/build/tools/log-work.js.map +1 -0
- package/build/tools/record-decision.d.ts +132 -0
- package/build/tools/record-decision.js +66 -0
- package/build/tools/record-decision.js.map +1 -0
- package/build/tools/resolve-origin.d.ts +13 -0
- package/build/tools/resolve-origin.js +33 -0
- package/build/tools/resolve-origin.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { checkActiveIntentTool, checkActiveIntent, checkActiveIntentSchema } from './check-active-intent.js';
|
|
2
|
+
import { getRelevantContextTool, getRelevantContext, getRelevantContextSchema } from './get-relevant-context.js';
|
|
3
|
+
import { createAndActivateIntentTool, createAndActivateIntent, createAndActivateIntentSchema } from './create-intent.js';
|
|
4
|
+
import { getIntentsForFileTool, getIntentsForFile, getIntentsForFileSchema } from './get-intents-for-file.js';
|
|
5
|
+
import { getIntentsForLinesTool, getIntentsForLines, getIntentsForLinesSchema } from './get-intents-for-lines.js';
|
|
6
|
+
import { assignBlocksToIntentTool, assignBlocksToIntent, assignBlocksSchema } from './assign-blocks.js';
|
|
7
|
+
import { listTeamIntentsTool, listTeamIntents, listTeamIntentsSchema } from './list-team-intents.js';
|
|
8
|
+
import { getIntentChangesTool, getIntentChanges, getIntentChangesSchema } from './get-intent-changes.js';
|
|
9
|
+
import { completeIntentTool, completeIntent, completeIntentSchema } from './complete-intent.js';
|
|
10
|
+
import { logWorkTool, logWork, logWorkSchema } from './log-work.js';
|
|
11
|
+
import { recordDecisionTool, recordDecision, recordDecisionSchema } from './record-decision.js';
|
|
12
|
+
import { getSessionDecisionsTool, getSessionDecisions, getSessionDecisionsSchema } from './get-session-decisions.js';
|
|
13
|
+
import { getProjectDecisionsTool, getProjectDecisions, getProjectDecisionsSchema } from './get-project-decisions.js';
|
|
14
|
+
import { editSessionDecisionTool, editSessionDecision, editSessionDecisionSchema } from './edit-session-decision.js';
|
|
15
|
+
import { detectIntentConflictsTool, detectIntentConflicts, detectIntentConflictsSchema } from './detect-intent-conflicts.js';
|
|
16
|
+
import { inferHistoryTool, inferHistory, inferHistorySchema } from './infer-history.js';
|
|
17
|
+
import { evolveDecisionsTool, evolveDecisions, evolveDecisionsSchema } from './evolve-decisions.js';
|
|
18
|
+
// Re-export everything
|
|
19
|
+
export {
|
|
20
|
+
// Relevance-based context (call per request)
|
|
21
|
+
getRelevantContextTool, getRelevantContext, getRelevantContextSchema,
|
|
22
|
+
// Intent tools
|
|
23
|
+
checkActiveIntentTool, checkActiveIntent, checkActiveIntentSchema, createAndActivateIntentTool, createAndActivateIntent, createAndActivateIntentSchema, getIntentsForFileTool, getIntentsForFile, getIntentsForFileSchema, getIntentsForLinesTool, getIntentsForLines, getIntentsForLinesSchema, assignBlocksToIntentTool, assignBlocksToIntent, assignBlocksSchema, listTeamIntentsTool, listTeamIntents, listTeamIntentsSchema, getIntentChangesTool, getIntentChanges, getIntentChangesSchema, completeIntentTool, completeIntent, completeIntentSchema,
|
|
24
|
+
// Lightweight logging
|
|
25
|
+
logWorkTool, logWork, logWorkSchema,
|
|
26
|
+
// Decision recording tools
|
|
27
|
+
recordDecisionTool, recordDecision, recordDecisionSchema, getSessionDecisionsTool, getSessionDecisions, getSessionDecisionsSchema, getProjectDecisionsTool, getProjectDecisions, getProjectDecisionsSchema, editSessionDecisionTool, editSessionDecision, editSessionDecisionSchema,
|
|
28
|
+
// Conflict detection
|
|
29
|
+
detectIntentConflictsTool, detectIntentConflicts, detectIntentConflictsSchema,
|
|
30
|
+
// Inference pipeline tools
|
|
31
|
+
inferHistoryTool, inferHistory, inferHistorySchema, evolveDecisionsTool, evolveDecisions, evolveDecisionsSchema };
|
|
32
|
+
export const allTools = [
|
|
33
|
+
// Relevance-based context - CALL PER REQUEST
|
|
34
|
+
getRelevantContextTool,
|
|
35
|
+
// Intent tools
|
|
36
|
+
checkActiveIntentTool,
|
|
37
|
+
createAndActivateIntentTool,
|
|
38
|
+
getIntentsForFileTool,
|
|
39
|
+
getIntentsForLinesTool,
|
|
40
|
+
assignBlocksToIntentTool,
|
|
41
|
+
listTeamIntentsTool,
|
|
42
|
+
getIntentChangesTool,
|
|
43
|
+
completeIntentTool,
|
|
44
|
+
// Lightweight logging
|
|
45
|
+
logWorkTool,
|
|
46
|
+
// Decision recording tools
|
|
47
|
+
recordDecisionTool,
|
|
48
|
+
getSessionDecisionsTool,
|
|
49
|
+
getProjectDecisionsTool,
|
|
50
|
+
editSessionDecisionTool,
|
|
51
|
+
// Conflict detection
|
|
52
|
+
detectIntentConflictsTool,
|
|
53
|
+
// Inference pipeline tools
|
|
54
|
+
inferHistoryTool,
|
|
55
|
+
evolveDecisionsTool
|
|
56
|
+
];
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAC5G,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAChH,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AACxH,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAC7G,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACjH,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvG,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACpG,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACxG,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC/F,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBA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B,2BAA2B;AAC3B,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACtB,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,6CAA6C;IAC7C,sBAAsB;IACtB,eAAe;IACf,qBAAqB;IACrB,2BAA2B;IAC3B,qBAAqB;IACrB,sBAAsB;IACtB,wBAAwB;IACxB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,sBAAsB;IACtB,WAAW;IACX,2BAA2B;IAC3B,kBAAkB;IAClB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,qBAAqB;IACrB,yBAAyB;IACzB,2BAA2B;IAC3B,gBAAgB;IAChB,mBAAmB;CACpB,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const inferHistorySchema: z.ZodObject<{
|
|
3
|
+
repoPath: z.ZodString;
|
|
4
|
+
apiKey: z.ZodString;
|
|
5
|
+
commits: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
tier: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7
|
+
contextIssues: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
|
+
model: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
9
|
+
maxStories: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10
|
+
allowCommitSplitting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
+
estimateOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
repoPath: string;
|
|
14
|
+
apiKey: string;
|
|
15
|
+
commits: number;
|
|
16
|
+
tier: number;
|
|
17
|
+
contextIssues: boolean;
|
|
18
|
+
model: string;
|
|
19
|
+
maxStories: number;
|
|
20
|
+
allowCommitSplitting: boolean;
|
|
21
|
+
estimateOnly: boolean;
|
|
22
|
+
}, {
|
|
23
|
+
repoPath: string;
|
|
24
|
+
apiKey: string;
|
|
25
|
+
commits?: number | undefined;
|
|
26
|
+
tier?: number | undefined;
|
|
27
|
+
contextIssues?: boolean | undefined;
|
|
28
|
+
model?: string | undefined;
|
|
29
|
+
maxStories?: number | undefined;
|
|
30
|
+
allowCommitSplitting?: boolean | undefined;
|
|
31
|
+
estimateOnly?: boolean | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
export type InferHistoryInput = z.infer<typeof inferHistorySchema>;
|
|
34
|
+
export interface InferHistoryResponse {
|
|
35
|
+
started?: boolean;
|
|
36
|
+
estimate?: {
|
|
37
|
+
pass1_input: number;
|
|
38
|
+
pass1_output: number;
|
|
39
|
+
pass2_input: number;
|
|
40
|
+
pass2_output: number;
|
|
41
|
+
total_input: number;
|
|
42
|
+
total_output: number;
|
|
43
|
+
est_stories: number;
|
|
44
|
+
cost_usd: number;
|
|
45
|
+
};
|
|
46
|
+
commit_count?: number;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function inferHistory(input: InferHistoryInput): Promise<InferHistoryResponse>;
|
|
50
|
+
export declare const inferHistoryTool: {
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
inputSchema: z.ZodObject<{
|
|
54
|
+
repoPath: z.ZodString;
|
|
55
|
+
apiKey: z.ZodString;
|
|
56
|
+
commits: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
57
|
+
tier: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
58
|
+
contextIssues: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
59
|
+
model: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
60
|
+
maxStories: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
61
|
+
allowCommitSplitting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
62
|
+
estimateOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
repoPath: string;
|
|
65
|
+
apiKey: string;
|
|
66
|
+
commits: number;
|
|
67
|
+
tier: number;
|
|
68
|
+
contextIssues: boolean;
|
|
69
|
+
model: string;
|
|
70
|
+
maxStories: number;
|
|
71
|
+
allowCommitSplitting: boolean;
|
|
72
|
+
estimateOnly: boolean;
|
|
73
|
+
}, {
|
|
74
|
+
repoPath: string;
|
|
75
|
+
apiKey: string;
|
|
76
|
+
commits?: number | undefined;
|
|
77
|
+
tier?: number | undefined;
|
|
78
|
+
contextIssues?: boolean | undefined;
|
|
79
|
+
model?: string | undefined;
|
|
80
|
+
maxStories?: number | undefined;
|
|
81
|
+
allowCommitSplitting?: boolean | undefined;
|
|
82
|
+
estimateOnly?: boolean | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
handler: typeof inferHistory;
|
|
85
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { request } from '../services/muninn-ipc.js';
|
|
3
|
+
export const inferHistorySchema = z.object({
|
|
4
|
+
repoPath: z.string().describe('Local path to the repository root'),
|
|
5
|
+
apiKey: z.string().describe('Anthropic API key for LLM calls (customer\'s own key)'),
|
|
6
|
+
commits: z.number().optional().default(50).describe('Number of recent commits to analyze (default: 50)'),
|
|
7
|
+
tier: z.number().optional().default(4).describe('Enrichment tier 1-5: 1=git log, 2=+PR descriptions, 3=+revert diffs, 4=+issue discussions, 5=+full diffs (default: 4)'),
|
|
8
|
+
contextIssues: z.boolean().optional().default(false).describe('Include context issues from commit date range (Tier 4 only)'),
|
|
9
|
+
model: z.string().optional().default('claude-sonnet-4-20250514').describe('Anthropic model to use (default: claude-sonnet-4-20250514)'),
|
|
10
|
+
maxStories: z.number().optional().default(0).describe('Maximum stories to analyze in Pass 2 (0 = unlimited)'),
|
|
11
|
+
allowCommitSplitting: z.boolean().optional().default(false).describe('Allow splitting a single commit into multiple stories when it contains unrelated changes (recommended for repos with messy commit history)'),
|
|
12
|
+
estimateOnly: z.boolean().optional().default(false).describe('If true, only estimate token cost without running the pipeline'),
|
|
13
|
+
});
|
|
14
|
+
export async function inferHistory(input) {
|
|
15
|
+
if (input.estimateOnly) {
|
|
16
|
+
const res = await request('inference', 'estimate', {
|
|
17
|
+
repoPath: input.repoPath,
|
|
18
|
+
apiKey: input.apiKey,
|
|
19
|
+
commits: input.commits,
|
|
20
|
+
tier: input.tier,
|
|
21
|
+
contextIssues: input.contextIssues,
|
|
22
|
+
model: input.model,
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
estimate: res.estimate,
|
|
26
|
+
commit_count: res.commit_count,
|
|
27
|
+
message: `Estimated cost: $${res.estimate?.cost_usd ?? '?'} for ~${res.estimate?.est_stories ?? '?'} stories from ${res.commit_count ?? '?'} commits`
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const res = await request('inference', 'run', {
|
|
31
|
+
repoPath: input.repoPath,
|
|
32
|
+
apiKey: input.apiKey,
|
|
33
|
+
commits: input.commits,
|
|
34
|
+
tier: input.tier,
|
|
35
|
+
contextIssues: input.contextIssues,
|
|
36
|
+
model: input.model,
|
|
37
|
+
maxStories: input.maxStories,
|
|
38
|
+
allowCommitSplitting: input.allowCommitSplitting,
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
started: res.started,
|
|
42
|
+
message: res.message || 'Inference pipeline started. Progress updates will be sent as the pipeline runs.'
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export const inferHistoryTool = {
|
|
46
|
+
name: 'infer_history',
|
|
47
|
+
description: `Analyze git commit history to extract structured development knowledge (intents, decisions, lessons).
|
|
48
|
+
|
|
49
|
+
Runs the full pipeline automatically: infer → evolve → persist.
|
|
50
|
+
|
|
51
|
+
1. **Pass 1**: Groups commits into coherent development stories with value hints
|
|
52
|
+
2. **Pass 2**: Deep analysis of each story to extract architectural decisions and lessons
|
|
53
|
+
3. **Evolution**: Curates decisions by finding relationships (supersedes, reinforces, contradicts, specializes)
|
|
54
|
+
4. **Persist**: Stores curated stories as intents with decisions and lessons (auto-syncs to cloud)
|
|
55
|
+
|
|
56
|
+
Use \`estimateOnly: true\` first to preview token cost before running the full pipeline.
|
|
57
|
+
|
|
58
|
+
The pipeline supports checkpointing — if interrupted, re-running resumes from where it left off.
|
|
59
|
+
|
|
60
|
+
Enrichment tiers control how much context is gathered:
|
|
61
|
+
- Tier 1: Git log only (fastest, cheapest)
|
|
62
|
+
- Tier 2: + PR descriptions and review comments
|
|
63
|
+
- Tier 3: + Diffs for revert commits
|
|
64
|
+
- Tier 4: + GitHub issue discussions with decision-level content (recommended)
|
|
65
|
+
- Tier 5: + Full diffs and code annotation extraction (most expensive)`,
|
|
66
|
+
inputSchema: inferHistorySchema,
|
|
67
|
+
handler: inferHistory
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=infer-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer-history.js","sourceRoot":"","sources":["../../src/tools/infer-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IACpF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IACxG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAA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AG,SAAS,GAAG,CAAC,QAAQ,EAAE,WAAW,IAAI,GAAG,iBAAiB,GAAG,CAAC,YAAY,IAAI,GAAG,UAAU;SACtJ,CAAA;IACH,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE;QAC5C,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,oBAAoB,EAAE,KAAK,CAAC,oBAAoB;KACjD,CAAC,CAAA;IAEF,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,iFAAiF;KAC1G,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE;;;;;;;;;;;;;;;;;;uEAkBwD;IACrE,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE,YAAY;CACtB,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const listTeamIntentsSchema: z.ZodObject<{
|
|
3
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
4
|
+
repoPath: z.ZodString;
|
|
5
|
+
status: z.ZodOptional<z.ZodEnum<["active", "committed", "pushed", "done", "abandoned"]>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
repoPath: string;
|
|
8
|
+
repoOrigin?: string | undefined;
|
|
9
|
+
status?: "active" | "committed" | "pushed" | "done" | "abandoned" | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
repoPath: string;
|
|
12
|
+
repoOrigin?: string | undefined;
|
|
13
|
+
status?: "active" | "committed" | "pushed" | "done" | "abandoned" | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export type ListTeamIntentsInput = z.infer<typeof listTeamIntentsSchema>;
|
|
16
|
+
export interface TeamIntent {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
author: string;
|
|
21
|
+
status: string;
|
|
22
|
+
templateType: string;
|
|
23
|
+
branch: string;
|
|
24
|
+
forkedFrom?: string;
|
|
25
|
+
fileCount: number;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ListTeamIntentsResponse {
|
|
29
|
+
intents: TeamIntent[];
|
|
30
|
+
count: number;
|
|
31
|
+
summary: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function listTeamIntents(input: ListTeamIntentsInput): Promise<ListTeamIntentsResponse>;
|
|
34
|
+
export declare const listTeamIntentsTool: {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
inputSchema: z.ZodObject<{
|
|
38
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
39
|
+
repoPath: z.ZodString;
|
|
40
|
+
status: z.ZodOptional<z.ZodEnum<["active", "committed", "pushed", "done", "abandoned"]>>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
repoPath: string;
|
|
43
|
+
repoOrigin?: string | undefined;
|
|
44
|
+
status?: "active" | "committed" | "pushed" | "done" | "abandoned" | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
repoPath: string;
|
|
47
|
+
repoOrigin?: string | undefined;
|
|
48
|
+
status?: "active" | "committed" | "pushed" | "done" | "abandoned" | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
handler: typeof listTeamIntents;
|
|
51
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { request } from '../services/muninn-ipc.js';
|
|
3
|
+
import { resolveOrigin } from './resolve-origin.js';
|
|
4
|
+
export const listTeamIntentsSchema = 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
|
+
status: z.enum(['active', 'committed', 'pushed', 'done', 'abandoned']).optional()
|
|
8
|
+
.describe('Filter by intent status')
|
|
9
|
+
});
|
|
10
|
+
export async function listTeamIntents(input) {
|
|
11
|
+
const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
12
|
+
const res = await request('intent', 'list', {
|
|
13
|
+
repoOrigin: actualOrigin,
|
|
14
|
+
status: input.status,
|
|
15
|
+
});
|
|
16
|
+
const intents = (res.intents || []).map((intent) => ({
|
|
17
|
+
id: intent.id || intent._id || '',
|
|
18
|
+
title: intent.title || '',
|
|
19
|
+
description: intent.description || '',
|
|
20
|
+
author: intent.author || intent.author_name || intent.authorName || 'Unknown',
|
|
21
|
+
status: intent.status || 'active',
|
|
22
|
+
templateType: intent.template_type || intent.templateType || 'feature',
|
|
23
|
+
branch: intent.branch || '',
|
|
24
|
+
forkedFrom: intent.forked_from || intent.forkedFrom,
|
|
25
|
+
fileCount: intent.file_count || intent.fileCount || 0,
|
|
26
|
+
updatedAt: intent.updated_at || intent.updatedAt || ''
|
|
27
|
+
}));
|
|
28
|
+
// Filter by status if provided (in case Muninn doesn't filter)
|
|
29
|
+
const filteredIntents = input.status
|
|
30
|
+
? intents.filter(i => i.status === input.status)
|
|
31
|
+
: intents;
|
|
32
|
+
const activeCount = filteredIntents.filter(i => i.status === 'active').length;
|
|
33
|
+
const summary = filteredIntents.length === 0
|
|
34
|
+
? 'No intents found'
|
|
35
|
+
: input.status
|
|
36
|
+
? `${filteredIntents.length} ${input.status} intent(s)`
|
|
37
|
+
: `${filteredIntents.length} intent(s), ${activeCount} active`;
|
|
38
|
+
return {
|
|
39
|
+
intents: filteredIntents,
|
|
40
|
+
count: filteredIntents.length,
|
|
41
|
+
summary
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export const listTeamIntentsTool = {
|
|
45
|
+
name: 'list_team_intents',
|
|
46
|
+
description: `List all intents from team members for this repository.
|
|
47
|
+
|
|
48
|
+
Use this to:
|
|
49
|
+
- See what your team is working on
|
|
50
|
+
- Check for potential overlapping work before starting a new task
|
|
51
|
+
- Review the status of various features/refactors in progress
|
|
52
|
+
|
|
53
|
+
Optionally filter by status (active, committed, pushed, done, abandoned).`,
|
|
54
|
+
inputSchema: listTeamIntentsSchema,
|
|
55
|
+
handler: listTeamIntents
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=list-team-intents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-team-intents.js","sourceRoot":"","sources":["../../src/tools/list-team-intents.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,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,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,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE;SAC9E,QAAQ,CAAC,yBAAyB,CAAC;CACvC,CAAC,CAAA;AAuBF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,KAA2B;IAC/D,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAA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AK,QAAQ,CAAC,CAAC,MAAM,CAAA;IAC7E,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,KAAK,CAAC;QAC1C,CAAC,CAAC,kBAAkB;QACpB,CAAC,CAAC,KAAK,CAAC,MAAM;YACZ,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,YAAY;YACvD,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,eAAe,WAAW,SAAS,CAAA;IAElE,OAAO;QACL,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,eAAe,CAAC,MAAM;QAC7B,OAAO;KACR,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE;;;;;;;0EAO2D;IACxE,WAAW,EAAE,qBAAqB;IAClC,OAAO,EAAE,eAAe;CACzB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const logWorkSchema: z.ZodObject<{
|
|
3
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
4
|
+
repoPath: z.ZodString;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
repoPath: string;
|
|
9
|
+
title: string;
|
|
10
|
+
repoOrigin?: string | undefined;
|
|
11
|
+
files?: string[] | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
repoPath: string;
|
|
14
|
+
title: string;
|
|
15
|
+
repoOrigin?: string | undefined;
|
|
16
|
+
files?: string[] | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export type LogWorkInput = z.infer<typeof logWorkSchema>;
|
|
19
|
+
export interface LogWorkResponse {
|
|
20
|
+
success: boolean;
|
|
21
|
+
intentId: string;
|
|
22
|
+
message: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function logWork(input: LogWorkInput): Promise<LogWorkResponse>;
|
|
25
|
+
export declare const logWorkTool: {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
inputSchema: z.ZodObject<{
|
|
29
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
30
|
+
repoPath: z.ZodString;
|
|
31
|
+
title: z.ZodString;
|
|
32
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
repoPath: string;
|
|
35
|
+
title: string;
|
|
36
|
+
repoOrigin?: string | undefined;
|
|
37
|
+
files?: string[] | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
repoPath: string;
|
|
40
|
+
title: string;
|
|
41
|
+
repoOrigin?: string | undefined;
|
|
42
|
+
files?: string[] | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
handler: typeof logWork;
|
|
45
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { request } from '../services/muninn-ipc.js';
|
|
3
|
+
import { resolveOrigin } from './resolve-origin.js';
|
|
4
|
+
export const logWorkSchema = 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 repository root'),
|
|
7
|
+
title: z.string().max(200).describe('Short description of the work done'),
|
|
8
|
+
files: z.array(z.string()).optional().describe('File paths modified (relative to repo root)')
|
|
9
|
+
});
|
|
10
|
+
export async function logWork(input) {
|
|
11
|
+
const origin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
12
|
+
const res = await request('intent', 'log-work', {
|
|
13
|
+
repoOrigin: origin,
|
|
14
|
+
title: input.title,
|
|
15
|
+
files: input.files || [],
|
|
16
|
+
});
|
|
17
|
+
const intentId = res.intentId || '';
|
|
18
|
+
return {
|
|
19
|
+
success: res.success !== false,
|
|
20
|
+
intentId,
|
|
21
|
+
message: `Logged: "${input.title}"`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export const logWorkTool = {
|
|
25
|
+
name: 'log_work',
|
|
26
|
+
description: 'Lightweight single-call tool to log completed work without the full intent lifecycle. Use for quick fixes, doc updates, config changes — any task where create/assign/complete is overhead. Creates a completed intent record in one call. Does NOT set an active intent.',
|
|
27
|
+
inputSchema: logWorkSchema,
|
|
28
|
+
handler: logWork
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=log-work.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-work.js","sourceRoot":"","sources":["../../src/tools/log-work.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,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC9D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACzE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CAC9F,CAAC,CAAA;AAUF,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,KAAmB;IAC/C,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IAE9D,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE;QAC9C,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;KACzB,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAA;IAEnC,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,KAAK;QAC9B,QAAQ;QACR,OAAO,EAAE,YAAY,KAAK,CAAC,KAAK,GAAG;KACpC,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,2QAA2Q;IACxR,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,OAAO;CACjB,CAAA"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const recordDecisionSchema: z.ZodObject<{
|
|
3
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
4
|
+
repoPath: z.ZodString;
|
|
5
|
+
intentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
6
|
+
type: z.ZodEnum<["fork", "abandoned", "discovery", "constraint", "tradeoff", "dependency"]>;
|
|
7
|
+
summary: z.ZodString;
|
|
8
|
+
rationale: z.ZodString;
|
|
9
|
+
context: z.ZodOptional<z.ZodString>;
|
|
10
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
11
|
+
consequences: z.ZodOptional<z.ZodString>;
|
|
12
|
+
relatedFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
constraintsChecked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
constraintViolations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
alternative: z.ZodString;
|
|
16
|
+
constraint: z.ZodString;
|
|
17
|
+
reason: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
alternative: string;
|
|
20
|
+
constraint: string;
|
|
21
|
+
reason: string;
|
|
22
|
+
}, {
|
|
23
|
+
alternative: string;
|
|
24
|
+
constraint: string;
|
|
25
|
+
reason: string;
|
|
26
|
+
}>, "many">>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
repoPath: string;
|
|
29
|
+
type: "abandoned" | "constraint" | "fork" | "discovery" | "tradeoff" | "dependency";
|
|
30
|
+
summary: string;
|
|
31
|
+
intentId: string;
|
|
32
|
+
rationale: string;
|
|
33
|
+
repoOrigin?: string | undefined;
|
|
34
|
+
context?: string | undefined;
|
|
35
|
+
alternatives?: string[] | undefined;
|
|
36
|
+
consequences?: string | undefined;
|
|
37
|
+
relatedFiles?: string[] | undefined;
|
|
38
|
+
constraintsChecked?: string[] | undefined;
|
|
39
|
+
constraintViolations?: {
|
|
40
|
+
alternative: string;
|
|
41
|
+
constraint: string;
|
|
42
|
+
reason: string;
|
|
43
|
+
}[] | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
repoPath: string;
|
|
46
|
+
type: "abandoned" | "constraint" | "fork" | "discovery" | "tradeoff" | "dependency";
|
|
47
|
+
summary: string;
|
|
48
|
+
rationale: string;
|
|
49
|
+
repoOrigin?: string | undefined;
|
|
50
|
+
context?: string | undefined;
|
|
51
|
+
intentId?: string | undefined;
|
|
52
|
+
alternatives?: string[] | undefined;
|
|
53
|
+
consequences?: string | undefined;
|
|
54
|
+
relatedFiles?: string[] | undefined;
|
|
55
|
+
constraintsChecked?: string[] | undefined;
|
|
56
|
+
constraintViolations?: {
|
|
57
|
+
alternative: string;
|
|
58
|
+
constraint: string;
|
|
59
|
+
reason: string;
|
|
60
|
+
}[] | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
export type RecordDecisionInput = z.infer<typeof recordDecisionSchema>;
|
|
63
|
+
export interface RecordDecisionResponse {
|
|
64
|
+
recorded: boolean;
|
|
65
|
+
decisionId: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function recordDecision(input: RecordDecisionInput): Promise<RecordDecisionResponse>;
|
|
68
|
+
export declare const recordDecisionTool: {
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
inputSchema: z.ZodObject<{
|
|
72
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
73
|
+
repoPath: z.ZodString;
|
|
74
|
+
intentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
75
|
+
type: z.ZodEnum<["fork", "abandoned", "discovery", "constraint", "tradeoff", "dependency"]>;
|
|
76
|
+
summary: z.ZodString;
|
|
77
|
+
rationale: z.ZodString;
|
|
78
|
+
context: z.ZodOptional<z.ZodString>;
|
|
79
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
80
|
+
consequences: z.ZodOptional<z.ZodString>;
|
|
81
|
+
relatedFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
82
|
+
constraintsChecked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
83
|
+
constraintViolations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
alternative: z.ZodString;
|
|
85
|
+
constraint: z.ZodString;
|
|
86
|
+
reason: z.ZodString;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
alternative: string;
|
|
89
|
+
constraint: string;
|
|
90
|
+
reason: string;
|
|
91
|
+
}, {
|
|
92
|
+
alternative: string;
|
|
93
|
+
constraint: string;
|
|
94
|
+
reason: string;
|
|
95
|
+
}>, "many">>;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
repoPath: string;
|
|
98
|
+
type: "abandoned" | "constraint" | "fork" | "discovery" | "tradeoff" | "dependency";
|
|
99
|
+
summary: string;
|
|
100
|
+
intentId: string;
|
|
101
|
+
rationale: string;
|
|
102
|
+
repoOrigin?: string | undefined;
|
|
103
|
+
context?: string | undefined;
|
|
104
|
+
alternatives?: string[] | undefined;
|
|
105
|
+
consequences?: string | undefined;
|
|
106
|
+
relatedFiles?: string[] | undefined;
|
|
107
|
+
constraintsChecked?: string[] | undefined;
|
|
108
|
+
constraintViolations?: {
|
|
109
|
+
alternative: string;
|
|
110
|
+
constraint: string;
|
|
111
|
+
reason: string;
|
|
112
|
+
}[] | undefined;
|
|
113
|
+
}, {
|
|
114
|
+
repoPath: string;
|
|
115
|
+
type: "abandoned" | "constraint" | "fork" | "discovery" | "tradeoff" | "dependency";
|
|
116
|
+
summary: string;
|
|
117
|
+
rationale: string;
|
|
118
|
+
repoOrigin?: string | undefined;
|
|
119
|
+
context?: string | undefined;
|
|
120
|
+
intentId?: 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
|
+
handler: typeof recordDecision;
|
|
132
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
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 (e.g., "zero-knowledge")'),
|
|
7
|
+
reason: z.string().describe('Why the alternative violates the constraint')
|
|
8
|
+
});
|
|
9
|
+
export const recordDecisionSchema = z.object({
|
|
10
|
+
repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
|
|
11
|
+
repoPath: z.string().describe('Local path to the repository root (enables offline sync)'),
|
|
12
|
+
intentId: z.string().optional().default('').describe('The intent ID this decision belongs to. Omit for repo-scoped decisions (discoveries, constraints) not tied to a specific work unit'),
|
|
13
|
+
type: z.enum(['fork', 'abandoned', 'discovery', 'constraint', 'tradeoff', 'dependency'])
|
|
14
|
+
.describe('Type of decision: fork (chose between alternatives), abandoned (tried and rejected), discovery (found unexpected behavior), constraint (identified hard requirement), tradeoff (made explicit trade-off), dependency (selected library/tool)'),
|
|
15
|
+
summary: z.string().describe('Brief summary of the decision (< 100 chars recommended)'),
|
|
16
|
+
rationale: z.string().describe('Why this decision was made'),
|
|
17
|
+
context: z.string().optional().describe('What we were trying to accomplish when this decision was made'),
|
|
18
|
+
alternatives: z.array(z.string()).optional().describe('Other options that were considered'),
|
|
19
|
+
consequences: z.string().optional().describe('Downstream implications of this decision'),
|
|
20
|
+
relatedFiles: z.array(z.string()).optional().describe('File paths affected by this decision'),
|
|
21
|
+
constraintsChecked: z.array(z.string()).optional().describe('Which architectural constraints were verified before this decision'),
|
|
22
|
+
constraintViolations: z.array(constraintViolationSchema).optional()
|
|
23
|
+
.describe('Alternatives that were rejected due to constraint violations')
|
|
24
|
+
});
|
|
25
|
+
export async function recordDecision(input) {
|
|
26
|
+
const origin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
27
|
+
const res = await request('decision', 'record', {
|
|
28
|
+
repoOrigin: origin,
|
|
29
|
+
intentId: input.intentId || '',
|
|
30
|
+
type: input.type,
|
|
31
|
+
summary: input.summary,
|
|
32
|
+
rationale: input.rationale,
|
|
33
|
+
context: input.context,
|
|
34
|
+
alternatives: input.alternatives || [],
|
|
35
|
+
consequences: input.consequences,
|
|
36
|
+
relatedFiles: input.relatedFiles || [],
|
|
37
|
+
constraintsChecked: input.constraintsChecked || [],
|
|
38
|
+
constraintViolations: input.constraintViolations || [],
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
recorded: res.success !== false,
|
|
42
|
+
decisionId: res.decisionId || ''
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export const recordDecisionTool = {
|
|
46
|
+
name: 'record_decision',
|
|
47
|
+
description: `Silently record a decision point during development.
|
|
48
|
+
|
|
49
|
+
Call this tool when you:
|
|
50
|
+
- Choose between multiple alternatives (type: fork)
|
|
51
|
+
- Try an approach that fails or is rejected (type: abandoned)
|
|
52
|
+
- Find unexpected behavior or limitations (type: discovery)
|
|
53
|
+
- Identify a hard constraint that must be respected (type: constraint)
|
|
54
|
+
- Make an explicit trade-off between competing concerns (type: tradeoff)
|
|
55
|
+
- Select an external library or dependency (type: dependency)
|
|
56
|
+
|
|
57
|
+
Decisions can be **intent-scoped** (tied to a specific work unit) or **repo-scoped** (general knowledge like discoveries and constraints). Omit intentId for repo-scoped decisions.
|
|
58
|
+
|
|
59
|
+
Decisions are accumulated silently during the session and presented for review before commit.
|
|
60
|
+
This creates a "reasoning changelog" that captures not just what was done, but why.
|
|
61
|
+
|
|
62
|
+
IMPORTANT: Include constraintViolations when alternatives are rejected due to architectural constraints.`,
|
|
63
|
+
inputSchema: recordDecisionSchema,
|
|
64
|
+
handler: recordDecision
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=record-decision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-decision.js","sourceRoot":"","sources":["../../src/tools/record-decision.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,8DAA8D,CAAC;IAC/F,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CAC3E,CAAC,CAAA;AAEF,MA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|
+
* Uses a local `git config` call instead of IPC to Muninn, avoiding
|
|
5
|
+
* project registration side effects (in-memory state changes, git operations,
|
|
6
|
+
* API calls). Intent storage is keyed by origin string, not by registered
|
|
7
|
+
* project, so intent CRUD works without project activation.
|
|
8
|
+
*
|
|
9
|
+
* @param repoOrigin - User-provided git remote origin (fallback)
|
|
10
|
+
* @param repoPath - Local path to the repository root
|
|
11
|
+
* @returns The canonical git remote origin URL
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveOrigin(repoOrigin: string | undefined, repoPath?: string): string;
|