@weareikko/code-review 0.10.3 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,100 +0,0 @@
1
- import { type McpEnvVars, type McpServerConfig } from './mcp-parse.js';
2
- import { type Skill, type SkillSpec } from './skills.js';
3
- /**
4
- * Marketplace manifest formats we know how to read. Different vendors ship the
5
- * same open SKILL.md standard but package it differently: Claude Code uses a
6
- * `.claude-plugin/marketplace.json` catalog (`anthropic`), OpenAI Codex uses a
7
- * `.codex-plugin/` layout (a future `codex` format). Only `anthropic` is
8
- * implemented today; the type is the extension point for the rest.
9
- */
10
- export declare const MARKETPLACE_FORMATS: readonly ['anthropic'];
11
- export type MarketplaceFormat = (typeof MARKETPLACE_FORMATS)[number];
12
- /** The default format assumed when a marketplace declaration omits a prefix. */
13
- export declare const DEFAULT_MARKETPLACE_FORMAT: MarketplaceFormat;
14
- /**
15
- * Marketplace names that collide with skill-spec protocol prefixes
16
- * (`npm:`, `file:`, `git:`) or the bare-name builtin lookup, and so cannot be
17
- * used as a marketplace name — `<name>:<plugin>/<skill>` would be ambiguous.
18
- */
19
- export declare const RESERVED_MARKETPLACE_NAMES: ReadonlySet<string>;
20
- /** A registered marketplace: a git repo cloned once, then read per its format. */
21
- export interface MarketplaceRef {
22
- /** Short name used in skill specs (`<name>:<plugin>/<skill>`). */
23
- name: string;
24
- format: MarketplaceFormat;
25
- /** Clone URL (credentials may be embedded; always redact before logging). */
26
- url: string;
27
- /** Pinned ref (tag/branch/SHA); empty resolves the remote's default branch. */
28
- ref: string;
29
- }
30
- export type MarketplaceRegistry = ReadonlyMap<string, MarketplaceRef>;
31
- /**
32
- * Parse a single marketplace declaration: `<name>=<[format:]url[#ref]>`.
33
- *
34
- * - `acme=https://host/group/tools.git#1.0.0` → default `anthropic` format
35
- * - `acme=anthropic:https://host/group/tools.git#1.0.0` → explicit format
36
- * - `acme=git+ssh://git@host/group/tools.git#main` → SSH transport
37
- *
38
- * The `#<ref>` fragment is taken whole as the ref (branch names may contain
39
- * `/`). Throws a `ConfigError` with an actionable hint on any malformed input.
40
- */
41
- export declare function parseMarketplaceEntry(entry: string): MarketplaceRef;
42
- /**
43
- * Build a name→ref registry from parsed marketplace declarations, rejecting
44
- * duplicate names (a later entry silently shadowing an earlier one is a config
45
- * bug worth surfacing).
46
- */
47
- export declare function buildMarketplaceRegistry(refs: readonly MarketplaceRef[]): MarketplaceRegistry;
48
- type MarketplaceSkillSpec = Extract<SkillSpec, {
49
- protocol: 'marketplace';
50
- }>;
51
- /**
52
- * Resolve a `<marketplace>:<plugin>/<skill>` reference to a loaded {@link Skill}.
53
- *
54
- * Clones the marketplace repo (reusing the shared on-disk clone cache), then
55
- * dispatches to the format-specific resolver. Throws a `ConfigError` with a
56
- * redacted, actionable hint when the marketplace, plugin, or skill cannot be
57
- * resolved — the caller treats that as a skip-and-warn, not a fatal error.
58
- */
59
- export declare function loadMarketplaceSkill(spec: MarketplaceSkillSpec, registry: MarketplaceRegistry, options?: {
60
- cacheDir?: string;
61
- refresh?: boolean;
62
- }): Promise<Skill>;
63
- /**
64
- * A `<marketplace>:<plugin>[/<server>]` reference — the `marketplace`
65
- * protocol case of `mcp-config.ts`'s `McpSpec`, restated structurally here so
66
- * this module does not need to import `mcp-config.ts` (which imports this
67
- * module for the marketplace source).
68
- */
69
- export interface MarketplaceMcpSpec {
70
- marketplace: string;
71
- plugin: string;
72
- /** Empty means "every server the plugin exposes". */
73
- server: string;
74
- }
75
- /**
76
- * Resolve a `<marketplace>:<plugin>` or `<marketplace>:<plugin>/<server>`
77
- * reference to its normalised {@link McpServerConfig}s.
78
- *
79
- * Clones the marketplace repo (reusing the shared on-disk clone cache), then
80
- * reads two independent, additive sources for the plugin's servers: a
81
- * `.mcp.json` colocated with the plugin (either the project or the plugin
82
- * shape), and the `mcpServers` field of the plugin's own
83
- * `.claude-plugin/plugin.json` (subject to the same `strict` gating as its
84
- * `skills` field). A server declared in both is taken from `plugin.json`,
85
- * since it is the more specific, authored-by-the-plugin declaration.
86
- * `${CLAUDE_PLUGIN_ROOT}` expands to the plugin's directory in both.
87
- *
88
- * With `spec.server` set, only that server is returned. Throws a
89
- * `ConfigError` with a redacted, actionable hint when the marketplace,
90
- * plugin, or named server cannot be resolved — the caller treats that as a
91
- * skip-and-warn, not a fatal error, matching `loadMarketplaceSkill`.
92
- */
93
- export declare function loadMarketplaceMcpServers(spec: MarketplaceMcpSpec, registry: MarketplaceRegistry, options?: {
94
- cacheDir?: string;
95
- refresh?: boolean;
96
- vars?: McpEnvVars;
97
- warn?: (msg: string) => void;
98
- }): Promise<McpServerConfig[]>;
99
- export {};
100
- //# sourceMappingURL=marketplaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"marketplaces.d.ts","sourceRoot":"","sources":["../src/marketplaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAOL,KAAK,KAAK,EACV,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,YAAI,WAAW,CAAU,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,EAAE,iBAA+B,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAKzD,CAAC;AAEH,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAQtE;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CA4CnE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,GAAG,mBAAmB,CAW7F;AAyBD,KAAK,oBAAoB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,QAAQ,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE5E;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GACrD,OAAO,CAAC,KAAK,CAAC,CAiChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACzB,GACL,OAAO,CAAC,eAAe,EAAE,CAAC,CA0E5B"}
@@ -1,90 +0,0 @@
1
- import type { Logger } from './logger.js';
2
- import { type MarketplaceRegistry } from './marketplaces.js';
3
- import { type McpDisableFilters, type McpEnvVars, type McpServerConfig } from './mcp-parse.js';
4
- export { applyMcpDisableFilters, dropEmptyHeaders, expandMcpTemplate, extractMcpServerMap, MAX_MCP_TIMEOUT_MS, normalizeMcpServer, parseMcpDisableFilters, parseMcpServers, pickMcpEnvVars, type McpDisableFilters, type McpEnvVars, type McpServerConfig, type McpServerSource, type McpTransportType, type NormalizeMcpServerOptions, } from './mcp-parse.js';
5
- /** Options for `loadAutoDiscoveredMcpServers`. */
6
- export interface LoadAutoDiscoveredMcpServersOptions {
7
- /** Variables for `${VAR}` expansion; defaults to none. */
8
- vars?: McpEnvVars;
9
- /** Disable lists to apply; loaded with `loadMcpDisableFilters` when omitted. */
10
- filters?: McpDisableFilters;
11
- }
12
- /**
13
- * Collect the MCP disable lists declared in the repository: `.claude/settings.json`
14
- * and the gitignored project-local `.claude/settings.local.json` — where Claude
15
- * Code persists `disabledMcpjsonServers` when a developer declines a server —
16
- * in every directory from `gitRoot` down to `cwd`. Lists from every level and
17
- * both files are unioned. Enable keys are ignored: this tool never re-enables a
18
- * server another config disabled.
19
- */
20
- export declare function loadMcpDisableFilters(cwd: string, gitRoot: string, warn?: (msg: string) => void): Promise<McpDisableFilters>;
21
- /**
22
- * Discover MCP servers declared in the repository, mirroring
23
- * `loadAutoDiscoveredSkills`: `.mcp.json` in every directory from `gitRoot` down
24
- * to `cwd`, the closest directory winning per server name.
25
- *
26
- * `disabledMcpjsonServers` is scoped to these project-declared servers and
27
- * applied here. `disabledMcpServers` is *not* scoped to them — it names a server
28
- * whatever its source — so `resolveMcpServers` applies it once at the end, over
29
- * marketplace and `file:` servers too.
30
- */
31
- export declare function loadAutoDiscoveredMcpServers(cwd: string, gitRoot: string, warn?: (msg: string) => void, options?: LoadAutoDiscoveredMcpServersOptions): Promise<McpServerConfig[]>;
32
- /** A parsed `--mcp` spec. Produced by `parseMcpSpec`. */
33
- export type McpSpec = {
34
- protocol: 'file';
35
- path: string;
36
- } | {
37
- protocol: 'marketplace';
38
- marketplace: string;
39
- plugin: string;
40
- server: string;
41
- };
42
- /**
43
- * Parse a `--mcp` / `CODE_REVIEW_MCP` spec string, mirroring `parseSkillSpec`'s
44
- * conventions:
45
- *
46
- * | Input | Result |
47
- * |---------------------------------|------------------------------------------------------------------|
48
- * | `file:./extra-servers.json` | `{ protocol: 'file', path: './extra-servers.json' }` |
49
- * | `acme:dev` | `{ protocol: 'marketplace', marketplace: 'acme', plugin: 'dev', server: '' }` |
50
- * | `acme:dev/context7` | `{ protocol: 'marketplace', marketplace: 'acme', plugin: 'dev', server: 'context7' }` |
51
- *
52
- * An empty `server` means "every server the plugin exposes". Throws a
53
- * `ConfigError` with an actionable hint on any malformed input.
54
- */
55
- export declare function parseMcpSpec(spec: string): McpSpec;
56
- /** The slice of `Config` `resolveMcpServers` needs — kept structural to avoid importing `Config`. */
57
- export interface McpServerSourcesConfig {
58
- /** Raw `--mcp` / `CODE_REVIEW_MCP` specs, in the order given. */
59
- mcp: string[];
60
- /** Server names to drop, applied last over every source. */
61
- disableMcp: string[];
62
- /** Whether to auto-discover `.mcp.json` files walked from `gitRoot` to `cwd`. Opt-in. */
63
- mcpDiscovery: boolean;
64
- }
65
- /**
66
- * Resolve every MCP server for a review, merging sources in the approved order:
67
- *
68
- * 1. Repo auto-discovery (`.mcp.json` walked from `gitRoot` to `cwd`, closest
69
- * wins, `disabledMcpjsonServers` applied) — only when `config.mcpDiscovery`
70
- * is `true`, which is opt-in: `.mcp.json` is content of the repository under
71
- * review, so a merge request could otherwise make the reviewer spawn a
72
- * process of its choosing on the CI runner.
73
- * 2. Every `--mcp` / `CODE_REVIEW_MCP` spec, in the order given: a `file:` spec
74
- * loads a standalone document, a `<marketplace>:<plugin>[/<server>]` spec
75
- * loads from the registered marketplace. A later spec's server overrides an
76
- * earlier one (from any source) of the same name.
77
- * 3. `disabledMcpServers` from `.claude/settings.json` (and `settings.local.json`)
78
- * plus `config.disableMcp` (`--disable-mcp` / `CODE_REVIEW_DISABLE_MCP`),
79
- * applied last over every source above — a name disabled there stays dropped
80
- * even when a `--mcp` spec redeclares it.
81
- *
82
- * A spec that fails to resolve (bad file, unregistered marketplace, unknown
83
- * plugin/server) is skipped with a warning — one broken `--mcp` entry must not
84
- * abort the whole review.
85
- */
86
- export declare function resolveMcpServers(config: McpServerSourcesConfig, cwd: string, gitRoot: string, registry: MarketplaceRegistry, logger?: Logger, options?: {
87
- vars?: McpEnvVars;
88
- refresh?: boolean;
89
- }): Promise<McpServerConfig[]>;
90
- //# sourceMappingURL=mcp-config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-config.d.ts","sourceRoot":"","sources":["../src/mcp-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,gBAAgB,CAAC;AAgCxB,kDAAkD;AAClD,MAAM,WAAW,mCAAmC;IAClD,0DAA0D;IAC1D,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,gFAAgF;IAChF,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAgB5B;AAED;;;;;;;;;GASG;AACH,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAC5B,OAAO,GAAE,mCAAwC,GAChD,OAAO,CAAC,eAAe,EAAE,CAAC,CAqB5B;AAED,yDAAyD;AACzD,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA4BlD;AAED,qGAAqG;AACrG,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,4DAA4D;IAC5D,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;CACvB;AAqBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GACrD,OAAO,CAAC,eAAe,EAAE,CAAC,CAsC5B"}
@@ -1,146 +0,0 @@
1
- /**
2
- * Pure MCP server-definition parsing: `.mcp.json`-style document shapes,
3
- * `${VAR}` env expansion, and normalisation into `McpServerConfig`. Has no
4
- * dependency on the filesystem, git, or marketplaces, so both `mcp-config.ts`
5
- * (repo/file discovery) and `marketplaces.ts` (plugin sources) can depend on
6
- * it without forming a cycle between themselves.
7
- */
8
- /**
9
- * Where an MCP server definition came from. Carried in enough detail to link
10
- * the server name in the summary footer back to its source (see the MCP
11
- * footer helper in `cli.ts`). `project.path` is the `.mcp.json` file relative to
12
- * the repository root, POSIX-separated, like `SkillOrigin.project`.
13
- */
14
- export type McpServerSource = {
15
- kind: 'project';
16
- path: string;
17
- } | {
18
- kind: 'marketplace';
19
- marketplace: string;
20
- plugin: string;
21
- url: string;
22
- ref: string;
23
- path: string;
24
- } | {
25
- kind: 'file';
26
- path: string;
27
- };
28
- /** Transports we can connect to. `sse` and `ws` are recognised in files but skipped. */
29
- export type McpTransportType = 'stdio' | 'http';
30
- /** A normalised, env-expanded MCP server definition ready to connect. */
31
- export interface McpServerConfig {
32
- name: string;
33
- type: McpTransportType;
34
- /** stdio only. */
35
- command?: string;
36
- /** stdio only. */
37
- args: string[];
38
- /** stdio only — extra environment for the child process. */
39
- env: Record<string, string>;
40
- /** http only. */
41
- url?: string;
42
- /** http only. */
43
- headers: Record<string, string>;
44
- /** Per-call timeout; `undefined` means the bridge default. */
45
- timeoutMs?: number;
46
- source: McpServerSource;
47
- }
48
- /** Names disabled by a `.claude/settings.json` file. */
49
- export interface McpDisableFilters {
50
- /** `disabledMcpjsonServers` — servers declared in repo `.mcp.json` files. */
51
- disabledMcpjsonServers: string[];
52
- /** `disabledMcpServers` — servers from any source (plugins included). */
53
- disabledMcpServers: string[];
54
- }
55
- /** Variables available to `${VAR}` expansion. Undefined values count as unset. */
56
- export type McpEnvVars = Readonly<Record<string, string | undefined>>;
57
- /**
58
- * Upper bound on a server-declared `timeout`. A server definition governs its
59
- * own per-call timeout, but it must not be able to stall the review for hours:
60
- * connect and `tools/list` run before the agent loop, outside the review
61
- * timeout, so an unclamped value there is a one-line denial of service.
62
- */
63
- export declare const MAX_MCP_TIMEOUT_MS = 120000;
64
- /**
65
- * The subset of `env` an operator opted into exposing to `${VAR}` expansion.
66
- *
67
- * Server definitions can come from the repository under review or from a
68
- * marketplace plugin whose upstream ref moves, so expanding from the whole
69
- * process environment would let a definition read any secret the reviewer holds
70
- * (`CODE_REVIEW_GITLAB_TOKEN`, `ANTHROPIC_API_KEY`, …) and ship it out in argv,
71
- * a header, or a URL query string. Only names listed in `allowlist` are
72
- * readable; everything else expands as unset, which skips the server with a
73
- * warning that names the variable and never a value.
74
- */
75
- export declare function pickMcpEnvVars(env: McpEnvVars, allowlist: readonly string[]): McpEnvVars;
76
- /**
77
- * Expand `${VAR}` and `${VAR:-default}` references in `value`. Missing
78
- * variables (unset, with no default) are left untouched and reported by name in
79
- * `missing` so callers can skip the server without ever logging a value.
80
- *
81
- * `${VAR:-default}` follows POSIX: the default applies when `VAR` is unset *or*
82
- * empty. Bare `${VAR}` expands to an empty string when `VAR` is set but empty.
83
- */
84
- export declare function expandMcpTemplate(value: string, vars: McpEnvVars): {
85
- value: string;
86
- missing: string[];
87
- };
88
- /**
89
- * Extract the server map from a parsed `.mcp.json`-style document. Two shapes
90
- * are accepted:
91
- *
92
- * - Claude Code project shape: `{ "mcpServers": { name: server } }`
93
- * - Plugin shape: `{ name: server }` (servers at the top level)
94
- *
95
- * The project shape is detected by a top-level `mcpServers` object. Returns
96
- * `null` when the document is not an object at all.
97
- */
98
- export declare function extractMcpServerMap(raw: unknown): Record<string, unknown> | null;
99
- /**
100
- * Drop headers whose value is empty or whitespace-only.
101
- *
102
- * A header value is routinely a `${VAR}` or `${VAR:-}` reference to a
103
- * credential that is simply absent — an optional API key, or a token only set
104
- * in CI. Sending `Authorization:` with no value is worse than not sending it:
105
- * some servers reject the malformed header outright where they would have
106
- * served the request anonymously. So an empty expansion means "no header",
107
- * not "empty header". `env` for stdio servers is deliberately left alone: an
108
- * empty environment variable is a meaningful, distinct value there.
109
- */
110
- export declare function dropEmptyHeaders(headers: Record<string, string>): Record<string, string>;
111
- /** Read the MCP disable lists from a parsed `.claude/settings.json` document. */
112
- export declare function parseMcpDisableFilters(raw: unknown): McpDisableFilters;
113
- /** Options for `normalizeMcpServer` / `parseMcpServers`. */
114
- export interface NormalizeMcpServerOptions {
115
- /**
116
- * Variables for `${VAR}` expansion. Defaults to none: the process
117
- * environment is never exposed implicitly — callers pass the operator's
118
- * allowlist (see `pickMcpEnvVars`).
119
- */
120
- vars?: McpEnvVars;
121
- /** Expanded from `${CLAUDE_PLUGIN_ROOT}` for marketplace plugins. */
122
- pluginRoot?: string;
123
- warn?: (msg: string) => void;
124
- }
125
- /**
126
- * Normalise one raw server entry. Returns `null` (after warning) when the
127
- * server is unsupported or incomplete:
128
- *
129
- * - `type: sse` or `ws`, or any `oauth` / `headersHelper` field — unsupported
130
- * transports and auth flows
131
- * - no `command` for stdio, no `url` for http, before or after expansion
132
- * - a `${VAR}` reference with no value and no default (the warning names the
133
- * variable, never a value)
134
- *
135
- * `type` defaults to `stdio` when `command` is present and `http` when `url`
136
- * is present. A server-declared `timeout` is clamped to `MAX_MCP_TIMEOUT_MS`.
137
- */
138
- export declare function normalizeMcpServer(name: string, raw: unknown, source: McpServerSource, options?: NormalizeMcpServerOptions): McpServerConfig | null;
139
- /**
140
- * Parse a whole `.mcp.json`-style document (either shape) into normalised
141
- * server configs. Invalid entries are skipped with a warning.
142
- */
143
- export declare function parseMcpServers(raw: unknown, source: McpServerSource, options?: NormalizeMcpServerOptions): McpServerConfig[];
144
- /** Drop servers named in either disable list. */
145
- export declare function applyMcpDisableFilters(servers: readonly McpServerConfig[], filters: McpDisableFilters): McpServerConfig[];
146
- //# sourceMappingURL=mcp-parse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-parse.d.ts","sourceRoot":"","sources":["../src/mcp-parse.ts"],"names":[],"mappings":"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"}
@@ -1,62 +0,0 @@
1
- import type { McpServerSource } from './mcp-parse.js';
2
- import type { SkillOrigin } from './skills.js';
3
- /**
4
- * Repository coordinates needed to link a skill that lives in the repository
5
- * under review. Both come from the CI environment: the project's web URL
6
- * (`CI_PROJECT_URL`, or `GITHUB_SERVER_URL` + `GITHUB_REPOSITORY`) and the
7
- * reviewed commit. Missing either leaves in-repo skills unlinked.
8
- */
9
- export interface SkillLinkContext {
10
- projectWebUrl?: string;
11
- commitSha?: string;
12
- }
13
- /** A skill as reported in review usage: its name plus where it was loaded from. */
14
- export interface SkillRef {
15
- name: string;
16
- origin: SkillOrigin;
17
- }
18
- /**
19
- * Build a blob (file) or tree (directory) URL for `path` at `ref` inside the
20
- * repository served at `repoWebUrl`. An empty ref resolves to `HEAD`, which both
21
- * GitHub and GitLab accept, so a skill or MCP server pinned to a remote's
22
- * default branch still links.
23
- */
24
- export declare function blobUrl(repoWebUrl: string, ref: string, path: string, kind?: 'blob' | 'tree'): string | undefined;
25
- /**
26
- * Convert a git clone URL to the repository's web URL: drop any transport
27
- * marker, embedded credentials, and the `.git` suffix, and serve it over HTTPS.
28
- * Accepts `https://`, `ssh://`, `git+<transport>://`, and scp-style
29
- * (`git@host:group/repo.git`) forms. Returns `undefined` for anything it cannot
30
- * parse, so an exotic remote simply yields an unlinked skill.
31
- */
32
- export declare function gitRepoWebUrl(cloneUrl: string): string | undefined;
33
- /**
34
- * Resolve a link to a skill's `SKILL.md`, or `undefined` when the source is not
35
- * reachable from a browser (a `file:` path, or an in-repo skill on a run with no
36
- * CI project URL). Built-in skills link to the published tag of this package, so
37
- * the link always shows the skill exactly as the run used it.
38
- */
39
- export declare function skillSourceUrl(origin: SkillOrigin, context?: SkillLinkContext): string | undefined;
40
- /**
41
- * Resolve a link to an MCP server's source, or `undefined` when it is not
42
- * reachable from a browser (a `file:` spec, or a repo `.mcp.json` on a run with
43
- * no CI project URL). A `project` source links to the `.mcp.json` file it was
44
- * declared in; a `marketplace` source links to the plugin's directory in the
45
- * marketplace repository.
46
- */
47
- export declare function mcpSourceUrl(source: McpServerSource, context?: SkillLinkContext): string | undefined;
48
- /**
49
- * The name a skill is shown under in the footer. Marketplace skills carry their
50
- * full selector (`<marketplace>:<plugin>/<skill>`) because a bare skill name says
51
- * nothing about which marketplace and plugin it came from — and that selector is
52
- * exactly what a developer would put in `CODE_REVIEW_SKILLS` to use it. Every
53
- * other source shows the skill's own name.
54
- */
55
- export declare function skillDisplayName(skill: SkillRef): string;
56
- /**
57
- * Render one skill for the summary footer: a link to its source when one can be
58
- * resolved, otherwise the bare name. The name keeps its code span either way so
59
- * linked and unlinked skills read the same.
60
- */
61
- export declare function formatSkillLink(skill: SkillRef, context?: SkillLinkContext): string;
62
- //# sourceMappingURL=skill-links.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill-links.d.ts","sourceRoot":"","sources":["../src/skill-links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mFAAmF;AACnF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;CACrB;AAkBD;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,GAAG,MAAe,GAC7B,MAAM,GAAG,SAAS,CAUpB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoBlE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAoBpB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,gBAAqB,GAC7B,MAAM,GAAG,SAAS,CAcpB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAIxD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAIvF"}
@@ -1,67 +0,0 @@
1
- /** The minimum a loaded skill must expose to attribute a file read to it. */
2
- export interface SkillReadTarget {
3
- name: string;
4
- /** Absolute path to the skill directory. Reads under it count as skill reads. */
5
- rootDir: string;
6
- }
7
- /**
8
- * The path a built-in read tool call targets, or `undefined` for any other tool
9
- * or a call with no usable `path`. The parameter name is `path`, matching the
10
- * `read` tool from `createReadOnlyTools` that the reviewer is actually handed.
11
- * Only the built-in read tool is considered: a skill is loaded by reading its
12
- * `SKILL.md`, and every other tool (grep, git, MCP) says nothing about whether
13
- * the reviewer read the skill.
14
- */
15
- export declare function readToolPath(toolName: string, args: unknown): string | undefined;
16
- /**
17
- * The skill whose directory contains `path`, or `undefined` when the read
18
- * targeted something else. Any file under the skill root counts — a reference
19
- * file the `SKILL.md` points at is as much a skill read as the `SKILL.md`
20
- * itself. Relative paths resolve against `cwd` — the review working directory
21
- * the reviewer's read tool resolves them against, which `--cwd` can move away
22
- * from the process working directory.
23
- */
24
- export declare function findSkillForPath(skills: readonly SkillReadTarget[], path: string, cwd: string): SkillReadTarget | undefined;
25
- /** Counts, per skill, how many files under its directory the reviewer read. */
26
- export interface SkillReadCounter {
27
- /** Feed every tool start; non-read calls and reads outside a skill are ignored. */
28
- record(toolName: string, args: unknown): void;
29
- /** Reads recorded for `skill` so far. */
30
- countFor(skill: SkillReadTarget): number;
31
- }
32
- /**
33
- * Build a counter shared by every review stage — Find and Verify run different
34
- * agents over the same tool list, so a skill read in either stage counts.
35
- */
36
- export declare function createSkillReadCounter(skills: readonly SkillReadTarget[], cwd: string): SkillReadCounter;
37
- /** Whether a skill was read, as shown in the footer and the usage log line. */
38
- export declare function formatSkillUsageState(skill: {
39
- reads: number;
40
- }): string;
41
- /**
42
- * How much a server was used, as shown in the footer and the usage log line:
43
- * a pluralised call count, `unused` for a server that connected but was never
44
- * called, and `unavailable` for one that failed to connect.
45
- */
46
- export declare function formatMcpUsageState(server: {
47
- status: 'connected' | 'unavailable';
48
- calls: number;
49
- }): string;
50
- /**
51
- * The end-of-review usage log line, e.g.
52
- * `Usage: skills code-review (read); MCP github (1 call), docs (unused)`.
53
- * Each half is omitted when nothing of that kind was configured, and the whole
54
- * line is `undefined` when neither was.
55
- */
56
- export declare function formatReviewUsageSummary(usage: {
57
- skills: readonly {
58
- name: string;
59
- reads: number;
60
- }[];
61
- mcp: readonly {
62
- name: string;
63
- status: 'connected' | 'unavailable';
64
- calls: number;
65
- }[];
66
- }): string | undefined;
67
- //# sourceMappingURL=skill-usage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill-usage.d.ts","sourceRoot":"","sources":["../src/skill-usage.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKhF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,eAAe,GAAG,SAAS,CAM7B;AAED,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,mFAAmF;IACnF,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9C,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,GAAG,EAAE,MAAM,GACV,gBAAgB,CAclB;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,GAAG,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACtF,GAAG,MAAM,GAAG,SAAS,CAWrB"}
package/dist/skills.d.ts DELETED
@@ -1,156 +0,0 @@
1
- /**
2
- * Where a loaded skill came from, carried in enough detail to build a link to
3
- * its `SKILL.md` for the summary footer (see `skill-links.ts`). `path` is always
4
- * the skill directory relative to the repository it lives in, POSIX-separated.
5
- */
6
- export type SkillOrigin = {
7
- kind: 'builtin';
8
- name: string;
9
- } | {
10
- kind: 'project';
11
- path: string;
12
- } | {
13
- kind: 'npm';
14
- packageName: string;
15
- subpath: string;
16
- } | {
17
- kind: 'file';
18
- path: string;
19
- } | {
20
- kind: 'git';
21
- url: string;
22
- ref: string;
23
- path: string;
24
- } | {
25
- kind: 'marketplace';
26
- marketplace: string;
27
- plugin: string;
28
- url: string;
29
- ref: string;
30
- path: string;
31
- };
32
- export interface Skill {
33
- name: string;
34
- description: string;
35
- /** Absolute path to the SKILL.md file. Used to reference skill content in prompts. */
36
- filePath: string;
37
- rootDir: string;
38
- resourceDirs: string[];
39
- origin: SkillOrigin;
40
- }
41
- /** Normalize a filesystem-relative path to the POSIX form used in URLs. */
42
- export declare function toPosixPath(path: string): string;
43
- /**
44
- * A parsed skill spec descriptor. Produced by `parseSkillSpec`.
45
- *
46
- * - `builtin` — bare name resolved from the package's bundled `skills/` dir
47
- * - `npm` — package in `node_modules`, optionally with a sub-directory
48
- * - `file` — explicit filesystem path (relative or absolute)
49
- * - `git` — shallow git clone at a pinned ref, optionally with a sub-directory
50
- * - `marketplace` — a skill inside a Claude-plugin marketplace registered by name
51
- * (resolved via its `.claude-plugin/marketplace.json`); see `marketplaces.ts`
52
- */
53
- export type SkillSpec = {
54
- protocol: 'builtin';
55
- name: string;
56
- } | {
57
- protocol: 'npm';
58
- packageName: string;
59
- subpath: string;
60
- } | {
61
- protocol: 'file';
62
- path: string;
63
- } | {
64
- protocol: 'git';
65
- url: string;
66
- ref: string;
67
- subpath: string;
68
- } | {
69
- protocol: 'marketplace';
70
- marketplace: string;
71
- plugin: string;
72
- skill: string;
73
- };
74
- export declare function loadSkillFromDir(dirPath: string, origin: SkillOrigin): Promise<Skill | null>;
75
- export declare function resolveBuiltinSkillsDir(): string;
76
- export declare function loadBuiltinSkill(name: string): Promise<Skill | null>;
77
- export declare function loadAutoDiscoveredSkills(cwd: string, gitRoot: string, warn?: (msg: string) => void): Promise<Skill[]>;
78
- /**
79
- * Parse a skill spec string into a typed `SkillSpec` descriptor.
80
- *
81
- * Supported spec formats:
82
- *
83
- * | Input | Result |
84
- * |------------------------------------|---------------------------------------------------|
85
- * | `code-review` | `{ protocol: 'builtin', name: 'code-review' }` |
86
- * | `npm:my-skill` | `{ protocol: 'npm', packageName: 'my-skill', ... }`|
87
- * | `npm:@scope/pkg` | `{ protocol: 'npm', packageName: '@scope/pkg', ... }`|
88
- * | `npm:@scope/bundle/security` | `{ protocol: 'npm', packageName: '@scope/bundle', subpath: 'security' }`|
89
- * | `npm:bundle/security` | `{ protocol: 'npm', packageName: 'bundle', subpath: 'security' }`|
90
- * | `file:./path/to/skill` | `{ protocol: 'file', path: './path/to/skill' }` |
91
- * | `file:/absolute/path` | `{ protocol: 'file', path: '/absolute/path' }` |
92
- * | `git:https://host/org/s.git` | `{ protocol: 'git', url: 'https://host/org/s.git', ref: '', subpath: '' }` |
93
- * | `git:https://host/org/b.git#v1/sec`| `{ protocol: 'git', url: 'https://host/org/b.git', ref: 'v1', subpath: 'sec' }` |
94
- * | `git+ssh://git@host/org/s.git` | `{ protocol: 'git', url: 'ssh://git@host/org/s.git', ref: '', subpath: '' }` |
95
- * | `acme:dev/aria-apg` (acme known) | `{ protocol: 'marketplace', marketplace: 'acme', plugin: 'dev', skill: 'aria-apg' }` |
96
- *
97
- * A spec whose portion before the first `:` matches a registered marketplace
98
- * name (from `knownMarketplaces`) is parsed as a `marketplace` reference. The
99
- * remainder must be `<plugin>/<skill>` — an explicit skill is always required.
100
- */
101
- export declare function parseSkillSpec(spec: string, knownMarketplaces?: ReadonlySet<string>): SkillSpec;
102
- /**
103
- * Resolve the directory for an npm-installed skill by walking `node_modules`
104
- * upward from `cwd` (supports monorepo hoisting). Returns the resolved path
105
- * or `null` if the package / subpath cannot be found.
106
- */
107
- export declare function resolveNpmSkillDir(packageName: string, subpath: string, cwd: string): Promise<string | null>;
108
- /** Strip a leading `git+` transport marker (`git+ssh://…` → `ssh://…`). */
109
- export declare function normalizeGitUrl(raw: string): string;
110
- /**
111
- * Remove embedded credentials from a URL so it is safe to show in logs, hints,
112
- * and errors. `https://user:token@host/path` becomes `https://***@host/path`.
113
- * Non-URL strings are returned with a best-effort `//user@` → `//***@` scrub.
114
- */
115
- export declare function redactUrl(url: string): string;
116
- /** Base directory for cached git-skill clones (honours `XDG_CACHE_HOME`). */
117
- export declare function resolveSkillCacheDir(): string;
118
- /**
119
- * Stable cache-directory name for a git skill. Keyed on the clone URL plus the
120
- * pinned ref so that two refs of the same repo never share a cache entry.
121
- */
122
- export declare function gitSkillCacheKey(url: string, ref: string): string;
123
- /**
124
- * Resolve a git URL + ref to a local clone directory, reusing the on-disk cache
125
- * when possible. The clone lands in a temp sibling first and is renamed into
126
- * place atomically, so a crashed or concurrent clone never leaves a half-written
127
- * cache entry. With `refresh`, any cached copy is discarded first. Shared by
128
- * `git:` skills and Claude-plugin marketplaces (see `marketplaces.ts`).
129
- */
130
- export declare function cloneGitRepo(url: string, ref: string, options: {
131
- cacheDir: string;
132
- refresh: boolean;
133
- }): Promise<string>;
134
- /** Options controlling how external skills are resolved. */
135
- export interface LoadNamedSkillOptions {
136
- /** Override the git-skill clone cache directory (defaults to the XDG cache). */
137
- cacheDir?: string;
138
- /** Re-clone git skills even when a cached copy exists. */
139
- refresh?: boolean;
140
- }
141
- /**
142
- * Load a skill by its spec string (`code-review`, `npm:@scope/pkg`, `file:./path`,
143
- * `git:https://…`, …).
144
- *
145
- * Resolution order:
146
- * 1. `builtin` — package-bundled `skills/<name>/`
147
- * 2. `npm:` — `node_modules/<packageName>[/subpath]` walked up from `cwd`
148
- * 3. `file:` — direct filesystem path (relative paths resolved from `cwd`)
149
- * 4. `git:` / `git+ssh:` — shallow clone at the pinned ref, cached on disk,
150
- * loading `SKILL.md` from the repo root or the `#<ref>/<subpath>` directory
151
- *
152
- * Throws a `ConfigError` if the spec cannot be resolved or the resolved
153
- * directory does not contain a valid `SKILL.md`.
154
- */
155
- export declare function loadNamedSkill(spec: string, cwd: string, options?: LoadNamedSkillOptions): Promise<Skill>;
156
- //# sourceMappingURL=skills.d.ts.map