Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

fix(joplin): resolve npm-global package.json across all common layouts in backend version fallback

27494539a-hub1385d95decde
diff --git a/README.md b/README.md
index e78918196..3a78cf387 100644
--- a/README.md
+++ b/README.md
@@ -880,6 +880,13 @@ Each application received complete, production-ready CLI interfaces — not demo
<td align="center">✅ <a href="zotero/agent-harness/">New</a></td>
</tr>
<tr>
+<td align="center"><strong>📓 <a href="joplin/agent-harness/">Joplin</a></strong></td>
+<td>Note-taking &amp; To-dos</td>
+<td><code>cli-anything-joplin</code></td>
+<td>Joplin terminal CLI subprocess</td>
+<td align="center">✅ <a href="joplin/agent-harness/">New</a></td>
+</tr>
+<tr>
<td align="center"><strong>📝 <a href="mubu/agent-harness/">Mubu</a></strong></td>
<td>Knowledge Management &amp; Outlining</td>
<td><code>cli-anything-mubu</code></td>
@@ -1183,6 +1190,7 @@ cli-anything/
├── 📄 libreoffice/agent-harness/ # LibreOffice CLI (158 tests)
├── 📧 mailchimp/agent-harness/ # Mailchimp Marketing API CLI (303 commands, 36 unit tests)
├── 📚 zotero/agent-harness/ # Zotero CLI (new, write import support)
+├── 📓 joplin/agent-harness/ # Joplin CLI (106 tests, new)
├── 📝 mubu/agent-harness/ # Mubu CLI (96 tests)
├── 📹 obs-studio/agent-harness/ # OBS Studio CLI (153 tests)
├── 📱 nslogger/agent-harness/ # NSLogger CLI (139 tests)
diff --git a/joplin/agent-harness/JOPLIN.md b/joplin/agent-harness/JOPLIN.md
index c68f70894..4f443d0b7 100644
--- a/joplin/agent-harness/JOPLIN.md
+++ b/joplin/agent-harness/JOPLIN.md
@@ -123,6 +123,11 @@ python -m pytest -v --tb=no cli_anything/joplin/tests
For real backend runs, ensure `joplin` is installed and available in `PATH`.
+Current validation baseline (Windows + Joplin CLI 3.6.2):
+
+- `python -m pytest -q cli_anything/joplin/tests/test_core.py` → `79 passed, 1 skipped`
+- `python -m pytest -q cli_anything/joplin/tests` → `106 passed, 2 skipped`
+
## Development notes
- Prefer adding new coverage as a small command test first.
diff --git a/joplin/agent-harness/README.md b/joplin/agent-harness/README.md
index 691a5ed34..03c250a36 100644
--- a/joplin/agent-harness/README.md
+++ b/joplin/agent-harness/README.md
@@ -63,5 +63,10 @@ cli-anything-joplin --dry-run --project ./demo.joplin-harness.json todos create
search, sync, export, import, attach, history)
- one full end-to-end roundtrip
+Current validation baseline (Windows + Joplin CLI 3.6.2):
+
+- `python -m pytest -q cli_anything/joplin/tests/test_core.py` → `79 passed, 1 skipped`
+- `python -m pytest -q cli_anything/joplin/tests` → `106 passed, 2 skipped`
+
See `cli_anything/joplin/tests/TEST.md` for the full plan and
`cli_anything/joplin/WORKFLOWS.md` for the verified workflow inventory.
diff --git a/joplin/agent-harness/cli_anything/joplin/README.md b/joplin/agent-harness/cli_anything/joplin/README.md
index b967b2219..9322967ed 100644
--- a/joplin/agent-harness/cli_anything/joplin/README.md
+++ b/joplin/agent-harness/cli_anything/joplin/README.md
@@ -107,5 +107,10 @@ python -m pytest -v --tb=no cli_anything/joplin/tests
CLI_ANYTHING_FORCE_INSTALLED=1 python -m pytest -v -s cli_anything/joplin/tests/test_full_e2e.py
```
+Current validation baseline (Windows + Joplin CLI 3.6.2):
+
+- `python -m pytest -q cli_anything/joplin/tests/test_core.py` → `79 passed, 1 skipped`
+- `python -m pytest -q cli_anything/joplin/tests` → `106 passed, 2 skipped`
+
See `cli_anything/joplin/tests/TEST.md` for the full test plan and
`cli_anything/joplin/WORKFLOWS.md` for the verified workflow inventory.
diff --git a/joplin/agent-harness/cli_anything/joplin/WORKFLOWS.md b/joplin/agent-harness/cli_anything/joplin/WORKFLOWS.md
index ccfa2f4b6..5005fc93b 100644
--- a/joplin/agent-harness/cli_anything/joplin/WORKFLOWS.md
+++ b/joplin/agent-harness/cli_anything/joplin/WORKFLOWS.md
@@ -6,7 +6,7 @@ has implemented and verified. It is intended as the single source of truth for
## 1. Categories
-The harness covers 11 workflow categories:
+The harness covers 12 workflow categories:
1. CLI surface — `--help`, every group's help, JSON envelope
2. Project lifecycle — `new`, `open`, `info`, `json`, `save`, `status`,
@@ -77,13 +77,13 @@ tag.add, tag.remove, attach.add, interop.export, note.remove, notebook.remove
## 4. Test layering summary
-| Layer | File / class | Backend needed | Workflows |
-|--------------------------|--------------------------------------|----------------|-----------|
-| Unit + CLI contract | `test_core.py` | No | 65 tests |
-| CLI subprocess | `TestCLISubprocess` | No | 10 tests |
-| Real-backend commands | `TestBackendCommands` | Yes | 6 tests |
-| Real-backend workflows | `TestBackendWorkflows` | Yes | 11 tests |
-| End-to-end integration | `TestBackendIntegration` | Yes | 1 test |
+| Layer | File / class | Backend needed | Workflows |
+|--------------------------|--------------------------------------|----------------|---------------------------------|
+| Unit + CLI contract | `test_core.py` | No | 79 tests (1 skipped on Windows) |
+| CLI subprocess | `TestCLISubprocess` | No | 10 tests |
+| Real-backend commands | `TestBackendCommands` | Yes | 6 tests |
+| Real-backend workflows | `TestBackendWorkflows` | Yes | 11 tests (1 skipped on Windows) |
+| End-to-end integration | `TestBackendIntegration` | Yes | 1 test |
## 5. Adding a new workflow
@@ -110,4 +110,7 @@ tag.add, tag.remove, attach.add, interop.export, note.remove, notebook.remove
is therefore skipped on Windows.
- `joplin version` can fail in npm global layouts because the upstream command
looks for `../package.json`. `backend version` falls back to the installed
- `node_modules/joplin/package.json` metadata.
+ Joplin `package.json` across every common layout: the symlink-resolved
+ binary directory (Unix npm global, Homebrew, nvm), the Windows-style
+ sibling `node_modules/joplin`, the Unix-style parent `lib/node_modules/joplin`,
+ and `npm root -g` as a last resort.
diff --git a/joplin/agent-harness/cli_anything/joplin/core/backend.py b/joplin/agent-harness/cli_anything/joplin/core/backend.py
index d1e0aa034..da4217c9f 100644
--- a/joplin/agent-harness/cli_anything/joplin/core/backend.py
+++ b/joplin/agent-harness/cli_anything/joplin/core/backend.py
@@ -1,24 +1,121 @@
import json
+import os
+import subprocess
from pathlib import Path
from cli_anything.joplin.utils.joplin_backend import BackendConfig, find_joplin, run_joplin_command, run_joplin_json
+def _npm_global_root() -> Path | None:
+ """Best-effort lookup of npm's global ``node_modules`` directory.
+
+ Returns ``None`` if npm is missing, fails, or produces no output. Errors
+ here must never propagate to the caller -- this is only the last-resort
+ leg of the ``backend version`` fallback path.
+ """
+ try:
+ proc = subprocess.run(
+ ["npm", "root", "-g"],
+ capture_output=True,
+ text=True,
+ timeout=10,
+ check=False,
+ )
+ except (FileNotFoundError, OSError, subprocess.SubprocessError):
+ return None
+ if proc.returncode != 0:
+ return None
+ out = (proc.stdout or "").strip()
+ return Path(out) if out else None
+
+
+def _joplin_package_json_candidates(binary_path: str) -> list[Path]:
+ """Plausible ``package.json`` locations for the installed Joplin CLI.
+
+ Handles the common npm/pnpm layouts:
+
+ * Windows npm shim / custom prefix:
+ ``<prefix>/joplin.cmd`` next to ``<prefix>/node_modules/joplin/package.json``.
+ * Unix npm global default (and Homebrew / nvm symlinks):
+ ``<prefix>/bin/joplin`` is a symlink into
+ ``<prefix>/lib/node_modules/joplin/main.js``; resolving the symlink and
+ taking the parent yields the package root.
+ * Last resort: ``npm root -g`` to discover wherever npm actually keeps the
+ global ``node_modules`` tree on this machine.
+ """
+ binary = Path(binary_path)
+ candidates: list[Path] = []
+ seen: set[str] = set()
+
+ def add(p: Path) -> None:
+ try:
+ key = os.path.normcase(os.path.normpath(str(p)))
+ except Exception:
+ key = str(p)
+ if key in seen:
+ return
+ seen.add(key)
+ candidates.append(p)
+
+ try:
+ resolved = Path(os.path.realpath(binary))
+ except OSError:
+ resolved = binary
+
+ # Symlinked binary points directly into the package (e.g. main.js at the
+ # package root, or one level deep under bin/).
+ add(resolved.parent / "package.json")
+ add(resolved.parent.parent / "package.json")
+
+ # Windows / custom-prefix layouts: shim next to a local node_modules tree.
+ add(binary.parent / "node_modules" / "joplin" / "package.json")
+
+ # Unix npm global default: <prefix>/bin/joplin -> <prefix>/lib/node_modules/joplin.
+ add(binary.parent.parent / "lib" / "node_modules" / "joplin" / "package.json")
+
+ npm_root = _npm_global_root()
+ if npm_root is not None:
+ add(npm_root / "joplin" / "package.json")
+
+ return candidates
+
+
+def _load_joplin_package_metadata(binary_path: str) -> dict | None:
+ """Return the parsed Joplin ``package.json`` if any candidate matches.
+
+ Only files whose ``"name"`` field is exactly ``"joplin"`` are accepted,
+ so an unrelated neighbour ``package.json`` (e.g. another tool sharing the
+ npm prefix) cannot impersonate the metadata.
+ """
+ for candidate in _joplin_package_json_candidates(binary_path):
+ try:
+ if not candidate.is_file():
+ continue
+ metadata = json.loads(candidate.read_text(encoding="utf-8"))
+ except (OSError, ValueError):
+ continue
+ if isinstance(metadata, dict) and metadata.get("name") == "joplin":
+ return metadata
+ return None
+
+
def version_info(config: BackendConfig) -> dict:
try:
return run_joplin_command(["version"], config)
except RuntimeError as exc:
# Joplin 3.6.2's installed `command-version.js` may require
# `../package.json`, which is missing in npm -g layouts. Fall back to
- # the package metadata next to the installed CLI.
+ # the package metadata next to the installed CLI -- searching every
+ # known npm/pnpm global layout so the recovery actually fires on the
+ # most common installs (Windows shim, Unix `/usr/local/bin -> lib/...`
+ # symlink, Homebrew, nvm, custom prefix).
if "package.json" not in str(exc):
raise
- binary = Path(find_joplin(config.binary))
- package_json = binary.parent / "node_modules" / "joplin" / "package.json"
- if not package_json.exists():
+ binary = find_joplin(config.binary)
+ metadata = _load_joplin_package_metadata(binary)
+ if metadata is None:
raise
- metadata = json.loads(package_json.read_text(encoding="utf-8"))
return {
"command": [str(binary), "version"],
"returncode": 0,
diff --git a/joplin/agent-harness/cli_anything/joplin/skills/SKILL.md b/joplin/agent-harness/cli_anything/joplin/skills/SKILL.md
index 193ad0b96..9067bc009 100644
--- a/joplin/agent-harness/cli_anything/joplin/skills/SKILL.md
+++ b/joplin/agent-harness/cli_anything/joplin/skills/SKILL.md
@@ -75,7 +75,10 @@ When `--json` is enabled, commands return:
- Some Joplin CLI builds gate `search` behind GUI mode; if you see
`"only available in GUI mode"`, treat search as best-effort.
- Joplin 3.6.x can have a broken `version` command in npm global layouts; the
- harness falls back to the installed package metadata for `backend version`.
+ harness falls back to installed package metadata for `backend version`,
+ probing the symlink-resolved binary directory, the Windows-style sibling
+ `node_modules/joplin`, the Unix-style parent `lib/node_modules/joplin`, and
+ finally `npm root -g`.
## Test workflow
@@ -95,3 +98,8 @@ python -m pytest -v --tb=no cli_anything/joplin/tests
# Verify the installed console script entry point
CLI_ANYTHING_FORCE_INSTALLED=1 python -m pytest -v -s cli_anything/joplin/tests/test_full_e2e.py
```
+
+Current validation baseline (Windows + Joplin CLI 3.6.2):
+
+- `python -m pytest -q cli_anything/joplin/tests/test_core.py` → `79 passed, 1 skipped`
+- `python -m pytest -q cli_anything/joplin/tests` → `106 passed, 2 skipped`
diff --git a/joplin/agent-harness/cli_anything/joplin/tests/TEST.md b/joplin/agent-harness/cli_anything/joplin/tests/TEST.md
index 5f876055a..914431c7a 100644
--- a/joplin/agent-harness/cli_anything/joplin/tests/TEST.md
+++ b/joplin/agent-harness/cli_anything/joplin/tests/TEST.md
@@ -8,7 +8,7 @@ The suite has two files:
Real-backend classes are skipped automatically when `joplin` is not on `PATH`.
-## test_core.py (65 tests)
+## test_core.py (79 tests, 1 skipped on Windows)
Pure Python tests covering the harness surface. Safe to run anywhere without
a Joplin backend.
@@ -18,9 +18,11 @@ Coverage areas:
- Project schema, save/open roundtrip, unicode roundtrip, history shape
- Session lifecycle: set/get, snapshot, undo, redo, undo→redo chain,
redo cleared on new snapshot, save/save-without-path, `mark_dirty`
+- Session save regression: nested project path auto-creates missing parent
+ directories before lock/write
- Backend runner: `find_joplin`, profile/no-profile invocation, error path,
- benign Node punycode warning passthrough, timeout, JSON parse fallback,
- empty stdout
+ benign Node warning stripping, mixed warning+real-error handling, timeout,
+ JSON parse fallback, empty stdout
- Core module argument shapes for: notes (cp/mv/ren/remove/get verbose),
notebooks (rmbook flags), todos (mktodo/toggle/clear/done/undone), tags
(tagnotes via `tag list`)
@@ -37,6 +39,18 @@ Coverage areas:
- Joplin source parity checks for `ls --format json`, `config --export`,
`config --import-file`, `sync --upgrade/--use-lock`, `import --force`,
`import --output-format`, `version`, `server`, and `e2ee` wrapper arguments
+- Backend config precedence regression checks: CLI `--binary/--profile`
+ overrides, project-persisted values when flags are omitted, and fallback to
+ default `joplin`
+- `backend version` fallback resolves the Joplin `package.json` across every
+ common npm/pnpm layout: Windows shim + custom prefix
+ (`<prefix>/joplin.cmd` + `<prefix>/node_modules/joplin`), Unix npm global
+ symlink (`<prefix>/bin/joplin -> <prefix>/lib/node_modules/joplin/main.js`,
+ skipped where symlinks need elevated privileges), Unix non-symlink wrapper
+ (`<prefix>/bin/joplin` + `<prefix>/lib/node_modules/joplin`), `npm root -g`
+ last-resort lookup, foreign `package.json` rejection (must have
+ `"name": "joplin"`), and reraise-when-nothing-found / unrelated-error
+ passthrough
```bash
python -m pytest -q cli_anything/joplin/tests/test_core.py
@@ -60,7 +74,7 @@ behavior:
- `--dry-run` does not mutate the project file
- unknown subcommand exits non-zero
-### `TestBackendCommands` (5 tests, backend required)
+### `TestBackendCommands` (6 tests, backend required)
Isolated real-backend command tests:
@@ -68,6 +82,7 @@ Isolated real-backend command tests:
- `notebooks list` and `notes list`
- `config get sync.target` and `config list`
- `status show`
+- backend utilities (`backend version/dump`, `server status`, `e2ee status`)
- `session undo` / `session redo` return the documented errors on a clean
project
@@ -126,7 +141,11 @@ CLI_ANYTHING_FORCE_INSTALLED=1 python -m pytest -v -s cli_anything/joplin/tests/
message, and the workflow test accepts that shape.
- `joplin version` is broken in some npm global layouts because
`command-version.js` requires `../package.json`. The harness falls back to
- `node_modules/joplin/package.json` and includes the original error in stderr.
+ the package metadata in any of: the symlink-resolved binary directory
+ (Unix npm global / Homebrew / nvm), the sibling `node_modules/joplin`
+ (Windows shim / custom prefix), the parent's `lib/node_modules/joplin`
+ (non-symlinked `<prefix>/bin/joplin`), or whatever `npm root -g` reports.
+ The original error is included in `stderr`.
- Non-ASCII process arguments on Windows pass through `joplin.cmd` →
`cmd.exe`, which drops to the active code page. The unicode workflow test
is therefore skipped on Windows. The Python-level unicode handling in the
diff --git a/joplin/agent-harness/cli_anything/joplin/tests/test_core.py b/joplin/agent-harness/cli_anything/joplin/tests/test_core.py
index 8550bc9ad..1c6012f60 100644
--- a/joplin/agent-harness/cli_anything/joplin/tests/test_core.py
+++ b/joplin/agent-harness/cli_anything/joplin/tests/test_core.py
@@ -617,6 +617,159 @@ def test_sync_import_config_and_backend_args(monkeypatch):
assert captured[6] == ["e2ee", "decrypt-file", "encrypted.bin", "--output", "out"]
+# ---------------------------------------------------------------------------
+# backend version fallback for broken npm-global `joplin version`
+# ---------------------------------------------------------------------------
+
+
+def _write_joplin_package_json(path, version="3.6.2", description="Joplin CLI"):
+ import json as _json
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(
+ _json.dumps(
+ {"name": "joplin", "version": version, "description": description}
+ ),
+ encoding="utf-8",
+ )
+
+
+def _force_version_failure(monkeypatch, message="Cannot find module '../package.json'"):
+ def boom(args, cfg, timeout=120):
+ assert args == ["version"]
+ raise RuntimeError(message)
+
+ monkeypatch.setattr(backend_core, "run_joplin_command", boom)
+
+
+def test_backend_version_fallback_windows_shim_layout(tmp_path, monkeypatch):
+ """Custom Windows prefix: `<prefix>/joplin.cmd` + sibling `node_modules`."""
+ prefix = tmp_path / "joplin-cli"
+ binary = prefix / "joplin.cmd"
+ binary.parent.mkdir(parents=True, exist_ok=True)
+ binary.write_text("@echo off", encoding="utf-8")
+ _write_joplin_package_json(prefix / "node_modules" / "joplin" / "package.json")
+
+ monkeypatch.setattr(backend_core, "find_joplin", lambda _b: str(binary))
+ monkeypatch.setattr(backend_core, "_npm_global_root", lambda: None)
+ _force_version_failure(monkeypatch)
+
+ result = backend_core.version_info(joplin_backend.BackendConfig())
+ assert result["returncode"] == 0
+ assert result["stdout"] == "3.6.2"
+ assert result["metadata"]["name"] == "joplin"
+ assert "Fallback after broken Joplin version command" in result["stderr"]
+
+
+def test_backend_version_fallback_unix_global_symlink(tmp_path, monkeypatch):
+ """Unix npm default: `<prefix>/bin/joplin` symlink into `<prefix>/lib/node_modules/joplin/main.js`."""
+ if not hasattr(os, "symlink"):
+ pytest.skip("symlinks not supported on this platform")
+
+ prefix = tmp_path / "usr-local"
+ bin_dir = prefix / "bin"
+ pkg_dir = prefix / "lib" / "node_modules" / "joplin"
+ bin_dir.mkdir(parents=True, exist_ok=True)
+ pkg_dir.mkdir(parents=True, exist_ok=True)
+
+ main_js = pkg_dir / "main.js"
+ main_js.write_text("// joplin entry", encoding="utf-8")
+ _write_joplin_package_json(pkg_dir / "package.json", version="3.5.1")
+
+ binary = bin_dir / "joplin"
+ try:
+ os.symlink(main_js, binary)
+ except (OSError, NotImplementedError):
+ pytest.skip("could not create symlink (permission denied?)")
+
+ monkeypatch.setattr(backend_core, "find_joplin", lambda _b: str(binary))
+ monkeypatch.setattr(backend_core, "_npm_global_root", lambda: None)
+ _force_version_failure(monkeypatch)
+
+ result = backend_core.version_info(joplin_backend.BackendConfig())
+ assert result["stdout"] == "3.5.1"
+ assert result["metadata"]["name"] == "joplin"
+
+
+def test_backend_version_fallback_unix_global_no_symlink(tmp_path, monkeypatch):
+ """`<prefix>/bin/joplin` is a plain wrapper script (no symlink), package
+ still lives at `<prefix>/lib/node_modules/joplin`."""
+ prefix = tmp_path / "opt-node"
+ bin_dir = prefix / "bin"
+ pkg_dir = prefix / "lib" / "node_modules" / "joplin"
+ bin_dir.mkdir(parents=True, exist_ok=True)
+ pkg_dir.mkdir(parents=True, exist_ok=True)
+ _write_joplin_package_json(pkg_dir / "package.json", version="3.4.0")
+
+ binary = bin_dir / "joplin"
+ binary.write_text("#!/bin/sh\nexec node ../lib/node_modules/joplin/main.js \"$@\"\n", encoding="utf-8")
+
+ monkeypatch.setattr(backend_core, "find_joplin", lambda _b: str(binary))
+ monkeypatch.setattr(backend_core, "_npm_global_root", lambda: None)
+ _force_version_failure(monkeypatch)
+
+ result = backend_core.version_info(joplin_backend.BackendConfig())
+ assert result["stdout"] == "3.4.0"
+
+
+def test_backend_version_fallback_uses_npm_root_when_local_paths_miss(tmp_path, monkeypatch):
+ """If none of the path-derived candidates exist, fall back to `npm root -g`."""
+ binary = tmp_path / "stray-bin" / "joplin"
+ binary.parent.mkdir(parents=True, exist_ok=True)
+ binary.write_text("noop", encoding="utf-8")
+
+ npm_root = tmp_path / "npm-global"
+ _write_joplin_package_json(npm_root / "joplin" / "package.json", version="3.7.99")
+
+ monkeypatch.setattr(backend_core, "find_joplin", lambda _b: str(binary))
+ monkeypatch.setattr(backend_core, "_npm_global_root", lambda: npm_root)
+ _force_version_failure(monkeypatch)
+
+ result = backend_core.version_info(joplin_backend.BackendConfig())
+ assert result["stdout"] == "3.7.99"
+
+
+def test_backend_version_fallback_ignores_foreign_package_json(tmp_path, monkeypatch):
+ """A non-Joplin `package.json` next to the binary must not impersonate metadata."""
+ prefix = tmp_path / "shared-prefix"
+ binary = prefix / "joplin.cmd"
+ binary.parent.mkdir(parents=True, exist_ok=True)
+ binary.write_text("@echo off", encoding="utf-8")
+
+ foreign = prefix / "node_modules" / "joplin" / "package.json"
+ foreign.parent.mkdir(parents=True, exist_ok=True)
+ foreign.write_text('{"name": "something-else", "version": "0.0.1"}', encoding="utf-8")
+
+ monkeypatch.setattr(backend_core, "find_joplin", lambda _b: str(binary))
+ monkeypatch.setattr(backend_core, "_npm_global_root", lambda: None)
+ _force_version_failure(monkeypatch)
+
+ with pytest.raises(RuntimeError, match="package.json"):
+ backend_core.version_info(joplin_backend.BackendConfig())
+
+
+def test_backend_version_fallback_reraises_when_nothing_found(tmp_path, monkeypatch):
+ binary = tmp_path / "nowhere" / "joplin"
+ binary.parent.mkdir(parents=True, exist_ok=True)
+ binary.write_text("noop", encoding="utf-8")
+
+ monkeypatch.setattr(backend_core, "find_joplin", lambda _b: str(binary))
+ monkeypatch.setattr(backend_core, "_npm_global_root", lambda: None)
+ _force_version_failure(monkeypatch, message="Cannot find module '../package.json'")
+
+ with pytest.raises(RuntimeError, match="package.json"):
+ backend_core.version_info(joplin_backend.BackendConfig())
+
+
+def test_backend_version_does_not_fallback_on_unrelated_error(tmp_path, monkeypatch):
+ binary = tmp_path / "joplin.cmd"
+ binary.write_text("@echo off", encoding="utf-8")
+ monkeypatch.setattr(backend_core, "find_joplin", lambda _b: str(binary))
+ _force_version_failure(monkeypatch, message="permission denied")
+
+ with pytest.raises(RuntimeError, match="permission denied"):
+ backend_core.version_info(joplin_backend.BackendConfig())
+
+
# ---------------------------------------------------------------------------
# Backend config resolution precedence
# ---------------------------------------------------------------------------
diff --git a/registry.json b/registry.json
index 27f64f593..3f8b9f749 100644
--- a/registry.json
+++ b/registry.json
@@ -987,8 +987,8 @@
"category": "knowledge",
"contributors": [
{
- "name": "Rowan-coder1",
- "url": "https://github.com/Rowan-coder1"
+ "name": "27494539a-hub",
+ "url": "https://github.com/27494539a-hub"
}
]
},
diff --git a/skills/cli-anything-joplin/SKILL.md b/skills/cli-anything-joplin/SKILL.md
index 444b147ae..7494e0a80 100644
--- a/skills/cli-anything-joplin/SKILL.md
+++ b/skills/cli-anything-joplin/SKILL.md
@@ -76,7 +76,10 @@ When `--json` is enabled, commands return:
`error.message` in the JSON envelope to decide whether to retry inside the
REPL.
- Joplin 3.6.x can have a broken `version` command in npm global layouts; the
- harness falls back to installed package metadata for `backend version`.
+ harness falls back to installed package metadata for `backend version`,
+ probing the symlink-resolved binary directory, the Windows-style sibling
+ `node_modules/joplin`, the Unix-style parent `lib/node_modules/joplin`, and
+ finally `npm root -g`.
## Recommended workflow
@@ -87,3 +90,8 @@ When `--json` is enabled, commands return:
3. Run mutating commands with `--json --project ./my-task.joplin-harness.json`.
4. Use `session history` for a structured audit of what the agent did.
5. Export with `interop export <path> --format jex` for portable backups.
+
+Current validation baseline (Windows + Joplin CLI 3.6.2):
+
+- `python -m pytest -q cli_anything/joplin/tests/test_core.py` → `79 passed, 1 skipped`
+- `python -m pytest -q cli_anything/joplin/tests` → `106 passed, 2 skipped`