oh-my-opencode 0.1.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/LICENSE +21 -0
- package/README.en.md +140 -0
- package/README.ko.md +140 -0
- package/dist/agents/document-writer.d.ts +2 -0
- package/dist/agents/explore.d.ts +2 -0
- package/dist/agents/frontend-ui-ux-engineer.d.ts +2 -0
- package/dist/agents/index.d.ts +2 -0
- package/dist/agents/librarian.d.ts +2 -0
- package/dist/agents/oracle.d.ts +2 -0
- package/dist/ast-grep-napi.darwin-arm64-qa3xn4vh.node +0 -0
- package/dist/features/terminal/index.d.ts +1 -0
- package/dist/features/terminal/title.d.ts +13 -0
- package/dist/hooks/context-window-monitor.d.ts +18 -0
- package/dist/hooks/grep-blocker.d.ts +10 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/session-notification.d.ts +18 -0
- package/dist/hooks/todo-continuation-enforcer.d.ts +7 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +15726 -0
- package/dist/tools/ast-grep/cli.d.ts +11 -0
- package/dist/tools/ast-grep/constants.d.ts +4 -0
- package/dist/tools/ast-grep/index.d.ts +92 -0
- package/dist/tools/ast-grep/napi.d.ts +13 -0
- package/dist/tools/ast-grep/tools.d.ts +135 -0
- package/dist/tools/ast-grep/types.d.ts +51 -0
- package/dist/tools/ast-grep/utils.d.ts +5 -0
- package/dist/tools/index.d.ts +255 -0
- package/dist/tools/lsp/client.d.ts +55 -0
- package/dist/tools/lsp/config.d.ts +24 -0
- package/dist/tools/lsp/constants.d.ts +5 -0
- package/dist/tools/lsp/index.d.ts +6 -0
- package/dist/tools/lsp/tools.d.ts +152 -0
- package/dist/tools/lsp/types.d.ts +131 -0
- package/dist/tools/lsp/utils.d.ts +25 -0
- package/dist/tools/safe-grep/cli.d.ts +3 -0
- package/dist/tools/safe-grep/constants.d.ts +16 -0
- package/dist/tools/safe-grep/index.d.ts +2 -0
- package/dist/tools/safe-grep/tools.d.ts +13 -0
- package/dist/tools/safe-grep/types.d.ts +36 -0
- package/dist/tools/safe-grep/utils.d.ts +3 -0
- package/package.json +53 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CliMatch, CliLanguage } from "./types";
|
|
2
|
+
export interface RunOptions {
|
|
3
|
+
pattern: string;
|
|
4
|
+
lang: CliLanguage;
|
|
5
|
+
paths?: string[];
|
|
6
|
+
globs?: string[];
|
|
7
|
+
rewrite?: string;
|
|
8
|
+
context?: number;
|
|
9
|
+
updateAll?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function runSg(options: RunOptions): Promise<CliMatch[]>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const SG_CLI_PATH = "sg";
|
|
2
|
+
export declare const CLI_LANGUAGES: readonly ["bash", "c", "cpp", "csharp", "css", "elixir", "go", "haskell", "html", "java", "javascript", "json", "kotlin", "lua", "nix", "php", "python", "ruby", "rust", "scala", "solidity", "swift", "typescript", "tsx", "yaml"];
|
|
3
|
+
export declare const NAPI_LANGUAGES: readonly ["html", "javascript", "tsx", "css", "typescript"];
|
|
4
|
+
export declare const LANG_EXTENSIONS: Record<string, string[]>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ast_grep_search, ast_grep_replace } from "./tools";
|
|
2
|
+
export declare const builtinTools: {
|
|
3
|
+
ast_grep_search: {
|
|
4
|
+
description: string;
|
|
5
|
+
args: {
|
|
6
|
+
pattern: import("zod").ZodString;
|
|
7
|
+
lang: import("zod").ZodEnum<{
|
|
8
|
+
typescript: "typescript";
|
|
9
|
+
csharp: "csharp";
|
|
10
|
+
rust: "rust";
|
|
11
|
+
php: "php";
|
|
12
|
+
python: "python";
|
|
13
|
+
javascript: "javascript";
|
|
14
|
+
go: "go";
|
|
15
|
+
c: "c";
|
|
16
|
+
cpp: "cpp";
|
|
17
|
+
java: "java";
|
|
18
|
+
ruby: "ruby";
|
|
19
|
+
lua: "lua";
|
|
20
|
+
swift: "swift";
|
|
21
|
+
elixir: "elixir";
|
|
22
|
+
yaml: "yaml";
|
|
23
|
+
bash: "bash";
|
|
24
|
+
css: "css";
|
|
25
|
+
haskell: "haskell";
|
|
26
|
+
html: "html";
|
|
27
|
+
json: "json";
|
|
28
|
+
kotlin: "kotlin";
|
|
29
|
+
nix: "nix";
|
|
30
|
+
scala: "scala";
|
|
31
|
+
solidity: "solidity";
|
|
32
|
+
tsx: "tsx";
|
|
33
|
+
}>;
|
|
34
|
+
paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
35
|
+
globs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
36
|
+
context: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
37
|
+
};
|
|
38
|
+
execute(args: {
|
|
39
|
+
pattern: string;
|
|
40
|
+
lang: "typescript" | "csharp" | "rust" | "php" | "python" | "javascript" | "go" | "c" | "cpp" | "java" | "ruby" | "lua" | "swift" | "elixir" | "yaml" | "bash" | "css" | "haskell" | "html" | "json" | "kotlin" | "nix" | "scala" | "solidity" | "tsx";
|
|
41
|
+
paths?: string[] | undefined;
|
|
42
|
+
globs?: string[] | undefined;
|
|
43
|
+
context?: number | undefined;
|
|
44
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
45
|
+
};
|
|
46
|
+
ast_grep_replace: {
|
|
47
|
+
description: string;
|
|
48
|
+
args: {
|
|
49
|
+
pattern: import("zod").ZodString;
|
|
50
|
+
rewrite: import("zod").ZodString;
|
|
51
|
+
lang: import("zod").ZodEnum<{
|
|
52
|
+
typescript: "typescript";
|
|
53
|
+
csharp: "csharp";
|
|
54
|
+
rust: "rust";
|
|
55
|
+
php: "php";
|
|
56
|
+
python: "python";
|
|
57
|
+
javascript: "javascript";
|
|
58
|
+
go: "go";
|
|
59
|
+
c: "c";
|
|
60
|
+
cpp: "cpp";
|
|
61
|
+
java: "java";
|
|
62
|
+
ruby: "ruby";
|
|
63
|
+
lua: "lua";
|
|
64
|
+
swift: "swift";
|
|
65
|
+
elixir: "elixir";
|
|
66
|
+
yaml: "yaml";
|
|
67
|
+
bash: "bash";
|
|
68
|
+
css: "css";
|
|
69
|
+
haskell: "haskell";
|
|
70
|
+
html: "html";
|
|
71
|
+
json: "json";
|
|
72
|
+
kotlin: "kotlin";
|
|
73
|
+
nix: "nix";
|
|
74
|
+
scala: "scala";
|
|
75
|
+
solidity: "solidity";
|
|
76
|
+
tsx: "tsx";
|
|
77
|
+
}>;
|
|
78
|
+
paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
79
|
+
globs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
80
|
+
dryRun: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
81
|
+
};
|
|
82
|
+
execute(args: {
|
|
83
|
+
pattern: string;
|
|
84
|
+
rewrite: string;
|
|
85
|
+
lang: "typescript" | "csharp" | "rust" | "php" | "python" | "javascript" | "go" | "c" | "cpp" | "java" | "ruby" | "lua" | "swift" | "elixir" | "yaml" | "bash" | "css" | "haskell" | "html" | "json" | "kotlin" | "nix" | "scala" | "solidity" | "tsx";
|
|
86
|
+
paths?: string[] | undefined;
|
|
87
|
+
globs?: string[] | undefined;
|
|
88
|
+
dryRun?: boolean | undefined;
|
|
89
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export { ast_grep_search, ast_grep_replace, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NapiLanguage, AnalyzeResult, MetaVariable } from "./types";
|
|
2
|
+
export declare function parseCode(code: string, lang: NapiLanguage): import("@ast-grep/napi").SgRoot<import("@ast-grep/napi/types/staticTypes").TypesMap>;
|
|
3
|
+
export declare function findPattern(root: ReturnType<typeof parseCode>, pattern: string): import("@ast-grep/napi").SgNode<import("@ast-grep/napi/types/staticTypes").TypesMap, import("@ast-grep/napi/types/staticTypes").Kinds<import("@ast-grep/napi/types/staticTypes").TypesMap>>[];
|
|
4
|
+
export declare function extractMetaVariables(node: ReturnType<ReturnType<typeof parseCode>["root"]>, pattern: string): MetaVariable[];
|
|
5
|
+
export declare function analyzeCode(code: string, lang: NapiLanguage, pattern: string, shouldExtractMetaVars: boolean): AnalyzeResult[];
|
|
6
|
+
export declare function transformCode(code: string, lang: NapiLanguage, pattern: string, rewrite: string): {
|
|
7
|
+
transformed: string;
|
|
8
|
+
editCount: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function getRootInfo(code: string, lang: NapiLanguage): {
|
|
11
|
+
kind: string;
|
|
12
|
+
childCount: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export declare const ast_grep_search: {
|
|
2
|
+
description: string;
|
|
3
|
+
args: {
|
|
4
|
+
pattern: import("zod").ZodString;
|
|
5
|
+
lang: import("zod").ZodEnum<{
|
|
6
|
+
typescript: "typescript";
|
|
7
|
+
csharp: "csharp";
|
|
8
|
+
rust: "rust";
|
|
9
|
+
php: "php";
|
|
10
|
+
python: "python";
|
|
11
|
+
javascript: "javascript";
|
|
12
|
+
go: "go";
|
|
13
|
+
c: "c";
|
|
14
|
+
cpp: "cpp";
|
|
15
|
+
java: "java";
|
|
16
|
+
ruby: "ruby";
|
|
17
|
+
lua: "lua";
|
|
18
|
+
swift: "swift";
|
|
19
|
+
elixir: "elixir";
|
|
20
|
+
yaml: "yaml";
|
|
21
|
+
bash: "bash";
|
|
22
|
+
css: "css";
|
|
23
|
+
haskell: "haskell";
|
|
24
|
+
html: "html";
|
|
25
|
+
json: "json";
|
|
26
|
+
kotlin: "kotlin";
|
|
27
|
+
nix: "nix";
|
|
28
|
+
scala: "scala";
|
|
29
|
+
solidity: "solidity";
|
|
30
|
+
tsx: "tsx";
|
|
31
|
+
}>;
|
|
32
|
+
paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
33
|
+
globs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
34
|
+
context: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
35
|
+
};
|
|
36
|
+
execute(args: {
|
|
37
|
+
pattern: string;
|
|
38
|
+
lang: "typescript" | "csharp" | "rust" | "php" | "python" | "javascript" | "go" | "c" | "cpp" | "java" | "ruby" | "lua" | "swift" | "elixir" | "yaml" | "bash" | "css" | "haskell" | "html" | "json" | "kotlin" | "nix" | "scala" | "solidity" | "tsx";
|
|
39
|
+
paths?: string[] | undefined;
|
|
40
|
+
globs?: string[] | undefined;
|
|
41
|
+
context?: number | undefined;
|
|
42
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
43
|
+
};
|
|
44
|
+
export declare const ast_grep_replace: {
|
|
45
|
+
description: string;
|
|
46
|
+
args: {
|
|
47
|
+
pattern: import("zod").ZodString;
|
|
48
|
+
rewrite: import("zod").ZodString;
|
|
49
|
+
lang: import("zod").ZodEnum<{
|
|
50
|
+
typescript: "typescript";
|
|
51
|
+
csharp: "csharp";
|
|
52
|
+
rust: "rust";
|
|
53
|
+
php: "php";
|
|
54
|
+
python: "python";
|
|
55
|
+
javascript: "javascript";
|
|
56
|
+
go: "go";
|
|
57
|
+
c: "c";
|
|
58
|
+
cpp: "cpp";
|
|
59
|
+
java: "java";
|
|
60
|
+
ruby: "ruby";
|
|
61
|
+
lua: "lua";
|
|
62
|
+
swift: "swift";
|
|
63
|
+
elixir: "elixir";
|
|
64
|
+
yaml: "yaml";
|
|
65
|
+
bash: "bash";
|
|
66
|
+
css: "css";
|
|
67
|
+
haskell: "haskell";
|
|
68
|
+
html: "html";
|
|
69
|
+
json: "json";
|
|
70
|
+
kotlin: "kotlin";
|
|
71
|
+
nix: "nix";
|
|
72
|
+
scala: "scala";
|
|
73
|
+
solidity: "solidity";
|
|
74
|
+
tsx: "tsx";
|
|
75
|
+
}>;
|
|
76
|
+
paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
77
|
+
globs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
78
|
+
dryRun: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
79
|
+
};
|
|
80
|
+
execute(args: {
|
|
81
|
+
pattern: string;
|
|
82
|
+
rewrite: string;
|
|
83
|
+
lang: "typescript" | "csharp" | "rust" | "php" | "python" | "javascript" | "go" | "c" | "cpp" | "java" | "ruby" | "lua" | "swift" | "elixir" | "yaml" | "bash" | "css" | "haskell" | "html" | "json" | "kotlin" | "nix" | "scala" | "solidity" | "tsx";
|
|
84
|
+
paths?: string[] | undefined;
|
|
85
|
+
globs?: string[] | undefined;
|
|
86
|
+
dryRun?: boolean | undefined;
|
|
87
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
88
|
+
};
|
|
89
|
+
export declare const ast_grep_languages: {
|
|
90
|
+
description: string;
|
|
91
|
+
args: {};
|
|
92
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
93
|
+
};
|
|
94
|
+
export declare const ast_grep_analyze: {
|
|
95
|
+
description: string;
|
|
96
|
+
args: {
|
|
97
|
+
code: import("zod").ZodString;
|
|
98
|
+
lang: import("zod").ZodEnum<{
|
|
99
|
+
typescript: "typescript";
|
|
100
|
+
javascript: "javascript";
|
|
101
|
+
css: "css";
|
|
102
|
+
html: "html";
|
|
103
|
+
tsx: "tsx";
|
|
104
|
+
}>;
|
|
105
|
+
pattern: import("zod").ZodOptional<import("zod").ZodString>;
|
|
106
|
+
extractMetaVars: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
107
|
+
};
|
|
108
|
+
execute(args: {
|
|
109
|
+
code: string;
|
|
110
|
+
lang: "typescript" | "javascript" | "css" | "html" | "tsx";
|
|
111
|
+
pattern?: string | undefined;
|
|
112
|
+
extractMetaVars?: boolean | undefined;
|
|
113
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
114
|
+
};
|
|
115
|
+
export declare const ast_grep_transform: {
|
|
116
|
+
description: string;
|
|
117
|
+
args: {
|
|
118
|
+
code: import("zod").ZodString;
|
|
119
|
+
lang: import("zod").ZodEnum<{
|
|
120
|
+
typescript: "typescript";
|
|
121
|
+
javascript: "javascript";
|
|
122
|
+
css: "css";
|
|
123
|
+
html: "html";
|
|
124
|
+
tsx: "tsx";
|
|
125
|
+
}>;
|
|
126
|
+
pattern: import("zod").ZodString;
|
|
127
|
+
rewrite: import("zod").ZodString;
|
|
128
|
+
};
|
|
129
|
+
execute(args: {
|
|
130
|
+
code: string;
|
|
131
|
+
lang: "typescript" | "javascript" | "css" | "html" | "tsx";
|
|
132
|
+
pattern: string;
|
|
133
|
+
rewrite: string;
|
|
134
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
135
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CLI_LANGUAGES, NAPI_LANGUAGES } from "./constants";
|
|
2
|
+
export type CliLanguage = (typeof CLI_LANGUAGES)[number];
|
|
3
|
+
export type NapiLanguage = (typeof NAPI_LANGUAGES)[number];
|
|
4
|
+
export interface Position {
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
}
|
|
8
|
+
export interface Range {
|
|
9
|
+
start: Position;
|
|
10
|
+
end: Position;
|
|
11
|
+
}
|
|
12
|
+
export interface CliMatch {
|
|
13
|
+
text: string;
|
|
14
|
+
range: {
|
|
15
|
+
byteOffset: {
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
};
|
|
19
|
+
start: Position;
|
|
20
|
+
end: Position;
|
|
21
|
+
};
|
|
22
|
+
file: string;
|
|
23
|
+
lines: string;
|
|
24
|
+
charCount: {
|
|
25
|
+
leading: number;
|
|
26
|
+
trailing: number;
|
|
27
|
+
};
|
|
28
|
+
language: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SearchMatch {
|
|
31
|
+
file: string;
|
|
32
|
+
text: string;
|
|
33
|
+
range: Range;
|
|
34
|
+
lines: string;
|
|
35
|
+
}
|
|
36
|
+
export interface MetaVariable {
|
|
37
|
+
name: string;
|
|
38
|
+
text: string;
|
|
39
|
+
kind: string;
|
|
40
|
+
}
|
|
41
|
+
export interface AnalyzeResult {
|
|
42
|
+
text: string;
|
|
43
|
+
range: Range;
|
|
44
|
+
kind: string;
|
|
45
|
+
metaVariables: MetaVariable[];
|
|
46
|
+
}
|
|
47
|
+
export interface TransformResult {
|
|
48
|
+
original: string;
|
|
49
|
+
transformed: string;
|
|
50
|
+
editCount: number;
|
|
51
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CliMatch, AnalyzeResult } from "./types";
|
|
2
|
+
export declare function formatSearchResult(matches: CliMatch[]): string;
|
|
3
|
+
export declare function formatReplaceResult(matches: CliMatch[], isDryRun: boolean): string;
|
|
4
|
+
export declare function formatAnalyzeResult(results: AnalyzeResult[], extractedMetaVars: boolean): string;
|
|
5
|
+
export declare function formatTransformResult(original: string, transformed: string, editCount: number): string;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
export declare const builtinTools: {
|
|
2
|
+
lsp_hover: {
|
|
3
|
+
description: string;
|
|
4
|
+
args: {
|
|
5
|
+
filePath: import("zod").ZodString;
|
|
6
|
+
line: import("zod").ZodNumber;
|
|
7
|
+
character: import("zod").ZodNumber;
|
|
8
|
+
};
|
|
9
|
+
execute(args: {
|
|
10
|
+
filePath: string;
|
|
11
|
+
line: number;
|
|
12
|
+
character: number;
|
|
13
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
14
|
+
};
|
|
15
|
+
lsp_goto_definition: {
|
|
16
|
+
description: string;
|
|
17
|
+
args: {
|
|
18
|
+
filePath: import("zod").ZodString;
|
|
19
|
+
line: import("zod").ZodNumber;
|
|
20
|
+
character: import("zod").ZodNumber;
|
|
21
|
+
};
|
|
22
|
+
execute(args: {
|
|
23
|
+
filePath: string;
|
|
24
|
+
line: number;
|
|
25
|
+
character: number;
|
|
26
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
27
|
+
};
|
|
28
|
+
lsp_find_references: {
|
|
29
|
+
description: string;
|
|
30
|
+
args: {
|
|
31
|
+
filePath: import("zod").ZodString;
|
|
32
|
+
line: import("zod").ZodNumber;
|
|
33
|
+
character: import("zod").ZodNumber;
|
|
34
|
+
includeDeclaration: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
35
|
+
};
|
|
36
|
+
execute(args: {
|
|
37
|
+
filePath: string;
|
|
38
|
+
line: number;
|
|
39
|
+
character: number;
|
|
40
|
+
includeDeclaration?: boolean | undefined;
|
|
41
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
42
|
+
};
|
|
43
|
+
lsp_document_symbols: {
|
|
44
|
+
description: string;
|
|
45
|
+
args: {
|
|
46
|
+
filePath: import("zod").ZodString;
|
|
47
|
+
};
|
|
48
|
+
execute(args: {
|
|
49
|
+
filePath: string;
|
|
50
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
51
|
+
};
|
|
52
|
+
lsp_workspace_symbols: {
|
|
53
|
+
description: string;
|
|
54
|
+
args: {
|
|
55
|
+
filePath: import("zod").ZodString;
|
|
56
|
+
query: import("zod").ZodString;
|
|
57
|
+
limit: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
58
|
+
};
|
|
59
|
+
execute(args: {
|
|
60
|
+
filePath: string;
|
|
61
|
+
query: string;
|
|
62
|
+
limit?: number | undefined;
|
|
63
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
64
|
+
};
|
|
65
|
+
lsp_diagnostics: {
|
|
66
|
+
description: string;
|
|
67
|
+
args: {
|
|
68
|
+
filePath: import("zod").ZodString;
|
|
69
|
+
severity: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
70
|
+
all: "all";
|
|
71
|
+
error: "error";
|
|
72
|
+
warning: "warning";
|
|
73
|
+
information: "information";
|
|
74
|
+
hint: "hint";
|
|
75
|
+
}>>;
|
|
76
|
+
};
|
|
77
|
+
execute(args: {
|
|
78
|
+
filePath: string;
|
|
79
|
+
severity?: "all" | "error" | "warning" | "information" | "hint" | undefined;
|
|
80
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
81
|
+
};
|
|
82
|
+
lsp_servers: {
|
|
83
|
+
description: string;
|
|
84
|
+
args: {};
|
|
85
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
86
|
+
};
|
|
87
|
+
lsp_prepare_rename: {
|
|
88
|
+
description: string;
|
|
89
|
+
args: {
|
|
90
|
+
filePath: import("zod").ZodString;
|
|
91
|
+
line: import("zod").ZodNumber;
|
|
92
|
+
character: import("zod").ZodNumber;
|
|
93
|
+
};
|
|
94
|
+
execute(args: {
|
|
95
|
+
filePath: string;
|
|
96
|
+
line: number;
|
|
97
|
+
character: number;
|
|
98
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
99
|
+
};
|
|
100
|
+
lsp_rename: {
|
|
101
|
+
description: string;
|
|
102
|
+
args: {
|
|
103
|
+
filePath: import("zod").ZodString;
|
|
104
|
+
line: import("zod").ZodNumber;
|
|
105
|
+
character: import("zod").ZodNumber;
|
|
106
|
+
newName: import("zod").ZodString;
|
|
107
|
+
};
|
|
108
|
+
execute(args: {
|
|
109
|
+
filePath: string;
|
|
110
|
+
line: number;
|
|
111
|
+
character: number;
|
|
112
|
+
newName: string;
|
|
113
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
114
|
+
};
|
|
115
|
+
lsp_code_actions: {
|
|
116
|
+
description: string;
|
|
117
|
+
args: {
|
|
118
|
+
filePath: import("zod").ZodString;
|
|
119
|
+
startLine: import("zod").ZodNumber;
|
|
120
|
+
startCharacter: import("zod").ZodNumber;
|
|
121
|
+
endLine: import("zod").ZodNumber;
|
|
122
|
+
endCharacter: import("zod").ZodNumber;
|
|
123
|
+
kind: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
124
|
+
quickfix: "quickfix";
|
|
125
|
+
refactor: "refactor";
|
|
126
|
+
"refactor.extract": "refactor.extract";
|
|
127
|
+
"refactor.inline": "refactor.inline";
|
|
128
|
+
"refactor.rewrite": "refactor.rewrite";
|
|
129
|
+
source: "source";
|
|
130
|
+
"source.organizeImports": "source.organizeImports";
|
|
131
|
+
"source.fixAll": "source.fixAll";
|
|
132
|
+
}>>;
|
|
133
|
+
};
|
|
134
|
+
execute(args: {
|
|
135
|
+
filePath: string;
|
|
136
|
+
startLine: number;
|
|
137
|
+
startCharacter: number;
|
|
138
|
+
endLine: number;
|
|
139
|
+
endCharacter: number;
|
|
140
|
+
kind?: "quickfix" | "refactor" | "refactor.extract" | "refactor.inline" | "refactor.rewrite" | "source" | "source.organizeImports" | "source.fixAll" | undefined;
|
|
141
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
142
|
+
};
|
|
143
|
+
lsp_code_action_resolve: {
|
|
144
|
+
description: string;
|
|
145
|
+
args: {
|
|
146
|
+
filePath: import("zod").ZodString;
|
|
147
|
+
codeAction: import("zod").ZodString;
|
|
148
|
+
};
|
|
149
|
+
execute(args: {
|
|
150
|
+
filePath: string;
|
|
151
|
+
codeAction: string;
|
|
152
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
153
|
+
};
|
|
154
|
+
ast_grep_search: {
|
|
155
|
+
description: string;
|
|
156
|
+
args: {
|
|
157
|
+
pattern: import("zod").ZodString;
|
|
158
|
+
lang: import("zod").ZodEnum<{
|
|
159
|
+
typescript: "typescript";
|
|
160
|
+
csharp: "csharp";
|
|
161
|
+
rust: "rust";
|
|
162
|
+
php: "php";
|
|
163
|
+
python: "python";
|
|
164
|
+
javascript: "javascript";
|
|
165
|
+
go: "go";
|
|
166
|
+
c: "c";
|
|
167
|
+
cpp: "cpp";
|
|
168
|
+
java: "java";
|
|
169
|
+
ruby: "ruby";
|
|
170
|
+
lua: "lua";
|
|
171
|
+
swift: "swift";
|
|
172
|
+
elixir: "elixir";
|
|
173
|
+
yaml: "yaml";
|
|
174
|
+
bash: "bash";
|
|
175
|
+
css: "css";
|
|
176
|
+
haskell: "haskell";
|
|
177
|
+
html: "html";
|
|
178
|
+
json: "json";
|
|
179
|
+
kotlin: "kotlin";
|
|
180
|
+
nix: "nix";
|
|
181
|
+
scala: "scala";
|
|
182
|
+
solidity: "solidity";
|
|
183
|
+
tsx: "tsx";
|
|
184
|
+
}>;
|
|
185
|
+
paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
186
|
+
globs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
187
|
+
context: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
188
|
+
};
|
|
189
|
+
execute(args: {
|
|
190
|
+
pattern: string;
|
|
191
|
+
lang: "typescript" | "csharp" | "rust" | "php" | "python" | "javascript" | "go" | "c" | "cpp" | "java" | "ruby" | "lua" | "swift" | "elixir" | "yaml" | "bash" | "css" | "haskell" | "html" | "json" | "kotlin" | "nix" | "scala" | "solidity" | "tsx";
|
|
192
|
+
paths?: string[] | undefined;
|
|
193
|
+
globs?: string[] | undefined;
|
|
194
|
+
context?: number | undefined;
|
|
195
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
196
|
+
};
|
|
197
|
+
ast_grep_replace: {
|
|
198
|
+
description: string;
|
|
199
|
+
args: {
|
|
200
|
+
pattern: import("zod").ZodString;
|
|
201
|
+
rewrite: import("zod").ZodString;
|
|
202
|
+
lang: import("zod").ZodEnum<{
|
|
203
|
+
typescript: "typescript";
|
|
204
|
+
csharp: "csharp";
|
|
205
|
+
rust: "rust";
|
|
206
|
+
php: "php";
|
|
207
|
+
python: "python";
|
|
208
|
+
javascript: "javascript";
|
|
209
|
+
go: "go";
|
|
210
|
+
c: "c";
|
|
211
|
+
cpp: "cpp";
|
|
212
|
+
java: "java";
|
|
213
|
+
ruby: "ruby";
|
|
214
|
+
lua: "lua";
|
|
215
|
+
swift: "swift";
|
|
216
|
+
elixir: "elixir";
|
|
217
|
+
yaml: "yaml";
|
|
218
|
+
bash: "bash";
|
|
219
|
+
css: "css";
|
|
220
|
+
haskell: "haskell";
|
|
221
|
+
html: "html";
|
|
222
|
+
json: "json";
|
|
223
|
+
kotlin: "kotlin";
|
|
224
|
+
nix: "nix";
|
|
225
|
+
scala: "scala";
|
|
226
|
+
solidity: "solidity";
|
|
227
|
+
tsx: "tsx";
|
|
228
|
+
}>;
|
|
229
|
+
paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
230
|
+
globs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
231
|
+
dryRun: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
232
|
+
};
|
|
233
|
+
execute(args: {
|
|
234
|
+
pattern: string;
|
|
235
|
+
rewrite: string;
|
|
236
|
+
lang: "typescript" | "csharp" | "rust" | "php" | "python" | "javascript" | "go" | "c" | "cpp" | "java" | "ruby" | "lua" | "swift" | "elixir" | "yaml" | "bash" | "css" | "haskell" | "html" | "json" | "kotlin" | "nix" | "scala" | "solidity" | "tsx";
|
|
237
|
+
paths?: string[] | undefined;
|
|
238
|
+
globs?: string[] | undefined;
|
|
239
|
+
dryRun?: boolean | undefined;
|
|
240
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
241
|
+
};
|
|
242
|
+
safe_grep: {
|
|
243
|
+
description: string;
|
|
244
|
+
args: {
|
|
245
|
+
pattern: import("zod").ZodString;
|
|
246
|
+
include: import("zod").ZodOptional<import("zod").ZodString>;
|
|
247
|
+
path: import("zod").ZodOptional<import("zod").ZodString>;
|
|
248
|
+
};
|
|
249
|
+
execute(args: {
|
|
250
|
+
pattern: string;
|
|
251
|
+
include?: string | undefined;
|
|
252
|
+
path?: string | undefined;
|
|
253
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ResolvedServer } from "./config";
|
|
2
|
+
declare class LSPServerManager {
|
|
3
|
+
private static instance;
|
|
4
|
+
private clients;
|
|
5
|
+
private cleanupInterval;
|
|
6
|
+
private readonly IDLE_TIMEOUT;
|
|
7
|
+
private constructor();
|
|
8
|
+
static getInstance(): LSPServerManager;
|
|
9
|
+
private getKey;
|
|
10
|
+
private startCleanupTimer;
|
|
11
|
+
private cleanupIdleClients;
|
|
12
|
+
getClient(root: string, server: ResolvedServer): Promise<LSPClient>;
|
|
13
|
+
warmupClient(root: string, server: ResolvedServer): void;
|
|
14
|
+
releaseClient(root: string, serverId: string): void;
|
|
15
|
+
isServerInitializing(root: string, serverId: string): boolean;
|
|
16
|
+
stopAll(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare const lspManager: LSPServerManager;
|
|
19
|
+
export declare class LSPClient {
|
|
20
|
+
private root;
|
|
21
|
+
private server;
|
|
22
|
+
private proc;
|
|
23
|
+
private buffer;
|
|
24
|
+
private pending;
|
|
25
|
+
private requestIdCounter;
|
|
26
|
+
private openedFiles;
|
|
27
|
+
private stderrBuffer;
|
|
28
|
+
private processExited;
|
|
29
|
+
constructor(root: string, server: ResolvedServer);
|
|
30
|
+
start(): Promise<void>;
|
|
31
|
+
private startReading;
|
|
32
|
+
private startStderrReading;
|
|
33
|
+
private rejectAllPending;
|
|
34
|
+
private findSequence;
|
|
35
|
+
private processBuffer;
|
|
36
|
+
private send;
|
|
37
|
+
private notify;
|
|
38
|
+
private respond;
|
|
39
|
+
private handleServerRequest;
|
|
40
|
+
initialize(): Promise<void>;
|
|
41
|
+
openFile(filePath: string): Promise<void>;
|
|
42
|
+
hover(filePath: string, line: number, character: number): Promise<unknown>;
|
|
43
|
+
definition(filePath: string, line: number, character: number): Promise<unknown>;
|
|
44
|
+
references(filePath: string, line: number, character: number, includeDeclaration?: boolean): Promise<unknown>;
|
|
45
|
+
documentSymbols(filePath: string): Promise<unknown>;
|
|
46
|
+
workspaceSymbols(query: string): Promise<unknown>;
|
|
47
|
+
diagnostics(filePath: string): Promise<unknown>;
|
|
48
|
+
prepareRename(filePath: string, line: number, character: number): Promise<unknown>;
|
|
49
|
+
rename(filePath: string, line: number, character: number, newName: string): Promise<unknown>;
|
|
50
|
+
codeAction(filePath: string, startLine: number, startChar: number, endLine: number, endChar: number, only?: string[]): Promise<unknown>;
|
|
51
|
+
codeActionResolve(codeAction: unknown): Promise<unknown>;
|
|
52
|
+
isAlive(): boolean;
|
|
53
|
+
stop(): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ResolvedServer {
|
|
2
|
+
id: string;
|
|
3
|
+
command: string[];
|
|
4
|
+
extensions: string[];
|
|
5
|
+
priority: number;
|
|
6
|
+
env?: Record<string, string>;
|
|
7
|
+
initialization?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export declare function findServerForExtension(ext: string): ResolvedServer | null;
|
|
10
|
+
export declare function getLanguageId(ext: string): string;
|
|
11
|
+
export declare function isServerInstalled(command: string[]): boolean;
|
|
12
|
+
export declare function getAllServers(): Array<{
|
|
13
|
+
id: string;
|
|
14
|
+
installed: boolean;
|
|
15
|
+
extensions: string[];
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
source: string;
|
|
18
|
+
priority: number;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function getConfigPaths_(): {
|
|
21
|
+
project: string;
|
|
22
|
+
user: string;
|
|
23
|
+
opencode: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LSPServerConfig } from "./types";
|
|
2
|
+
export declare const SYMBOL_KIND_MAP: Record<number, string>;
|
|
3
|
+
export declare const SEVERITY_MAP: Record<number, string>;
|
|
4
|
+
export declare const BUILTIN_SERVERS: Record<string, Omit<LSPServerConfig, "id">>;
|
|
5
|
+
export declare const EXT_TO_LANG: Record<string, string>;
|