{"version":3,"file":"domains-CTBa5Jx2.cjs","names":["isRecord","requireRecord","optionalString","requireString","assertOnlyKeys","path","fs","crypto","os","readDoomConfigSources","globalDoomConfigDirectory","fs","path"],"sources":["../src/services/pluginCatalog/index.ts","../src/services/domains/completion.ts","../src/services/domains/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport type {\n  GitPluginSource,\n  PluginCatalog,\n  PluginCatalogEntry,\n  PluginManifestMetadata,\n  PluginSource,\n} from '../../types/domains';\n\nconst AGENT_PLUGIN_SCHEMA_PREFIX = 'https://agent-plugins.org/schemas/';\nconst CACHE_DIRECTORY = 'plugin-cache';\nconst PLUGIN_ID_SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\nconst NPM_PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/;\nconst LEGACY_PLUGIN_MANIFEST_PATHS = [\n  '.codex-plugin/plugin.json',\n  '.claude-plugin/plugin.json',\n  '.cursor-plugin/plugin.json',\n] as const;\n\nexport const MARKETPLACE_MANIFEST_RELATIVE_PATHS = [\n  '.agents/plugins/marketplace.json',\n  '.agents/plugins/api_marketplace.json',\n  '.claude-plugin/marketplace.json',\n  '.cursor-plugin/marketplace.json',\n] as const;\n\nexport interface PluginCatalogConfigSource {\n  filePath: string;\n  baseDirectory: string;\n  value: unknown;\n}\n\ninterface MarketplaceLocation {\n  manifestPath: string;\n  root: string;\n}\n\ninterface ParsedConfiguredEntry {\n  source: PluginSource;\n  description?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n  return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction requireRecord(value: unknown, label: string): Record<string, unknown> {\n  if (!isRecord(value)) throw new Error(`${label} must be an object`);\n  return value;\n}\n\nfunction optionalString(value: unknown, label: string): string | undefined {\n  if (value === undefined) return undefined;\n  if (typeof value !== 'string' || !value.trim()) throw new Error(`${label} must be a non-empty string`);\n  return value.trim();\n}\n\nfunction requireString(value: unknown, label: string): string {\n  const result = optionalString(value, label);\n  if (!result) throw new Error(`${label} must be a non-empty string`);\n  return result;\n}\n\nfunction assertOnlyKeys(record: Record<string, unknown>, allowed: readonly string[], label: string): void {\n  const unexpected = Object.keys(record).filter((key) => !allowed.includes(key));\n  if (unexpected.length > 0) throw new Error(`${label} contains unsupported field \"${unexpected[0]}\"`);\n}\n\nfunction validatePluginIdSegment(value: string, label: string): void {\n  if (!PLUGIN_ID_SEGMENT.test(value)) {\n    throw new Error(`${label} must start with an alphanumeric character and contain only alphanumerics, ., _, or -`);\n  }\n}\n\nfunction validatePluginId(value: string, label: string): void {\n  const segments = value.split('@');\n  if (segments.length > 2 || segments.some((segment) => !PLUGIN_ID_SEGMENT.test(segment))) {\n    throw new Error(`${label} must be a plugin name or plugin@marketplace identifier`);\n  }\n}\n\nfunction normalizeRemoteSubdirectory(value: unknown, label: string): string | undefined {\n  const raw = optionalString(value, label);\n  if (!raw) return undefined;\n  const normalized = raw.replaceAll('\\\\', '/').replace(/^\\.\\//, '');\n  if (\n    normalized.startsWith('/') ||\n    normalized.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')\n  ) {\n    throw new Error(`${label} must stay within the remote repository root`);\n  }\n  return normalized;\n}\n\nfunction normalizeGitUrl(value: unknown, baseDirectory: string, label: string): string {\n  const url = requireString(value, label);\n  if (/^(?:https?|ssh|file):\\/\\//.test(url) || /^git@[^:]+:.+/.test(url) || path.isAbsolute(url)) return url;\n  if (url.startsWith('./') || url.startsWith('.\\\\')) {\n    const relative = url.replaceAll('\\\\', '/').slice(2);\n    if (!relative || relative.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {\n      throw new Error(`${label} must stay within its declaring root`);\n    }\n    return path.resolve(baseDirectory, relative);\n  }\n  if (/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+(?:\\.git)?$/.test(url)) {\n    return `https://github.com/${url.endsWith('.git') ? url : `${url}.git`}`;\n  }\n  throw new Error(`${label} is not a supported Git URL`);\n}\n\nfunction resolveMarketplaceLocalPath(rawPath: string, marketplace: MarketplaceLocation, label: string): string {\n  if (rawPath === '.' || rawPath === './') return marketplace.root;\n  const cursorMarketplace = marketplace.manifestPath.endsWith('.cursor-plugin/marketplace.json');\n  const relative = rawPath.startsWith('./') ? rawPath.slice(2) : cursorMarketplace ? rawPath : undefined;\n  if (!relative) throw new Error(`${label} must start with ./`);\n  const normalized = relative.replaceAll('\\\\', '/');\n  if (normalized.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {\n    throw new Error(`${label} must stay within the marketplace root`);\n  }\n  return path.resolve(marketplace.root, normalized);\n}\n\nfunction parseSourceObject(\n  value: Record<string, unknown>,\n  baseDirectory: string,\n  label: string,\n  marketplace?: MarketplaceLocation,\n): PluginSource {\n  const sourceType = requireString(value.source, `${label}.source`);\n  if (sourceType === 'local') {\n    assertOnlyKeys(value, ['source', 'path', 'description'], label);\n    const rawPath = requireString(value.path, `${label}.path`);\n    return {\n      type: 'local',\n      path: marketplace\n        ? resolveMarketplaceLocalPath(rawPath, marketplace, `${label}.path`)\n        : path.resolve(baseDirectory, rawPath),\n    };\n  }\n  if (sourceType === 'url' || sourceType === 'git-subdir') {\n    assertOnlyKeys(value, ['source', 'url', 'path', 'ref', 'sha', 'description'], label);\n    const remotePath = normalizeRemoteSubdirectory(value.path, `${label}.path`);\n    if (sourceType === 'git-subdir' && !remotePath) {\n      throw new Error(`${label}.path must be a non-empty string for git-subdir sources`);\n    }\n    const ref = optionalString(value.ref, `${label}.ref`);\n    const sha = optionalString(value.sha, `${label}.sha`);\n    return {\n      type: 'git',\n      url: normalizeGitUrl(value.url, marketplace?.root ?? baseDirectory, `${label}.url`),\n      ...(remotePath ? { path: remotePath } : {}),\n      ...(ref ? { ref } : {}),\n      ...(sha ? { sha } : {}),\n    };\n  }\n  if (sourceType === 'npm') {\n    assertOnlyKeys(value, ['source', 'package', 'version', 'registry', 'description'], label);\n    const packageName = requireString(value.package, `${label}.package`);\n    if (!NPM_PACKAGE_NAME.test(packageName)) throw new Error(`${label}.package must be a valid npm package name`);\n    const version = optionalString(value.version, `${label}.version`);\n    const registry = optionalString(value.registry, `${label}.registry`);\n    return {\n      type: 'npm',\n      package: packageName,\n      ...(version ? { version } : {}),\n      ...(registry ? { registry } : {}),\n    };\n  }\n  throw new Error(`${label}.source must be local, url, git-subdir, or npm`);\n}\n\nfunction parsePluginSource(\n  value: unknown,\n  baseDirectory: string,\n  label: string,\n  marketplace?: MarketplaceLocation,\n): PluginSource {\n  if (typeof value === 'string') {\n    const rawPath = requireString(value, label);\n    return {\n      type: 'local',\n      path: marketplace\n        ? resolveMarketplaceLocalPath(rawPath, marketplace, label)\n        : path.resolve(baseDirectory, rawPath),\n    };\n  }\n  return parseSourceObject(requireRecord(value, label), baseDirectory, label, marketplace);\n}\n\nfunction parseConfiguredEntry(value: unknown, baseDirectory: string, label: string): ParsedConfiguredEntry {\n  if (typeof value === 'string') return { source: parsePluginSource(value, baseDirectory, label) };\n  const record = requireRecord(value, label);\n  const description = optionalString(record.description, `${label}.description`);\n  if (record.source === undefined && typeof record.path === 'string') {\n    assertOnlyKeys(record, ['path', 'description'], label);\n    return {\n      source: { type: 'local', path: path.resolve(baseDirectory, requireString(record.path, `${label}.path`)) },\n      ...(description ? { description } : {}),\n    };\n  }\n  if (typeof record.source === 'string' && !['local', 'url', 'git-subdir', 'npm'].includes(record.source)) {\n    assertOnlyKeys(record, ['source', 'description'], label);\n    return {\n      source: parsePluginSource(record.source, baseDirectory, `${label}.source`),\n      ...(description ? { description } : {}),\n    };\n  }\n  if (isRecord(record.source)) {\n    assertOnlyKeys(record, ['source', 'description'], label);\n    return {\n      source: parsePluginSource(record.source, baseDirectory, `${label}.source`),\n      ...(description ? { description } : {}),\n    };\n  }\n  return {\n    source: parseSourceObject(record, baseDirectory, label),\n    ...(description ? { description } : {}),\n  };\n}\n\nfunction marketplaceRootFromManifest(manifestPath: string): string | undefined {\n  const normalized = path.resolve(manifestPath);\n  for (const relativePath of MARKETPLACE_MANIFEST_RELATIVE_PATHS) {\n    const suffix = path.normalize(relativePath);\n    if (!normalized.endsWith(suffix)) continue;\n    let root = normalized;\n    for (const _segment of relativePath.split('/')) root = path.dirname(root);\n    return root;\n  }\n  return undefined;\n}\n\nfunction findMarketplace(rootOrManifest: string): MarketplaceLocation | undefined {\n  if (fs.existsSync(rootOrManifest) && fs.statSync(rootOrManifest).isFile()) {\n    const root = marketplaceRootFromManifest(rootOrManifest);\n    return root ? { manifestPath: path.resolve(rootOrManifest), root } : undefined;\n  }\n  for (const relativePath of MARKETPLACE_MANIFEST_RELATIVE_PATHS) {\n    const manifestPath = path.join(rootOrManifest, relativePath);\n    if (fs.existsSync(manifestPath) && fs.statSync(manifestPath).isFile()) {\n      return { manifestPath: path.resolve(manifestPath), root: path.resolve(rootOrManifest) };\n    }\n  }\n  return undefined;\n}\n\nfunction readJsonRecord(filePath: string, label: string): Record<string, unknown> {\n  let parsed: unknown;\n  try {\n    parsed = JSON.parse(fs.readFileSync(filePath, 'utf8')) as unknown;\n  } catch (error) {\n    throw new Error(\n      `${label} at ${filePath} is invalid JSON: ${error instanceof Error ? error.message : String(error)}`,\n    );\n  }\n  return requireRecord(parsed, `${label} at ${filePath}`);\n}\n\n/** Matches Codex manifest precedence, including schema-gated root plugin.json. */\nexport function findPluginManifestPath(pluginRoot: string): string | undefined {\n  const rootManifest = path.join(pluginRoot, 'plugin.json');\n  try {\n    const metadata = fs.lstatSync(rootManifest);\n    if (metadata.isSymbolicLink() || !metadata.isFile()) return undefined;\n    const parsed = JSON.parse(fs.readFileSync(rootManifest, 'utf8')) as unknown;\n    const schema = isRecord(parsed) && typeof parsed.$schema === 'string' ? parsed.$schema : undefined;\n    if (schema?.startsWith(AGENT_PLUGIN_SCHEMA_PREFIX)) return rootManifest;\n  } catch {\n    // A missing, unreadable, or unrelated root manifest does not outrank legacy manifests.\n  }\n  return LEGACY_PLUGIN_MANIFEST_PATHS.map((relativePath) => path.join(pluginRoot, relativePath)).find(\n    (manifestPath) => fs.existsSync(manifestPath) && fs.statSync(manifestPath).isFile(),\n  );\n}\n\nfunction readPluginManifestMetadata(pluginRoot: string, diagnostics: string[]): PluginManifestMetadata | undefined {\n  const manifestPath = findPluginManifestPath(pluginRoot);\n  if (!manifestPath) return undefined;\n  try {\n    const manifest = readJsonRecord(manifestPath, 'Plugin manifest');\n    const schema = optionalString(manifest.$schema, `${manifestPath}.$schema`);\n    const name = optionalString(manifest.name, `${manifestPath}.name`);\n    const version = optionalString(manifest.version, `${manifestPath}.version`);\n    const description = optionalString(manifest.description, `${manifestPath}.description`);\n    return {\n      path: manifestPath,\n      ...(name ? { name } : {}),\n      ...(version ? { version } : {}),\n      ...(description ? { description } : {}),\n      ...(schema?.startsWith(AGENT_PLUGIN_SCHEMA_PREFIX) ? { agentPluginSchema: schema } : {}),\n    };\n  } catch (error) {\n    diagnostics.push(error instanceof Error ? error.message : String(error));\n    return { path: manifestPath };\n  }\n}\n\nfunction discoverPluginRoot(\n  pluginRoot: string,\n  entries: Record<string, PluginCatalogEntry>,\n  diagnostics: string[],\n): boolean {\n  const diagnosticCount = diagnostics.length;\n  const manifest = readPluginManifestMetadata(pluginRoot, diagnostics);\n  if (!manifest || diagnostics.length !== diagnosticCount) return false;\n  const name = manifest.name ?? path.basename(pluginRoot);\n  try {\n    validatePluginIdSegment(name, `Plugin name in ${manifest.path}`);\n  } catch (error) {\n    diagnostics.push(error instanceof Error ? error.message : String(error));\n    return false;\n  }\n  entries[name] = {\n    source: { type: 'local', path: pluginRoot },\n    ...(manifest.description ? { description: manifest.description } : {}),\n    manifest,\n  };\n  return true;\n}\n\nfunction discoverPluginFolder(\n  root: string,\n  entries: Record<string, PluginCatalogEntry>,\n  diagnostics: string[],\n): number {\n  if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) return 0;\n  if (findPluginManifestPath(root)) return discoverPluginRoot(root, entries, diagnostics) ? 1 : 0;\n\n  let discovered = 0;\n  const children = fs\n    .readdirSync(root, { withFileTypes: true })\n    .filter((entry) => entry.isDirectory())\n    .sort((left, right) => left.name.localeCompare(right.name));\n  for (const child of children) {\n    if (discoverPluginRoot(path.join(root, child.name), entries, diagnostics)) discovered += 1;\n  }\n  return discovered;\n}\n\nfunction parseMarketplace(\n  marketplace: MarketplaceLocation,\n  entries: Record<string, PluginCatalogEntry>,\n  diagnostics: string[],\n): void {\n  const document = readJsonRecord(marketplace.manifestPath, 'Marketplace manifest');\n  const marketplaceName = requireString(document.name, `${marketplace.manifestPath}.name`);\n  validatePluginIdSegment(marketplaceName, `${marketplace.manifestPath}.name`);\n  if (!Array.isArray(document.plugins)) throw new Error(`${marketplace.manifestPath}.plugins must be an array`);\n  for (let index = 0; index < document.plugins.length; index += 1) {\n    const label = `${marketplace.manifestPath}.plugins[${index}]`;\n    try {\n      const plugin = requireRecord(document.plugins[index], label);\n      const pluginName = requireString(plugin.name, `${label}.name`);\n      validatePluginIdSegment(pluginName, `${label}.name`);\n      const id = `${pluginName}@${marketplaceName}`;\n      if (Object.hasOwn(entries, id)) continue;\n      const source = parsePluginSource(plugin.source, marketplace.root, `${label}.source`, marketplace);\n      const description = optionalString(plugin.description, `${label}.description`);\n      const manifest = source.type === 'local' ? readPluginManifestMetadata(source.path, diagnostics) : undefined;\n      const resolvedDescription = description ?? manifest?.description;\n      entries[id] = {\n        source,\n        marketplace: marketplaceName,\n        ...(resolvedDescription ? { description: resolvedDescription } : {}),\n        ...(manifest ? { manifest } : {}),\n      };\n    } catch (error) {\n      diagnostics.push(error instanceof Error ? error.message : String(error));\n    }\n  }\n}\n\nfunction parseConfiguredRoots(source: PluginCatalogConfigSource): string[] {\n  if (source.value === undefined) return [];\n  const document = requireRecord(source.value, `plugins in ${source.filePath}`);\n  assertOnlyKeys(document, ['roots', 'entries'], `plugins in ${source.filePath}`);\n  if (document.roots === undefined) return [];\n  if (!Array.isArray(document.roots)) throw new Error(`plugins.roots in ${source.filePath} must be an array`);\n  return document.roots.map((root, index) =>\n    path.resolve(source.baseDirectory, requireString(root, `plugins.roots[${index}] in ${source.filePath}`)),\n  );\n}\n\nfunction applyConfiguredEntries(\n  source: PluginCatalogConfigSource,\n  entries: Record<string, PluginCatalogEntry>,\n  diagnostics: string[],\n): void {\n  if (source.value === undefined) return;\n  const document = requireRecord(source.value, `plugins in ${source.filePath}`);\n  if (document.entries === undefined) return;\n  const configuredEntries = requireRecord(document.entries, `plugins.entries in ${source.filePath}`);\n  for (const [name, value] of Object.entries(configuredEntries)) {\n    validatePluginId(name, `Plugin entry \"${name}\" in ${source.filePath}`);\n    const parsed = parseConfiguredEntry(value, source.baseDirectory, `plugins.entries.${name} in ${source.filePath}`);\n    const manifest =\n      parsed.source.type === 'local' ? readPluginManifestMetadata(parsed.source.path, diagnostics) : undefined;\n    const description = parsed.description ?? manifest?.description;\n    entries[name] = {\n      source: parsed.source,\n      ...(description ? { description } : {}),\n      ...(manifest ? { manifest } : {}),\n    };\n  }\n}\n\nexport function pluginDirectoryForSource(source: PluginSource, homeDoomDirectory: string): string {\n  if (source.type === 'local') return source.path;\n  const identity =\n    source.type === 'git'\n      ? ['git', source.url, source.path ?? '', source.ref ?? '', source.sha ?? '']\n      : ['npm', source.package, source.version ?? '', source.registry ?? ''];\n  const digest = crypto.createHash('sha256').update(JSON.stringify(identity)).digest('hex');\n  return path.join(homeDoomDirectory, CACHE_DIRECTORY, digest);\n}\n\nexport function loadPluginCatalog(\n  sources: readonly PluginCatalogConfigSource[],\n  repoRoot: string,\n  homeDirectory: string,\n): PluginCatalog {\n  const diagnostics: string[] = [];\n  const entries: Record<string, PluginCatalogEntry> = {};\n  const roots = [...new Set(sources.flatMap(parseConfiguredRoots))];\n  const candidates = [homeDirectory, repoRoot, ...roots];\n  const marketplaces: string[] = [];\n  const seenMarketplaces = new Set<string>();\n\n  for (const candidate of candidates) {\n    const marketplace = findMarketplace(candidate);\n    if (!marketplace) continue;\n    if (seenMarketplaces.has(marketplace.manifestPath)) continue;\n    seenMarketplaces.add(marketplace.manifestPath);\n    marketplaces.push(marketplace.manifestPath);\n    try {\n      parseMarketplace(marketplace, entries, diagnostics);\n    } catch (error) {\n      diagnostics.push(error instanceof Error ? error.message : String(error));\n    }\n  }\n\n  for (const root of roots) {\n    if (findMarketplace(root)) continue;\n    if (discoverPluginFolder(root, entries, diagnostics) === 0) {\n      diagnostics.push(`Plugin root contains neither a supported marketplace nor discoverable plugins: ${root}`);\n    }\n  }\n\n  for (const source of sources) applyConfiguredEntries(source, entries, diagnostics);\n  return { roots, marketplaces, entries, diagnostics };\n}\n\nexport function isRemotePluginSource(\n  source: PluginSource,\n): source is GitPluginSource | Extract<PluginSource, { type: 'npm' }> {\n  return source.type !== 'local';\n}\n","import type { DomainManifest } from '../../types/domains';\n\nconst NAME_DELIMITER = ',';\n\n/** Splits comma-joined selections and expands aliases into concrete domain names. */\nexport function expandDomainNames(manifest: DomainManifest, domainNames: readonly string[]): string[] {\n  return domainNames\n    .flatMap((raw) =>\n      raw\n        .split(NAME_DELIMITER)\n        .map((name) => name.trim())\n        .filter(Boolean),\n    )\n    .flatMap((name) => manifest.aliases[name] ?? [name]);\n}\n\nexport function domainCompletionPrefix(textBeforeCursor: string): string | undefined {\n  const match = textBeforeCursor.match(/^\\/domains\\s+(?:[^\\s,]+,)*([^\\s,]*)$/);\n  return match?.[1];\n}\n\nexport function domainCompletionItems(domainNames: string[], query: string): Array<{ value: string; label: string }> {\n  const normalizedQuery = query.toLowerCase();\n  return domainNames\n    .filter((name) => name.toLowerCase().startsWith(normalizedQuery))\n    .map((name) => ({ value: name, label: name }));\n}\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport type {\n  DomainDefinition,\n  DomainManifest,\n  DomainMcpAllowlist,\n  DomainPlugin,\n  PluginEntry,\n  ResolvedDomain,\n} from '../../types/domains';\nimport { globalDoomConfigDirectory } from '../config';\nimport { readDoomConfigSources } from '../layeredConfig';\nimport { loadPluginCatalog, pluginDirectoryForSource } from '../pluginCatalog';\nimport { expandDomainNames } from './completion';\n\nexport { DOOM_DIR } from '../layeredConfig';\n\nconst DOMAINS_FILE = 'domains.yaml';\nconst UNKNOWN_DOMAIN_ERROR = 'Unknown domain';\nconst UNKNOWN_PLUGIN_ERROR = 'Unknown plugin';\nconst MISSING_PLUGIN_DIRECTORY_ERROR = 'Plugin directory does not exist';\nconst DEFAULT_DOMAINS_PATH = '.doom/domains.yaml';\nconst SUPPORTED_AGENT_PLUGIN_SCHEMA = 'https://agent-plugins.org/schemas/1.0.0/plugin.schema.json';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n  return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction requireRecord(value: unknown, label: string): Record<string, unknown> {\n  if (!isRecord(value)) throw new Error(`${label} must be an object`);\n  return value;\n}\n\nfunction assertOnlyKeys(record: Record<string, unknown>, allowed: readonly string[], label: string): void {\n  const unexpected = Object.keys(record).filter((key) => !allowed.includes(key));\n  if (unexpected.length > 0) throw new Error(`${label} contains unsupported field \"${unexpected[0]}\"`);\n}\n\nfunction requireString(value: unknown, label: string): string {\n  if (typeof value !== 'string' || !value.trim()) throw new Error(`${label} must be a non-empty string`);\n  return value.trim();\n}\n\nfunction optionalString(value: unknown, label: string): string | undefined {\n  if (value === undefined) return undefined;\n  return requireString(value, label);\n}\n\nfunction parseStringArray(value: unknown, label: string): string[] {\n  if (!Array.isArray(value)) throw new Error(`${label} must be an array of non-empty strings`);\n  return [...new Set(value.map((entry, index) => requireString(entry, `${label}[${index}]`)))];\n}\n\nfunction parseOptionalBoolean(value: unknown, label: string): boolean | undefined {\n  if (value === undefined) return undefined;\n  if (typeof value !== 'boolean') throw new Error(`${label} must be a boolean`);\n  return value;\n}\n\nfunction parseDefaultDomains(value: unknown): string[] {\n  return parseStringArray(value, `defaultDomains in ${DEFAULT_DOMAINS_PATH}`);\n}\n\nfunction parseDomainPlugin(value: unknown, label: string): DomainPlugin {\n  if (typeof value === 'string') return requireString(value, label);\n  const plugin = requireRecord(value, label);\n  assertOnlyKeys(plugin, ['name', 'skills', 'agents', 'hooks', 'mcp'], label);\n  const skills = plugin.skills === undefined ? undefined : parseStringArray(plugin.skills, `${label}.skills`);\n  const agents = plugin.agents === undefined ? undefined : parseStringArray(plugin.agents, `${label}.agents`);\n  const hooks = parseOptionalBoolean(plugin.hooks, `${label}.hooks`);\n  const mcp = parseOptionalBoolean(plugin.mcp, `${label}.mcp`);\n  return {\n    name: requireString(plugin.name, `${label}.name`),\n    ...(skills ? { skills } : {}),\n    ...(agents ? { agents } : {}),\n    ...(hooks === undefined ? {} : { hooks }),\n    ...(mcp === undefined ? {} : { mcp }),\n  };\n}\n\nfunction parseMcpAllowlist(value: unknown, label: string): DomainMcpAllowlist {\n  const mcp = requireRecord(value, label);\n  assertOnlyKeys(mcp, ['servers', 'proxy'], label);\n  return {\n    ...(mcp.servers === undefined ? {} : { servers: parseStringArray(mcp.servers, `${label}.servers`) }),\n    ...(mcp.proxy === undefined ? {} : { proxy: parseStringArray(mcp.proxy, `${label}.proxy`) }),\n  };\n}\n\nfunction parseDomain(value: unknown, label: string): DomainDefinition {\n  const domain = requireRecord(value, label);\n  assertOnlyKeys(domain, ['description', 'plugins', 'mcp', 'sharedSkills'], label);\n  const description = optionalString(domain.description, `${label}.description`);\n  if (domain.plugins !== undefined && !Array.isArray(domain.plugins)) {\n    throw new Error(`${label}.plugins must be an array`);\n  }\n  const sharedSkills = parseOptionalBoolean(domain.sharedSkills, `${label}.sharedSkills`);\n  return {\n    ...(description ? { description } : {}),\n    ...(Array.isArray(domain.plugins)\n      ? { plugins: domain.plugins.map((plugin, index) => parseDomainPlugin(plugin, `${label}.plugins[${index}]`)) }\n      : {}),\n    ...(domain.mcp === undefined ? {} : { mcp: parseMcpAllowlist(domain.mcp, `${label}.mcp`) }),\n    ...(sharedSkills === undefined ? {} : { sharedSkills }),\n  };\n}\n\nfunction parseAliases(value: unknown, label: string): Record<string, string[]> {\n  if (value === undefined) return {};\n  const aliases = requireRecord(value, label);\n  return Object.fromEntries(\n    Object.entries(aliases).map(([name, domains]) => [name, parseStringArray(domains, `${label}.${name}`)]),\n  );\n}\n\n/**\n * Reads domains and plugin catalogs from global and repository configs.\n *\n * Named domains and explicit plugin entries are replaced by later repository\n * definitions. Configured roots accumulate, with exact marketplace manifests\n * deduplicated in discovery order. Explicit entries override discovered IDs.\n */\nexport function loadDomains(repoRoot: string, homeDirectory: string = os.homedir()): DomainManifest {\n  const sources = readDoomConfigSources<unknown>(DOMAINS_FILE, repoRoot, homeDirectory);\n  const aliases: Record<string, string[]> = {};\n  const domains: Record<string, ResolvedDomain> = {};\n  let defaultDomains: string[] | undefined;\n\n  for (const source of sources) {\n    const document = requireRecord(source.document, source.filePath);\n    assertOnlyKeys(document, ['plugins', 'domains', 'aliases', 'defaultDomains'], source.filePath);\n    Object.assign(aliases, parseAliases(document.aliases, `aliases in ${source.filePath}`));\n    if (document.domains !== undefined) {\n      const sourceDomains = requireRecord(document.domains, `domains in ${source.filePath}`);\n      for (const [name, definition] of Object.entries(sourceDomains)) {\n        domains[name] = {\n          ...parseDomain(definition, `domains.${name} in ${source.filePath}`),\n          baseDirectory: source.baseDirectory,\n        };\n      }\n    }\n    if (Object.hasOwn(document, 'defaultDomains')) defaultDomains = parseDefaultDomains(document.defaultDomains);\n  }\n\n  const plugins = loadPluginCatalog(\n    sources.map((source) => ({\n      filePath: source.filePath,\n      baseDirectory: source.baseDirectory,\n      value: requireRecord(source.document, source.filePath).plugins,\n    })),\n    repoRoot,\n    homeDirectory,\n  );\n\n  if (defaultDomains) {\n    for (const name of expandDomainNames({ plugins, domains, aliases }, defaultDomains)) {\n      if (!Object.hasOwn(domains, name)) {\n        throw new Error(`Unknown default domain \"${name}\" in ${DEFAULT_DOMAINS_PATH}`);\n      }\n    }\n  }\n  return { plugins, domains, aliases, ...(defaultDomains ? { defaultDomains } : {}) };\n}\n\nexport function listDomainNames(repoRoot: string, homeDirectory?: string): string[] {\n  const manifest = loadDomains(repoRoot, homeDirectory);\n  return [...new Set([...Object.keys(manifest.domains), ...Object.keys(manifest.aliases)])].sort();\n}\n\n/**\n * Whether to include .claude/skills as shared fallbacks.\n *\n * Shared skills are included unless every selected domain opts out, so mixing a\n * trimmed domain with an untrimmed one cannot strip the untrimmed one's skills.\n */\nexport function resolveSharedSkills(repoRoot: string, domainNames: string[], homeDirectory?: string): boolean {\n  const manifest = loadDomains(repoRoot, homeDirectory);\n  const expanded = expandDomainNames(manifest, domainNames);\n  if (expanded.length === 0) return true;\n  return expanded.some((name) => manifest.domains[name]?.sharedSkills !== false);\n}\n\n/** Resolves named domain plugins while preserving each subset filter. */\nexport function resolvePluginEntries(\n  repoRoot: string,\n  domainNames: string[],\n  explicitDirectories: string[],\n  homeDirectory: string = os.homedir(),\n): PluginEntry[] {\n  const manifest = loadDomains(repoRoot, homeDirectory);\n  const entries: PluginEntry[] = [];\n  const seen = new Set<string>();\n  const homeDoomDirectory = globalDoomConfigDirectory(homeDirectory);\n\n  for (const domainName of expandDomainNames(manifest, domainNames)) {\n    const domain = manifest.domains[domainName];\n    if (!domain) throw new Error(`${UNKNOWN_DOMAIN_ERROR}: ${domainName}`);\n    for (const selection of domain.plugins ?? []) {\n      const isSubset = typeof selection !== 'string';\n      const pluginName = isSubset ? selection.name : selection;\n      const plugin = manifest.plugins.entries[pluginName];\n      if (!plugin) throw new Error(`${UNKNOWN_PLUGIN_ERROR} \"${pluginName}\" referenced by domain \"${domainName}\"`);\n      const directory = pluginDirectoryForSource(plugin.source, homeDoomDirectory);\n      if (plugin.source.type === 'local' && (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory())) {\n        throw new Error(`${MISSING_PLUGIN_DIRECTORY_ERROR}: ${directory}`);\n      }\n      if (seen.has(directory)) continue;\n      seen.add(directory);\n      entries.push({\n        name: pluginName,\n        directory,\n        // The domain is only in scope here. `resolvePluginDirectories` keeps\n        // just the path, so anything downstream that wants to say which domain\n        // brought a plugin has to be told now or not at all.\n        domain: domainName,\n        source: plugin.source,\n        ...(plugin.manifest ? { manifest: plugin.manifest } : {}),\n        ...(plugin.manifest?.agentPluginSchema === SUPPORTED_AGENT_PLUGIN_SCHEMA\n          ? { skillDiscovery: 'direct-children' as const }\n          : {}),\n        ...(isSubset && selection.skills ? { skills: selection.skills } : {}),\n        ...(isSubset && selection.agents ? { agents: selection.agents } : {}),\n        ...(isSubset && selection.hooks !== undefined ? { hooks: selection.hooks } : {}),\n        ...(isSubset && selection.mcp !== undefined ? { mcp: selection.mcp } : {}),\n      });\n    }\n  }\n\n  for (const configuredDirectory of explicitDirectories) {\n    const directory = path.resolve(configuredDirectory);\n    if (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory()) {\n      throw new Error(`${MISSING_PLUGIN_DIRECTORY_ERROR}: ${directory}`);\n    }\n    if (seen.has(directory)) continue;\n    seen.add(directory);\n    entries.push({\n      name: path.basename(directory),\n      directory,\n      source: { type: 'local', path: directory },\n    });\n  }\n  return entries;\n}\n\nexport function resolvePluginDirectories(\n  repoRoot: string,\n  domainNames: string[],\n  explicitDirectories: string[],\n  homeDirectory?: string,\n): string[] {\n  return resolvePluginEntries(repoRoot, domainNames, explicitDirectories, homeDirectory).map(\n    (entry) => entry.directory,\n  );\n}\n\nexport const DOOMPI_DOMAINS_ENV = 'DOOMPI_DOMAINS';\nexport const DEFAULT_DOMAIN = 'default';\nconst MARKETING_MAJOR_MODE = 'marketing';\n\nfunction parseDomainList(value: string): string[] {\n  return value\n    .split(',')\n    .map((entry) => entry.trim())\n    .filter(Boolean);\n}\n\n/**\n * Domains selected when the caller names none.\n *\n * Configuration keeps this axis independent of the major mode. The\n * major-mode-derived choice is retained only as the compatibility fallback for\n * domains files that declare no defaultDomains.\n */\nexport function defaultDomainsForMajorMode(\n  majorMode: string,\n  environment: NodeJS.ProcessEnv,\n  defaultDomains?: readonly string[],\n): string[] {\n  const inherited = environment[DOOMPI_DOMAINS_ENV];\n  // An explicitly empty variable means no domains, so this tests for the key\n  // rather than for a truthy value.\n  if (inherited !== undefined) return parseDomainList(inherited);\n  if (defaultDomains !== undefined) return [...defaultDomains];\n  return parseDomainList(majorMode === MARKETING_MAJOR_MODE ? MARKETING_MAJOR_MODE : DEFAULT_DOMAIN);\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,6BAA6B;AACnC,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AACzB,MAAM,+BAA+B;CACnC;CACA;CACA;AACF;AAEA,MAAa,sCAAsC;CACjD;CACA;CACA;CACA;AACF;AAkBA,SAASA,WAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAASC,gBAAc,OAAgB,OAAwC;CAC7E,IAAI,CAACD,WAAS,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,mBAAmB;CAClE,OAAO;AACT;AAEA,SAASE,iBAAe,OAAgB,OAAmC;CACzE,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,4BAA4B;CACrG,OAAO,MAAM,KAAK;AACpB;AAEA,SAASC,gBAAc,OAAgB,OAAuB;CAC5D,MAAM,SAASD,iBAAe,OAAO,KAAK;CAC1C,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,GAAG,MAAM,4BAA4B;CAClE,OAAO;AACT;AAEA,SAASE,iBAAe,QAAiC,SAA4B,OAAqB;CACxG,MAAM,aAAa,OAAO,KAAK,MAAM,CAAC,CAAC,QAAQ,QAAQ,CAAC,QAAQ,SAAS,GAAG,CAAC;CAC7E,IAAI,WAAW,SAAS,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,+BAA+B,WAAW,GAAG,EAAE;AACrG;AAEA,SAAS,wBAAwB,OAAe,OAAqB;CACnE,IAAI,CAAC,kBA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