test(claude-import): use portable marketplace fixtures

This commit is contained in:
Jamie McGregor Nelson 2026-03-15 09:34:43 -04:00
parent 60413c4ea9
commit fd15f852d8
4 changed files with 29 additions and 8 deletions

View file

@ -52,6 +52,9 @@ export function getClaudeSearchRoots(cwd: string): { skillRoots: string[]; plugi
const parent = resolve(cwd, "..");
const grandparent = resolve(cwd, "..", "..");
// Claude Code user-scope skills live under ~/.claude/skills.
// Keep sibling/local clone fallbacks for developer workflows, but they are
// examples/convenience paths rather than the primary Claude storage model.
const skillRoots = uniqueExistingDirs([
join(home, ".claude", "skills"),
join(home, "repos", "claude_skills"),
@ -62,7 +65,14 @@ export function getClaudeSearchRoots(cwd: string): { skillRoots: string[]; plugi
join(grandparent, "skills"),
]);
// Anthropic docs model marketplaces as sources users add with
// `/plugin marketplace add ...`, and Claude stores those marketplaces under
// ~/.claude/plugins/marketplaces/. Installed plugin payloads are copied into
// ~/.claude/plugins/cache/. We prefer those stable Claude-managed locations
// before local example clones.
const pluginRoots = uniqueExistingDirs([
join(home, ".claude", "plugins", "marketplaces"),
join(home, ".claude", "plugins", "cache"),
join(home, ".claude", "plugins"),
join(home, "repos", "claude-plugins-official"),
join(home, "repos", "claude_skills"),

View file

@ -4,9 +4,14 @@
* Reads marketplace.json from Claude marketplace repos, resolves plugin source paths,
* parses plugin.json manifests, and inventories available components (skills, agents, commands, MCP servers, LSP servers, hooks).
*
* Handles two marketplace formats:
* 1. jamie-style (../claude_skills): marketplace.json has {name, source} entries; plugins have .claude-plugin/plugin.json
* 2. official-style (../claude-plugins-official): marketplace.json entries contain inline metadata
* Marketplace roots should reflect the Claude Code model documented by Anthropic:
* users add a marketplace source with `/plugin marketplace add ...`, Claude stores
* marketplace sources under `~/.claude/plugins/marketplaces/`, and installed plugin
* payloads are copied into `~/.claude/plugins/cache/`.
*
* Handles two marketplace catalog shapes observed in the wild:
* 1. jamie-style: marketplace.json has {name, source} entries; plugins have .claude-plugin/plugin.json
* 2. official-style: marketplace.json entries contain inline metadata
*/
import * as fs from 'node:fs';

View file

@ -1,10 +1,14 @@
/**
* TUI Command Flow Tests for import-claude
*
* Tests R015: Validates the TUI command flow for /gsd prefs import-claude
* Uses mock UI to simulate user selections.
* Tests R015: validates the TUI command flow for /gsd prefs import-claude.
* These tests currently use mock UI, and marketplace availability is still
* derived from real/local marketplace roots. Follow-up work should route these
* through portable marketplace fixtures that mirror Claude Code's
* `/plugin marketplace add ...` source model.
*/
import { describe, it, before, after, mock } from 'node:test';
import assert from 'node:assert';
import { existsSync, mkdtempSync, rmSync, writeFileSync, readFileSync, mkdirSync } from 'node:fs';

View file

@ -1,10 +1,12 @@
/**
* Live E2E Tests Against Real Marketplace Repos
*
* Tests R014: Validates PluginImporter pipeline against real marketplace data.
* Uses ../claude_skills and ../claude-plugins-official directories.
* Tests R014: validates PluginImporter against real marketplace data.
*
* Skips gracefully when repos are absent (CI-safe).
* Source model alignment:
* - Prefer Claude Code managed marketplace locations when available
* - Fall back to cloned fixture repos for portability
* - Never require a contributor's personal sibling repo layout
*/
import { describe, it, before, after } from 'node:test';