@markstanden/opencode-docs-plugin 0.6.2 → 0.8.0
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/README.md +56 -1
- package/package.json +2 -1
- package/src/index.ts +9 -1
package/README.md
CHANGED
|
@@ -89,7 +89,21 @@ The simplest setup uses `root` — one repo lake:
|
|
|
89
89
|
|
|
90
90
|
`root` expands `~`, resolves a relative path against the location, and defaults
|
|
91
91
|
to `<location>/docs`. A blank value counts as unset. `root` declares a **repo**
|
|
92
|
-
lake; for a personal or global lake, use `lakes` with the class instead.
|
|
92
|
+
lake; for a personal or global lake, use `lakes` with the class instead. Its
|
|
93
|
+
name follows the root folder unless you set the `name` option beside it:
|
|
94
|
+
|
|
95
|
+
```jsonc
|
|
96
|
+
{
|
|
97
|
+
"plugins": [
|
|
98
|
+
{
|
|
99
|
+
"package": "@markstanden/opencode-docs-plugin",
|
|
100
|
+
"options": { "root": "documentation", "name": "doclake" },
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`name` only applies to `root`; inside `lakes`, set it on the entry.
|
|
93
107
|
|
|
94
108
|
For several lakes, list them inline, in a base file, or both. The base file is
|
|
95
109
|
usually a personal or managed file; the repo file adds local lakes:
|
|
@@ -159,6 +173,47 @@ Lake paths never follow symlinks: a symlinked doc is skipped by search and
|
|
|
159
173
|
`check`, refused by `read`, and refused by `add`. The configured `root` itself
|
|
160
174
|
may be a symlink; the content beneath it must be real.
|
|
161
175
|
|
|
176
|
+
A lake root nested inside another lake's root is indexed once. The outer lake
|
|
177
|
+
skips the nested root, so the doc is returned by the inner lake only — never
|
|
178
|
+
twice, and never under both roots. Class and writability make no difference: a
|
|
179
|
+
writable repo lake may sit inside a larger read-only wiki lake, and search,
|
|
180
|
+
`read` and `add` all resolve to the writable inner lake. The outer lake's class
|
|
181
|
+
only decides its own profile and defaults; `repo`, `machine`, `global` and
|
|
182
|
+
`wiki` all skip a nested root the same way.
|
|
183
|
+
|
|
184
|
+
The skip compares the configured roots as written, so reach the tree the same
|
|
185
|
+
way from both declarations. If one lake names the real directory and the other
|
|
186
|
+
reaches it through a symlink, junction or mapped drive, the two paths never
|
|
187
|
+
match and the nested doc is indexed twice.
|
|
188
|
+
|
|
189
|
+
```jsonc
|
|
190
|
+
{
|
|
191
|
+
"plugins": [
|
|
192
|
+
{
|
|
193
|
+
"package": "@markstanden/opencode-docs-plugin",
|
|
194
|
+
"options": {
|
|
195
|
+
"lakes": [
|
|
196
|
+
{
|
|
197
|
+
"class": "wiki",
|
|
198
|
+
"root": "~/reference-wiki",
|
|
199
|
+
"name": "wiki",
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"class": "repo",
|
|
203
|
+
"root": "~/reference-wiki/work/docs",
|
|
204
|
+
"name": "work",
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
`class` is one of `repo`, `machine`, `global` or `wiki`; `root` and `name` are
|
|
214
|
+
strings, and `writable` is a boolean that is fixed `false` for `wiki`. Do not
|
|
215
|
+
add `root` alongside `lakes` — they are mutually exclusive.
|
|
216
|
+
|
|
162
217
|
A missing lake root is flagged, never created. The lake stays dormant until the
|
|
163
218
|
directory exists: `search` appends a note naming the lake and path, `help` marks
|
|
164
219
|
it `— missing`, and `add` refuses with the path rather than bootstrapping a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markstanden/opencode-docs-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode V2 plugin: a `docs` tool and `/docs` command over configurable knowledge lakes (repo, machine, global and read-only wiki), nested README.md search, and the writing convention they share",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"test": "node --test 'tests/**/*.test.ts'",
|
|
24
|
+
"test:coverage": "mkdir -p coverage && node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info 'tests/**/*.test.ts'",
|
|
24
25
|
"test:watch": "node --test --watch 'tests/**/*.test.ts'",
|
|
25
26
|
"typecheck": "tsc --noEmit"
|
|
26
27
|
},
|
package/src/index.ts
CHANGED
|
@@ -2370,6 +2370,8 @@ export const REPO_LAKES_FILE = ".opencode/docs-lakes.json";
|
|
|
2370
2370
|
export interface DocsPluginOptions {
|
|
2371
2371
|
/** The single repo-lake override; mutually exclusive with `lakes`. */
|
|
2372
2372
|
root?: unknown;
|
|
2373
|
+
/** The `root` lake's name; defaults to the root folder name. Needs `root`. */
|
|
2374
|
+
name?: unknown;
|
|
2373
2375
|
/** Base lake declarations, merged after `lakesFile` and the repo file. */
|
|
2374
2376
|
lakes?: unknown;
|
|
2375
2377
|
/** A JSON file of base lakes (`{ "lakes": [...] }`). */
|
|
@@ -2646,6 +2648,12 @@ function assertLakesOptions(options: DocsPluginOptions): void {
|
|
|
2646
2648
|
"use 'root' for one repo lake or 'lakes' for the full list.",
|
|
2647
2649
|
);
|
|
2648
2650
|
}
|
|
2651
|
+
if (options.name !== undefined && options.root === undefined) {
|
|
2652
|
+
throw new Error(
|
|
2653
|
+
"docs plugin option 'name' names the 'root' lake; " +
|
|
2654
|
+
"set 'name' inside a 'lakes' entry instead.",
|
|
2655
|
+
);
|
|
2656
|
+
}
|
|
2649
2657
|
}
|
|
2650
2658
|
|
|
2651
2659
|
/** Map raw lake entries from a file to specs. */
|
|
@@ -2722,7 +2730,7 @@ export function resolveLakes(
|
|
|
2722
2730
|
if (options.root !== undefined) {
|
|
2723
2731
|
specs.push(
|
|
2724
2732
|
lakeSpecFrom(
|
|
2725
|
-
{ class: "repo", root: options.root },
|
|
2733
|
+
{ class: "repo", root: options.root, name: options.name },
|
|
2726
2734
|
location,
|
|
2727
2735
|
false,
|
|
2728
2736
|
),
|