@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,174 +0,0 @@
1
- # OpenShell Pre-Release Review Note
2
-
3
- Date: 2026-03-26
4
- Branch: `main`
5
- Reviewer: Claude Code
6
-
7
- ## Scope
8
-
9
- This document reviews the first pre-release candidate for:
10
-
11
- - npm package: `@junwu168/openshell`
12
- - CLI binary: `openshell`
13
- - supported host: `opencode`
14
-
15
- The package enables AI coding CLIs to safely operate on remote Linux servers over SSH with credential isolation, user approval enforcement, and local audit trails.
16
-
17
- ## Automated Verification
18
-
19
- Verified on current HEAD:
20
-
21
- ```bash
22
- bun test
23
- bun run typecheck
24
- bun run build
25
- ```
26
-
27
- Observed result:
28
-
29
- - `bun test` -> `96 pass, 0 fail`
30
- - `typecheck` -> pass
31
- - `build` -> pass
32
-
33
- ## Architecture Summary
34
-
35
- ```
36
- src/
37
- ├── index.ts # Package exports (OpenCodePlugin, contracts)
38
- ├── core/ # Host-agnostic runtime core
39
- │ ├── contracts.ts # Shared types: ServerID, ToolPayload, ToolResult, PolicyDecision
40
- │ ├── result.ts # okResult(), partialFailureResult(), errorResult()
41
- │ ├── paths.ts # Runtime path resolution via env-paths
42
- │ ├── policy.ts # Deterministic command classification
43
- │ ├── patch.ts # Unified diff application
44
- │ ├── orchestrator.ts # Central pipeline: validate -> classify -> approve -> execute -> audit
45
- │ ├── registry/ # Server registry (layered JSON, NOT encrypted)
46
- │ │ └── server-registry.ts # Global + workspace scoped server records
47
- │ ├── ssh/ # SSH/SFTP operations
48
- │ │ └── ssh-runtime.ts # exec, readFile, writeFile, listDir, stat
49
- │ └── audit/ # Audit logging and git-backed snapshots
50
- │ ├── log-store.ts # JSONL append-only audit log
51
- │ ├── git-audit-repo.ts # Git-backed file snapshots
52
- │ └── redact.ts # Secret redaction before logging
53
- ├── opencode/
54
- │ └── plugin.ts # OpenCode adapter (tool definitions, approval prompts)
55
- ├── cli/ # CLI commands
56
- │ ├── openshell.ts # Main CLI entry (install/uninstall/server-registry)
57
- │ └── server-registry.ts # Interactive server registry CLI
58
- └── product/ # Install/uninstall lifecycle
59
- ├── install.ts # openshell install
60
- ├── uninstall.ts # openshell uninstall
61
- ├── opencode-config.ts # OpenCode config merging
62
- └── workspace-tracker.ts # Track workspaces for cleanup
63
- ```
64
-
65
- ## Implemented Features
66
-
67
- ### Remote Tools (8 tools)
68
- - `list_servers` - List registered servers
69
- - `remote_exec` - Execute shell commands on remote servers
70
- - `remote_read_file` - Read remote files
71
- - `remote_write_file` - Write remote files (approval-required)
72
- - `remote_patch_file` - Apply unified diffs (approval-required)
73
- - `remote_list_dir` - List remote directories
74
- - `remote_stat` - Stat remote paths
75
- - `remote_find` - Search remote files/content
76
-
77
- ### Policy Engine
78
- - **Auto-allow:** Safe inspection commands (cat, grep, find, ls, pwd, uname, df, free, ps, systemctl status)
79
- - **Approval-required:** Middleware commands (psql, mysql, redis-cli, kubectl, docker, helm, aws, gcloud, az) and shell composition (pipes, redirects, chaining)
80
- - **Reject:** Empty commands
81
-
82
- ### Server Registry
83
- - **Layered configuration:** Global (`~/.config/openshell/servers.json`) and workspace (`<workspace>/.open-code/servers.json`)
84
- - **File locking:** Prevents concurrent write corruption
85
- - **Workspace shadowing:** Workspace entries override global entries with the same ID
86
- - **Auth types:** Password, private key (with optional passphrase), certificate
87
-
88
- ### Audit System
89
- - **JSONL action log:** All tool actions logged with timestamps, sanitized secrets
90
- - **Git-backed snapshots:** Before/after content for file writes stored in git commits
91
- - **Fail-closed:** If audit preflight fails, operations do not proceed
92
-
93
- ### Install/Uninstall Lifecycle
94
- - `openshell install` - Creates dirs, merges OpenCode config with plugin + permissions
95
- - `openshell uninstall` - Aggressively removes all OpenShell state and tracked workspace `.open-code/` dirs
96
-
97
- ## Security Considerations
98
-
99
- ### Known Security Model (Documented)
100
-
101
- > "Password auth is stored in plain text. That is intentionally simple for this pre-release and not recommended for long-term production use."
102
-
103
- ### Secret Handling
104
- - Passwords stored in plain text JSON files (keytar dependency was removed)
105
- - Private key paths and certificate paths are read from filesystem at runtime
106
- - Secret redaction in audit logs covers URLs with embedded credentials and `password=`, `secret=`, `token=` patterns
107
- - `list_servers` properly excludes auth data from returned server records
108
-
109
- ### Credential Isolation
110
- - Server IDs used in tool calls, not raw credentials
111
- - Auth paths validated for workspace-scoped records only
112
- - Relative auth paths rejected for global scope
113
-
114
- ## Pre-Release Concerns
115
-
116
- ### 1. Plain-Text Password Storage
117
- The current implementation stores passwords in plain text JSON. For a production release, encryption at rest would be essential.
118
-
119
- ### 2. `remote_find` Uses Shell Execution (Medium Risk)
120
- The `remote_find` implementation builds shell commands (`find ... | head -n ...` or `grep -R -n ... | head -n ...`) which bypasses the policy engine's shell composition detection. Commands with pipes or redirects could be constructed via the `pattern` or `glob` arguments.
121
-
122
- ### 3. No Connection Pooling/Reuse (Performance)
123
- Each SSH operation creates a new connection. For high-frequency tool use, this could be inefficient.
124
-
125
- ### 4. Uninstall Removes Workspace `.open-code/` Dirs
126
- The uninstall is "aggressive" and removes ALL tracked workspace `.open-code/` directories. If users have other plugins or data in those directories, it would be lost.
127
-
128
- ### 5. Bun Runtime Dependency
129
- The project uses Bun as its runtime/package manager. Node.js compatibility would require additional work.
130
-
131
- ### 6. No Connection Recovery (Reliability)
132
- The audit system is fail-closed, but there's no retry logic or recovery for transient SSH failures.
133
-
134
- ## Review Path
135
-
136
- Reviewer flow:
137
-
138
- 1. `npm install -g @junwu168/openshell`
139
- 2. `openshell install`
140
- 3. `openshell server-registry add`
141
- 4. Launch `opencode`
142
- 5. Exercise:
143
- - `list_servers`
144
- - safe `remote_exec`
145
- - approval-gated `remote_write_file`
146
- 6. `openshell uninstall`
147
-
148
- ## Prior Fix (Verified in This Review)
149
-
150
- During prior verification, an uninstall bug was fixed:
151
-
152
- - if OpenCode config only contained `@junwu168/openshell`, uninstall preserved the plugin entry because the config writer spread `...current` back into the output when the filtered plugin list became empty
153
-
154
- This is covered by `tests/unit/opencode-config.test.ts` and fixed in `src/product/opencode-config.ts`.
155
-
156
- ## Test Coverage
157
-
158
- | File | Approx Lines | Coverage Relevance |
159
- |------|-------------|-------------------|
160
- | `src/core/orchestrator.ts` | ~1080 | Central pipeline (critical) |
161
- | `src/core/registry/server-registry.ts` | ~505 | Server registry |
162
- | `src/cli/server-registry.ts` | ~470 | Interactive CLI |
163
- | `src/core/ssh/ssh-runtime.ts` | ~355 | SSH operations |
164
- | `src/opencode/plugin.ts` | ~243 | OpenCode adapter |
165
- | `src/product/opencode-config.ts` | ~118 | Config lifecycle |
166
-
167
- ## Verdict
168
-
169
- **Ready for pre-release** with the documented concerns understood by users:
170
-
171
- - Plain-text password storage is acceptable for pre-release evaluation
172
- - `remote_find` shell composition bypass should be addressed before production
173
- - All automated tests pass (96 tests)
174
-