Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit 0c6eb72

Browse files
committed
ci: Add stub types to repository and configure TypeScript
- Add stubs/@opencode-ai/plugin/index.d.ts for CI environments - Configure tsconfig.json to use path mapping for @opencode-ai/plugin - Allows type checking to work in CI without local file dependencies 🤖 Generated with OpenCode
1 parent 380a2dc commit 0c6eb72

2 files changed

Lines changed: 44 additions & 2 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Minimal stub for @opencode-ai/plugin types
3+
* Used for CI environments where the actual plugin is not available
4+
*/
5+
6+
export interface PluginContext {
7+
directory: string;
8+
client: {
9+
session: {
10+
get: (args: { path: { id: string } }) => Promise<{ data?: { id: string } }>;
11+
todo: (args: { path: { id: string } }) => Promise<unknown>;
12+
prompt: (args: { path: { id: string }; body: { agent?: string; model?: { providerID: string; modelID: string }; parts: Array<{ type: "text"; text: string }> }; query?: { directory?: string } }) => Promise<void>;
13+
messages: (args: { path: { id: string } }) => Promise<unknown>;
14+
};
15+
tui: {
16+
showToast: (args: { body: { title: string; message: string; variant: string; duration: number } }) => Promise<void>;
17+
};
18+
};
19+
}
20+
21+
export type Plugin = (input: PluginContext) => Promise<{
22+
tools?: Record<string, unknown>;
23+
event?: (event: { event: unknown }) => Promise<void>;
24+
}>;
25+
26+
export interface ToolDefinition<T extends (...args: unknown[]) => unknown> {
27+
description: string;
28+
args: Record<string, unknown>;
29+
execute: T;
30+
}
31+
32+
export declare function tool<T extends (...args: unknown[]) => unknown>(
33+
definition: {
34+
description: string;
35+
args: Record<string, unknown>;
36+
},
37+
execute: T
38+
): ToolDefinition<T>;

tsconfig.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
"moduleResolution": "NodeNext",
1616
"resolveJsonModule": true,
1717
"isolatedModules": true,
18-
"noEmit": false
18+
"noEmit": false,
19+
"baseUrl": ".",
20+
"paths": {
21+
"@opencode-ai/plugin": ["./stubs/@opencode-ai/plugin"]
22+
}
1923
},
20-
"include": ["*.ts"],
24+
"include": ["*.ts", "stubs/**/*.d.ts"],
2125
"exclude": ["node_modules", "dist", "**/*.test.ts"]
2226
}

0 commit comments

Comments
 (0)