{"version":3,"file":"skills-install-Byv04S67.mjs","names":[],"sources":["../src/cli/skills-install.ts"],"sourcesContent":["/**\n * `pagesmith skills install` — write versioned-pointer skill stubs into a\n * consumer repo.\n *\n * Unlike the old full-copy installer, this never duplicates a skill body into\n * the repo. For every skill shipped by a resolvable `@pagesmith/*` package under\n * `node_modules/@pagesmith/<pkg>/skills/<name>/`, it writes a canonical pointer\n * stub at `.agents/skills/<name>/SKILL.md` plus thin mirrors under each\n * detected/requested harness dir (`.claude/skills`, `.cursor/skills`,\n * `.codex/skills`, `.continue/skills`). The stub bodies point back at the\n * version-pinned original in `node_modules`, so every agent reads exactly the\n * skill that matches the installed package.\n *\n * Stubs carry an HTML-comment marker so re-runs are idempotent (created /\n * updated / unchanged), version bumps are detected as drift, and orphaned stubs\n * (skills removed from a newer package, or a package that is no longer\n * installed) can be swept — but only within the managed `pagesmith-*` namespace,\n * and only stubs we actually generated.\n *\n * The mechanism is deliberately parallel to `diagramkit skills install`; the\n * only structural difference is that Pagesmith installs from several packages at\n * once, so the orphan baseline is the union of every resolvable package's skill\n * set (never just the packages selected for this run).\n */\n\nimport {\n  existsSync,\n  mkdirSync,\n  readFileSync,\n  readdirSync,\n  rmSync,\n  statSync,\n  writeFileSync,\n} from \"fs\";\nimport { createRequire } from \"module\";\nimport { dirname, join, relative, resolve } from \"path\";\n\n/* ── Public constants ── */\n\nexport type HarnessName = \"claude\" | \"cursor\" | \"codex\" | \"continue\";\n\n/** Parent dir for each harness (mirrors live under `<dir>/skills/`). */\nexport const HARNESS_PARENT_DIRS: Record<HarnessName, string> = {\n  claude: \".claude\",\n  cursor: \".cursor\",\n  codex: \".codex\",\n  continue: \".continue\",\n};\n\nexport const ALL_HARNESSES: readonly HarnessName[] = [\"claude\", \"cursor\", \"codex\", \"continue\"];\n\n/** HTML-comment marker token identifying a canonical Pagesmith pointer stub. */\nexport const POINTER_MARKER_TOKEN = \"pagesmith-skill-pointer\";\n\n/** HTML-comment marker token identifying a Pagesmith harness mirror stub. */\nexport const MIRROR_MARKER_TOKEN = \"pagesmith-skill-mirror\";\n\n/**\n * Shared substring present in both marker tokens. Retained for reference; orphan\n * detection deliberately does **not** key on this bare substring (it would match\n * a hand-authored skill that merely mentions the token in prose) — see\n * {@link hasManagedMarker}.\n */\nexport const MANAGED_MARKER_SUBSTRING = \"pagesmith-skill-\";\n\n/**\n * Exact HTML-comment marker a stub must carry to be considered ours. Anchored on\n * the generated `<!-- pagesmith-skill-{pointer,mirror}: …` prefix so orphan\n * detection never mistakes prose that merely contains the token for a managed\n * stub, and never sweeps a hand-authored skill.\n */\nconst MANAGED_MARKER_PATTERN = new RegExp(\n  `<!--\\\\s*(?:${POINTER_MARKER_TOKEN}|${MIRROR_MARKER_TOKEN}):`,\n);\n\n/** True when `content` carries a generated Pagesmith pointer or mirror marker. */\nexport function hasManagedMarker(content: string): boolean {\n  return MANAGED_MARKER_PATTERN.test(content);\n}\n\n/** Only skills in this namespace are ever created, swept, or reported. */\nexport const MANAGED_SKILL_PREFIX = \"pagesmith-\";\n\n/** Packages the umbrella installer considers by default. */\nexport const DEFAULT_PACKAGES: readonly string[] = [\n  \"@pagesmith/core\",\n  \"@pagesmith/site\",\n  \"@pagesmith/docs\",\n];\n\n/* ── Public types ── */\n\nexport type StubStatus =\n  | \"created\"\n  | \"updated\"\n  | \"unchanged\"\n  | \"removed\" // orphan deleted (install / dry-run)\n  | \"missing\" // --check: stub absent, would be created\n  | \"stale\" // --check: stub drifted, would be updated\n  | \"orphaned\"; // --check: managed stub no longer shipped\n\nexport interface SkillStubAction {\n  /** Path relative to the target dir. */\n  path: string;\n  skill: string;\n  /** Owning package (undefined for orphan sweeps). */\n  pkg?: string;\n  kind: \"canonical\" | \"mirror\" | \"orphan\";\n  harness?: HarnessName;\n  status: StubStatus;\n}\n\nexport interface InstalledPackage {\n  pkg: string;\n  /** Installed version read from the resolved package.json. */\n  version: string;\n}\n\nexport interface InstallSkillsResult {\n  cwd: string;\n  mode: \"install\" | \"check\" | \"dry-run\";\n  /** Packages skills were installed from this run (resolved + selected). */\n  packages: InstalledPackage[];\n  /** Requested packages that could not be resolved from the consumer. */\n  unresolved: string[];\n  /**\n   * Whether the caller named packages explicitly (`--package`). When `false`\n   * the run used the default package set, so an unresolved default is expected\n   * for a core-only consumer and is not surfaced as a `[skipped]` warning.\n   */\n  requestedExplicit: boolean;\n  /** Harness mirror dirs written this run (the `.agents` base is always written). */\n  harnesses: HarnessName[];\n  /** Skill names targeted this run. */\n  skills: string[];\n  actions: SkillStubAction[];\n  /**\n   * `--check` disposition: `true` when nothing is missing/stale/orphaned.\n   * Always `true` for install / dry-run.\n   */\n  ok: boolean;\n}\n\nexport interface InstallSkillsOptions {\n  /** Target repo directory (default: `process.cwd()`). */\n  cwd?: string;\n  /**\n   * Restrict installation to these packages. `undefined` = every default\n   * package that resolves. Orphan detection always uses the full resolvable\n   * set, so `--package` never sweeps stubs it merely chose not to reinstall.\n   */\n  packages?: string[];\n  /** Explicit harness selection. `undefined` = auto-detect. */\n  harnesses?: HarnessName[];\n  /** Restrict to these skill names (with or without the `pagesmith-` prefix). */\n  only?: string[];\n  /** Verify-only: never write, exit nonzero on missing/stale/orphaned. */\n  check?: boolean;\n  /** Show what would happen without writing. */\n  dryRun?: boolean;\n  /**\n   * Test hook: map of package name → package root. When a package is present\n   * here its root is used verbatim, bypassing `import.meta.resolve`.\n   */\n  packageRoots?: Record<string, string>;\n}\n\n/* ── Frontmatter ── */\n\nexport interface SkillFrontmatter {\n  name?: string;\n  description?: string;\n}\n\n/** Parse the leading YAML frontmatter block for `name` / `description`. */\nexport function readFrontmatter(content: string): SkillFrontmatter {\n  const match = /^---\\s*\\n([\\s\\S]*?)\\n---/.exec(content);\n  if (!match) return {};\n  const body = match[1] ?? \"\";\n  const get = (key: string): string | undefined => {\n    const re = new RegExp(`^${key}:\\\\s*(.+)$`, \"m\");\n    const m = re.exec(body);\n    return m?.[1]?.trim();\n  };\n  return { name: get(\"name\"), description: get(\"description\") };\n}\n\n/* ── Package resolution ── */\n\n/**\n * Resolve a package root (the dir containing its `package.json`) as seen from\n * the consumer `cwd`. Returns `undefined` when the package is not installed.\n *\n * Resolution is anchored on `cwd` via `createRequire(<cwd>/package.json)`.\n * `import.meta.resolve(spec, base)` must **not** be used here: on stable Node\n * (without `--experimental-import-meta-resolve`) the second `base`/parent\n * argument is silently ignored, so it resolves relative to *this* module — the\n * CLI's own install location — instead of the consumer `cwd`. That defeats the\n * whole point of `--dir`/`cwd` scoping (it would happily \"find\" a package the\n * consumer never installed). `createRequire` from the consumer's own\n * `package.json` walks the consumer's `node_modules` chain, matching Node's\n * runtime resolution for that directory.\n */\nexport function resolvePackageRoot(pkg: string, cwd: string): string | undefined {\n  const requireFromCwd = createRequire(join(resolve(cwd), \"package.json\"));\n\n  // Preferred: resolve the package's own `package.json` (most packages expose\n  // it via `exports`, and Node always permits the `./package.json` subpath).\n  try {\n    const pkgPath = requireFromCwd.resolve(`${pkg}/package.json`);\n    if (existsSync(pkgPath)) return dirname(pkgPath);\n  } catch {\n    // Package may not expose `./package.json` through its `exports` map — fall\n    // through to resolving its entry point and walking up.\n  }\n\n  // Fallback: resolve the package entry, then walk up to the nearest\n  // `package.json` whose name matches the requested package.\n  try {\n    let dir = dirname(requireFromCwd.resolve(pkg));\n    for (;;) {\n      const candidate = join(dir, \"package.json\");\n      if (existsSync(candidate) && readPackageName(candidate) === pkg) return dir;\n      const parent = dirname(dir);\n      if (parent === dir) break;\n      dir = parent;\n    }\n  } catch {\n    // package not installed — fall through\n  }\n  return undefined;\n}\n\nfunction readPackageName(packageJsonPath: string): string | undefined {\n  try {\n    const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { name?: string };\n    return pkg.name;\n  } catch {\n    return undefined;\n  }\n}\n\nfunction readPackageVersion(packageRoot: string): string {\n  try {\n    const pkg = JSON.parse(readFileSync(join(packageRoot, \"package.json\"), \"utf-8\")) as {\n      version?: string;\n    };\n    return pkg.version ?? \"0.0.0\";\n  } catch {\n    return \"0.0.0\";\n  }\n}\n\n/* ── Skill discovery ── */\n\nexport interface DiscoveredSkill {\n  name: string;\n  description: string;\n  sourcePath: string;\n}\n\n/** List every `skills/<name>/SKILL.md` shipped in a package root. */\nexport function discoverSkills(packageRoot: string): DiscoveredSkill[] {\n  const skillsDir = join(packageRoot, \"skills\");\n  if (!existsSync(skillsDir) || !statSync(skillsDir).isDirectory()) return [];\n  const out: DiscoveredSkill[] = [];\n  for (const name of readdirSync(skillsDir).sort()) {\n    const skillMd = join(skillsDir, name, \"SKILL.md\");\n    if (!existsSync(skillMd)) continue;\n    const content = readFileSync(skillMd, \"utf-8\");\n    const { name: fmName, description } = readFrontmatter(content);\n    out.push({ name: fmName ?? name, description: description ?? \"\", sourcePath: skillMd });\n  }\n  return out;\n}\n\n/* ── Harness detection ── */\n\n/** A harness is auto-detected when its parent dir already exists in the repo. */\nexport function detectHarnesses(cwd: string): HarnessName[] {\n  return ALL_HARNESSES.filter((h) => existsSync(join(cwd, HARNESS_PARENT_DIRS[h])));\n}\n\n/* ── Stub templates ── */\n\nexport function buildPointerMarker(pkg: string, version: string): string {\n  return `<!-- ${POINTER_MARKER_TOKEN}: pkg=${pkg} version=${version} generator=${pkg}@${version} -->`;\n}\n\nexport function buildMirrorMarker(name: string): string {\n  return `<!-- ${MIRROR_MARKER_TOKEN}: canonical=.agents/skills/${name}/SKILL.md -->`;\n}\n\n/** POSIX relative path from `stubDir` to a target under the resolved package root. */\nfunction posixRelative(stubDir: string, target: string): string {\n  return relative(resolve(stubDir), target)\n    .split(/[\\\\/]+/)\n    .join(\"/\");\n}\n\n/**\n * Compute the POSIX relative link from a canonical stub's directory to the\n * `SKILL.md` shipped by the resolved package root. Using the *resolved* package\n * root (not a fixed `../../../node_modules/@pagesmith/<pkg>` string) keeps the\n * pointer correct in hoisted monorepos, where the package lives at the repo-root\n * `node_modules` while the stub may sit several levels deep.\n */\nexport function pointerToPackageSkill(stubDir: string, packageRoot: string, name: string): string {\n  return posixRelative(stubDir, join(resolve(packageRoot), \"skills\", name, \"SKILL.md\"));\n}\n\n/**\n * Canonical stub written to `.agents/skills/<name>/SKILL.md`. Points at the\n * version-pinned original in the resolved package via relative links.\n */\nexport function renderCanonicalStub(input: {\n  name: string;\n  description: string;\n  pkg: string;\n  version: string;\n  pointerPath: string;\n  referencesPath: string;\n  packageReferencePath: string;\n}): string {\n  const { name, description, pkg, version, pointerPath, referencesPath, packageReferencePath } =\n    input;\n  return `---\nname: ${name}\ndescription: ${description}\n---\n\n${buildPointerMarker(pkg, version)}\n\n# ${name}\n\nCanonical, version-matched skill body ships inside the installed \\`${pkg}\\` package. Read and follow it exactly — do not duplicate it here:\n\n→ [\\`${pointerPath}\\`](${pointerPath})\n\nSibling references (if present): [\\`${referencesPath}\\`](${referencesPath})\nPackage reference: [\\`${packageReferencePath}\\`](${packageReferencePath})\n\nThe body auto-upgrades whenever \\`${pkg}\\` is reinstalled. Always anchor on the local install (\\`npx pagesmith ...\\`), never a global one.\n`;\n}\n\n/**\n * Mirror stub written to `<harness>/skills/<name>/SKILL.md`. Points back at the\n * canonical `.agents/skills/...` file. The `../../../` prefix resolves to the\n * repo root from three levels deep (`.claude/skills/<name>/`).\n */\nexport function renderMirrorStub(name: string, description: string): string {\n  return `---\nname: ${name}\ndescription: ${description}\n---\n\n${buildMirrorMarker(name)}\n\n# ${name}\n\nFollow [\\`.agents/skills/${name}/SKILL.md\\`](../../../.agents/skills/${name}/SKILL.md). Do not duplicate its content here.\n`;\n}\n\n/* ── Idempotent writes ── */\n\ntype PlannedWrite = \"created\" | \"updated\" | \"unchanged\";\n\nfunction planWrite(path: string, content: string): PlannedWrite {\n  if (existsSync(path)) {\n    return readFileSync(path, \"utf-8\") === content ? \"unchanged\" : \"updated\";\n  }\n  return \"created\";\n}\n\nfunction commitWrite(path: string, content: string): void {\n  mkdirSync(dirname(path), { recursive: true });\n  writeFileSync(path, content);\n}\n\n/** Map a planned write to its `--check` status. */\nfunction checkStatus(planned: PlannedWrite): StubStatus {\n  if (planned === \"created\") return \"missing\";\n  if (planned === \"updated\") return \"stale\";\n  return \"unchanged\";\n}\n\n/* ── Orphan detection ── */\n\n/**\n * A managed skill dir under `<skillsRoot>/` that we generated (marker present)\n * but which is not in `shippedNames` is an orphan. User-authored folders —\n * anything outside the `pagesmith-*` namespace, or a `pagesmith-*` folder without\n * our marker (e.g. a hand-authored skill) — are never touched.\n */\nfunction findOrphans(skillsRoot: string, shippedNames: Set<string>): string[] {\n  if (!existsSync(skillsRoot) || !statSync(skillsRoot).isDirectory()) return [];\n  const orphans: string[] = [];\n  for (const name of readdirSync(skillsRoot).sort()) {\n    if (!name.startsWith(MANAGED_SKILL_PREFIX)) continue;\n    if (shippedNames.has(name)) continue;\n    const skillMd = join(skillsRoot, name, \"SKILL.md\");\n    if (!existsSync(skillMd)) continue;\n    if (!hasManagedMarker(readFileSync(skillMd, \"utf-8\"))) continue;\n    orphans.push(name);\n  }\n  return orphans;\n}\n\n/* ── Filters ── */\n\n/**\n * Filter discovered skills to those requested via `--only`. Names match with or\n * without the `pagesmith-` prefix (`--only core-setup` == `--only\n * pagesmith-core-setup`).\n */\nfunction filterByOnly(skills: DiscoveredSkill[], only: string[] | undefined): DiscoveredSkill[] {\n  if (!only || only.length === 0) return skills;\n  const wanted = new Set<string>();\n  for (const raw of only) {\n    const token = raw.trim();\n    if (!token) continue;\n    wanted.add(token);\n    wanted.add(token.startsWith(MANAGED_SKILL_PREFIX) ? token : `${MANAGED_SKILL_PREFIX}${token}`);\n  }\n  return skills.filter((s) => wanted.has(s.name));\n}\n\n/* ── Resolution helpers ── */\n\ninterface ResolvedPackage {\n  pkg: string;\n  root: string;\n  version: string;\n  skills: DiscoveredSkill[];\n}\n\nfunction resolvePackages(\n  candidates: string[],\n  cwd: string,\n  packageRoots: Record<string, string> | undefined,\n): ResolvedPackage[] {\n  const resolved: ResolvedPackage[] = [];\n  for (const pkg of candidates) {\n    const root = packageRoots?.[pkg] ?? resolvePackageRoot(pkg, cwd);\n    if (!root) continue;\n    const skills = discoverSkills(root);\n    if (skills.length === 0) continue;\n    resolved.push({ pkg, root, version: readPackageVersion(root), skills });\n  }\n  return resolved;\n}\n\n/* ── Install ── */\n\nexport function installPackageSkills(options: InstallSkillsOptions = {}): InstallSkillsResult {\n  const cwd = resolve(options.cwd ?? process.cwd());\n  const check = options.check ?? false;\n  const dryRun = options.dryRun ?? false;\n  const write = !check && !dryRun;\n  const mode: InstallSkillsResult[\"mode\"] = check ? \"check\" : dryRun ? \"dry-run\" : \"install\";\n\n  // Orphan baseline: every resolvable package (default set ∪ test overrides),\n  // independent of the `--package` filter. This is what stops a `--package\n  // @pagesmith/core` run from sweeping perfectly valid site/docs stubs.\n  const unionCandidates = [\n    ...new Set([...DEFAULT_PACKAGES, ...Object.keys(options.packageRoots ?? {})]),\n  ];\n  const resolvedUnion = resolvePackages(unionCandidates, cwd, options.packageRoots);\n  const shippedNames = new Set<string>();\n  for (const rp of resolvedUnion) for (const s of rp.skills) shippedNames.add(s.name);\n\n  // Packages to actually (re)install from this run.\n  const requestedExplicit = (options.packages?.length ?? 0) > 0;\n  const requested = options.packages ?? unionCandidates;\n  const requestedSet = new Set(requested);\n  const targetPackages = resolvedUnion.filter((rp) => requestedSet.has(rp.pkg));\n  const unresolved = requested.filter((pkg) => !resolvedUnion.some((rp) => rp.pkg === pkg));\n\n  if (resolvedUnion.length === 0) {\n    throw new Error(\n      `No @pagesmith/* packages with a skills/ folder resolved from ${cwd}. ` +\n        `Install @pagesmith/core, @pagesmith/site, or @pagesmith/docs first.`,\n    );\n  }\n\n  const harnesses = options.harnesses ?? detectHarnesses(cwd);\n  const agentsSkillsRoot = join(cwd, \".agents\", \"skills\");\n  const actions: SkillStubAction[] = [];\n  const targetedSkillNames = new Set<string>();\n\n  for (const rp of targetPackages) {\n    const skills = filterByOnly(rp.skills, options.only);\n    for (const skill of skills) {\n      targetedSkillNames.add(skill.name);\n\n      // Canonical pointer.\n      const canonicalPath = join(agentsSkillsRoot, skill.name, \"SKILL.md\");\n      const stubDir = dirname(canonicalPath);\n      const canonicalContent = renderCanonicalStub({\n        name: skill.name,\n        description: skill.description,\n        pkg: rp.pkg,\n        version: rp.version,\n        pointerPath: pointerToPackageSkill(stubDir, rp.root, skill.name),\n        referencesPath: posixRelative(\n          stubDir,\n          join(resolve(rp.root), \"skills\", skill.name, \"references\"),\n        ),\n        packageReferencePath: posixRelative(stubDir, join(resolve(rp.root), \"REFERENCE.md\")),\n      });\n      const canonicalPlan = planWrite(canonicalPath, canonicalContent);\n      if (write && canonicalPlan !== \"unchanged\") commitWrite(canonicalPath, canonicalContent);\n      actions.push({\n        path: relPath(cwd, canonicalPath),\n        skill: skill.name,\n        pkg: rp.pkg,\n        kind: \"canonical\",\n        status: check ? checkStatus(canonicalPlan) : canonicalPlan,\n      });\n\n      // Harness mirrors.\n      for (const harness of harnesses) {\n        const mirrorPath = join(\n          cwd,\n          HARNESS_PARENT_DIRS[harness],\n          \"skills\",\n          skill.name,\n          \"SKILL.md\",\n        );\n        const mirrorContent = renderMirrorStub(skill.name, skill.description);\n        const mirrorPlan = planWrite(mirrorPath, mirrorContent);\n        if (write && mirrorPlan !== \"unchanged\") commitWrite(mirrorPath, mirrorContent);\n        actions.push({\n          path: relPath(cwd, mirrorPath),\n          skill: skill.name,\n          pkg: rp.pkg,\n          kind: \"mirror\",\n          harness,\n          status: check ? checkStatus(mirrorPlan) : mirrorPlan,\n        });\n      }\n    }\n  }\n\n  // Orphan sweep — canonical base plus every managed harness dir this run.\n  const orphanRoots: Array<{ root: string; harness?: HarnessName }> = [{ root: agentsSkillsRoot }];\n  for (const harness of harnesses) {\n    orphanRoots.push({ root: join(cwd, HARNESS_PARENT_DIRS[harness], \"skills\"), harness });\n  }\n  for (const { root: skillsRoot, harness } of orphanRoots) {\n    for (const orphanName of findOrphans(skillsRoot, shippedNames)) {\n      const orphanDir = join(skillsRoot, orphanName);\n      if (write) rmSync(orphanDir, { recursive: true, force: true });\n      actions.push({\n        path: relPath(cwd, join(orphanDir, \"SKILL.md\")),\n        skill: orphanName,\n        kind: \"orphan\",\n        harness,\n        status: check ? \"orphaned\" : \"removed\",\n      });\n    }\n  }\n\n  const ok = check\n    ? !actions.some(\n        (a) => a.status === \"missing\" || a.status === \"stale\" || a.status === \"orphaned\",\n      )\n    : true;\n\n  return {\n    cwd,\n    mode,\n    packages: targetPackages.map((rp) => ({ pkg: rp.pkg, version: rp.version })),\n    unresolved,\n    requestedExplicit,\n    harnesses,\n    skills: [...targetedSkillNames].sort(),\n    actions,\n    ok,\n  };\n}\n\n/* ── Reporting ── */\n\n/** Human-readable summary for CLI output (non-JSON mode). */\nexport function renderSkillsReport(result: InstallSkillsResult): string {\n  const lines: string[] = [];\n  const pkgSummary = result.packages.map((p) => `${p.pkg}@${p.version}`).join(\", \") || \"(none)\";\n  lines.push(\n    `pagesmith skills ${result.mode} — ${result.skills.length} skill(s) from ${pkgSummary}; ` +\n      `harnesses: ${[\"agents\", ...result.harnesses].join(\", \")}`,\n  );\n  // Only flag unresolved packages the caller asked for by name. When the run\n  // used the default set, an uninstalled site/docs package is expected for a\n  // legitimate core-only consumer, so stay quiet rather than emit `[skipped]`.\n  if (result.requestedExplicit) {\n    for (const pkg of result.unresolved) {\n      lines.push(`  [skipped] ${pkg} (not installed)`);\n    }\n  }\n  for (const action of result.actions) {\n    const where = action.kind === \"orphan\" ? \"orphan\" : (action.harness ?? \"agents\");\n    lines.push(`  [${action.status}] ${action.path} (${where})`);\n  }\n  if (result.mode === \"check\") {\n    lines.push(result.ok ? \"Stubs are up to date.\" : \"Stubs are out of date (see above).\");\n  }\n  return lines.join(\"\\n\");\n}\n\n/* ── CLI runner (shared by the `pagesmith` umbrella and the `pagesmith-core` alias) ── */\n\n/** Flatten a cac option that may be a string, comma list, or repeated array. */\nexport function toList(input: string | string[] | undefined): string[] {\n  if (input === undefined) return [];\n  const raw = Array.isArray(input) ? input : [input];\n  const out: string[] = [];\n  for (const value of raw) {\n    for (const part of String(value).split(\",\")) {\n      const token = part.trim();\n      if (token) out.push(token);\n    }\n  }\n  return out;\n}\n\nfunction validateHarnessNames(raw: string[]): HarnessName[] {\n  const out: HarnessName[] = [];\n  for (const value of raw) {\n    if (!ALL_HARNESSES.includes(value as HarnessName)) {\n      throw new Error(`Invalid harness \"${value}\". Must be one of: ${ALL_HARNESSES.join(\", \")}.`);\n    }\n    out.push(value as HarnessName);\n  }\n  return out;\n}\n\nexport interface SkillsCliOptions {\n  cwd?: string;\n  packages?: string[];\n  /** Raw harness tokens (validated here); empty = auto-detect. */\n  harnesses?: string[];\n  only?: string[];\n  check?: boolean;\n  dryRun?: boolean;\n  json?: boolean;\n  /** One-line note printed to stderr before running (deprecated-alias path). */\n  deprecationNote?: string;\n  /** Test hook forwarded to {@link installPackageSkills}. */\n  packageRoots?: Record<string, string>;\n}\n\n/**\n * Parse normalized CLI inputs, run {@link installPackageSkills}, print a human\n * or JSON report, and return the process exit code (never throws, never exits).\n */\nexport function runSkillsInstallCli(options: SkillsCliOptions): number {\n  if (options.deprecationNote) console.error(options.deprecationNote);\n  const json = options.json ?? false;\n  const cwd = resolve(options.cwd ?? process.cwd());\n\n  const fail = (message: string): number => {\n    if (json) {\n      console.info(\n        JSON.stringify({ schemaVersion: 1, command: \"skills-install\", ok: false, error: message }),\n      );\n    } else {\n      console.error(message);\n    }\n    return 1;\n  };\n\n  let harnesses: HarnessName[] | undefined;\n  try {\n    const raw = options.harnesses ?? [];\n    harnesses = raw.length > 0 ? validateHarnessNames(raw) : undefined;\n  } catch (err) {\n    return fail(err instanceof Error ? err.message : String(err));\n  }\n\n  if (options.only && options.only.length > 0) {\n    const unknown = unknownOnlyNames(cwd, options.only, options.packageRoots);\n    if (unknown.length > 0) {\n      console.warn(`Warning: --only matched no shipped skill: ${unknown.join(\", \")}`);\n    }\n  }\n\n  let result: InstallSkillsResult;\n  try {\n    result = installPackageSkills({\n      cwd,\n      packages: options.packages && options.packages.length > 0 ? options.packages : undefined,\n      harnesses,\n      only: options.only && options.only.length > 0 ? options.only : undefined,\n      check: options.check,\n      dryRun: options.dryRun,\n      packageRoots: options.packageRoots,\n    });\n  } catch (err) {\n    return fail(err instanceof Error ? err.message : String(err));\n  }\n\n  if (json) {\n    console.info(JSON.stringify({ schemaVersion: 1, command: \"skills-install\", ...result }));\n  } else {\n    console.info(renderSkillsReport(result));\n  }\n  return result.ok ? 0 : 1;\n}\n\n/* ── Helpers ── */\n\nfunction relPath(cwd: string, absPath: string): string {\n  const rel = absPath.startsWith(cwd) ? absPath.slice(cwd.length).replace(/^[\\\\/]+/, \"\") : absPath;\n  return rel.split(/[\\\\/]+/).join(\"/\");\n}\n\n/** Resolve requested `--only` names that match nothing shipped (for warnings). */\nexport function unknownOnlyNames(\n  cwd: string,\n  only: string[] | undefined,\n  packageRoots?: Record<string, string>,\n): string[] {\n  if (!only || only.length === 0) return [];\n  const unionCandidates = [...new Set([...DEFAULT_PACKAGES, ...Object.keys(packageRoots ?? {})])];\n  const resolved = resolvePackages(unionCandidates, resolve(cwd), packageRoots);\n  const shipped: DiscoveredSkill[] = [];\n  for (const rp of resolved) shipped.push(...rp.skills);\n  const matched = new Set(filterByOnly(shipped, only).map((s) => s.name));\n  const unknown: string[] = [];\n  for (const raw of only) {\n    const token = raw.trim();\n    if (!token) continue;\n    const withPrefix = token.startsWith(MANAGED_SKILL_PREFIX)\n      ? token\n      : `${MANAGED_SKILL_PREFIX}${token}`;\n    if (!matched.has(withPrefix) && !matched.has(token)) unknown.push(token);\n  }\n  return unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,sBAAmD;CAC9D,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,UAAU;AACZ;AAEA,MAAa,gBAAwC;CAAC;CAAU;CAAU;CAAS;AAAU;;AAG7F,MAAa,uBAAuB;;AAGpC,MAAa,sBAAsB;;;;;;;AAQnC,MAAa,2BAA2B;;;;;;;AAQxC,MAAM,yBAAyB,IAAI,OACjC,cAAc,q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