oh-my-opencode-slim 1.0.7 → 1.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 (38) hide show
  1. package/README.md +16 -6
  2. package/dist/cli/config-io.d.ts +1 -0
  3. package/dist/cli/index.js +170 -52
  4. package/dist/goal/index.d.ts +3 -0
  5. package/dist/goal/manager.d.ts +41 -0
  6. package/dist/goal/prompts.d.ts +4 -0
  7. package/dist/goal/store.d.ts +15 -0
  8. package/dist/goal/types.d.ts +28 -0
  9. package/dist/hooks/index.d.ts +1 -0
  10. package/dist/hooks/session-goal/index.d.ts +38 -0
  11. package/dist/index.js +1135 -369
  12. package/dist/multiplexer/session-manager.d.ts +3 -1
  13. package/dist/tools/fork/command.d.ts +28 -0
  14. package/dist/tools/fork/files.d.ts +33 -0
  15. package/dist/tools/fork/index.d.ts +10 -0
  16. package/dist/tools/fork/state.d.ts +7 -0
  17. package/dist/tools/fork/tools.d.ts +23 -0
  18. package/dist/tools/fork/vendor.d.ts +28 -0
  19. package/dist/tools/handoff/command.d.ts +29 -0
  20. package/dist/tools/handoff/files.d.ts +33 -0
  21. package/dist/tools/handoff/index.d.ts +10 -0
  22. package/dist/tools/handoff/state.d.ts +7 -0
  23. package/dist/tools/handoff/tools.d.ts +23 -0
  24. package/dist/tools/handoff/vendor.d.ts +28 -0
  25. package/dist/tools/index.d.ts +2 -0
  26. package/dist/tools/subtask/command.d.ts +30 -0
  27. package/dist/tools/subtask/files.d.ts +34 -0
  28. package/dist/tools/subtask/index.d.ts +11 -0
  29. package/dist/tools/subtask/state.d.ts +7 -0
  30. package/dist/tools/subtask/tools.d.ts +23 -0
  31. package/dist/tools/subtask/vendor.d.ts +27 -0
  32. package/dist/tui.js +56 -0
  33. package/dist/utils/session.d.ts +2 -1
  34. package/package.json +1 -1
  35. package/src/skills/clonedeps/README.md +23 -0
  36. package/src/skills/clonedeps/SKILL.md +237 -0
  37. package/src/skills/clonedeps/codemap.md +41 -0
  38. package/src/skills/codemap.md +8 -5
@@ -0,0 +1,237 @@
1
+ ---
2
+ name: clonedeps
3
+ description: Clone important project dependency source code into an ignored local workspace so OpenCode can inspect library internals. Use when the user asks to clone dependencies, inspect dependency/source internals, understand SDK/framework behavior from source, debug library implementation details, or make core dependency repos locally readable. Do not use for ordinary API/docs questions where @librarian is enough.
4
+ ---
5
+
6
+ # Clonedeps Skill
7
+
8
+ You help users make a small set of important dependency source repositories
9
+ locally readable to OpenCode.
10
+
11
+ This is a workflow skill, not a command wrapper. Do not use a helper script for
12
+ dependency detection, ref validation, cloning, status, or cleanup. The
13
+ orchestrator and `@librarian` do the repo-specific thinking; the orchestrator
14
+ performs the approved filesystem/git operations directly.
15
+
16
+ ## Workflow
17
+
18
+ ### Step 1: Check Existing State
19
+
20
+ First check whether `.slim/clonedeps.json` exists.
21
+
22
+ If it exists:
23
+
24
+ 1. Read it before asking librarian for a new plan.
25
+ 2. Check whether each listed `path` exists under `.slim/clonedeps/repos/`.
26
+ 3. Reuse existing cloned repos when they already satisfy the user's task.
27
+ 4. Only ask librarian for new recommendations if the existing manifest is
28
+ missing, stale, or insufficient for the current task.
29
+
30
+ Do not rescan/re-plan from scratch when the manifest already has useful entries.
31
+
32
+ ### Step 2: Ask Librarian for the Clone Plan
33
+
34
+ Delegate dependency discovery and source resolution to `@librarian`.
35
+
36
+ Use this prompt:
37
+
38
+ ```md
39
+ Understand this project first, then recommend remote source repos that would
40
+ help a developer work on it.
41
+
42
+ Read enough of the current repo to understand:
43
+ - what the project does
44
+ - its main architecture
45
+ - the important integration points
46
+ - what external systems or libraries it depends on in practice
47
+
48
+ Think like a developer trying to debug or extend this project.
49
+
50
+ Which remote repositories, if cloned locally, would actually help understand the
51
+ codebase or solve likely implementation/debugging tasks?
52
+
53
+ Do not make a dependency dump. Most dependencies are not worth cloning.
54
+ Recommend a repo only when its source code would be more useful than docs or the
55
+ current repo alone.
56
+
57
+ For each recommendation, include:
58
+ - repo name
59
+ - repo URL
60
+ - suggested ref/tag/commit if known
61
+ - why cloning this source would help
62
+ - when it would be useful
63
+ - caveats
64
+
65
+ Also include:
66
+ - current-repo files/folders to inspect first
67
+ - repos/dependencies you considered but would not clone
68
+
69
+ Keep it small. Prefer 0–3 strong recommendations over 5 weak ones. If nothing
70
+ clearly needs cloning, say so.
71
+ ```
72
+
73
+ Librarian should return a small plan with:
74
+
75
+ - dependency name;
76
+ - current version/range if discoverable;
77
+ - official source repository URL;
78
+ - tag/commit/ref to check out;
79
+ - package subdirectory if the source is a monorepo;
80
+ - reason local source helps;
81
+ - caveats such as huge repo, missing tag, or uncertain version mapping.
82
+
83
+ Prefer at most 3-5 core dependencies. Include user-mentioned dependencies and
84
+ central frameworks, SDKs, ORMs, runtime/plugin APIs, or build/runtime tools. Do
85
+ not clone tiny utilities, transitive dependencies, or dev-only tools unless they
86
+ are directly relevant to the active task.
87
+
88
+ ### Step 3: Verify and Confirm the Plan
89
+
90
+ The orchestrator owns final approval. Before cloning:
91
+
92
+ 1. Verify refs manually where possible with `git ls-remote`.
93
+ 2. Prefer pinned tags or commit SHAs. If no exact tag exists, ask librarian to
94
+ find the correct module-specific tag/commit or explain the fallback.
95
+ 3. Only use HTTPS GitHub/GitLab-style repository URLs by default. Reject
96
+ `file://`, SSH URLs, local paths, URLs with embedded credentials, and private
97
+ or auth-required repositories unless the user explicitly approves that case.
98
+ 4. Present the plan to the user with dependency, repo URL, ref, reason, and
99
+ caveats.
100
+ 5. Ask for confirmation before network cloning unless the user explicitly asked
101
+ to clone immediately.
102
+
103
+ ### Step 4: Clone Sources Manually
104
+
105
+ Create one folder per source repository under:
106
+
107
+ ```text
108
+ .slim/clonedeps/repos/<safe-repo-name>/
109
+ ```
110
+
111
+ Derive the safe name from the repository owner/name, not from the package name.
112
+ For example, `https://github.com/opencode-ai/opencode.git` becomes
113
+ `opencode-ai__opencode`. Replace `/` with `__`, strip common `.git` suffixes,
114
+ and replace other unsafe path characters with `_`.
115
+
116
+ If multiple packages come from the same monorepo, clone the repository once and
117
+ point each manifest entry at the same repo path with different `packagePath`
118
+ values as needed. Do not create ecosystem folders, per-package clone folders, or
119
+ per-version folders. If two different source repositories normalize to the same
120
+ safe name, disambiguate manually and record the chosen path in
121
+ `.slim/clonedeps.json`.
122
+
123
+ Clone/fetch with normal git commands. For an existing clone, first verify that
124
+ `git remote get-url origin` matches the approved repo URL. If it does not match,
125
+ stop and ask whether to clean/reclone.
126
+
127
+ Safe manual git pattern:
128
+
129
+ 1. `git ls-remote <repoUrl> <ref>` to verify the ref where practical.
130
+ 2. Clone without submodules/recursive behavior.
131
+ 3. Prefer shallow fetch/clone where practical.
132
+ 4. Clone into a temporary directory under `.slim/clonedeps/repos/`, then move it
133
+ into the final safe-name path after checkout succeeds.
134
+ 5. Remove failed temporary clones.
135
+
136
+ Do not run dependency install/build/test scripts from cloned repositories.
137
+
138
+ ### Step 5: Write Local State
139
+
140
+ Write `.slim/clonedeps.json` so future agents know what exists:
141
+
142
+ ```json
143
+ {
144
+ "version": "1.0.0",
145
+ "updatedAt": "2026-05-12T00:00:00.000Z",
146
+ "dependencies": [
147
+ {
148
+ "name": "@opencode-ai/plugin",
149
+ "resolvedVersion": "1.3.17",
150
+ "repoUrl": "https://github.com/opencode-ai/opencode.git",
151
+ "ref": "v1.3.17",
152
+ "path": ".slim/clonedeps/repos/opencode-ai__opencode",
153
+ "packagePath": "packages/plugin",
154
+ "reason": "Plugin API source used by the project"
155
+ },
156
+ {
157
+ "name": "@opencode-ai/sdk",
158
+ "resolvedVersion": "1.3.17",
159
+ "repoUrl": "https://github.com/opencode-ai/opencode.git",
160
+ "ref": "v1.3.17",
161
+ "path": ".slim/clonedeps/repos/opencode-ai__opencode",
162
+ "packagePath": "packages/sdk/js",
163
+ "reason": "Core SDK source used to inspect runtime behavior"
164
+ }
165
+ ]
166
+ }
167
+ ```
168
+
169
+ If a clone fails after earlier clones succeeded, still write state for the
170
+ successful clones so future inspection is not misleading.
171
+
172
+ Do not add `.slim/clonedeps.json` to `.gitignore`. It is small, reviewable
173
+ project metadata that can be committed. Only the cloned repository contents
174
+ under `.slim/clonedeps/repos/` should be ignored.
175
+
176
+ ### Step 6: Update Ignore Files
177
+
178
+ Update `.gitignore` with an idempotent marker block:
179
+
180
+ ```gitignore
181
+ # BEGIN oh-my-opencode-slim clonedeps
182
+ .slim/clonedeps/repos/
183
+ # END oh-my-opencode-slim clonedeps
184
+ ```
185
+
186
+ Update `.ignore` so OpenCode can read the cloned source while git still ignores
187
+ it:
188
+
189
+ ```ignore
190
+ # BEGIN oh-my-opencode-slim clonedeps
191
+ !.slim/
192
+ !.slim/clonedeps.json
193
+ !.slim/clonedeps/
194
+ !.slim/clonedeps/repos/
195
+ !.slim/clonedeps/repos/**
196
+ .slim/clonedeps/repos/**/.git/
197
+ .slim/clonedeps/repos/**/.git/**
198
+ # END oh-my-opencode-slim clonedeps
199
+ ```
200
+
201
+ Only edit content inside these marker blocks.
202
+
203
+ ### Step 7: Register Dependency Source in AGENTS.md
204
+
205
+ After successful cloning, update the repository root `AGENTS.md` so future
206
+ agents know why the dependency source exists and where to look.
207
+
208
+ If `AGENTS.md` already has a `## Cloned Dependency Source` section, update that
209
+ section. Otherwise append this section:
210
+
211
+ Use this format and list the actual repos directly. Keep each item to one short
212
+ sentence so future agents do not need an extra read just to know what is there:
213
+
214
+ ```markdown
215
+ ## Cloned Dependency Source
216
+
217
+ Read-only dependency source repositories are available under
218
+ `.slim/clonedeps/repos/` for inspection. Do not edit these clones.
219
+
220
+ - `.slim/clonedeps/repos/<safe-name>/` — `<repo>` at `<ref>`; <one sentence on
221
+ why this source is useful>.
222
+ - `.slim/clonedeps/repos/<safe-name-2>/` — `<repo>` at `<ref>`; <one sentence on
223
+ why this source is useful>.
224
+ ```
225
+
226
+ Also keep `.slim/clonedeps.json` updated as the structured manifest, but do not
227
+ make agents read it for the basic repo list.
228
+
229
+ ## Cleanup
230
+
231
+ When the user asks to clean cloned dependencies, remove:
232
+
233
+ - `.slim/clonedeps/repos/`
234
+ - the managed clonedeps marker blocks from `.gitignore` and `.ignore`
235
+
236
+ Ask before removing `.slim/clonedeps.json` or the `AGENTS.md` section because
237
+ they may be intentional project metadata.
@@ -0,0 +1,41 @@
1
+ # src/skills/clonedeps/
2
+
3
+ ## Responsibility
4
+
5
+ Workflow-only bundled OpenCode skill for local dependency source mirroring. It
6
+ instructs the orchestrator to use `@librarian` for dependency discovery and
7
+ source URL/ref resolution, then perform approved git/filesystem operations
8
+ directly.
9
+
10
+ ## Design
11
+
12
+ - `SKILL.md` is the prompt contract loaded by OpenCode and assigned only to the
13
+ orchestrator.
14
+ - No helper script is bundled. The skill avoids brittle cross-ecosystem parsing
15
+ and keeps repo-specific judgment in librarian/orchestrator.
16
+ - State is trackable project metadata stored in `.slim/clonedeps.json`; clone
17
+ contents live under `.slim/clonedeps/repos/<safe-dependency-name>/` and are
18
+ ignored by git.
19
+ - The workflow updates `.gitignore`, `.ignore`, and root `AGENTS.md` with
20
+ concise marker sections so cloned source stays out of git but visible to
21
+ OpenCode and discoverable by future agents.
22
+
23
+ ## Flow
24
+
25
+ 1. Orchestrator checks `.slim/clonedeps.json` first and reuses existing clones
26
+ when they satisfy the current task.
27
+ 2. Orchestrator asks librarian for a small source-resolution plan across the
28
+ repository's actual languages/ecosystems.
29
+ 3. Orchestrator verifies refs where possible and asks the user to approve.
30
+ 4. Orchestrator clones/fetches each approved source repo once into
31
+ `.slim/clonedeps/repos/<safe-repo-name>/`.
32
+ 5. Orchestrator writes `.slim/clonedeps.json` with paths, refs, and reasons.
33
+ 6. Orchestrator updates `.gitignore`, `.ignore`, and root `AGENTS.md`; the
34
+ AGENTS section lists each read-only clone path directly with a one-sentence
35
+ purpose.
36
+
37
+ ## Integration
38
+
39
+ - Registered in `src/cli/custom-skills.ts` with orchestrator-only permission.
40
+ - Included in release verification via `scripts/verify-release-artifact.ts`.
41
+ - Documented in `docs/skills.md` and included in `src/skills/codemap.md`.
@@ -12,10 +12,11 @@
12
12
 
13
13
  - `CUSTOM_SKILLS` in `src/cli/custom-skills.ts` is the authoritative skill manifest for bundled
14
14
  skills; each entry maps folder name + `sourcePath` to an install-time consumer.
15
- - `install.ts` runs `installCustomSkill()` which recursively copies `src/skills/codemap` and
16
- `src/skills/simplify` into the OpenCode skills directory.
15
+ - `install.ts` runs `installCustomSkill()` which recursively copies bundled skill
16
+ directories into the OpenCode skills directory.
17
17
  - This directory is partitioned by skill:
18
18
  - `src/skills/codemap/` (command-style repository mapping skill)
19
+ - `src/skills/clonedeps/` (workflow skill for dependency source mirroring)
19
20
  - `src/skills/simplify/` (readability/refactor guidance skill)
20
21
  - Files are considered static runtime payload. No plugin TS module in `src/` imports these files directly; they
21
22
  are loaded by OpenCode via filesystem installation.
@@ -34,7 +35,9 @@
34
35
 
35
36
  - `src/cli/custom-skills.ts`: source-of-truth registry consumed by installer and permission helpers.
36
37
  - `src/cli/skills.ts:getSkillPermissionsForAgent()` auto-populates permission rules for
37
- `codemap` and `simplify` when agent policy is derived from built-in recommendations.
38
- - `verify-release-artifact.ts` enforces artifact completeness by asserting `src/skills/simplify/SKILL.md`
39
- and `src/skills/codemap/SKILL.md` are present in the tarball.
38
+ bundled skills when agent policy is derived from built-in recommendations.
39
+ - `verify-release-artifact.ts` enforces artifact completeness by asserting key
40
+ bundled skill payloads such as `src/skills/simplify/SKILL.md`,
41
+ `src/skills/codemap/SKILL.md`, and `src/skills/clonedeps/SKILL.md` are present
42
+ in the tarball.
40
43
  - `package.json` scripts (`verify:release`, `build`) rely on these assets to ensure install-time skill availability.