Repository navigation
fix(skills): scan a directory marketplace's live plugin directory - #23
Conversation
Claude Code installs a `directory`-sourced marketplace by copying it into `~/.claude/plugins/cache/`, but loads plugins from the source directory in place. The skill picker scanned the cache copy, so it offered whatever skill set existed at the last `claude plugin update` rather than what the harness would actually load. Fork feature `fork-live-plugin-marketplaces` reads `known_marketplaces.json`, keeps only the `directory` entries, resolves each marketplace manifest's plugins to their live `skills` directory, and repoints matching cache roots at it. `github`/`git` marketplaces are untouched — their cache copy is what the harness loads. Any read or parse failure degrades to the cached roots, so a malformed registry never drops a plugin. The WSL path batches `known_marketplaces.json` into the metadata read that already happens, so a distro with no directory marketplace still costs exactly one `wsl.exe` boot; the manifest read is a second and final one. Two import-swap seams (`discovery.ts`, `skill-discovery-wsl.ts`) and the feature glob are declared in the ownership manifest.
There was a problem hiding this comment.
🟡 Changes recommended
The new native metadata reader uses a TOCTOU-prone stat() + readFile() pattern that can bypass the intended size cap and allow resource exhaustion from oversized marketplace files.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a fork-owned “live plugin marketplaces” feature so Orca’s skill discovery repoints directory-sourced Claude marketplaces from the cached copy (~/.claude/plugins/cache/...) to the live marketplace directory that Claude actually loads, including a WSL implementation.
Changes:
- Introduces
fork-live-plugin-marketplaces/to parseknown_marketplaces.json, read marketplace manifests, and rewrite plugin scan roots to liveskills/directories. - Switches native + WSL skill discovery to call the new “live” discovery entrypoints via
import-swapseams. - Adds unit tests covering native + WSL behavior, including batching/ordering guarantees and quoting behavior.
File summaries
| File | Description |
|---|---|
| src/main/skills/skill-discovery-wsl.ts | Routes WSL plugin root discovery through the new live-marketplace implementation. |
| src/main/skills/discovery.ts | Routes native plugin root discovery through the new live-marketplace implementation. |
| src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-sources.ts | Native entrypoint: reads metadata + directory marketplaces and applies root overrides. |
| src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-sources.test.ts | Native tests for live-root rewriting and failure degradation. |
| src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-sources-wsl.ts | WSL entrypoint: batches metadata reads in-distro and applies overrides with a second manifest batch. |
| src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-sources-wsl.test.ts | WSL tests for batching/ordering, quoting, --exec, and failure degradation. |
| src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-registry.ts | Parses known_marketplaces.json and filters to absolute, directory-sourced marketplaces. |
| src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-registry.test.ts | Tests for registry filtering and path resolution. |
| src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-override.ts | Builds cache-path→plugin-id index, resolves live skill paths, and rewrites roots without duplication. |
| src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-override.test.ts | Tests for install indexing, source containment, live-path mapping, and root rewrite semantics. |
| config/fork-ownership.json | Declares the new Tier 1 feature glob and registers the two import-swap seams + residual updates. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@copilot-pull-request-reviewer Fixing. Will be in the next commit |
|
Fixing:
Will be in the next commit. |
f037e51 to
87434ee
Compare
…nce off the deprecated owner resolver (stablyai#30484) The eight mirroring callers (#23-#30) read the owner through runtimeEnvironmentIdWithLegacyFallbackUnlessTwin, so a twin is still not mirrored. Sort-order persistence (#2) leaves out ids that two hosts publish, and ids whose only server proof is a repo row (isUnprovenServerSshRoute), instead of writing them to this desktop's or a guessed server's meta. Deprecated importers 40 -> 31.
Problem
Claude Code installs a
directory-sourced marketplace by copying it into~/.claude/plugins/cache/, but it loads those plugins from the source directory in place. Orca's skill picker scanned the cache copy, so it offered whatever skill set existed at the lastclaude plugin update— not what the harness would actually load. Skills added to a locally-developed marketplace never appeared until the user remembered to re-runplugin update.Approach
New Tier 1 fork feature at
src/main/skills/fork-live-plugin-marketplaces/:live-plugin-marketplace-registry.tsknown_marketplaces.json, keeps onlydirectoryentries with an absoluteinstallLocationlive-plugin-marketplace-override.ts<installPath>/skills, resolves each manifest's plugins to their liveskillsdir, rewrites matching rootslive-plugin-marketplace-sources.tslive-plugin-marketplace-sources-wsl.tsTwo
import-swapseams point the existing callers at the live variants:src/main/skills/discovery.ts:20,277src/main/skills/skill-discovery-wsl.ts:19,191Details worth a second look
github/gitmarketplaces are left alone. Those really are copied into the cache, so the cached root already matches what the harness loads.known_marketplaces.jsonkey, never the manifest's ownname. The two can disagree, and installs are recorded under the key.sourceis confined to the install location. A../or absolutesourceresolves tonullrather than escaping the marketplace directory.wsl.exeboots.known_marketplaces.jsonrides along in the metadata read that already happens, so a distro with no directory marketplace still costs exactly one; the manifest batch is the second and final one. Metadata is read inside the distro (not over UNC) so Windows path semantics never apply to guest files.Fork ownership
**/fork-live-plugin-marketplaces/**declared underfeatures.seamswith their lines verbatim; residuals re-baselined (discovery.ts3/0 → 5/2,skill-discovery-wsl.ts4/1 → 6/3).v1.4.187: no coverage, staleness, capture, seam, or residual findings.Verification
pnpm typecheck— cleanpnpm lint(incl. localization extraction + coverage) — cleanpnpm test:sandboxon the feature — 4 files, 29 tests, all passTest coverage includes the WSL phase-1 batch's exact path list and order (the module slices it positionally) and a two-marketplace case proving each manifest stays aligned with its own live directory; that alignment assertion was mutation-checked by reversing
manifestContents.Adversarial review (
/quirk:adversarial-review, Codexgpt-5.6-solas cross-family reviewer) returned PASS: 0 blocking, 1 advisory since addressed, 1 finding refuted on miscited evidence.