Skip to content

Commit 4fb1da5

Browse files
committed
fix: resolve TypeScript compilation errors
- Export Frontmatter type from core package for isolate.ts - Fix SpecInfo date field to be optional (matches core package) - Fix search.ts type mismatches for title/description (cast unknown to string) - Fix MCP tool/resource handler signatures (add extra parameter) - Fix isolate.ts missing created field - Fix broken console capturing in backfill/files/validate tools - Add 'as const' to type literals in all MCP tool responses - Use 'any' cast for MCP tool registration to work around SDK type narrowing All typecheck errors are now resolved and build succeeds.
1 parent 2c002d6 commit 4fb1da5

File tree

24 files changed

+108
-73
lines changed

24 files changed

+108
-73
lines changed

packages/cli/src/commands/isolate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ async function executeIsolate(
214214
// 3. Create new spec with extracted content
215215
const targetFrontmatter: Frontmatter = {
216216
status: 'planned',
217+
created: new Date().toISOString().split('T')[0], // YYYY-MM-DD format
217218
priority: sourceFrontmatter?.priority || 'medium',
218219
tags: sourceFrontmatter?.tags || [],
219220
created_at: new Date().toISOString(),

packages/cli/src/commands/search.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export async function performSearch(query: string, options: {
8080
status: spec.frontmatter.status,
8181
priority: spec.frontmatter.priority,
8282
tags: spec.frontmatter.tags,
83-
title: spec.frontmatter.title,
84-
description: spec.frontmatter.description,
83+
title: typeof spec.frontmatter.title === 'string' ? spec.frontmatter.title : undefined,
84+
description: typeof spec.frontmatter.description === 'string' ? spec.frontmatter.description : undefined,
8585
content: spec.content,
8686
}));
8787

packages/cli/src/mcp/resources/board.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function boardResource() {
1717
title: 'Kanban Board',
1818
description: 'Current Kanban board state organized by status',
1919
},
20-
async (uri: URL) => {
20+
async (uri: URL, _variables: Record<string, string | string[]>, _extra: any) => {
2121
try {
2222
const board = await getBoardData();
2323
const text = Object.entries(board.columns)

packages/cli/src/mcp/resources/spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ export function specResource() {
1717
title: 'Spec Content',
1818
description: 'Read individual specification content by path or name',
1919
},
20-
async (uri: URL, { specPath }: { specPath: string | string[] }) => {
20+
async (uri: URL, variables: Record<string, string | string[]>, _extra: any) => {
2121
try {
22+
const specPath = variables.specPath;
2223
const pathString = Array.isArray(specPath) ? specPath[0] : specPath;
2324
const { spec, content } = await readSpecData(pathString);
2425
return {

packages/cli/src/mcp/resources/stats.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function statsResource() {
1717
title: 'Project Statistics',
1818
description: 'Overview of project statistics',
1919
},
20-
async (uri: URL) => {
20+
async (uri: URL, _variables: Record<string, string | string[]>, _extra: any) => {
2121
try {
2222
const stats = await getStatsData();
2323

packages/cli/src/mcp/tools/archive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function archiveTool(): ToolDefinition {
2424
message: z.string(),
2525
},
2626
},
27-
async (input) => {
27+
async (input, _extra) => {
2828
const originalLog = console.log;
2929
try {
3030
let capturedOutput = '';
@@ -40,7 +40,7 @@ export function archiveTool(): ToolDefinition {
4040
};
4141

4242
return {
43-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
43+
content: [{ type: 'text' as const, text: JSON.stringify(output, null, 2) }],
4444
structuredContent: output,
4545
};
4646
} catch (error) {
@@ -49,7 +49,7 @@ export function archiveTool(): ToolDefinition {
4949
message: formatErrorMessage('Error archiving spec', error),
5050
};
5151
return {
52-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
52+
content: [{ type: 'text' as const, text: JSON.stringify(output, null, 2) }],
5353
structuredContent: output,
5454
};
5555
} finally {

packages/cli/src/mcp/tools/backfill.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function backfillTool(): ToolDefinition {
2929
message: z.string(),
3030
},
3131
},
32-
async (input) => {
32+
async (input, _extra) => {
3333
const originalLog = console.log;
3434
const originalError = console.error;
3535
try {
@@ -52,8 +52,8 @@ export function backfillTool(): ToolDefinition {
5252
// Parse output to extract updated specs
5353
const updated = capturedOutput
5454
.split('\n')
55-
.filter(l => l.includes('Updated:') || l.includes('✓'))
56-
.map(l => l.replace(/.*Updated:\s*/, '').replace(/\s*/, '').trim())
55+
.filter((l: string) => l.includes('Updated:') || l.includes('✓'))
56+
.map((l: string) => l.replace(/.*Updated:\s*/, '').replace(/\s*/, '').trim())
5757
.filter(Boolean);
5858

5959
const output = {
@@ -65,13 +65,13 @@ export function backfillTool(): ToolDefinition {
6565
};
6666

6767
return {
68-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
68+
content: [{ type: 'text' as const, text: JSON.stringify(output, null, 2) }],
6969
structuredContent: output,
7070
};
7171
} catch (error) {
7272
const errorMessage = formatErrorMessage('Error backfilling timestamps', error);
7373
return {
74-
content: [{ type: 'text', text: errorMessage }],
74+
content: [{ type: 'text' as const, text: errorMessage }],
7575
isError: true,
7676
};
7777
} finally {

packages/cli/src/mcp/tools/board.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ export function boardTool(): ToolDefinition {
4343
board: z.any(),
4444
},
4545
},
46-
async () => {
46+
async (_input, _extra) => {
4747
try {
4848
const board = await getBoardData();
4949
const output = { board };
5050
return {
51-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
51+
content: [{ type: 'text' as const, text: JSON.stringify(output, null, 2) }],
5252
structuredContent: output,
5353
};
5454
} catch (error) {
5555
const errorMessage = formatErrorMessage('Error getting board', error);
5656
return {
57-
content: [{ type: 'text', text: errorMessage }],
57+
content: [{ type: 'text' as const, text: errorMessage }],
5858
isError: true,
5959
};
6060
}

packages/cli/src/mcp/tools/check.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function checkTool(): ToolDefinition {
2323
message: z.string(),
2424
},
2525
},
26-
async () => {
26+
async (_input, _extra) => {
2727
const originalLog = console.log;
2828
const originalError = console.error;
2929
try {
@@ -44,13 +44,13 @@ export function checkTool(): ToolDefinition {
4444
};
4545

4646
return {
47-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
47+
content: [{ type: 'text' as const, text: JSON.stringify(output, null, 2) }],
4848
structuredContent: output,
4949
};
5050
} catch (error) {
5151
const errorMessage = formatErrorMessage('Error checking specs', error);
5252
return {
53-
content: [{ type: 'text', text: errorMessage }],
53+
content: [{ type: 'text' as const, text: errorMessage }],
5454
isError: true,
5555
};
5656
} finally {

packages/cli/src/mcp/tools/create.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function createTool(): ToolDefinition {
3232
message: z.string(),
3333
},
3434
},
35-
async (input) => {
35+
async (input, _extra) => {
3636
const originalLog = console.log;
3737
try {
3838
// Capture output
@@ -57,7 +57,7 @@ export function createTool(): ToolDefinition {
5757
};
5858

5959
return {
60-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
60+
content: [{ type: 'text' as const, text: JSON.stringify(output, null, 2) }],
6161
structuredContent: output,
6262
};
6363
} catch (error) {
@@ -67,7 +67,7 @@ export function createTool(): ToolDefinition {
6767
message: formatErrorMessage('Error creating spec', error),
6868
};
6969
return {
70-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
70+
content: [{ type: 'text' as const, text: JSON.stringify(output, null, 2) }],
7171
structuredContent: output,
7272
};
7373
} finally {

0 commit comments

Comments
 (0)