oh-my-opencode 3.0.0-beta.7 → 3.0.0-beta.8
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/README.md +7 -5
- package/README.zh-cn.md +5 -0
- package/bin/oh-my-opencode.js +80 -0
- package/bin/platform.js +38 -0
- package/bin/platform.test.ts +148 -0
- package/dist/agents/sisyphus-junior.d.ts +1 -1
- package/dist/cli/config-manager.d.ts +9 -1
- package/dist/cli/index.js +172 -119
- package/dist/config/schema.d.ts +2 -0
- package/dist/features/background-agent/manager.d.ts +5 -0
- package/dist/features/hook-message-injector/index.d.ts +1 -1
- package/dist/features/opencode-skill-loader/skill-content.d.ts +10 -0
- package/dist/features/skill-mcp-manager/manager.d.ts +10 -0
- package/dist/features/task-toast-manager/index.d.ts +1 -1
- package/dist/features/task-toast-manager/manager.d.ts +2 -1
- package/dist/features/task-toast-manager/types.d.ts +5 -0
- package/dist/hooks/comment-checker/cli.d.ts +0 -1
- package/dist/hooks/comment-checker/cli.test.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/sisyphus-task-retry/index.d.ts +24 -0
- package/dist/hooks/sisyphus-task-retry/index.test.d.ts +1 -0
- package/dist/index.js +2300 -413
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/session-cursor.d.ts +13 -0
- package/dist/shared/session-cursor.test.d.ts +1 -0
- package/dist/shared/shell-env.d.ts +41 -0
- package/dist/shared/shell-env.test.d.ts +1 -0
- package/dist/tools/look-at/tools.d.ts +7 -0
- package/dist/tools/look-at/tools.test.d.ts +1 -0
- package/dist/tools/lsp/client.d.ts +0 -7
- package/dist/tools/lsp/constants.d.ts +0 -3
- package/dist/tools/lsp/tools.d.ts +0 -3
- package/dist/tools/lsp/types.d.ts +0 -56
- package/dist/tools/lsp/utils.d.ts +1 -8
- package/package.json +18 -3
- package/postinstall.mjs +43 -0
package/dist/shared/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type MessageTime = {
|
|
2
|
+
created?: number | string;
|
|
3
|
+
} | number | string | undefined;
|
|
4
|
+
type MessageInfo = {
|
|
5
|
+
id?: string;
|
|
6
|
+
time?: MessageTime;
|
|
7
|
+
};
|
|
8
|
+
export type CursorMessage = {
|
|
9
|
+
info?: MessageInfo;
|
|
10
|
+
};
|
|
11
|
+
export declare function consumeNewMessages<T extends CursorMessage>(sessionID: string | undefined, messages: T[]): T[];
|
|
12
|
+
export declare function resetMessageCursor(sessionID?: string): void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type ShellType = "unix" | "powershell" | "cmd";
|
|
2
|
+
/**
|
|
3
|
+
* Detect the current shell type based on environment variables.
|
|
4
|
+
*
|
|
5
|
+
* Detection priority:
|
|
6
|
+
* 1. PSModulePath → PowerShell
|
|
7
|
+
* 2. SHELL env var → Unix shell
|
|
8
|
+
* 3. Platform fallback → win32: cmd, others: unix
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectShellType(): ShellType;
|
|
11
|
+
/**
|
|
12
|
+
* Shell-escape a value for use in environment variable assignment.
|
|
13
|
+
*
|
|
14
|
+
* @param value - The value to escape
|
|
15
|
+
* @param shellType - The target shell type
|
|
16
|
+
* @returns Escaped value appropriate for the shell
|
|
17
|
+
*/
|
|
18
|
+
export declare function shellEscape(value: string, shellType: ShellType): string;
|
|
19
|
+
/**
|
|
20
|
+
* Build environment variable prefix command for the target shell.
|
|
21
|
+
*
|
|
22
|
+
* @param env - Record of environment variables to set
|
|
23
|
+
* @param shellType - The target shell type
|
|
24
|
+
* @returns Command prefix string to prepend to the actual command
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* // Unix: "export VAR1=val1 VAR2=val2; command"
|
|
29
|
+
* buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "unix")
|
|
30
|
+
* // => "export VAR1=val1 VAR2=val2;"
|
|
31
|
+
*
|
|
32
|
+
* // PowerShell: "$env:VAR1='val1'; $env:VAR2='val2'; command"
|
|
33
|
+
* buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "powershell")
|
|
34
|
+
* // => "$env:VAR1='val1'; $env:VAR2='val2';"
|
|
35
|
+
*
|
|
36
|
+
* // cmd.exe: "set VAR1=val1 && set VAR2=val2 && command"
|
|
37
|
+
* buildEnvPrefix({ VAR1: "val1", VAR2: "val2" }, "cmd")
|
|
38
|
+
* // => "set VAR1=\"val1\" && set VAR2=\"val2\" &&"
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildEnvPrefix(env: Record<string, string>, shellType: ShellType): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { type PluginInput, type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
import type { LookAtArgs } from "./types";
|
|
3
|
+
interface LookAtArgsWithAlias extends LookAtArgs {
|
|
4
|
+
path?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function normalizeArgs(args: LookAtArgsWithAlias): LookAtArgs;
|
|
7
|
+
export declare function validateArgs(args: LookAtArgs): string | null;
|
|
2
8
|
export declare function createLookAt(ctx: PluginInput): ToolDefinition;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -42,18 +42,11 @@ export declare class LSPClient {
|
|
|
42
42
|
private handleServerRequest;
|
|
43
43
|
initialize(): Promise<void>;
|
|
44
44
|
openFile(filePath: string): Promise<void>;
|
|
45
|
-
hover(filePath: string, line: number, character: number): Promise<unknown>;
|
|
46
|
-
definition(filePath: string, line: number, character: number): Promise<unknown>;
|
|
47
|
-
references(filePath: string, line: number, character: number, includeDeclaration?: boolean): Promise<unknown>;
|
|
48
|
-
documentSymbols(filePath: string): Promise<unknown>;
|
|
49
|
-
workspaceSymbols(query: string): Promise<unknown>;
|
|
50
45
|
diagnostics(filePath: string): Promise<{
|
|
51
46
|
items: Diagnostic[];
|
|
52
47
|
}>;
|
|
53
48
|
prepareRename(filePath: string, line: number, character: number): Promise<unknown>;
|
|
54
49
|
rename(filePath: string, line: number, character: number, newName: string): Promise<unknown>;
|
|
55
|
-
codeAction(filePath: string, startLine: number, startChar: number, endLine: number, endChar: number, only?: string[]): Promise<unknown>;
|
|
56
|
-
codeActionResolve(codeAction: unknown): Promise<unknown>;
|
|
57
50
|
isAlive(): boolean;
|
|
58
51
|
stop(): Promise<void>;
|
|
59
52
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { LSPServerConfig } from "./types";
|
|
2
|
-
export declare const SYMBOL_KIND_MAP: Record<number, string>;
|
|
3
2
|
export declare const SEVERITY_MAP: Record<number, string>;
|
|
4
|
-
export declare const DEFAULT_MAX_REFERENCES = 200;
|
|
5
|
-
export declare const DEFAULT_MAX_SYMBOLS = 200;
|
|
6
3
|
export declare const DEFAULT_MAX_DIAGNOSTICS = 200;
|
|
7
4
|
export declare const LSP_INSTALL_HINTS: Record<string, string>;
|
|
8
5
|
export declare const BUILTIN_SERVERS: Record<string, Omit<LSPServerConfig, "id">>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
|
2
|
-
export declare const lsp_goto_definition: ToolDefinition;
|
|
3
|
-
export declare const lsp_find_references: ToolDefinition;
|
|
4
|
-
export declare const lsp_symbols: ToolDefinition;
|
|
5
2
|
export declare const lsp_diagnostics: ToolDefinition;
|
|
6
3
|
export declare const lsp_servers: ToolDefinition;
|
|
7
4
|
export declare const lsp_prepare_rename: ToolDefinition;
|
|
@@ -14,29 +14,6 @@ export interface Range {
|
|
|
14
14
|
start: Position;
|
|
15
15
|
end: Position;
|
|
16
16
|
}
|
|
17
|
-
export interface Location {
|
|
18
|
-
uri: string;
|
|
19
|
-
range: Range;
|
|
20
|
-
}
|
|
21
|
-
export interface LocationLink {
|
|
22
|
-
targetUri: string;
|
|
23
|
-
targetRange: Range;
|
|
24
|
-
targetSelectionRange: Range;
|
|
25
|
-
originSelectionRange?: Range;
|
|
26
|
-
}
|
|
27
|
-
export interface SymbolInfo {
|
|
28
|
-
name: string;
|
|
29
|
-
kind: number;
|
|
30
|
-
location: Location;
|
|
31
|
-
containerName?: string;
|
|
32
|
-
}
|
|
33
|
-
export interface DocumentSymbol {
|
|
34
|
-
name: string;
|
|
35
|
-
kind: number;
|
|
36
|
-
range: Range;
|
|
37
|
-
selectionRange: Range;
|
|
38
|
-
children?: DocumentSymbol[];
|
|
39
|
-
}
|
|
40
17
|
export interface Diagnostic {
|
|
41
18
|
range: Range;
|
|
42
19
|
severity?: number;
|
|
@@ -44,16 +21,6 @@ export interface Diagnostic {
|
|
|
44
21
|
source?: string;
|
|
45
22
|
message: string;
|
|
46
23
|
}
|
|
47
|
-
export interface HoverResult {
|
|
48
|
-
contents: {
|
|
49
|
-
kind?: string;
|
|
50
|
-
value: string;
|
|
51
|
-
} | string | Array<{
|
|
52
|
-
kind?: string;
|
|
53
|
-
value: string;
|
|
54
|
-
} | string>;
|
|
55
|
-
range?: Range;
|
|
56
|
-
}
|
|
57
24
|
export interface TextDocumentIdentifier {
|
|
58
25
|
uri: string;
|
|
59
26
|
}
|
|
@@ -106,29 +73,6 @@ export interface PrepareRenameResult {
|
|
|
106
73
|
export interface PrepareRenameDefaultBehavior {
|
|
107
74
|
defaultBehavior: boolean;
|
|
108
75
|
}
|
|
109
|
-
export interface Command {
|
|
110
|
-
title: string;
|
|
111
|
-
command: string;
|
|
112
|
-
arguments?: unknown[];
|
|
113
|
-
}
|
|
114
|
-
export interface CodeActionContext {
|
|
115
|
-
diagnostics: Diagnostic[];
|
|
116
|
-
only?: string[];
|
|
117
|
-
triggerKind?: CodeActionTriggerKind;
|
|
118
|
-
}
|
|
119
|
-
export type CodeActionTriggerKind = 1 | 2;
|
|
120
|
-
export interface CodeAction {
|
|
121
|
-
title: string;
|
|
122
|
-
kind?: string;
|
|
123
|
-
diagnostics?: Diagnostic[];
|
|
124
|
-
isPreferred?: boolean;
|
|
125
|
-
disabled?: {
|
|
126
|
-
reason: string;
|
|
127
|
-
};
|
|
128
|
-
edit?: WorkspaceEdit;
|
|
129
|
-
command?: Command;
|
|
130
|
-
data?: unknown;
|
|
131
|
-
}
|
|
132
76
|
export interface ServerLookupInfo {
|
|
133
77
|
id: string;
|
|
134
78
|
command: string[];
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { LSPClient } from "./client";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Diagnostic, PrepareRenameResult, PrepareRenameDefaultBehavior, Range, WorkspaceEdit, TextEdit, ServerLookupResult } from "./types";
|
|
3
3
|
export declare function findWorkspaceRoot(filePath: string): string;
|
|
4
4
|
export declare function uriToPath(uri: string): string;
|
|
5
5
|
export declare function formatServerLookupError(result: Exclude<ServerLookupResult, {
|
|
6
6
|
status: "found";
|
|
7
7
|
}>): string;
|
|
8
8
|
export declare function withLspClient<T>(filePath: string, fn: (client: LSPClient) => Promise<T>): Promise<T>;
|
|
9
|
-
export declare function formatHoverResult(result: HoverResult | null): string;
|
|
10
|
-
export declare function formatLocation(loc: Location | LocationLink): string;
|
|
11
|
-
export declare function formatSymbolKind(kind: number): string;
|
|
12
9
|
export declare function formatSeverity(severity: number | undefined): string;
|
|
13
|
-
export declare function formatDocumentSymbol(symbol: DocumentSymbol, indent?: number): string;
|
|
14
|
-
export declare function formatSymbolInfo(symbol: SymbolInfo): string;
|
|
15
10
|
export declare function formatDiagnostic(diag: Diagnostic): string;
|
|
16
11
|
export declare function filterDiagnosticsBySeverity(diagnostics: Diagnostic[], severityFilter?: "error" | "warning" | "information" | "hint" | "all"): Diagnostic[];
|
|
17
12
|
export declare function formatPrepareRenameResult(result: PrepareRenameResult | PrepareRenameDefaultBehavior | Range | null): string;
|
|
18
13
|
export declare function formatTextEdit(edit: TextEdit): string;
|
|
19
14
|
export declare function formatWorkspaceEdit(edit: WorkspaceEdit | null): string;
|
|
20
|
-
export declare function formatCodeAction(action: CodeAction): string;
|
|
21
|
-
export declare function formatCodeActions(actions: (CodeAction | Command)[] | null): string;
|
|
22
15
|
export interface ApplyResult {
|
|
23
16
|
success: boolean;
|
|
24
17
|
filesModified: string[];
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-opencode",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.8",
|
|
4
4
|
"description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
|
-
"oh-my-opencode": "./
|
|
9
|
+
"oh-my-opencode": "./bin/oh-my-opencode.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"dist"
|
|
12
|
+
"dist",
|
|
13
|
+
"bin",
|
|
14
|
+
"postinstall.mjs"
|
|
13
15
|
],
|
|
14
16
|
"exports": {
|
|
15
17
|
".": {
|
|
@@ -20,8 +22,11 @@
|
|
|
20
22
|
},
|
|
21
23
|
"scripts": {
|
|
22
24
|
"build": "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema",
|
|
25
|
+
"build:all": "bun run build && bun run build:binaries",
|
|
26
|
+
"build:binaries": "bun run script/build-binaries.ts",
|
|
23
27
|
"build:schema": "bun run script/build-schema.ts",
|
|
24
28
|
"clean": "rm -rf dist",
|
|
29
|
+
"postinstall": "node postinstall.mjs",
|
|
25
30
|
"prepublishOnly": "bun run clean && bun run build",
|
|
26
31
|
"typecheck": "tsc --noEmit",
|
|
27
32
|
"test": "bun test"
|
|
@@ -55,6 +60,7 @@
|
|
|
55
60
|
"@opencode-ai/plugin": "^1.1.19",
|
|
56
61
|
"@opencode-ai/sdk": "^1.1.19",
|
|
57
62
|
"commander": "^14.0.2",
|
|
63
|
+
"detect-libc": "^2.0.0",
|
|
58
64
|
"hono": "^4.10.4",
|
|
59
65
|
"js-yaml": "^4.1.1",
|
|
60
66
|
"jsonc-parser": "^3.3.1",
|
|
@@ -70,6 +76,15 @@
|
|
|
70
76
|
"bun-types": "latest",
|
|
71
77
|
"typescript": "^5.7.3"
|
|
72
78
|
},
|
|
79
|
+
"optionalDependencies": {
|
|
80
|
+
"oh-my-opencode-darwin-arm64": "3.0.0-beta.8",
|
|
81
|
+
"oh-my-opencode-darwin-x64": "3.0.0-beta.8",
|
|
82
|
+
"oh-my-opencode-linux-arm64": "3.0.0-beta.8",
|
|
83
|
+
"oh-my-opencode-linux-arm64-musl": "3.0.0-beta.8",
|
|
84
|
+
"oh-my-opencode-linux-x64": "3.0.0-beta.8",
|
|
85
|
+
"oh-my-opencode-linux-x64-musl": "3.0.0-beta.8",
|
|
86
|
+
"oh-my-opencode-windows-x64": "3.0.0-beta.8"
|
|
87
|
+
},
|
|
73
88
|
"trustedDependencies": [
|
|
74
89
|
"@ast-grep/cli",
|
|
75
90
|
"@ast-grep/napi",
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// postinstall.mjs
|
|
2
|
+
// Runs after npm install to verify platform binary is available
|
|
3
|
+
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { getPlatformPackage, getBinaryPath } from "./bin/platform.js";
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Detect libc family on Linux
|
|
11
|
+
*/
|
|
12
|
+
function getLibcFamily() {
|
|
13
|
+
if (process.platform !== "linux") {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const detectLibc = require("detect-libc");
|
|
19
|
+
return detectLibc.familySync();
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main() {
|
|
26
|
+
const { platform, arch } = process;
|
|
27
|
+
const libcFamily = getLibcFamily();
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const pkg = getPlatformPackage({ platform, arch, libcFamily });
|
|
31
|
+
const binPath = getBinaryPath(pkg, platform);
|
|
32
|
+
|
|
33
|
+
// Try to resolve the binary
|
|
34
|
+
require.resolve(binPath);
|
|
35
|
+
console.log(`✓ oh-my-opencode binary installed for ${platform}-${arch}`);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.warn(`⚠ oh-my-opencode: ${error.message}`);
|
|
38
|
+
console.warn(` The CLI may not work on this platform.`);
|
|
39
|
+
// Don't fail installation - let user try anyway
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
main();
|