@junwu168/openshell 0.1.2 → 0.1.4

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 (61) hide show
  1. package/dist/cli/openshell.js +4 -0
  2. package/dist/core/audit/log-store.js +1 -1
  3. package/dist/core/orchestrator.d.ts +2 -2
  4. package/dist/core/orchestrator.js +3 -3
  5. package/dist/core/result.d.ts +1 -1
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +3 -3
  8. package/dist/opencode/plugin.d.ts +1 -1
  9. package/dist/opencode/plugin.js +8 -8
  10. package/package.json +6 -1
  11. package/.claude/settings.local.json +0 -15
  12. package/bun.lock +0 -368
  13. package/docs/superpowers/notes/2026-03-25-opencode-remote-tools-handoff.md +0 -81
  14. package/docs/superpowers/notes/2026-03-26-openshell-pre-release-review.md +0 -174
  15. package/docs/superpowers/plans/2026-03-25-opencode-remote-tools.md +0 -1656
  16. package/docs/superpowers/plans/2026-03-25-server-registry-cli.md +0 -54
  17. package/docs/superpowers/plans/2026-03-26-config-backed-credential-registry.md +0 -494
  18. package/docs/superpowers/plans/2026-03-26-openshell-release-prep.md +0 -639
  19. package/docs/superpowers/specs/2026-03-25-opencode-remote-tools-design.md +0 -378
  20. package/docs/superpowers/specs/2026-03-26-config-backed-credential-registry-design.md +0 -272
  21. package/docs/superpowers/specs/2026-03-26-openshell-release-prep-design.md +0 -197
  22. package/examples/opencode-local/opencode.json +0 -19
  23. package/scripts/openshell.ts +0 -3
  24. package/scripts/server-registry.ts +0 -3
  25. package/src/cli/openshell.ts +0 -60
  26. package/src/cli/server-registry.ts +0 -476
  27. package/src/core/audit/git-audit-repo.ts +0 -42
  28. package/src/core/audit/log-store.ts +0 -20
  29. package/src/core/audit/redact.ts +0 -4
  30. package/src/core/contracts.ts +0 -51
  31. package/src/core/orchestrator.ts +0 -1082
  32. package/src/core/patch.ts +0 -11
  33. package/src/core/paths.ts +0 -32
  34. package/src/core/policy.ts +0 -30
  35. package/src/core/registry/server-registry.ts +0 -505
  36. package/src/core/result.ts +0 -16
  37. package/src/core/ssh/ssh-runtime.ts +0 -355
  38. package/src/index.ts +0 -3
  39. package/src/opencode/plugin.ts +0 -242
  40. package/src/product/install.ts +0 -43
  41. package/src/product/opencode-config.ts +0 -118
  42. package/src/product/uninstall.ts +0 -47
  43. package/src/product/workspace-tracker.ts +0 -69
  44. package/tests/integration/fake-ssh-server.ts +0 -97
  45. package/tests/integration/install-lifecycle.test.ts +0 -85
  46. package/tests/integration/orchestrator.test.ts +0 -767
  47. package/tests/integration/ssh-runtime.test.ts +0 -122
  48. package/tests/unit/audit.test.ts +0 -221
  49. package/tests/unit/build-layout.test.ts +0 -28
  50. package/tests/unit/opencode-config.test.ts +0 -100
  51. package/tests/unit/opencode-plugin.test.ts +0 -358
  52. package/tests/unit/openshell-cli.test.ts +0 -60
  53. package/tests/unit/paths.test.ts +0 -64
  54. package/tests/unit/plugin-export.test.ts +0 -10
  55. package/tests/unit/policy.test.ts +0 -53
  56. package/tests/unit/release-docs.test.ts +0 -31
  57. package/tests/unit/result.test.ts +0 -28
  58. package/tests/unit/server-registry-cli.test.ts +0 -673
  59. package/tests/unit/server-registry.test.ts +0 -452
  60. package/tests/unit/workspace-tracker.test.ts +0 -57
  61. package/tsconfig.json +0 -14
@@ -1,197 +0,0 @@
1
- # OpenShell Release Prep Design
2
-
3
- Date: 2026-03-26
4
- Branch: `registry-cli`
5
- Status: Approved for planning
6
-
7
- ## Summary
8
-
9
- Prepare the current codebase for a first pre-release review as `@junwu168/openshell` with CLI binary `openshell`.
10
-
11
- The release-prep pass will:
12
-
13
- - rename the product-facing package and CLI identity from the current working name to `openshell`
14
- - make install and uninstall first-class user workflows
15
- - auto-register the OpenCode plugin globally by merging into `~/.config/opencode/opencode.json`
16
- - track touched workspaces so uninstall can remove every `.open-code/` directory created by the product
17
- - clean up user-facing docs, examples, and metadata so the repo reads like a reviewable pre-release product
18
-
19
- This is a productization pass, not a runtime redesign.
20
-
21
- ## Goals
22
-
23
- - Publish as npm package `@junwu168/openshell`
24
- - Expose CLI command `openshell`
25
- - Optimize for global install via npm
26
- - Support only OpenCode as the host integration in v1
27
- - Auto-register the plugin globally in OpenCode config
28
- - Provide a complete uninstall for pre-release testing
29
- - Use `openshell`-owned config/data paths rather than piggybacking on OpenCode for internal product state
30
-
31
- ## Non-Goals
32
-
33
- - Supporting `codex` or `claude code` in this pass
34
- - Stable-release uninstall semantics
35
- - Cross-host plugin abstraction work
36
- - Reworking the remote-tool runtime beyond what naming/install lifecycle requires
37
-
38
- ## Product Identity
39
-
40
- Package name:
41
-
42
- - `@junwu168/openshell`
43
-
44
- CLI binary:
45
-
46
- - `openshell`
47
-
48
- Host integration target:
49
-
50
- - `opencode`
51
-
52
- This separation must stay explicit in docs and code:
53
-
54
- - `openshell` is the installed product
55
- - `opencode` is the host client it integrates with
56
-
57
- ## Product Paths
58
-
59
- OpenShell global product state should live under its own namespace:
60
-
61
- - config: `~/.config/openshell`
62
- - data: `~/.local/share/openshell`
63
-
64
- These paths should be resolved with standard OS-appropriate app-directory helpers, but the logical names stay `openshell`.
65
-
66
- OpenCode config remains where OpenCode expects it:
67
-
68
- - `~/.config/opencode/opencode.json`
69
-
70
- OpenShell must not store its own internal state under `~/.config/opencode` except for the plugin integration artifacts that OpenCode itself needs.
71
-
72
- ## Install Behavior
73
-
74
- `openshell install` should be global-first and mostly non-interactive.
75
-
76
- Responsibilities:
77
-
78
- 1. ensure `openshell` config/data directories exist
79
- 2. install or refresh the OpenCode plugin files in the global OpenCode area
80
- 3. read `~/.config/opencode/opencode.json` if it exists
81
- 4. merge in:
82
- - the `openshell` plugin registration
83
- - the required permission rules for the explicit remote toolset
84
- 5. write the merged config back safely
85
- 6. initialize the workspace-tracker file if missing
86
- 7. print a concise summary of installed artifacts
87
-
88
- Important rules:
89
-
90
- - merge existing OpenCode config, do not replace it
91
- - preserve unrelated plugins, providers, agents, and user settings
92
- - if OpenCode config does not exist yet, create the minimal valid config needed for `openshell`
93
-
94
- ## Uninstall Behavior
95
-
96
- `openshell uninstall` should be aggressively clean during pre-release.
97
-
98
- Responsibilities:
99
-
100
- 1. remove the `openshell` plugin registration from `~/.config/opencode/opencode.json`
101
- 2. remove global OpenCode plugin files installed by `openshell`
102
- 3. read the tracked workspace list from `~/.local/share/openshell`
103
- 4. delete each tracked workspace `.open-code/` directory if it still exists
104
- 5. remove `~/.config/openshell`
105
- 6. remove `~/.local/share/openshell`
106
- 7. print a cleanup summary including failures
107
-
108
- For this unstable phase, uninstall should attempt a complete cleanup rather than a conservative partial one.
109
-
110
- ## Workspace Tracking
111
-
112
- OpenShell should maintain its own registry of touched workspaces under its data directory.
113
-
114
- Tracked information:
115
-
116
- - workspace root path
117
- - managed `.open-code/` path
118
- - optional timestamp of first/last touch
119
-
120
- Usage:
121
-
122
- - install/bootstrap flows append the current workspace when OpenShell creates or manages its local plugin/runtime artifacts
123
- - uninstall reads the tracker and removes all tracked workspace `.open-code/` directories
124
-
125
- This avoids filesystem-wide scanning and makes cleanup deterministic.
126
-
127
- ## OpenCode Integration
128
-
129
- V1 supports only OpenCode.
130
-
131
- OpenShell should install a global OpenCode integration by:
132
-
133
- - writing the OpenShell plugin files where global OpenCode config can reference them
134
- - merging the plugin entry into `~/.config/opencode/opencode.json`
135
- - ensuring the required permissions are present for the explicit remote tools
136
-
137
- The integration should remain explicit. OpenShell is not replacing OpenCode behavior; it is registering an additional plugin/toolset into it.
138
-
139
- ## CLI Surface
140
-
141
- The release-prep pass should make the CLI feel productized.
142
-
143
- Minimum first-class commands:
144
-
145
- - `openshell install`
146
- - `openshell uninstall`
147
- - `openshell server-registry add`
148
- - `openshell server-registry list`
149
- - `openshell server-registry remove`
150
-
151
- The existing registry functionality remains, but it should now live under the `openshell` product surface rather than being a Bun-script-centric workflow.
152
-
153
- ## Repository Cleanup For Pre-Release Review
154
-
155
- This pass should make the repo review-ready by cleaning up product-facing artifacts:
156
-
157
- - rename package metadata and user-facing strings to `openshell`
158
- - remove stale `open-code` or keychain-era wording from README/examples/installation docs
159
- - ensure examples and checked-in smoke files match the released install story
160
- - reduce obvious implementation-era leftovers where they confuse reviewers
161
-
162
- This is not a generic refactor. Cleanup should be driven by release-readiness and user comprehension.
163
-
164
- ## Verification Requirements
165
-
166
- The finished release-prep pass should be reviewable with a concrete path:
167
-
168
- 1. install globally from the package
169
- 2. confirm global OpenCode registration was merged successfully
170
- 3. register a server via `openshell server-registry add`
171
- 4. run OpenCode and verify:
172
- - `list_servers`
173
- - safe `remote_exec`
174
- - approval-gated `remote_write_file`
175
- 5. run `openshell uninstall`
176
- 6. verify:
177
- - global OpenShell config/data removed
178
- - OpenCode plugin registration removed
179
- - tracked workspace `.open-code/` directories removed
180
-
181
- ## Risks
182
-
183
- - Auto-merging OpenCode config can accidentally duplicate entries unless matching rules are careful.
184
- - Full uninstall can remove more than intended if ownership boundaries are sloppy.
185
- - Naming cleanup can miss small user-facing leftovers and create review friction.
186
-
187
- These risks are acceptable, but the implementation must make ownership and merge behavior explicit.
188
-
189
- ## Recommendation
190
-
191
- Implement this as a focused productization pass on top of the current runtime:
192
-
193
- - do not redesign the remote execution core again
194
- - do build proper install/uninstall lifecycle
195
- - do make naming, docs, and examples coherent for a pre-release reviewer
196
-
197
- That is the shortest path from “working branch” to “npm-installable, reviewable first version candidate.”
@@ -1,19 +0,0 @@
1
- {
2
- "$schema": "https://opencode.ai/config.json",
3
- "permission": {
4
- "edit": "ask",
5
- "bash": {
6
- "*": "ask",
7
- "cat *": "allow",
8
- "grep *": "allow",
9
- "find *": "allow",
10
- "ls *": "allow",
11
- "pwd": "allow",
12
- "uname *": "allow",
13
- "df *": "allow",
14
- "free *": "allow",
15
- "ps *": "allow",
16
- "systemctl status *": "allow"
17
- }
18
- }
19
- }
@@ -1,3 +0,0 @@
1
- import { main } from "../src/cli/openshell"
2
-
3
- process.exitCode = await main(process.argv.slice(2))
@@ -1,3 +0,0 @@
1
- import { main } from "../src/cli/server-registry"
2
-
3
- process.exitCode = await main(process.argv.slice(2))
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env node
2
- import { stderr, stdout } from "node:process"
3
- import { runInstallCli } from "../product/install.js"
4
- import { runUninstallCli } from "../product/uninstall.js"
5
- import { runServerRegistryCli } from "./server-registry.js"
6
-
7
- type WritableLike = {
8
- write(chunk: string): void
9
- }
10
-
11
- type OpenShellCliDeps = {
12
- stdout: WritableLike
13
- stderr: WritableLike
14
- runServerRegistryCli: (argv: string[]) => Promise<number>
15
- runInstallCli: (argv: string[]) => Promise<number>
16
- runUninstallCli: (argv: string[]) => Promise<number>
17
- }
18
-
19
- const usage = [
20
- "Usage: openshell <install|uninstall|server-registry>",
21
- "",
22
- "Commands:",
23
- " install configure OpenCode for the openshell plugin",
24
- " uninstall remove OpenCode integration and local openshell state",
25
- " server-registry manage configured remote servers",
26
- ].join("\n")
27
-
28
- const createDefaultDeps = (): OpenShellCliDeps => ({
29
- stdout: { write: (chunk) => stdout.write(chunk) },
30
- stderr: { write: (chunk) => stderr.write(chunk) },
31
- runServerRegistryCli,
32
- runInstallCli,
33
- runUninstallCli,
34
- })
35
-
36
- export const runOpenShellCli = async (argv: string[], deps?: Partial<OpenShellCliDeps>) => {
37
- const activeDeps = {
38
- ...createDefaultDeps(),
39
- ...deps,
40
- }
41
-
42
- const [command, ...rest] = argv
43
-
44
- switch (command) {
45
- case undefined:
46
- activeDeps.stdout.write(`${usage}\n`)
47
- return 0
48
- case "server-registry":
49
- return activeDeps.runServerRegistryCli(rest)
50
- case "install":
51
- return activeDeps.runInstallCli(rest)
52
- case "uninstall":
53
- return activeDeps.runUninstallCli(rest)
54
- default:
55
- activeDeps.stderr.write(`${usage}\n`)
56
- return 1
57
- }
58
- }
59
-
60
- export const main = async (argv: string[] = process.argv.slice(2)) => runOpenShellCli(argv)