/** * Plugin marketplaces — install plugins from a curated index hosted in a git repo * (or a local directory). * * A marketplace is a directory containing an index manifest in one of three formats: * - Native: `.agents-plugin/marketplace.json` (preferred; the `.agents` surface) * - Claude: `.claude-plugin/marketplace.json` * - Copilot: `.github/marketplace.json` (Copilot-style git index) * * All three use the same shape: `{ name?, owner?, plugins: [{ name, source, description? }] }`. * A plugin `source` is either a path relative to the marketplace root (a plugin * directory inside the repo), a git URL, or an `npm:` reference. * * When more than one is present the native `.agents-plugin` format wins, then * Claude, then Copilot (no merge) — matching the "`.agents/` first" policy used * across hoocode's resource surfaces. */ import type { MarketplacePlatform } from "./formats/types.js"; /** * Canonical platform token used by the optional `supportPlatform` field. The * `.github/marketplace.json` (Copilot-style) format is surfaced as `"github"` — * friendlier than the internal `format: "copilot"` and matching where the file * lives. Authored aliases (`copilot`, `gh`) normalize to `github`. * * Re-exported from the format registry so the platform vocabulary has a single * source of truth. */ export type { MarketplacePlatform } from "./formats/types.js"; /** Normalize an authored `supportPlatform` (string | string[]) to canonical tokens. */ export declare function normalizePlatforms(value: unknown): MarketplacePlatform[]; /** Structured source pointing at an entire git repository. */ interface MarketplacePluginSourceUrl { source: "url"; url: string; ref?: string; sha?: string; } /** Structured source pointing at a subdirectory within a git repository. */ interface MarketplacePluginSourceGitSubdir { source: "git-subdir"; url: string; /** Subdirectory path inside the repository. */ path: string; ref?: string; sha?: string; } /** Structured source pointing at an npm package. */ interface MarketplacePluginSourceNpm { source: "npm"; package: string; version?: string; registry?: string; } /** Structured source pointing at a zip archive served over HTTPS. */ interface MarketplacePluginSourceArchive { source: "archive"; url: string; sha256?: string; } /** * Source value authored in a marketplace manifest. * * `npm` and `archive` are in the union despite not being installable here. They * are documented vendor source types, so an entry using one is a *valid* catalog * entry hoocode cannot fetch — which is a different thing from a malformed entry, * and has to read differently. Dropping them at parse time made the plugin vanish * from SearchPlugins entirely, so the failure mode was "that plugin does not * exist" rather than "hoocode cannot install that kind yet". */ export type MarketplacePluginSource = string | MarketplacePluginSourceUrl | MarketplacePluginSourceGitSubdir | MarketplacePluginSourceNpm | MarketplacePluginSourceArchive; interface MarketplacePluginEntry { name: string; /** Relative path, git URL, `npm:`, or structured source object. */ source: MarketplacePluginSource; description?: string; /** * Optional platform(s) this entry targets. Only set when authored on the * entry; absent means "no per-entry restriction" (the marketplace's * platforms apply). Purely informational today — nothing filters on it. */ supportPlatform?: MarketplacePlatform[]; } export interface NormalizedMarketplace { name: string; /** Precedence winner when several index files conflict (agents > claude > copilot). */ format: "agents" | "claude" | "copilot"; /** * Every platform this marketplace directory offers, so a conflict between * multiple index files (e.g. both `.github/` and `.claude-plugin/`) is * recorded rather than hidden. Always includes the resolved `format`'s * platform; also folds in any authored top-level `supportPlatform`. Never * empty. */ supportPlatform: MarketplacePlatform[]; /** Absolute path to the marketplace directory. */ root: string; manifestPath: string; plugins: MarketplacePluginEntry[]; } /** A resolved plugin source. The last two are recognized but not fetchable here. */ export type ResolvedPluginSource = { kind: "local"; path: string; } | { kind: "git"; url: string; ref?: string; sha?: string; } | { kind: "git-subdir"; url: string; path: string; ref?: string; sha?: string; } | { kind: "npm"; spec: string; } | { kind: "archive"; url: string; sha256?: string; }; /** * Parse a marketplace directory. Native `.agents-plugin` wins, then Claude, then * Copilot when more than one file is present. Returns null if no manifest exists * or it is invalid. */ export declare function parseMarketplaceDir(dir: string): NormalizedMarketplace | null; /** Classify and resolve a plugin `source` against its marketplace root. */ export declare function resolvePluginSource(source: MarketplacePluginSource, marketplaceRoot: string): ResolvedPluginSource; export interface MarketplaceRecord { /** Original location the user added (git URL or local path). */ location: string; /** Local directory to read the manifest from (clone dir for git, else location). */ dir: string; } /** Read the persisted marketplace list from ``. */ export declare function readMarketplaceStore(storePath: string): MarketplaceRecord[]; /** Write the marketplace list to ``. */ export declare function writeMarketplaceStore(storePath: string, records: MarketplaceRecord[]): void; //# sourceMappingURL=marketplace.d.ts.map