@getchomp/mcp 0.0.0-stage → 0.2.42
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.
- package/README.md +15 -2
- package/dist/conventionsReference.d.ts +84 -0
- package/dist/conventionsReference.js +313 -0
- package/dist/designSystem/astScanner.d.ts +153 -0
- package/dist/designSystem/astScanner.js +2014 -0
- package/dist/designSystem/baseline.d.ts +65 -0
- package/dist/designSystem/baseline.js +136 -0
- package/dist/designSystem/color.d.ts +35 -0
- package/dist/designSystem/color.js +265 -0
- package/dist/designSystem/config.d.ts +183 -0
- package/dist/designSystem/config.js +469 -0
- package/dist/designSystem/contrast.d.ts +55 -0
- package/dist/designSystem/contrast.js +377 -0
- package/dist/designSystem/cssParser.d.ts +63 -0
- package/dist/designSystem/cssParser.js +469 -0
- package/dist/designSystem/merges.d.ts +57 -0
- package/dist/designSystem/merges.js +94 -0
- package/dist/designSystem/preprocessors.d.ts +46 -0
- package/dist/designSystem/preprocessors.js +1108 -0
- package/dist/designSystem/presentation.d.ts +45 -0
- package/dist/designSystem/presentation.js +796 -0
- package/dist/designSystem/styleVectors.d.ts +27 -0
- package/dist/designSystem/styleVectors.js +484 -0
- package/dist/designSystem/tokens.d.ts +39 -0
- package/dist/designSystem/tokens.js +409 -0
- package/dist/designSystem/topology.d.ts +64 -0
- package/dist/designSystem/topology.js +254 -0
- package/dist/designSystem/types.d.ts +857 -0
- package/dist/designSystem/types.js +113 -0
- package/dist/designSystem/typography.d.ts +25 -0
- package/dist/designSystem/typography.js +244 -0
- package/dist/designSystem/uiShapes.d.ts +74 -0
- package/dist/designSystem/uiShapes.js +285 -0
- package/dist/designSystem/valueClusters.d.ts +76 -0
- package/dist/designSystem/valueClusters.js +281 -0
- package/dist/designSystemPlugin.d.ts +321 -0
- package/dist/designSystemPlugin.js +4730 -0
- package/dist/enrichNodesPlugin.d.ts +160 -0
- package/dist/enrichNodesPlugin.js +957 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +1298 -0
- package/dist/intelligence.d.ts +502 -0
- package/dist/intelligence.js +3058 -0
- package/dist/pluginRunner.d.ts +364 -0
- package/dist/pluginRunner.js +1096 -0
- package/dist/plugins/design-system/index.d.ts +14 -0
- package/dist/plugins/design-system/index.js +241 -0
- package/dist/plugins/enrich-nodes/index.d.ts +388 -0
- package/dist/plugins/enrich-nodes/index.js +697 -0
- package/dist/plugins/index.d.ts +15 -0
- package/dist/plugins/index.js +20 -0
- package/dist/plugins/local-shims/index.d.ts +121 -0
- package/dist/plugins/local-shims/index.js +237 -0
- package/dist/shimsPlugin.d.ts +134 -0
- package/dist/shimsPlugin.js +1392 -0
- package/package.json +38 -3
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* packages/mcp/src/pluginRunner.ts
|
|
3
|
+
*
|
|
4
|
+
* Modular Chomp Plugin Runtime, Folder Discovery, Settings, Active Views & Projection Engine
|
|
5
|
+
* Enforces [PAT-DB-03], [PAT-DB-05], [PAT-MCP-03], [PAT-VIS-28], and [PAT-VIS-36].
|
|
6
|
+
*
|
|
7
|
+
* Architecture ("One Folder, Zero Plumbing Edits"):
|
|
8
|
+
* - Built-in plugins live in self-contained folders under `packages/mcp/src/plugins/<name>/index.ts`
|
|
9
|
+
* and are auto-discovered at startup (`discoverPluginsInDir`).
|
|
10
|
+
* - Repository-local plugin state & user settings live under `.chomp/plugins/<plugin.name>/`
|
|
11
|
+
* (e.g. `.chomp/plugins/local-shims/shims.json`, `.chomp/plugins/<name>/settings.json`).
|
|
12
|
+
* - Every plugin automatically receives:
|
|
13
|
+
* 1. Scoped `.chomp/plugins/<name>/` file I/O + SHA-256 `inputs` staleness hashes (`ctx.pluginDir`,
|
|
14
|
+
* `ctx.readPluginFile`, `ctx.writePluginFile`, `ctx.hashPluginFile`).
|
|
15
|
+
* 2. Declarative `settingsSchema` resolved into `ctx.settings` and rendered automatically in the
|
|
16
|
+
* Explorer Settings drawer (`GET/PUT /api/plugins/:name/settings`).
|
|
17
|
+
* 3. Active View array controls via both declarative Spotlight lenses (`summary.views[].highlightNodeIds`)
|
|
18
|
+
* and imperative `ctx.setActiveView({ highlightNodeIds, ... })` writing `.chomp/current_view.json`.
|
|
19
|
+
* 4. Generic `PluginPresentation` v1 sections rendered in the HUD, Package Inspector, and Node Inspector.
|
|
20
|
+
* 5. Optional `projectGraph`, `mcpTools`, and `formatCliSummary` hooks wired automatically across
|
|
21
|
+
* CLI, Explorer UI, and MCP server with zero edits outside the plugin's own folder.
|
|
22
|
+
*/
|
|
23
|
+
import type { z } from "zod";
|
|
24
|
+
import { type PluginInspectorScope, type PluginSettingField, type PluginSettingValue, type PluginToolDescriptorSummary, type RepresentationGraph } from "@getchomp/core";
|
|
25
|
+
import { type ChompStorage, type EntityOverlayInput, type EntityOverlayRecord, type OverlayEvidenceItem, type OverlayInputDependency, type OverlayLayer } from "@getchomp/db";
|
|
26
|
+
import { type ActiveViewLevel } from "./intelligence.js";
|
|
27
|
+
export declare const PLUGINS_STATE_DIR_REL: ".chomp/plugins";
|
|
28
|
+
export type ChompPluginEvidenceHelper = (filePath: string, lineNumber?: number, snippet?: string, evidenceRole?: string) => OverlayEvidenceItem;
|
|
29
|
+
export interface PluginActiveViewRequest {
|
|
30
|
+
title: string;
|
|
31
|
+
description: string;
|
|
32
|
+
/** Semantic node IDs (`CONTRACT`, `CLASS`, `NAMESPACE`, `INIT_BLOCK`, `OPEN_CONNECTOR`) to highlight. */
|
|
33
|
+
highlightNodeIds: string[];
|
|
34
|
+
/** Optional per-node banner callouts (`nodeId -> short note`). */
|
|
35
|
+
nodeAnnotations?: Record<string, string>;
|
|
36
|
+
/** Optional explicit altitude (`"system"` or `"package"`). Auto-resolved from `highlightNodeIds` when omitted. */
|
|
37
|
+
viewLevel?: ActiveViewLevel;
|
|
38
|
+
/** Optional target package label when `viewLevel === "package"`. */
|
|
39
|
+
packageName?: string;
|
|
40
|
+
/** Optional summary pills displayed in the Agent Spotlight banner. */
|
|
41
|
+
pills?: string[];
|
|
42
|
+
/** Optional key-value metric summary displayed in the Agent Spotlight banner. */
|
|
43
|
+
metrics?: Record<string, string | number>;
|
|
44
|
+
/** Optional graph used to infer `viewLevel` and `packageName` from `highlightNodeIds`. */
|
|
45
|
+
graph?: RepresentationGraph;
|
|
46
|
+
}
|
|
47
|
+
export interface ChompPluginContext {
|
|
48
|
+
repoId: string;
|
|
49
|
+
repoName: string;
|
|
50
|
+
repoPath: string;
|
|
51
|
+
graph: RepresentationGraph;
|
|
52
|
+
/** Existing persisted overlays in `entity_overlays` for `repoId` (e.g. `AI_HYPOTHESIS` rows for `enrich-nodes`). */
|
|
53
|
+
existingOverlays: EntityOverlayRecord[];
|
|
54
|
+
/** Repo-relative POSIX file paths accepted by `plugin.accepts(file)` (includes `.chomp/plugins/**`). */
|
|
55
|
+
files: string[];
|
|
56
|
+
environment: string;
|
|
57
|
+
runId: string;
|
|
58
|
+
/** Absolute path to `.chomp/plugins/<plugin.name>`. */
|
|
59
|
+
pluginDir: string;
|
|
60
|
+
/** Repo-relative POSIX path `.chomp/plugins/<plugin.name>`. */
|
|
61
|
+
pluginDirRel: string;
|
|
62
|
+
/** Resolved user settings (`.chomp/plugins/<plugin.name>/settings.json` merged over `settingsSchema` defaults). */
|
|
63
|
+
settings: Record<string, PluginSettingValue>;
|
|
64
|
+
/** Reads a file relative to `repoPath` (or absolute path) as UTF-8 text. */
|
|
65
|
+
readFile: (filePath: string) => string | null;
|
|
66
|
+
/** Reads a file inside `.chomp/plugins/<plugin.name>/` as UTF-8 text. */
|
|
67
|
+
readPluginFile: (relPath: string) => string | null;
|
|
68
|
+
/** Writes UTF-8 text to a file inside `.chomp/plugins/<plugin.name>/` (creating directories automatically). */
|
|
69
|
+
writePluginFile: (relPath: string, content: string) => string;
|
|
70
|
+
/**
|
|
71
|
+
* Computes the 16-char SHA-256 input dependency record `{ path, hash }`
|
|
72
|
+
* for non-AST `inputs` staleness tracking (`[PAT-DB-05]`).
|
|
73
|
+
*/
|
|
74
|
+
hashFile: (filePath: string) => OverlayInputDependency | null;
|
|
75
|
+
/** Computes `{ path, hash }` for a file inside `.chomp/plugins/<plugin.name>/`. */
|
|
76
|
+
hashPluginFile: (relPath: string) => OverlayInputDependency | null;
|
|
77
|
+
/** Builds a normalized `OverlayEvidenceItem` (`filePath`, `lineNumber`, `snippet`, `evidenceRole`). */
|
|
78
|
+
evidence: ChompPluginEvidenceHelper;
|
|
79
|
+
/** Resolves a secret from `process.env` via a `kind: "env"` setting key (or direct env-var name), never storing secrets in `settings.json`. */
|
|
80
|
+
resolveSecret: (settingKeyOrEnvName: string) => string | undefined;
|
|
81
|
+
/** Writes `.chomp/current_view.json` to highlight `highlightNodeIds` in the Explorer Active View banner. */
|
|
82
|
+
setActiveView: (spec: PluginActiveViewRequest) => string | null;
|
|
83
|
+
}
|
|
84
|
+
export interface ChompPluginExtractResult {
|
|
85
|
+
overlays: EntityOverlayInput[];
|
|
86
|
+
summary?: Record<string, any>;
|
|
87
|
+
}
|
|
88
|
+
export interface ChompPluginProjectionOverlayLike {
|
|
89
|
+
entityId: string;
|
|
90
|
+
layer: string;
|
|
91
|
+
source?: string;
|
|
92
|
+
payload: Record<string, any>;
|
|
93
|
+
}
|
|
94
|
+
export interface ChompPluginProjectionContext {
|
|
95
|
+
graph: RepresentationGraph;
|
|
96
|
+
overlays: readonly ChompPluginProjectionOverlayLike[];
|
|
97
|
+
repoPath?: string;
|
|
98
|
+
settings: Record<string, PluginSettingValue>;
|
|
99
|
+
/** Reads a repo-relative file (supports git-blob overrides during historical diff comparisons). */
|
|
100
|
+
readRepoFile: (relPath: string) => string | null;
|
|
101
|
+
/** Reads a file relative to `.chomp/plugins/<plugin.name>/`. */
|
|
102
|
+
readPluginFile: (relPath: string) => string | null;
|
|
103
|
+
/** Resolves a secret from `process.env` via a `kind: "env"` setting key or direct env-var name. */
|
|
104
|
+
resolveSecret: (settingKeyOrEnvName: string) => string | undefined;
|
|
105
|
+
}
|
|
106
|
+
export interface ChompPluginToolContext {
|
|
107
|
+
repoPath: string;
|
|
108
|
+
repoName: string;
|
|
109
|
+
repoId: string;
|
|
110
|
+
dbPath: string;
|
|
111
|
+
settings: Record<string, PluginSettingValue>;
|
|
112
|
+
/** Resolves a secret from `process.env` via a `kind: "env"` setting key or direct env-var name. */
|
|
113
|
+
resolveSecret: (settingKeyOrEnvName: string) => string | undefined;
|
|
114
|
+
loadRawGraph: () => Promise<RepresentationGraph | null>;
|
|
115
|
+
loadProjectedGraph: () => Promise<RepresentationGraph | null>;
|
|
116
|
+
withStorage: <T>(fn: (storage: ChompStorage) => Promise<T>) => Promise<T>;
|
|
117
|
+
invalidateCache: () => void;
|
|
118
|
+
runSelf: (opts?: Partial<RunChompPluginOptions>) => Promise<RunChompPluginResult>;
|
|
119
|
+
setActiveView: (spec: PluginActiveViewRequest) => string | null;
|
|
120
|
+
}
|
|
121
|
+
export type ChompPluginMcpToolResult = {
|
|
122
|
+
content: Array<{
|
|
123
|
+
type: "text";
|
|
124
|
+
text: string;
|
|
125
|
+
}>;
|
|
126
|
+
isError?: boolean;
|
|
127
|
+
} | object | string;
|
|
128
|
+
export interface ChompPluginMcpTool {
|
|
129
|
+
name: string;
|
|
130
|
+
description: string;
|
|
131
|
+
inputSchema: Record<string, z.ZodTypeAny>;
|
|
132
|
+
handler: (args: Record<string, any>, ctx: ChompPluginToolContext) => Promise<ChompPluginMcpToolResult> | ChompPluginMcpToolResult;
|
|
133
|
+
}
|
|
134
|
+
export interface ChompCliAnsiHelpers {
|
|
135
|
+
bold: (s: string) => string;
|
|
136
|
+
dim: (s: string) => string;
|
|
137
|
+
green: (s: string) => string;
|
|
138
|
+
yellow: (s: string) => string;
|
|
139
|
+
cyan: (s: string) => string;
|
|
140
|
+
}
|
|
141
|
+
export interface ChompPlugin {
|
|
142
|
+
/** Unique plugin identifier used as `source` in `entity_overlays` and `.chomp/plugins/<name>/` (e.g. `'local-shims'`). */
|
|
143
|
+
name: string;
|
|
144
|
+
/** Semantic version of the plugin (e.g. `'1.0.0'`). */
|
|
145
|
+
version: string;
|
|
146
|
+
/** Default overlay layer written by this plugin (`'L1_DESIGN_SYSTEM'`, `'L1_SHIMS'`, or `'PLUGIN:<name>'`). */
|
|
147
|
+
layer: OverlayLayer;
|
|
148
|
+
/** Human-readable name shown in the HUD, Inspector, and Settings drawer (default: `name`). */
|
|
149
|
+
displayName?: string;
|
|
150
|
+
/** Human-readable description of what the plugin extracts or projects. */
|
|
151
|
+
description: string;
|
|
152
|
+
/** Optional display sort order across HUD, Settings, and CLI (lower renders first; defaults to `100`). */
|
|
153
|
+
order?: number;
|
|
154
|
+
/** Default layer visibility when unset in `.chomp/rules.json` (defaults to `true`). */
|
|
155
|
+
defaultEnabled?: boolean;
|
|
156
|
+
/** Superseded overlay `source` names pruned (per layer/environment) whenever this plugin persists a run. */
|
|
157
|
+
legacySources?: string[];
|
|
158
|
+
/**
|
|
159
|
+
* Optional inspector surfaces where this plugin's `PluginPresentation` sections may appear.
|
|
160
|
+
* Defaults to both `["package", "node"]` when omitted. Set `["package"]` when node-level data
|
|
161
|
+
* writes directly to core entity fields (e.g. `enrich-nodes`).
|
|
162
|
+
*/
|
|
163
|
+
inspectorScopes?: PluginInspectorScope[];
|
|
164
|
+
/** Declarative user-configurable settings persisted in `.chomp/plugins/<name>/settings.json` and rendered in Settings. */
|
|
165
|
+
settingsSchema?: PluginSettingField[];
|
|
166
|
+
/**
|
|
167
|
+
* When `false`, skips walking the full repository source tree during `runChompPlugin` and only inspects
|
|
168
|
+
* `.chomp/plugins/**` + root `chomp.config.json` (ideal for graph-only, snapshot, or telemetry plugins).
|
|
169
|
+
* Defaults to `true`.
|
|
170
|
+
*/
|
|
171
|
+
scanRepoFiles?: boolean;
|
|
172
|
+
/** Predicate returning true if a repo-relative POSIX file path is relevant to this plugin. */
|
|
173
|
+
accepts: (filePath: string) => boolean;
|
|
174
|
+
/** Deterministic extraction function producing `EntityOverlayInput[]` and optional summary metadata. */
|
|
175
|
+
extract: (ctx: ChompPluginContext) => Promise<ChompPluginExtractResult | EntityOverlayInput[]> | ChompPluginExtractResult | EntityOverlayInput[];
|
|
176
|
+
/**
|
|
177
|
+
* Optional in-memory graph projection hook (e.g. `local-shims` projecting `INFERRED` Layer 1 edges/connectors)
|
|
178
|
+
* invoked automatically before layout, health, and MCP graph intelligence queries when this plugin's layer is enabled.
|
|
179
|
+
*/
|
|
180
|
+
projectGraph?: (ctx: ChompPluginProjectionContext) => RepresentationGraph;
|
|
181
|
+
/**
|
|
182
|
+
* Optional predicate returning true when an overlay from this plugin alters the structural story layout
|
|
183
|
+
* (participates in `structureFp` even when custom classification rules do not reference overlays).
|
|
184
|
+
*/
|
|
185
|
+
isStructuralOverlay?: (overlay: ChompPluginProjectionOverlayLike) => boolean;
|
|
186
|
+
/** Optional MCP tools owned by this plugin and auto-registered on the `@getchomp/mcp` server. */
|
|
187
|
+
mcpTools?: ChompPluginMcpTool[];
|
|
188
|
+
/** Optional terminal summary lines printed by `chomp plugin run <name>`. */
|
|
189
|
+
formatCliSummary?: (res: RunChompPluginResult, ansi: ChompCliAnsiHelpers) => string[];
|
|
190
|
+
}
|
|
191
|
+
/** Identity helper providing full TypeScript inference when authoring a self-contained plugin folder. */
|
|
192
|
+
export declare function defineChompPlugin<T extends ChompPlugin>(plugin: T): T;
|
|
193
|
+
export interface RunChompPluginOptions {
|
|
194
|
+
repoPath: string;
|
|
195
|
+
repoId?: string;
|
|
196
|
+
repoName?: string;
|
|
197
|
+
dbPath?: string;
|
|
198
|
+
storage?: ChompStorage;
|
|
199
|
+
graph?: RepresentationGraph;
|
|
200
|
+
existingOverlays?: EntityOverlayRecord[];
|
|
201
|
+
environment?: string;
|
|
202
|
+
runId?: string;
|
|
203
|
+
excludeWorkspaces?: string[];
|
|
204
|
+
settingsOverride?: Record<string, PluginSettingValue>;
|
|
205
|
+
/** When true (default), writes extracted overlays to `entity_overlays` and prunes stale rows for this source. */
|
|
206
|
+
persist?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* When true, persists `.chomp/plugins/<name>/last-run.json` with status, duration, warnings, and any error.
|
|
209
|
+
* Defaults to `true` whenever `persist` is enabled (unless an in-memory `storage` is passed on a directory without `.chomp/`).
|
|
210
|
+
*/
|
|
211
|
+
persistRunRecord?: boolean;
|
|
212
|
+
}
|
|
213
|
+
export interface RunAllChompPluginsOptions extends RunChompPluginOptions {
|
|
214
|
+
/** When true, isolates per-plugin exceptions so remaining plugins still execute (`last-run.json` records each failure). */
|
|
215
|
+
continueOnError?: boolean;
|
|
216
|
+
/** Optional callback invoked when an individual plugin throws during `runAllChompPlugins`. */
|
|
217
|
+
onPluginError?: (plugin: ChompPlugin, error: Error) => void;
|
|
218
|
+
}
|
|
219
|
+
export interface PersistedPluginRunRecord {
|
|
220
|
+
pluginName: string;
|
|
221
|
+
pluginVersion: string;
|
|
222
|
+
layer: string;
|
|
223
|
+
status: "ok" | "error";
|
|
224
|
+
runId?: string;
|
|
225
|
+
startedAt: string;
|
|
226
|
+
finishedAt: string;
|
|
227
|
+
durationMs: number;
|
|
228
|
+
acceptedFileCount?: number;
|
|
229
|
+
overlayCount?: number;
|
|
230
|
+
presentationWarnings: string[];
|
|
231
|
+
error?: string;
|
|
232
|
+
}
|
|
233
|
+
export interface RunChompPluginResult {
|
|
234
|
+
pluginName: string;
|
|
235
|
+
pluginVersion: string;
|
|
236
|
+
layer: OverlayLayer;
|
|
237
|
+
runId: string;
|
|
238
|
+
acceptedFileCount: number;
|
|
239
|
+
overlayCount: number;
|
|
240
|
+
overlays: EntityOverlayInput[];
|
|
241
|
+
summary: Record<string, any>;
|
|
242
|
+
durationMs: number;
|
|
243
|
+
/** Problems found while validating `payload.presentation` (dropped sections, unsupported versions, size caps). */
|
|
244
|
+
presentationWarnings: string[];
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Resolves a plugin by name or merges bare plugin instances with their registered
|
|
248
|
+
* module metadata (`settingsSchema`, `scanRepoFiles`, `defaultEnabled`, etc.) so direct
|
|
249
|
+
* callers like `manageLocalShims` or `auditDesignSystem` always honor persisted settings.
|
|
250
|
+
*/
|
|
251
|
+
export declare function resolveEffectivePlugin(pluginOrName: ChompPlugin | string): ChompPlugin | undefined;
|
|
252
|
+
/** Max serialized size of one overlay's presentation; lowest-priority sections are dropped beyond it. */
|
|
253
|
+
export declare const MAX_PRESENTATION_BYTES = 120000;
|
|
254
|
+
export declare function getPluginStateDirRel(pluginName: string): string;
|
|
255
|
+
export declare function getPluginStateDir(repoPath: string, pluginName: string): string;
|
|
256
|
+
export declare function getPluginSettingsPath(repoPath: string, pluginName: string): string;
|
|
257
|
+
export declare const PLUGIN_LAST_RUN_FILENAME = "last-run.json";
|
|
258
|
+
export declare function getPluginLastRunPath(repoPath: string, pluginName: string): string;
|
|
259
|
+
export declare function readPluginLastRun(repoPath: string | undefined, pluginName: string): PersistedPluginRunRecord | null;
|
|
260
|
+
export declare function writePluginLastRun(repoPath: string, record: PersistedPluginRunRecord): string | null;
|
|
261
|
+
export declare function loadPluginSettings(repoPath: string | undefined, pluginOrName: ChompPlugin | string): Record<string, PluginSettingValue>;
|
|
262
|
+
export declare function savePluginSettings(repoPath: string, pluginOrName: ChompPlugin | string, patch: Record<string, unknown>): Record<string, PluginSettingValue>;
|
|
263
|
+
export declare function getPluginMcpToolSummaries(plugin: ChompPlugin): PluginToolDescriptorSummary[];
|
|
264
|
+
/**
|
|
265
|
+
* Resolves a secret from `env` (`process.env` by default) via a `kind: "env"` setting key
|
|
266
|
+
* or direct environment-variable identifier — never reading raw secrets from `settings.json`.
|
|
267
|
+
*/
|
|
268
|
+
export declare function resolvePluginSecret(plugin: Pick<ChompPlugin, "settingsSchema">, settings: Record<string, PluginSettingValue>, settingKeyOrEnvName: string, env?: Record<string, string | undefined>): string | undefined;
|
|
269
|
+
/**
|
|
270
|
+
* Computes boolean presence status (`true` = set in `env`, `false` = unset) for each `kind: "env"`
|
|
271
|
+
* field in `plugin.settingsSchema`. Safe to expose to the UI because secret values are never included.
|
|
272
|
+
*/
|
|
273
|
+
export declare function getPluginEnvStatus(plugin: Pick<ChompPlugin, "settingsSchema">, settings: Record<string, PluginSettingValue>, env?: Record<string, string | undefined>): Record<string, boolean> | undefined;
|
|
274
|
+
/**
|
|
275
|
+
* Resolves the current Git branch name for a repository or worktree (handling `.git` pointer files).
|
|
276
|
+
*/
|
|
277
|
+
export declare function resolveRepoGitBranch(repoPath: string, fallbackBranch?: string): string | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* Resolves the canonical repository name for `inputPath`, unwrapping Git worktree
|
|
280
|
+
* `.git` pointer files (`gitdir:` + `commondir`) back to the parent repository root.
|
|
281
|
+
*/
|
|
282
|
+
export declare function resolveRepoName(inputPath: string): string;
|
|
283
|
+
/**
|
|
284
|
+
* Resolves the base URL of the local Chomp Visualizer server (`chomp ui`) for Active View deep-links.
|
|
285
|
+
*/
|
|
286
|
+
export declare function resolveActiveUiBaseUrl(repoPath: string): string;
|
|
287
|
+
/**
|
|
288
|
+
* Writes `.chomp/current_view.json` on behalf of a plugin (`[PAT-MCP-03]`, `[PAT-VIS-28]`),
|
|
289
|
+
* resolving topological altitude and deep-link URL automatically.
|
|
290
|
+
*/
|
|
291
|
+
export declare function writePluginActiveView(options: {
|
|
292
|
+
repoPath: string;
|
|
293
|
+
repoId?: string;
|
|
294
|
+
repoName?: string;
|
|
295
|
+
pluginName: string;
|
|
296
|
+
layer: string;
|
|
297
|
+
}, spec: PluginActiveViewRequest): string | null;
|
|
298
|
+
/**
|
|
299
|
+
* Enforces the Plugin Presentation Contract on every overlay a plugin produced: the presentation is
|
|
300
|
+
* sanitized (bounded, unknown blocks dropped) and size-capped. A presentation that is not usable is
|
|
301
|
+
* removed so the UI falls back to the generic payload view instead of failing.
|
|
302
|
+
*/
|
|
303
|
+
export declare function enforcePresentationContract(overlays: EntityOverlayInput[], pluginName: string): {
|
|
304
|
+
overlays: EntityOverlayInput[];
|
|
305
|
+
warnings: string[];
|
|
306
|
+
};
|
|
307
|
+
export declare function registerChompPlugin(plugin: ChompPlugin): void;
|
|
308
|
+
export declare function unregisterChompPlugin(name: string): boolean;
|
|
309
|
+
export declare function getChompPlugin(name: string): ChompPlugin | undefined;
|
|
310
|
+
export declare function listChompPlugins(): ChompPlugin[];
|
|
311
|
+
/**
|
|
312
|
+
* Returns default `overlayLayers` visibility map combining core layers and all registered plugins.
|
|
313
|
+
*/
|
|
314
|
+
export declare function getRegisteredPluginDefaultLayers(): Record<string, boolean>;
|
|
315
|
+
/**
|
|
316
|
+
* Checks whether a plugin overlay alters structural layout (`structureFp`) via registered `isStructuralOverlay` hooks.
|
|
317
|
+
*/
|
|
318
|
+
export declare function isRegisteredStructuralPluginOverlay(overlay: ChompPluginProjectionOverlayLike): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Reads `.chomp/rules.json#overlayLayers` from `repoPath` when not explicitly supplied.
|
|
321
|
+
*/
|
|
322
|
+
export declare function readRepoOverlayLayerToggles(repoPath: string | undefined): Record<string, boolean>;
|
|
323
|
+
export declare function isPluginLayerEnabled(plugin: ChompPlugin, overlayLayers?: Record<string, boolean>): boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Runs every enabled registered plugin's `projectGraph` hook in deterministic registration order.
|
|
326
|
+
* Eliminates plugin-specific projection branches from `ui.ts`, `health.ts`, and `mcp/src/index.ts`.
|
|
327
|
+
*/
|
|
328
|
+
export declare function applyActivePluginProjections(graph: RepresentationGraph, options?: {
|
|
329
|
+
repoPath?: string;
|
|
330
|
+
overlays?: readonly ChompPluginProjectionOverlayLike[];
|
|
331
|
+
overlayLayers?: Record<string, boolean>;
|
|
332
|
+
readRepoFileOverride?: (relPath: string) => string | null;
|
|
333
|
+
}): RepresentationGraph;
|
|
334
|
+
/**
|
|
335
|
+
* Auto-discovers and registers self-contained plugin folders inside `pluginsRootDir`.
|
|
336
|
+
* Each subdirectory `<pluginsRootDir>/<folder>/` is checked for `index.js`, `index.mjs`, or `index.ts`.
|
|
337
|
+
*/
|
|
338
|
+
export declare function discoverPluginsInDir(pluginsRootDir: string): Promise<ChompPlugin[]>;
|
|
339
|
+
/**
|
|
340
|
+
* Walks `repoPath` deterministically (plus `.chomp/plugins/**`) and returns sorted repo-relative POSIX file paths.
|
|
341
|
+
*/
|
|
342
|
+
export declare function collectPluginRepoFiles(repoPath: string, excludeWorkspaces?: string[]): string[];
|
|
343
|
+
/**
|
|
344
|
+
* Lightweight file collector used when `plugin.scanRepoFiles === false`:
|
|
345
|
+
* inspects ONLY `.chomp/plugins/**`, legacy `.chomp/shims.json`, and root `chomp.config.json`
|
|
346
|
+
* without walking the repository source tree.
|
|
347
|
+
*/
|
|
348
|
+
export declare function collectPluginStateFiles(repoPath: string): string[];
|
|
349
|
+
/**
|
|
350
|
+
* Computes a deterministic 16-character SHA-256 fingerprint for an input file (`[PAT-DB-05]`).
|
|
351
|
+
* Matches the exact 16-hex slice used by `graphRepository.ts` (`upsertEntityOverlaySync` / `getEntityOverlaysSync`).
|
|
352
|
+
*/
|
|
353
|
+
export declare function computeFileOverlayHash(repoPath: string, relOrAbsPath: string): OverlayInputDependency | null;
|
|
354
|
+
export declare function buildOverlayEvidence(filePath: string, lineNumber?: number, snippet?: string, evidenceRole?: string): OverlayEvidenceItem;
|
|
355
|
+
/**
|
|
356
|
+
* Executes a single `ChompPlugin` against a repository and optionally persists
|
|
357
|
+
* its deterministic `EXTRACTED` overlays into `entity_overlays` with `runId` prune-on-recommit (`[PAT-DB-05]`).
|
|
358
|
+
*/
|
|
359
|
+
export declare function runChompPlugin(pluginOrName: ChompPlugin | string, options: RunChompPluginOptions): Promise<RunChompPluginResult>;
|
|
360
|
+
/**
|
|
361
|
+
* Runs all registered Chomp plugins (plus any repo-local `.chomp/plugins/<custom>/plugin.mjs` drop-ins)
|
|
362
|
+
* sequentially against `options.repoPath`.
|
|
363
|
+
*/
|
|
364
|
+
export declare function runAllChompPlugins(options: RunAllChompPluginsOptions): Promise<RunChompPluginResult[]>;
|