@mirrowel/opencode-openshare 0.0.0-stage → 0.1.1

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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +181 -2
  3. package/ci/README.md +56 -0
  4. package/ci/openshare.config.json +10 -0
  5. package/ci/openshare.js +2270 -0
  6. package/dist/commands.d.ts +7 -0
  7. package/dist/commands.js +440 -0
  8. package/dist/config.d.ts +138 -0
  9. package/dist/config.js +524 -0
  10. package/dist/core.d.ts +117 -0
  11. package/dist/core.js +1944 -0
  12. package/dist/dialogs.d.ts +94 -0
  13. package/dist/dialogs.js +725 -0
  14. package/dist/server.d.ts +64 -0
  15. package/dist/server.js +30 -0
  16. package/dist/settings.d.ts +24 -0
  17. package/dist/settings.js +1226 -0
  18. package/dist/share-flow.d.ts +287 -0
  19. package/dist/share-flow.js +516 -0
  20. package/dist/sidebar.d.ts +19 -0
  21. package/dist/sidebar.js +144 -0
  22. package/dist/tui-host.d.ts +158 -0
  23. package/dist/tui-host.js +6 -0
  24. package/dist/tui.d.ts +17 -0
  25. package/dist/tui.js +4719 -0
  26. package/dist/ui-prefs.d.ts +16 -0
  27. package/dist/ui-prefs.js +27 -0
  28. package/dist/v2-server.d.ts +81 -0
  29. package/dist/v2-server.js +402 -0
  30. package/dist/v2-tui.d.ts +24 -0
  31. package/dist/v2-tui.js +313 -0
  32. package/dist/v2-types.d.ts +134 -0
  33. package/dist/v2-types.js +8 -0
  34. package/openshare.config.json +16 -0
  35. package/package.json +98 -4
  36. package/src/banner.txt +25 -0
  37. package/src/commands.ts +452 -0
  38. package/src/config.ts +524 -0
  39. package/src/core.ts +1997 -0
  40. package/src/dialogs.tsx +971 -0
  41. package/src/server.ts +47 -0
  42. package/src/settings.ts +1239 -0
  43. package/src/share-flow.ts +551 -0
  44. package/src/sidebar.tsx +187 -0
  45. package/src/tui-host.ts +134 -0
  46. package/src/tui.tsx +318 -0
  47. package/src/ui-prefs.ts +36 -0
  48. package/src/v2-server.ts +438 -0
  49. package/src/v2-tui.ts +315 -0
  50. package/src/v2-types.ts +102 -0
  51. package/tsconfig.json +18 -0
package/src/server.ts ADDED
@@ -0,0 +1,47 @@
1
+ // Open(code)Share — server plugin entry.
2
+ //
3
+ // Dual-target:
4
+ // - OpenCode v1 invokes the `server` factory with (input, options); the
5
+ // input carries the SDK client, directory and worktree.
6
+ // - OpenCode v2 validates `default` as `{ id, setup }` and calls setup
7
+ // with the v2 plugin context (see v2-server.ts).
8
+ // The excess keys are ignored by the other host, so one default export
9
+ // serves both loaders.
10
+
11
+ import { moduleDir } from "./config.js"
12
+ import { createEngine, type Engine, type EngineDeps } from "./core.js"
13
+ import { createV2ServerSetup } from "./v2-server.js"
14
+
15
+ export const PLUGIN_ID = "openshare"
16
+
17
+ type V1PluginInput = {
18
+ client?: EngineDeps["client"]
19
+ directory?: string
20
+ worktree?: string
21
+ [key: string]: unknown
22
+ }
23
+
24
+ export type V1Plugin = (
25
+ input: V1PluginInput,
26
+ options?: Record<string, unknown>,
27
+ ) => Promise<Engine["hooks"] | Record<string, never>>
28
+
29
+ export const OpenSharePlugin: V1Plugin = async (input, options) => {
30
+ const deps: EngineDeps = {
31
+ client: input?.client as EngineDeps["client"],
32
+ directory: typeof input?.directory === "string" ? input.directory : undefined,
33
+ worktree: typeof input?.worktree === "string" ? input.worktree : undefined,
34
+ pluginDir: moduleDir(),
35
+ options,
36
+ }
37
+ const engine = createEngine(deps)
38
+ return engine.hooks
39
+ }
40
+
41
+ const server = OpenSharePlugin
42
+
43
+ export default {
44
+ id: PLUGIN_ID,
45
+ server,
46
+ setup: createV2ServerSetup(),
47
+ }