@opencode-ai/plugin 0.0.0-dev-202604131734 → 0.0.0-dev-202604131812
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/example-workspace.d.ts +3 -0
- package/dist/example-workspace.js +30 -0
- package/dist/index.d.ts +28 -0
- package/package.json +2 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { mkdir, rm } from "node:fs/promises";
|
|
2
|
+
export const FolderWorkspacePlugin = async ({ experimental_workspace }) => {
|
|
3
|
+
experimental_workspace.register("folder", {
|
|
4
|
+
name: "Folder",
|
|
5
|
+
description: "Create a blank folder",
|
|
6
|
+
configure(config) {
|
|
7
|
+
const rand = "" + Math.random();
|
|
8
|
+
return {
|
|
9
|
+
...config,
|
|
10
|
+
directory: `/tmp/folder/folder-${rand}`,
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
async create(config) {
|
|
14
|
+
if (!config.directory)
|
|
15
|
+
return;
|
|
16
|
+
await mkdir(config.directory, { recursive: true });
|
|
17
|
+
},
|
|
18
|
+
async remove(config) {
|
|
19
|
+
await rm(config.directory, { recursive: true, force: true });
|
|
20
|
+
},
|
|
21
|
+
target(config) {
|
|
22
|
+
return {
|
|
23
|
+
type: "local",
|
|
24
|
+
directory: config.directory,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return {};
|
|
29
|
+
};
|
|
30
|
+
export default FolderWorkspacePlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,11 +8,39 @@ export type ProviderContext = {
|
|
|
8
8
|
info: Provider;
|
|
9
9
|
options: Record<string, any>;
|
|
10
10
|
};
|
|
11
|
+
export type WorkspaceInfo = {
|
|
12
|
+
id: string;
|
|
13
|
+
type: string;
|
|
14
|
+
name: string;
|
|
15
|
+
branch: string | null;
|
|
16
|
+
directory: string | null;
|
|
17
|
+
extra: unknown | null;
|
|
18
|
+
projectID: string;
|
|
19
|
+
};
|
|
20
|
+
export type WorkspaceTarget = {
|
|
21
|
+
type: "local";
|
|
22
|
+
directory: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "remote";
|
|
25
|
+
url: string | URL;
|
|
26
|
+
headers?: HeadersInit;
|
|
27
|
+
};
|
|
28
|
+
export type WorkspaceAdaptor = {
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
configure(config: WorkspaceInfo): WorkspaceInfo | Promise<WorkspaceInfo>;
|
|
32
|
+
create(config: WorkspaceInfo, from?: WorkspaceInfo): Promise<void>;
|
|
33
|
+
remove(config: WorkspaceInfo): Promise<void>;
|
|
34
|
+
target(config: WorkspaceInfo): WorkspaceTarget | Promise<WorkspaceTarget>;
|
|
35
|
+
};
|
|
11
36
|
export type PluginInput = {
|
|
12
37
|
client: ReturnType<typeof createOpencodeClient>;
|
|
13
38
|
project: Project;
|
|
14
39
|
directory: string;
|
|
15
40
|
worktree: string;
|
|
41
|
+
experimental_workspace: {
|
|
42
|
+
register(type: string, adaptor: WorkspaceAdaptor): void;
|
|
43
|
+
};
|
|
16
44
|
serverUrl: URL;
|
|
17
45
|
$: BunShell;
|
|
18
46
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode-ai/plugin",
|
|
4
|
-
"version": "0.0.0-dev-
|
|
4
|
+
"version": "0.0.0-dev-202604131812",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@opencode-ai/sdk": "0.0.0-dev-
|
|
29
|
+
"@opencode-ai/sdk": "0.0.0-dev-202604131812",
|
|
30
30
|
"effect": "4.0.0-beta.46",
|
|
31
31
|
"zod": "4.1.8"
|
|
32
32
|
},
|