@cleocode/adapters 2026.3.42 → 2026.3.44
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/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/claude-code/adapter.d.ts +75 -0
- package/dist/providers/claude-code/adapter.d.ts.map +1 -0
- package/dist/providers/claude-code/context-monitor.d.ts +24 -0
- package/dist/providers/claude-code/context-monitor.d.ts.map +1 -0
- package/dist/providers/claude-code/hooks.d.ts +59 -0
- package/dist/providers/claude-code/hooks.d.ts.map +1 -0
- package/dist/providers/claude-code/index.d.ts +24 -0
- package/dist/providers/claude-code/index.d.ts.map +1 -0
- package/dist/providers/claude-code/install.d.ts +75 -0
- package/dist/providers/claude-code/install.d.ts.map +1 -0
- package/dist/providers/claude-code/paths.d.ts +24 -0
- package/dist/providers/claude-code/paths.d.ts.map +1 -0
- package/dist/providers/claude-code/spawn.d.ts +60 -0
- package/dist/providers/claude-code/spawn.d.ts.map +1 -0
- package/dist/providers/claude-code/statusline.d.ts +24 -0
- package/dist/providers/claude-code/statusline.d.ts.map +1 -0
- package/dist/providers/claude-code/task-sync.d.ts +24 -0
- package/dist/providers/claude-code/task-sync.d.ts.map +1 -0
- package/dist/providers/claude-code/transport.d.ts +14 -0
- package/dist/providers/claude-code/transport.d.ts.map +1 -0
- package/dist/providers/cursor/adapter.d.ts +62 -0
- package/dist/providers/cursor/adapter.d.ts.map +1 -0
- package/dist/providers/cursor/hooks.d.ts +48 -0
- package/dist/providers/cursor/hooks.d.ts.map +1 -0
- package/dist/providers/cursor/index.d.ts +19 -0
- package/dist/providers/cursor/index.d.ts.map +1 -0
- package/dist/providers/cursor/install.d.ts +94 -0
- package/dist/providers/cursor/install.d.ts.map +1 -0
- package/dist/providers/cursor/spawn.d.ts +50 -0
- package/dist/providers/cursor/spawn.d.ts.map +1 -0
- package/dist/providers/opencode/adapter.d.ts +67 -0
- package/dist/providers/opencode/adapter.d.ts.map +1 -0
- package/dist/providers/opencode/hooks.d.ts +66 -0
- package/dist/providers/opencode/hooks.d.ts.map +1 -0
- package/dist/providers/opencode/index.d.ts +20 -0
- package/dist/providers/opencode/index.d.ts.map +1 -0
- package/dist/providers/opencode/install.d.ts +65 -0
- package/dist/providers/opencode/install.d.ts.map +1 -0
- package/dist/providers/opencode/spawn.d.ts +72 -0
- package/dist/providers/opencode/spawn.d.ts.map +1 -0
- package/dist/registry.d.ts +36 -0
- package/dist/registry.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Install Provider
|
|
3
|
+
*
|
|
4
|
+
* Handles CLEO installation into Cursor environments:
|
|
5
|
+
* - Registers CLEO MCP server in .cursor/mcp.json
|
|
6
|
+
* - Ensures .cursorrules has CLEO @-references (legacy format)
|
|
7
|
+
* - Creates .cursor/rules/cleo.mdc with CLEO references (modern format)
|
|
8
|
+
*
|
|
9
|
+
* Cursor supports two instruction file formats:
|
|
10
|
+
* 1. Legacy: .cursorrules (flat file, project root)
|
|
11
|
+
* 2. Modern: .cursor/rules/*.mdc (MDC format, per-rule files)
|
|
12
|
+
*
|
|
13
|
+
* This provider writes to both for maximum compatibility.
|
|
14
|
+
*
|
|
15
|
+
* @task T5240
|
|
16
|
+
*/
|
|
17
|
+
import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
|
|
18
|
+
/**
|
|
19
|
+
* Install provider for Cursor.
|
|
20
|
+
*
|
|
21
|
+
* Manages CLEO's integration with Cursor by:
|
|
22
|
+
* 1. Registering the CLEO MCP server in .cursor/mcp.json
|
|
23
|
+
* 2. Creating/updating .cursorrules with @-references (legacy)
|
|
24
|
+
* 3. Creating .cursor/rules/cleo.mdc with @-references (modern)
|
|
25
|
+
*/
|
|
26
|
+
export declare class CursorInstallProvider implements AdapterInstallProvider {
|
|
27
|
+
private installedProjectDir;
|
|
28
|
+
/**
|
|
29
|
+
* Install CLEO into a Cursor project.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Installation options including project directory and MCP server path
|
|
32
|
+
* @returns Result describing what was installed
|
|
33
|
+
*/
|
|
34
|
+
install(options: InstallOptions): Promise<InstallResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Uninstall CLEO from the current Cursor project.
|
|
37
|
+
*
|
|
38
|
+
* Removes the MCP server registration from .cursor/mcp.json.
|
|
39
|
+
* Does not remove instruction file references (they are harmless if CLEO is not present).
|
|
40
|
+
*/
|
|
41
|
+
uninstall(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Check whether CLEO is installed in the current environment.
|
|
44
|
+
*
|
|
45
|
+
* Checks for MCP server registered in .cursor/mcp.json.
|
|
46
|
+
*/
|
|
47
|
+
isInstalled(): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Ensure instruction files contain @-references to CLEO.
|
|
50
|
+
*
|
|
51
|
+
* Updates .cursorrules (legacy) and creates .cursor/rules/cleo.mdc (modern).
|
|
52
|
+
*
|
|
53
|
+
* @param projectDir - Project root directory
|
|
54
|
+
*/
|
|
55
|
+
ensureInstructionReferences(projectDir: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Register the CLEO MCP server in .cursor/mcp.json.
|
|
58
|
+
*
|
|
59
|
+
* Cursor stores MCP server configuration in .cursor/mcp.json
|
|
60
|
+
* under the mcpServers key.
|
|
61
|
+
*
|
|
62
|
+
* @returns true if registration was performed or updated
|
|
63
|
+
*/
|
|
64
|
+
private registerMcpServer;
|
|
65
|
+
/**
|
|
66
|
+
* Update instruction files with CLEO @-references.
|
|
67
|
+
*
|
|
68
|
+
* Handles both legacy (.cursorrules) and modern (.cursor/rules/cleo.mdc) formats.
|
|
69
|
+
*
|
|
70
|
+
* @returns true if any file was created or modified
|
|
71
|
+
*/
|
|
72
|
+
private updateInstructionFiles;
|
|
73
|
+
/**
|
|
74
|
+
* Update legacy .cursorrules file with @-references.
|
|
75
|
+
* Only modifies the file if it already exists (does not create it).
|
|
76
|
+
*
|
|
77
|
+
* @returns true if the file was modified
|
|
78
|
+
*/
|
|
79
|
+
private updateLegacyRules;
|
|
80
|
+
/**
|
|
81
|
+
* Create or update .cursor/rules/cleo.mdc with CLEO references.
|
|
82
|
+
*
|
|
83
|
+
* MDC (Markdown Component) format is Cursor's modern rule file format.
|
|
84
|
+
* Each .mdc file in .cursor/rules/ is loaded as a rule set.
|
|
85
|
+
*
|
|
86
|
+
* @returns true if the file was created or modified
|
|
87
|
+
*/
|
|
88
|
+
private updateModernRules;
|
|
89
|
+
/**
|
|
90
|
+
* Get list of instruction files that were updated.
|
|
91
|
+
*/
|
|
92
|
+
private getUpdatedFileList;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/cursor/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQjG;;;;;;;GAOG;AACH,qBAAa,qBAAsB,YAAW,sBAAsB;IAClE,OAAO,CAAC,mBAAmB,CAAuB;IAElD;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAgC9D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAiBrC;;;;;;OAMG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IA6BzB;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAgB9B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAmBzB;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAQ3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Spawn Provider
|
|
3
|
+
*
|
|
4
|
+
* Cursor is a GUI-based AI code editor and does not support
|
|
5
|
+
* CLI-based subagent spawning. This provider implements
|
|
6
|
+
* the AdapterSpawnProvider interface with appropriate rejections.
|
|
7
|
+
*
|
|
8
|
+
* @task T5240
|
|
9
|
+
*/
|
|
10
|
+
import type { AdapterSpawnProvider, SpawnContext, SpawnResult } from '@cleocode/contracts';
|
|
11
|
+
/**
|
|
12
|
+
* Spawn provider for Cursor.
|
|
13
|
+
*
|
|
14
|
+
* Cursor does not support subagent spawning via CLI. The adapter
|
|
15
|
+
* declares supportsSpawn: false in its capabilities. All methods
|
|
16
|
+
* either reject or return empty results.
|
|
17
|
+
*/
|
|
18
|
+
export declare class CursorSpawnProvider implements AdapterSpawnProvider {
|
|
19
|
+
/**
|
|
20
|
+
* Check if Cursor supports spawning subagents.
|
|
21
|
+
*
|
|
22
|
+
* @returns false (Cursor does not support CLI spawning)
|
|
23
|
+
*/
|
|
24
|
+
canSpawn(): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Attempt to spawn a subagent via Cursor.
|
|
27
|
+
*
|
|
28
|
+
* Always throws because Cursor does not support subagent spawning.
|
|
29
|
+
* Callers should check canSpawn() before calling this method.
|
|
30
|
+
*
|
|
31
|
+
* @param _context - Unused; spawning is not supported
|
|
32
|
+
* @throws Error explaining that Cursor does not support subagent spawning
|
|
33
|
+
*/
|
|
34
|
+
spawn(_context: SpawnContext): Promise<SpawnResult>;
|
|
35
|
+
/**
|
|
36
|
+
* List running Cursor subagent processes.
|
|
37
|
+
*
|
|
38
|
+
* @returns Empty array (no processes can be spawned)
|
|
39
|
+
*/
|
|
40
|
+
listRunning(): Promise<SpawnResult[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Terminate a Cursor subagent process.
|
|
43
|
+
*
|
|
44
|
+
* No-op because Cursor cannot spawn processes.
|
|
45
|
+
*
|
|
46
|
+
* @param _instanceId - Unused; no processes to terminate
|
|
47
|
+
*/
|
|
48
|
+
terminate(_instanceId: string): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=spawn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/providers/cursor/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE3F;;;;;;GAMG;AACH,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC;;;;;;;;OAQG;IACG,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAQzD;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAI3C;;;;;;OAMG;IACG,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Adapter
|
|
3
|
+
*
|
|
4
|
+
* Main CLEOProviderAdapter implementation for OpenCode AI coding assistant.
|
|
5
|
+
* Provides spawn, hooks, and install capabilities for CLEO integration.
|
|
6
|
+
*
|
|
7
|
+
* @task T5240
|
|
8
|
+
*/
|
|
9
|
+
import type { AdapterCapabilities, AdapterHealthStatus, CLEOProviderAdapter } from '@cleocode/contracts';
|
|
10
|
+
import { OpenCodeHookProvider } from './hooks.js';
|
|
11
|
+
import { OpenCodeInstallProvider } from './install.js';
|
|
12
|
+
import { OpenCodeSpawnProvider } from './spawn.js';
|
|
13
|
+
/**
|
|
14
|
+
* CLEO provider adapter for OpenCode AI coding assistant.
|
|
15
|
+
*
|
|
16
|
+
* Bridges CLEO's adapter system with OpenCode's native capabilities:
|
|
17
|
+
* - Hooks: Maps OpenCode events (session.start, tool.complete, etc.) to CAAMP events
|
|
18
|
+
* - Spawn: Launches subagent processes via the `opencode` CLI
|
|
19
|
+
* - Install: Registers MCP server in .opencode/config.json and ensures AGENTS.md references
|
|
20
|
+
*/
|
|
21
|
+
export declare class OpenCodeAdapter implements CLEOProviderAdapter {
|
|
22
|
+
readonly id = "opencode";
|
|
23
|
+
readonly name = "OpenCode";
|
|
24
|
+
readonly version = "1.0.0";
|
|
25
|
+
capabilities: AdapterCapabilities;
|
|
26
|
+
hooks: OpenCodeHookProvider;
|
|
27
|
+
spawn: OpenCodeSpawnProvider;
|
|
28
|
+
install: OpenCodeInstallProvider;
|
|
29
|
+
private projectDir;
|
|
30
|
+
private initialized;
|
|
31
|
+
constructor();
|
|
32
|
+
/**
|
|
33
|
+
* Initialize the adapter for a given project directory.
|
|
34
|
+
*
|
|
35
|
+
* Validates the environment by checking for the OpenCode CLI
|
|
36
|
+
* and OpenCode configuration directory.
|
|
37
|
+
*
|
|
38
|
+
* @param projectDir - Root directory of the project
|
|
39
|
+
*/
|
|
40
|
+
initialize(projectDir: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Dispose the adapter and clean up resources.
|
|
43
|
+
*
|
|
44
|
+
* Unregisters hooks and releases any tracked state.
|
|
45
|
+
*/
|
|
46
|
+
dispose(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Run a health check to verify OpenCode is accessible.
|
|
49
|
+
*
|
|
50
|
+
* Checks:
|
|
51
|
+
* 1. Adapter has been initialized
|
|
52
|
+
* 2. OpenCode CLI is available in PATH
|
|
53
|
+
* 3. .opencode/ configuration directory exists in the project
|
|
54
|
+
*
|
|
55
|
+
* @returns Health status with details about each check
|
|
56
|
+
*/
|
|
57
|
+
healthCheck(): Promise<AdapterHealthStatus>;
|
|
58
|
+
/**
|
|
59
|
+
* Check whether the adapter has been initialized.
|
|
60
|
+
*/
|
|
61
|
+
isInitialized(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Get the project directory this adapter was initialized with.
|
|
64
|
+
*/
|
|
65
|
+
getProjectDir(): string | null;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAInD;;;;;;;GAOG;AACH,qBAAa,eAAgB,YAAW,mBAAmB;IACzD,QAAQ,CAAC,EAAE,cAAc;IACzB,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,OAAO,WAAW;IAE3B,YAAY,EAAE,mBAAmB,CAoB/B;IAEF,KAAK,EAAE,oBAAoB,CAAC;IAC5B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,EAAE,uBAAuB,CAAC;IAEjC,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,WAAW,CAAS;;IAQ5B;;;;;;;OAOG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnD;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IA2CjD;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;CAG/B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Hook Provider
|
|
3
|
+
*
|
|
4
|
+
* Maps OpenCode's native hook events to CAAMP hook events.
|
|
5
|
+
* OpenCode supports 6 of 8 CAAMP events through its agent/hook system.
|
|
6
|
+
*
|
|
7
|
+
* OpenCode event mapping:
|
|
8
|
+
* - session.start -> onSessionStart
|
|
9
|
+
* - session.end -> onSessionEnd
|
|
10
|
+
* - tool.start -> onToolStart
|
|
11
|
+
* - tool.complete -> onToolComplete
|
|
12
|
+
* - error -> onError
|
|
13
|
+
* - prompt.submit -> onPromptSubmit
|
|
14
|
+
*
|
|
15
|
+
* @task T5240
|
|
16
|
+
*/
|
|
17
|
+
import type { AdapterHookProvider } from '@cleocode/contracts';
|
|
18
|
+
/**
|
|
19
|
+
* Hook provider for OpenCode.
|
|
20
|
+
*
|
|
21
|
+
* OpenCode registers hooks via its configuration system at
|
|
22
|
+
* .opencode/config.json. Hook handlers are defined as shell commands
|
|
23
|
+
* or script paths that execute when the corresponding event fires.
|
|
24
|
+
*
|
|
25
|
+
* Since hooks are registered through the config system (managed by
|
|
26
|
+
* the install provider), registerNativeHooks and unregisterNativeHooks
|
|
27
|
+
* track registration state without performing filesystem operations.
|
|
28
|
+
*/
|
|
29
|
+
export declare class OpenCodeHookProvider implements AdapterHookProvider {
|
|
30
|
+
private registered;
|
|
31
|
+
/**
|
|
32
|
+
* Map an OpenCode native event name to a CAAMP hook event name.
|
|
33
|
+
*
|
|
34
|
+
* @param providerEvent - OpenCode event name (e.g. "session.start", "tool.complete")
|
|
35
|
+
* @returns CAAMP event name or null if unmapped
|
|
36
|
+
*/
|
|
37
|
+
mapProviderEvent(providerEvent: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Register native hooks for a project.
|
|
40
|
+
*
|
|
41
|
+
* For OpenCode, hooks are registered via the config system
|
|
42
|
+
* (.opencode/config.json), which is handled by the install provider.
|
|
43
|
+
* This method marks hooks as registered without performing
|
|
44
|
+
* filesystem operations.
|
|
45
|
+
*
|
|
46
|
+
* @param _projectDir - Project directory (unused; config manages registration)
|
|
47
|
+
*/
|
|
48
|
+
registerNativeHooks(_projectDir: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Unregister native hooks.
|
|
51
|
+
*
|
|
52
|
+
* For OpenCode, this is a no-op since hooks are managed through
|
|
53
|
+
* the config system. Unregistration happens via the install
|
|
54
|
+
* provider's uninstall method.
|
|
55
|
+
*/
|
|
56
|
+
unregisterNativeHooks(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Check whether hooks have been registered via registerNativeHooks.
|
|
59
|
+
*/
|
|
60
|
+
isRegistered(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Get the full event mapping for introspection/debugging.
|
|
63
|
+
*/
|
|
64
|
+
getEventMap(): Readonly<Record<string, string>>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAiB/D;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,YAAW,mBAAmB;IAC9D,OAAO,CAAC,UAAU,CAAS;IAE3B;;;;;OAKG;IACH,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAItD;;;;;;;;;OASG;IACG,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7D;;;;;;OAMG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,WAAW,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAGhD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode provider adapter.
|
|
3
|
+
*
|
|
4
|
+
* CLEO provider adapter for OpenCode AI coding assistant.
|
|
5
|
+
* Default export is the adapter class for dynamic loading by AdapterManager.
|
|
6
|
+
*
|
|
7
|
+
* @task T5240
|
|
8
|
+
*/
|
|
9
|
+
import { OpenCodeAdapter } from './adapter.js';
|
|
10
|
+
export { OpenCodeAdapter } from './adapter.js';
|
|
11
|
+
export { OpenCodeHookProvider } from './hooks.js';
|
|
12
|
+
export { OpenCodeInstallProvider } from './install.js';
|
|
13
|
+
export { OpenCodeSpawnProvider } from './spawn.js';
|
|
14
|
+
export default OpenCodeAdapter;
|
|
15
|
+
/**
|
|
16
|
+
* Factory function for creating adapter instances.
|
|
17
|
+
* Used by AdapterManager's dynamic import fallback.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createAdapter(): OpenCodeAdapter;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,eAAe,eAAe,CAAC;AAE/B;;;GAGG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAE/C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Install Provider
|
|
3
|
+
*
|
|
4
|
+
* Handles CLEO installation into OpenCode environments:
|
|
5
|
+
* - Registers CLEO MCP server in .opencode/config.json
|
|
6
|
+
* - Ensures AGENTS.md has CLEO @-references
|
|
7
|
+
*
|
|
8
|
+
* @task T5240
|
|
9
|
+
*/
|
|
10
|
+
import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
|
|
11
|
+
/**
|
|
12
|
+
* Install provider for OpenCode.
|
|
13
|
+
*
|
|
14
|
+
* Manages CLEO's integration with OpenCode by:
|
|
15
|
+
* 1. Registering the CLEO MCP server in .opencode/config.json
|
|
16
|
+
* 2. Ensuring AGENTS.md contains @-references to CLEO instruction files
|
|
17
|
+
*/
|
|
18
|
+
export declare class OpenCodeInstallProvider implements AdapterInstallProvider {
|
|
19
|
+
private installedProjectDir;
|
|
20
|
+
/**
|
|
21
|
+
* Install CLEO into an OpenCode project.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Installation options including project directory and MCP server path
|
|
24
|
+
* @returns Result describing what was installed
|
|
25
|
+
*/
|
|
26
|
+
install(options: InstallOptions): Promise<InstallResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Uninstall CLEO from the current OpenCode project.
|
|
29
|
+
*
|
|
30
|
+
* Removes the MCP server registration from .opencode/config.json.
|
|
31
|
+
* Does not remove AGENTS.md references (they are harmless if CLEO is not present).
|
|
32
|
+
*/
|
|
33
|
+
uninstall(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Check whether CLEO is installed in the current environment.
|
|
36
|
+
*
|
|
37
|
+
* Checks for MCP server registered in .opencode/config.json.
|
|
38
|
+
* Returns true if the CLEO MCP server entry is found.
|
|
39
|
+
*/
|
|
40
|
+
isInstalled(): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Ensure AGENTS.md contains @-references to CLEO instruction files.
|
|
43
|
+
*
|
|
44
|
+
* Creates AGENTS.md if it does not exist. Appends any missing references.
|
|
45
|
+
*
|
|
46
|
+
* @param projectDir - Project root directory
|
|
47
|
+
*/
|
|
48
|
+
ensureInstructionReferences(projectDir: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Register the CLEO MCP server in .opencode/config.json.
|
|
51
|
+
*
|
|
52
|
+
* OpenCode stores its MCP server configuration in .opencode/config.json
|
|
53
|
+
* under the mcpServers key.
|
|
54
|
+
*
|
|
55
|
+
* @returns true if registration was performed or updated
|
|
56
|
+
*/
|
|
57
|
+
private registerMcpServer;
|
|
58
|
+
/**
|
|
59
|
+
* Update AGENTS.md with CLEO @-references.
|
|
60
|
+
*
|
|
61
|
+
* @returns true if the file was created or modified
|
|
62
|
+
*/
|
|
63
|
+
private updateInstructionFile;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQjG;;;;;;GAMG;AACH,qBAAa,uBAAwB,YAAW,sBAAsB;IACpE,OAAO,CAAC,mBAAmB,CAAuB;IAElD;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAgC9D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAkBrC;;;;;;OAMG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IA6BzB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;CA8B9B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Spawn Provider
|
|
3
|
+
*
|
|
4
|
+
* Implements AdapterSpawnProvider for OpenCode CLI.
|
|
5
|
+
* Migrated from src/core/spawn/adapters/opencode-adapter.ts
|
|
6
|
+
*
|
|
7
|
+
* Uses `opencode run --agent ... --format json` to spawn subagent
|
|
8
|
+
* processes. Processes run detached and are tracked by PID for
|
|
9
|
+
* listing and termination.
|
|
10
|
+
*
|
|
11
|
+
* @task T5240
|
|
12
|
+
*/
|
|
13
|
+
import type { AdapterSpawnProvider, SpawnContext, SpawnResult } from '@cleocode/contracts';
|
|
14
|
+
/**
|
|
15
|
+
* Build the markdown content for an OpenCode agent definition file.
|
|
16
|
+
*
|
|
17
|
+
* OpenCode agents are defined as markdown files with YAML frontmatter
|
|
18
|
+
* in the .opencode/agent/ directory.
|
|
19
|
+
*
|
|
20
|
+
* @param description - Agent description for frontmatter
|
|
21
|
+
* @param instructions - Markdown instructions body
|
|
22
|
+
* @returns Complete agent definition markdown
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildOpenCodeAgentMarkdown(description: string, instructions: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Spawn provider for OpenCode.
|
|
27
|
+
*
|
|
28
|
+
* Spawns detached OpenCode CLI processes for subagent execution.
|
|
29
|
+
* Each spawn ensures a CLEO subagent definition exists, then runs
|
|
30
|
+
* `opencode run --format json --agent <name> --title <title> <prompt>`
|
|
31
|
+
* as a detached, unref'd child process.
|
|
32
|
+
*/
|
|
33
|
+
export declare class OpenCodeSpawnProvider implements AdapterSpawnProvider {
|
|
34
|
+
/** Map of instance IDs to tracked process info. */
|
|
35
|
+
private processMap;
|
|
36
|
+
/**
|
|
37
|
+
* Check if the OpenCode CLI is available in PATH.
|
|
38
|
+
*
|
|
39
|
+
* @returns true if `opencode` is found via `which`
|
|
40
|
+
*/
|
|
41
|
+
canSpawn(): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Spawn a subagent via OpenCode CLI.
|
|
44
|
+
*
|
|
45
|
+
* Ensures the CLEO subagent definition exists in the project's
|
|
46
|
+
* .opencode/agent/ directory, then spawns a detached OpenCode
|
|
47
|
+
* process. The process runs independently of the parent.
|
|
48
|
+
*
|
|
49
|
+
* @param context - Spawn context with taskId, prompt, and options
|
|
50
|
+
* @returns Spawn result with instance ID and status
|
|
51
|
+
*/
|
|
52
|
+
spawn(context: SpawnContext): Promise<SpawnResult>;
|
|
53
|
+
/**
|
|
54
|
+
* List currently running OpenCode subagent processes.
|
|
55
|
+
*
|
|
56
|
+
* Checks each tracked process via kill(pid, 0) to verify it is still alive.
|
|
57
|
+
* Dead processes are automatically cleaned from the tracking map.
|
|
58
|
+
*
|
|
59
|
+
* @returns Array of spawn results for running processes
|
|
60
|
+
*/
|
|
61
|
+
listRunning(): Promise<SpawnResult[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Terminate a running spawn by instance ID.
|
|
64
|
+
*
|
|
65
|
+
* Sends SIGTERM to the tracked process. If the process is not found
|
|
66
|
+
* or has already exited, this is a no-op.
|
|
67
|
+
*
|
|
68
|
+
* @param instanceId - ID of the spawn instance to terminate
|
|
69
|
+
*/
|
|
70
|
+
terminate(instanceId: string): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=spawn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAiB3F;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAY5F;AA0CD;;;;;;;GAOG;AACH,qBAAa,qBAAsB,YAAW,oBAAoB;IAChE,mDAAmD;IACnD,OAAO,CAAC,UAAU,CAAqC;IAEvD;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IASlC;;;;;;;;;OASG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAiExD;;;;;;;OAOG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAqB3C;;;;;;;OAOG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAWnD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter registry — discovers and provides access to provider manifests.
|
|
3
|
+
*
|
|
4
|
+
* Scans the providers/ directory for manifest.json files and returns
|
|
5
|
+
* the discovered adapter manifests for use by AdapterManager.
|
|
6
|
+
*
|
|
7
|
+
* @task T5240
|
|
8
|
+
*/
|
|
9
|
+
/** Minimal manifest shape for provider discovery. */
|
|
10
|
+
export interface AdapterManifest {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
version: string;
|
|
14
|
+
description: string;
|
|
15
|
+
provider: string;
|
|
16
|
+
entryPoint: string;
|
|
17
|
+
capabilities: Record<string, unknown>;
|
|
18
|
+
detectionPatterns: Array<{
|
|
19
|
+
type: string;
|
|
20
|
+
pattern: string;
|
|
21
|
+
description: string;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the manifests for all bundled provider adapters.
|
|
26
|
+
*
|
|
27
|
+
* @returns Array of adapter manifests
|
|
28
|
+
*/
|
|
29
|
+
export declare function getProviderManifests(): AdapterManifest[];
|
|
30
|
+
/**
|
|
31
|
+
* Discover all available provider adapters.
|
|
32
|
+
*
|
|
33
|
+
* Returns a map of provider ID to adapter factory function.
|
|
34
|
+
*/
|
|
35
|
+
export declare function discoverProviders(): Promise<Map<string, () => Promise<unknown>>>;
|
|
36
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,qDAAqD;AACrD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,iBAAiB,EAAE,KAAK,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;CACJ;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,eAAe,EAAE,CAexD;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAmBtF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/adapters",
|
|
3
|
-
"version": "2026.3.
|
|
3
|
+
"version": "2026.3.44",
|
|
4
4
|
"description": "Unified provider adapters for CLEO (Claude Code, OpenCode, Cursor)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@cleocode/contracts": "2026.3.
|
|
15
|
+
"@cleocode/contracts": "2026.3.44"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"engines": {
|