obsidian-wikilinks 0.2.1 → 0.2.2

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 (2) hide show
  1. package/README.md +93 -29
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -49,12 +49,20 @@ claude plugin install obsidian-wikilinks@depickeresven-obsidian-wikilinks
49
49
 
50
50
  ### From npm (recommended)
51
51
 
52
- If you want it local in one project
52
+ The `opencode plugin` command installs the package and adds it to your config.
53
+ For every project:
54
+
55
+ ```bash
56
+ opencode plugin obsidian-wikilinks --global
57
+ ```
58
+
59
+ For one project only, run it without the flag inside that repo:
60
+
53
61
  ```bash
54
62
  opencode plugin obsidian-wikilinks
55
63
  ```
56
64
 
57
- That installs the package and adds it to your config. Or add it by hand:
65
+ You can also add it by hand:
58
66
 
59
67
  ```json
60
68
  {
@@ -66,12 +74,6 @@ That installs the package and adds it to your config. Or add it by hand:
66
74
  Use `~/.config/opencode/opencode.json` for every project, or `opencode.json` in
67
75
  a repo for that project only.
68
76
 
69
- Or you want it installed global:
70
- ```bash
71
- opencode plugin obsidian-wikilinks --global
72
- ```
73
-
74
-
75
77
  ### From a local checkout
76
78
 
77
79
  OpenCode loads any `.js` / `.ts` file in a plugin directory, and follows
@@ -86,7 +88,7 @@ ln -s ~/.config/opencode/obsidian-wikilinks/plugin/obsidian-wikilinks.js ~/.conf
86
88
  Use `.opencode/plugin/` instead of `~/.config/opencode/plugin/` to enable it for
87
89
  a single project only.
88
90
 
89
- Alternatively, reference the checkout from your config instead of symlinking
91
+ Alternatively, reference the checkout from your config instead of symlinking.
90
92
  `plugin` entries accept `file://` URLs and paths relative to the config file:
91
93
 
92
94
  ```json
@@ -131,6 +133,30 @@ Review the notes in [[Meetings]] and prepare a weekly summary.
131
133
  When a name is ambiguous, the plugin provides up to three candidate paths. If
132
134
  there is no match, it says so instead of guessing.
133
135
 
136
+ ### What the agent receives
137
+
138
+ The injected context is plain text, one line per distinct wikilink:
139
+
140
+ ```text
141
+ Obsidian wikilink resolution (vault: /Users/you/Documents/Obsidian):
142
+ [[Website Redesign]] -> /Users/you/Documents/Obsidian/Projects/Website Redesign.md
143
+ [[Meetings]] -> /Users/you/Documents/Obsidian/Meetings/
144
+ [[Notes]] -> ambiguous, candidates: /path/Notes.md, /path/Old/Notes.md
145
+ [[Nope]] -> no match found in vault /Users/you/Documents/Obsidian
146
+ Read the resolved file(s) when their content is relevant to the request.
147
+ ```
148
+
149
+ Folder matches end in a path separator. Repeated wikilinks are resolved once.
150
+
151
+ ### What gets indexed
152
+
153
+ The whole vault is walked, notes and folders alike, with two exclusions:
154
+
155
+ - Anything whose name starts with a dot.
156
+ - The folders `.obsidian`, `.trash`, `.git`, and `.vault-meta`.
157
+
158
+ A note inside a hidden folder will therefore never resolve.
159
+
134
160
  ## Vault selection
135
161
 
136
162
  Vault path resolution order:
@@ -142,8 +168,8 @@ Vault path resolution order:
142
168
  (or `$OPENCODE_CONFIG_DIR` / `$XDG_CONFIG_HOME` when set)
143
169
  2. The other hosts' config files, as a compatibility fallback
144
170
  3. `$OBSIDIAN_VAULT` environment variable
145
- 4. Obsidian's vault registry auto-detected (prefers the open vault, else most
146
- recently opened). Cross-platform (macOS / Windows / Linux).
171
+ 4. Obsidian's vault registry, auto-detected (prefers the open vault, else the
172
+ most recently opened). Cross-platform (macOS / Windows / Linux).
147
173
  5. `~/Documents/Obsidian` (default fallback)
148
174
 
149
175
  You only need an explicit override if you have **multiple vaults** and want to
@@ -153,19 +179,53 @@ pin a specific one. Create the config file for your host with:
153
179
  { "vault": "/Users/you/Documents/Obsidian" }
154
180
  ```
155
181
 
156
- The plugin itself is identical on every device. Update Claude Code with
157
- `claude plugin update obsidian-wikilinks`. Re-run the Codex `plugin add` command
158
- to install an updated version there. For OpenCode, re-run `opencode plugin
159
- obsidian-wikilinks`, or `git pull` in the checkout.
182
+ ## Updating
183
+
184
+ The plugin itself is identical on every device.
185
+
186
+ - Claude Code: `claude plugin update obsidian-wikilinks`
187
+ - Codex: re-run the `codex plugin add` command to install a newer version.
188
+ - OpenCode: re-run `opencode plugin obsidian-wikilinks`, or `git pull` in the
189
+ checkout.
160
190
 
161
191
  ## Environment variables
162
192
 
163
- | Variable | Purpose |
164
- |---------------------------------|--------------------------------------------------------------|
165
- | `OBSIDIAN_VAULT` | Vault path, used when no host config file sets one |
166
- | `OBSIDIAN_WIKILINKS_RESOLVER` | Path to `wikilink-resolver.py` (OpenCode only) |
167
- | `OBSIDIAN_WIKILINKS_PYTHON` | Python interpreter to use (default `python3`, OpenCode only) |
168
- | `OBSIDIAN_WIKILINKS_TIMEOUT_MS` | Resolver timeout in ms (default `10000`, OpenCode only) |
193
+ | Variable | Purpose |
194
+ |---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
195
+ | `OBSIDIAN_VAULT` | Vault path, used when no host config file sets one |
196
+ | `OBSIDIAN_WIKILINKS_HOST` | Force the host the resolver assumes: `codex`, `claude`, `opencode`. Normally auto-detected, and the OpenCode plugin sets it for you |
197
+ | `OBSIDIAN_WIKILINKS_RESOLVER` | Path to `wikilink-resolver.py` (OpenCode only) |
198
+ | `OBSIDIAN_WIKILINKS_PYTHON` | Python interpreter to use (default `python3`, OpenCode only) |
199
+ | `OBSIDIAN_WIKILINKS_TIMEOUT_MS` | Resolver timeout in ms (default `10000`, OpenCode only) |
200
+
201
+ ## Troubleshooting
202
+
203
+ The resolver is deliberately silent: on any problem it exits without output and
204
+ your prompt is passed through untouched. That makes the failure modes below look
205
+ identical from the outside, so work through them in order.
206
+
207
+ **Nothing is injected at all.**
208
+
209
+ - Check `python3 --version` in the same shell the agent runs in. No `python3` on
210
+ PATH means no resolution. On OpenCode, point `OBSIDIAN_WIKILINKS_PYTHON` at
211
+ your interpreter.
212
+ - On Codex, run `/hooks` in a new thread and confirm the plugin's
213
+ `UserPromptSubmit` hook is trusted. Untrusted hooks never execute.
214
+ - Confirm the vault directory actually exists. The resolver exits early when the
215
+ resolved path is not a directory, including for the `~/Documents/Obsidian`
216
+ fallback.
217
+
218
+ **The wrong vault is used.** Run through the resolution order above. A stale
219
+ config file for *another* host wins over `$OBSIDIAN_VAULT`, because step 2 comes
220
+ first. Delete it, or set an explicit override for your own host.
221
+
222
+ **A note resolves to `no match found`.** Check that it is not inside a hidden
223
+ folder (see [What gets indexed](#what-gets-indexed)), and that the vault in the
224
+ output line is the one you expect.
225
+
226
+ **Resolution is slow or times out on OpenCode.** The vault is walked on every
227
+ prompt containing a wikilink. On a very large vault, raise
228
+ `OBSIDIAN_WIKILINKS_TIMEOUT_MS` above its `10000` default.
169
229
 
170
230
  ## Development
171
231
 
@@ -183,16 +243,16 @@ Two workflows, chained.
183
243
 
184
244
  `.github/workflows/ci.yml` runs the smoke tests on Node 20/22/24 and on Bun, and
185
245
  checks the packed tarball ships both `plugin/` and `hooks/`. It runs on pull
186
- requests and on pushes to `main` not on every branch, so a pull request is
246
+ requests and on pushes to `main`, not on every branch, so a pull request is
187
247
  never tested twice.
188
248
 
189
249
  `.github/workflows/publish.yml` starts only when a CI run on `main` finishes
190
250
  successfully, checks out that exact commit, and asks npm whether the version in
191
251
  `package.json` already exists:
192
252
 
193
- - **Already on npm** nothing is released. This is what an ordinary push to
253
+ - **Already on npm**: nothing is released. This is what an ordinary push to
194
254
  `main` does.
195
- - **Not on npm** it publishes with provenance, tags the commit, and opens a
255
+ - **Not on npm**: it publishes with provenance, tags the commit, and opens a
196
256
  GitHub release with notes generated from the merged commits.
197
257
 
198
258
  So a version bump landing on `main` *is* the release, and it can only happen
@@ -208,13 +268,17 @@ git push
208
268
 
209
269
  `--no-git-tag-version` matters: the workflow creates the tag, so creating one
210
270
  locally would collide. The bump still runs `scripts/sync-versions.mjs`, keeping
211
- the Claude Code and Codex manifests on the same version as `package.json` CI
271
+ the Claude Code and Codex manifests on the same version as `package.json`. CI
212
272
  fails the build if they ever drift.
213
273
 
214
274
  Use the publish workflow's manual trigger (`workflow_dispatch`) with *dry run*
215
- enabled to rehearse a publish without releasing anything.
275
+ enabled to rehearse a publication without releasing anything.
276
+
277
+ ## Requirements
278
+
279
+ - `python3` on PATH. Standard library only, no pip installs.
280
+ - OpenCode only: no extra dependencies, the plugin uses Node/Bun built-ins.
216
281
 
217
- ### Requirements
282
+ ## License
218
283
 
219
- - `python3` on PATH (standard-library only; no pip installs).
220
- - OpenCode only: no extra dependencies — the plugin uses Node/Bun built-ins.
284
+ [MIT](LICENSE) © Sven Depickere
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obsidian-wikilinks",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Resolve Obsidian [[wikilinks]] in coding-agent prompts to local vault paths and inject them as context.",
5
5
  "type": "module",
6
6
  "main": "plugin/obsidian-wikilinks.js",