@b-apm/core 0.1.0
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/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/index.d.mts +4048 -0
- package/dist/index.mjs +14330 -0
- package/package.json +83 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,4048 @@
|
|
|
1
|
+
import { IntegrationRegistry, MarketplaceOutputRegistry, MaterializeReport, McpServerConfig } from "@b-apm/integration-api";
|
|
2
|
+
//#region src/modules/Manifest/errors.d.ts
|
|
3
|
+
/** Typed diagnostics for manifest discovery / YAML load / validate. */
|
|
4
|
+
type ManifestErrorCode = "MANIFEST_NOT_FOUND" | "MANIFEST_DUAL_CONFLICT" | "MANIFEST_MISSING_FILE" | "MANIFEST_YAML_PARSE" | "MANIFEST_YAML_SAFE_SUBSET" | "MANIFEST_VALIDATION";
|
|
5
|
+
declare class ManifestError extends Error {
|
|
6
|
+
readonly code: ManifestErrorCode;
|
|
7
|
+
readonly path?: string;
|
|
8
|
+
readonly details?: Record<string, unknown>;
|
|
9
|
+
constructor(code: ManifestErrorCode, message: string, options?: {
|
|
10
|
+
path?: string;
|
|
11
|
+
details?: Record<string, unknown>;
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
type ManifestWarning = {
|
|
16
|
+
code: string;
|
|
17
|
+
message: string;
|
|
18
|
+
path?: string;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/modules/Manifest/types.d.ts
|
|
22
|
+
/** Declared agentic dependency (APM package, skill path, plugin, MCP server, …). */
|
|
23
|
+
type BapmDependency = {
|
|
24
|
+
/** Spec string, e.g. `org/repo`, `org/repo/path`, `org/repo#v1.0.0`. */
|
|
25
|
+
spec: string;
|
|
26
|
+
kind?: "apm" | "mcp" | "skill" | "plugin" | "primitive";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Object-form APM dependency. Source discriminators `git` | `id` | `path` |
|
|
30
|
+
* `registry` | `marketplace` | `local` are mutually exclusive, except `path` may
|
|
31
|
+
* accompany `git` as a virtual_path companion (`git: parent` requires `path`).
|
|
32
|
+
* `local` is a bapm extension (default `.agents/local`); it MUST NOT replace the
|
|
33
|
+
* git virtual_path companion role.
|
|
34
|
+
*/
|
|
35
|
+
type ObjectDependency = {
|
|
36
|
+
git?: string;
|
|
37
|
+
id?: string;
|
|
38
|
+
path?: string;
|
|
39
|
+
registry?: string;
|
|
40
|
+
/** Marketplace alias for `{ name, marketplace, version? }` form. */
|
|
41
|
+
marketplace?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Bapm-only local source: `true` | `null` | `""` → default `.agents/local`;
|
|
44
|
+
* non-empty string → custom path. Rejected: `false` and non-scalars.
|
|
45
|
+
*/
|
|
46
|
+
local?: boolean | string | null;
|
|
47
|
+
name?: string;
|
|
48
|
+
version?: string;
|
|
49
|
+
ref?: string;
|
|
50
|
+
alias?: string;
|
|
51
|
+
skills?: unknown;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
type DependencyEntry = string | ObjectDependency | BapmDependency;
|
|
55
|
+
/** Dependency list keys under `dependencies` / `devDependencies`. */
|
|
56
|
+
type DependencyLists = {
|
|
57
|
+
apm?: DependencyEntry[];
|
|
58
|
+
mcp?: unknown[];
|
|
59
|
+
lsp?: unknown[];
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
};
|
|
62
|
+
type RegistryEntry = {
|
|
63
|
+
url: string;
|
|
64
|
+
/** Allow remote `http://` registry URL (OpenAPM §4.2.3 / sc-006). */
|
|
65
|
+
insecure?: boolean;
|
|
66
|
+
/** Explicit hostnames that share this registry URL's credential host-class (sc-005). */
|
|
67
|
+
aliases?: string[];
|
|
68
|
+
[key: string]: unknown;
|
|
69
|
+
};
|
|
70
|
+
type ManifestFilename = "apm.yml" | "bapm.yml";
|
|
71
|
+
/**
|
|
72
|
+
* Bapm-extension host id → npm integration package specifier map
|
|
73
|
+
* (`target` / `targets` object form). Keys are mf-005 tokens; values are
|
|
74
|
+
* opaque non-empty package strings (not loaded by install in this slice).
|
|
75
|
+
*/
|
|
76
|
+
type TargetIntegrationMap = Record<string, string>;
|
|
77
|
+
/**
|
|
78
|
+
* In-memory project manifest. Known fields are typed; unknown top-level and
|
|
79
|
+
* `x-*` keys are retained on the same object for a future rewrite path.
|
|
80
|
+
*/
|
|
81
|
+
type BapmManifest = {
|
|
82
|
+
name: string;
|
|
83
|
+
version: string;
|
|
84
|
+
dependencies?: DependencyLists;
|
|
85
|
+
devDependencies?: DependencyLists;
|
|
86
|
+
registries?: Record<string, RegistryEntry | string>;
|
|
87
|
+
default_host?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Host preference: legacy single id string, or object-map host→package
|
|
90
|
+
* (mutually exclusive with `targets`). Vendor ids `x-<vendor>-<name>` allowed.
|
|
91
|
+
*/
|
|
92
|
+
target?: string | TargetIntegrationMap;
|
|
93
|
+
/**
|
|
94
|
+
* Host preferences: legacy string array, or object-map host→package
|
|
95
|
+
* (mutually exclusive with `target`). Prefer this field for multi-host maps.
|
|
96
|
+
*/
|
|
97
|
+
targets?: string[] | TargetIntegrationMap;
|
|
98
|
+
/**
|
|
99
|
+
* Bapm extension: non-empty list of mf-005 host ids to activate for
|
|
100
|
+
* materialize/MCP (multi) or compile (sole). Distinct from `target`/`targets`.
|
|
101
|
+
*/
|
|
102
|
+
active?: string[];
|
|
103
|
+
/**
|
|
104
|
+
* Optional bake / placeholder defaults (string map). Deep-merged from
|
|
105
|
+
* `bapm.local.yml` when present (local keys win).
|
|
106
|
+
*/
|
|
107
|
+
env?: Record<string, string>;
|
|
108
|
+
[key: string]: unknown;
|
|
109
|
+
};
|
|
110
|
+
type DiscoverManifestOptions = {
|
|
111
|
+
/** Project root; defaults to `process.cwd()`. No parent walk-up. */
|
|
112
|
+
cwd?: string;
|
|
113
|
+
/** Explicit manifest path; wins over discovery. */
|
|
114
|
+
path?: string;
|
|
115
|
+
};
|
|
116
|
+
type DiscoveredManifest = {
|
|
117
|
+
path: string;
|
|
118
|
+
/** Basename of the loaded file (`apm.yml` / `bapm.yml`, or explicit path basename). */
|
|
119
|
+
filename: string;
|
|
120
|
+
};
|
|
121
|
+
type LoadManifestOptions = DiscoverManifestOptions;
|
|
122
|
+
type LoadManifestResult = {
|
|
123
|
+
/** Validated document retaining unknown / `x-*` keys. */
|
|
124
|
+
document: BapmManifest;
|
|
125
|
+
sourcePath: string;
|
|
126
|
+
sourceFilename: string;
|
|
127
|
+
/** Absolute path to `bapm.local.yml` when an overlay was merged. */
|
|
128
|
+
localPath?: string;
|
|
129
|
+
warnings?: ManifestWarning[];
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/modules/Manifest/discover.d.ts
|
|
133
|
+
declare const APM_MANIFEST_FILE = "apm.yml";
|
|
134
|
+
declare const BAPM_MANIFEST_FILE = "bapm.yml";
|
|
135
|
+
/**
|
|
136
|
+
* Resolve which manifest file to load.
|
|
137
|
+
* Explicit `path` wins; otherwise exactly one of apm.yml / bapm.yml at cwd.
|
|
138
|
+
* Does not walk parent directories.
|
|
139
|
+
*/
|
|
140
|
+
declare function discoverManifestPath(options?: DiscoverManifestOptions): DiscoveredManifest;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/modules/Manifest/load.d.ts
|
|
143
|
+
/**
|
|
144
|
+
* Discover → read base dual-read file → safe YAML → validate.
|
|
145
|
+
* Does **not** merge `bapm.local.yml` (use `loadEffectiveManifest` / `loadManifest` for that).
|
|
146
|
+
* Suitable for publish/pack wire identity serialization.
|
|
147
|
+
*/
|
|
148
|
+
declare function loadBaseManifest(options?: LoadManifestOptions): LoadManifestResult;
|
|
149
|
+
/**
|
|
150
|
+
* Load validated base dual-read manifest, then optionally merge `bapm.local.yml`.
|
|
151
|
+
* Precedence for settings: CLI flags (call-site) → local overlay → base → env overrides.
|
|
152
|
+
*/
|
|
153
|
+
declare function loadEffectiveManifest(options?: LoadManifestOptions): LoadManifestResult;
|
|
154
|
+
/**
|
|
155
|
+
* Discover → read file → safe YAML → validate → merge optional personal overlay.
|
|
156
|
+
* Does not resolve, lock, download, or install.
|
|
157
|
+
*/
|
|
158
|
+
declare function loadManifest(options?: LoadManifestOptions): LoadManifestResult;
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/modules/Manifest/localOverlay.d.ts
|
|
161
|
+
declare const BAPM_LOCAL_MANIFEST_FILE = "bapm.local.yml";
|
|
162
|
+
/** Unsupported dual-brand local overlay filename (v1 refuse). */
|
|
163
|
+
declare const APM_LOCAL_MANIFEST_FILE = "apm.local.yml";
|
|
164
|
+
type LocalOverlayFields = {
|
|
165
|
+
active?: string[];
|
|
166
|
+
target?: string | TargetIntegrationMap;
|
|
167
|
+
targets?: string[] | TargetIntegrationMap;
|
|
168
|
+
env?: Record<string, string>;
|
|
169
|
+
registries?: Record<string, RegistryEntry | string>;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Validate overlay YAML: mapping + allowlist + field shapes (via stub parse).
|
|
173
|
+
*/
|
|
174
|
+
declare function parseLocalOverlayDocument(input: unknown, sourcePath?: string): LocalOverlayFields;
|
|
175
|
+
/**
|
|
176
|
+
* Merge allowlisted local fields over a validated base document, then re-validate.
|
|
177
|
+
*/
|
|
178
|
+
declare function mergeLocalOverlay(base: BapmManifest, overlay: LocalOverlayFields): BapmManifest;
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/modules/Manifest/parse.d.ts
|
|
181
|
+
type ParseManifestResult = {
|
|
182
|
+
document: BapmManifest;
|
|
183
|
+
warnings: ManifestWarning[];
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Validate top-level (or overlay) `env` as string→string with env-safe keys.
|
|
187
|
+
* Empty string values are allowed (shape); bake still requires non-empty at lookup.
|
|
188
|
+
*/
|
|
189
|
+
declare function validateManifestEnv(value: unknown, pathPrefix?: string): Record<string, string>;
|
|
190
|
+
/**
|
|
191
|
+
* Validate a pre-parsed JS value as an OpenAPM/APM project manifest.
|
|
192
|
+
* Retains unknown top-level and `x-*` keys on the returned document.
|
|
193
|
+
*/
|
|
194
|
+
declare function parseManifestDocument(input: unknown): ParseManifestResult;
|
|
195
|
+
/** Back-compat entry for already-loaded JS objects. */
|
|
196
|
+
declare function parseManifest(input: unknown): BapmManifest;
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/modules/Manifest/yaml-load.d.ts
|
|
199
|
+
/**
|
|
200
|
+
* Public YAML loader for Manifest consumers.
|
|
201
|
+
* Wraps common safe-subset loader and maps YamlError → ManifestError.
|
|
202
|
+
*/
|
|
203
|
+
declare function loadYamlDocument(source: string, sourcePath?: string): unknown;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/modules/Manifest/write.d.ts
|
|
206
|
+
type WriteManifestOptions = {
|
|
207
|
+
cwd?: string;
|
|
208
|
+
/** Explicit destination path (overrides write-back / discovery). */
|
|
209
|
+
path?: string;
|
|
210
|
+
/** Loaded filename for same-brand write-back. */
|
|
211
|
+
sourceFilename?: string;
|
|
212
|
+
/** Absolute path that was loaded; preferred write-back target. */
|
|
213
|
+
sourcePath?: string;
|
|
214
|
+
};
|
|
215
|
+
type WriteProducerManifestOptions = WriteManifestOptions & {
|
|
216
|
+
/** Optional sink for non-blocking warnings (e.g. mf-004). */
|
|
217
|
+
onWarning?: (warning: ManifestWarning) => void;
|
|
218
|
+
};
|
|
219
|
+
type WriteProducerManifestResult = {
|
|
220
|
+
path: string;
|
|
221
|
+
warnings: ManifestWarning[];
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Serialize a manifest document to YAML (round-trip best-effort).
|
|
225
|
+
*/
|
|
226
|
+
declare function serializeManifest(document: BapmManifest | Record<string, unknown>): string;
|
|
227
|
+
/**
|
|
228
|
+
* Write manifest YAML back to the discovered dual-read path (or explicit path).
|
|
229
|
+
* Does not validate — prefer {@link writeProducerManifest} for producer emit.
|
|
230
|
+
*/
|
|
231
|
+
declare function writeManifest(document: BapmManifest | Record<string, unknown>, options?: WriteManifestOptions): string;
|
|
232
|
+
/**
|
|
233
|
+
* Producer write path: parse/validate before durable emit (mf-*).
|
|
234
|
+
* Preserves vendor `x-*` keys; mf-004 non-semver is a non-blocking warning.
|
|
235
|
+
*/
|
|
236
|
+
declare function writeProducerManifest(document: BapmManifest | Record<string, unknown>, options?: WriteProducerManifestOptions): WriteProducerManifestResult;
|
|
237
|
+
/** Aliases for acceptance / design naming flexibility. */
|
|
238
|
+
declare const emitManifest: typeof writeProducerManifest;
|
|
239
|
+
declare const writeManifestValidated: typeof writeProducerManifest;
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/modules/Manifest/createMinimal.d.ts
|
|
242
|
+
type CreateMinimalManifestOptions = {
|
|
243
|
+
/** Package / project name (required, non-empty). */
|
|
244
|
+
name: string;
|
|
245
|
+
/** Semver-shaped version; defaults to `0.1.0`. */
|
|
246
|
+
version?: string;
|
|
247
|
+
/** Single host target (mutually exclusive with `targets`). */
|
|
248
|
+
target?: string;
|
|
249
|
+
/** Multi host targets or object-map (mutually exclusive with `target`). */
|
|
250
|
+
targets?: string[] | TargetIntegrationMap;
|
|
251
|
+
/** Optional active host ids for materialize/compile selection. */
|
|
252
|
+
active?: string[];
|
|
253
|
+
description?: string;
|
|
254
|
+
author?: string;
|
|
255
|
+
/**
|
|
256
|
+
* When true, emit plugin-mode scaffold fields:
|
|
257
|
+
* `devDependencies.apm`, `includes: auto`, `scripts: {}`.
|
|
258
|
+
* Consumer / default path remains unchanged when omitted/false.
|
|
259
|
+
*/
|
|
260
|
+
pluginMode?: boolean;
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Build a minimal conforming producer manifest (mf-001..003, mf-021).
|
|
264
|
+
* Never includes top-level `workspaces`.
|
|
265
|
+
*/
|
|
266
|
+
declare function createMinimalManifest(options: CreateMinimalManifestOptions): BapmManifest;
|
|
267
|
+
/** Alias accepted by acceptance helpers. */
|
|
268
|
+
declare const createMinimalManifestDocument: typeof createMinimalManifest;
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/modules/Manifest/pluginNames.d.ts
|
|
271
|
+
/**
|
|
272
|
+
* Validate a kebab-case plugin name (`^[a-z][a-z0-9-]{0,63}$`).
|
|
273
|
+
* Returns `{ ok: true }` or `{ ok: false, message }`.
|
|
274
|
+
*/
|
|
275
|
+
declare function validatePluginName(name: string): {
|
|
276
|
+
ok: true;
|
|
277
|
+
} | {
|
|
278
|
+
ok: false;
|
|
279
|
+
message: string;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Path-safe project / subdirectory name for plugin init.
|
|
283
|
+
* Rejects empty, path separators (`/`, `\`), and `..` segments.
|
|
284
|
+
*/
|
|
285
|
+
declare function validateProjectName(name: string): {
|
|
286
|
+
ok: true;
|
|
287
|
+
} | {
|
|
288
|
+
ok: false;
|
|
289
|
+
message: string;
|
|
290
|
+
};
|
|
291
|
+
/** Boolean alias for callers that prefer a simple predicate. */
|
|
292
|
+
declare function isValidPluginName(name: string): boolean;
|
|
293
|
+
/** Boolean alias for callers that prefer a simple predicate. */
|
|
294
|
+
declare function isValidProjectName(name: string): boolean;
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/modules/Manifest/pluginJson.d.ts
|
|
297
|
+
type PluginJsonAuthor = {
|
|
298
|
+
name: string;
|
|
299
|
+
};
|
|
300
|
+
type CreatePluginJsonOptions = {
|
|
301
|
+
name: string;
|
|
302
|
+
version?: string;
|
|
303
|
+
description?: string;
|
|
304
|
+
author?: PluginJsonAuthor;
|
|
305
|
+
license?: string;
|
|
306
|
+
};
|
|
307
|
+
type PluginJsonDocument = {
|
|
308
|
+
name: string;
|
|
309
|
+
version: string;
|
|
310
|
+
description: string;
|
|
311
|
+
author: PluginJsonAuthor;
|
|
312
|
+
license: string;
|
|
313
|
+
};
|
|
314
|
+
type WritePluginJsonOptions = CreatePluginJsonOptions & {
|
|
315
|
+
cwd?: string;
|
|
316
|
+
/** Explicit destination path (defaults to `<cwd>/plugin.json`). */
|
|
317
|
+
path?: string;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Build an in-memory `plugin.json` document (APM-shaped thin scaffold).
|
|
321
|
+
*/
|
|
322
|
+
declare function createPluginJson(options: CreatePluginJsonOptions): PluginJsonDocument;
|
|
323
|
+
/** Alias accepted by acceptance helpers. */
|
|
324
|
+
declare const createPluginJsonDocument: typeof createPluginJson;
|
|
325
|
+
declare const buildPluginJson: typeof createPluginJson;
|
|
326
|
+
/**
|
|
327
|
+
* Serialize `plugin.json` with indent width 2 and a trailing newline.
|
|
328
|
+
*/
|
|
329
|
+
declare function serializePluginJson(document: PluginJsonDocument | Record<string, unknown>): string;
|
|
330
|
+
/**
|
|
331
|
+
* Write `plugin.json` to disk (indent 2 + trailing newline). Offline only.
|
|
332
|
+
*/
|
|
333
|
+
declare function writePluginJson(options: WritePluginJsonOptions): string;
|
|
334
|
+
/** Aliases for acceptance naming flexibility. */
|
|
335
|
+
declare const writePluginJsonFile: typeof writePluginJson;
|
|
336
|
+
declare const emitPluginJson: typeof writePluginJson;
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/modules/Manifest/targets.d.ts
|
|
339
|
+
/**
|
|
340
|
+
* OpenAPM mf-005 target / targets token validation.
|
|
341
|
+
* Canonical set + legacy aliases from OpenAPM v0.1 §4.2.1.
|
|
342
|
+
*/
|
|
343
|
+
/** Canonical host ids registered by OpenAPM v0.1. */
|
|
344
|
+
declare const CANONICAL_TARGET_TOKENS: Set<string>;
|
|
345
|
+
/** Legacy aliases accepted on input (normalised by writers elsewhere). */
|
|
346
|
+
declare const TARGET_ALIAS_TOKENS: Set<string>;
|
|
347
|
+
/** Vendor extension: `x-<vendor>-<name>` (OpenAPM req-mf-005). */
|
|
348
|
+
declare const VENDOR_TARGET_RE: RegExp;
|
|
349
|
+
declare function isValidTargetToken(token: string): boolean;
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/modules/Manifest/registryUrl.d.ts
|
|
352
|
+
/**
|
|
353
|
+
* Registry URL http gate helpers (OpenAPM §4.2.3 / sc-006).
|
|
354
|
+
*/
|
|
355
|
+
/** Loopback, localhost, ::1, and RFC1918 private hosts — http allowed without insecure. */
|
|
356
|
+
declare function isExemptInsecureHost(hostname: string): boolean;
|
|
357
|
+
//#endregion
|
|
358
|
+
//#region src/modules/Lockfile/types.d.ts
|
|
359
|
+
/** Declared lock dependency entry (OpenAPM §5 / APM LockedDependency wire). */
|
|
360
|
+
type LockedDependency = {
|
|
361
|
+
repo_url: string;
|
|
362
|
+
materialization_repo_url?: string;
|
|
363
|
+
name?: string;
|
|
364
|
+
version?: string;
|
|
365
|
+
source?: string;
|
|
366
|
+
resolved_commit?: string;
|
|
367
|
+
/** Pin identity used for resolve / outdated tip (branch, tag, SHA, or HEAD). */
|
|
368
|
+
resolved_ref?: string;
|
|
369
|
+
resolved_url?: string;
|
|
370
|
+
resolved_hash?: string;
|
|
371
|
+
virtual_path?: string;
|
|
372
|
+
constraint?: string;
|
|
373
|
+
resolved_tag?: string;
|
|
374
|
+
resolved_at?: string;
|
|
375
|
+
tree_sha256?: string;
|
|
376
|
+
deployed_files?: string[];
|
|
377
|
+
deployed_file_hashes?: Record<string, string>;
|
|
378
|
+
[key: string]: unknown;
|
|
379
|
+
};
|
|
380
|
+
/**
|
|
381
|
+
* In-memory lockfile document. Known fields are typed; unknown top-level and
|
|
382
|
+
* `x-*` keys (incl. deployments / lsp_* / MCP lists) are retained for round-trip.
|
|
383
|
+
*/
|
|
384
|
+
type LockfileDocument = {
|
|
385
|
+
lockfile_version: "1" | "2";
|
|
386
|
+
dependencies: LockedDependency[];
|
|
387
|
+
generated_at?: string;
|
|
388
|
+
apm_version?: string | number;
|
|
389
|
+
local_deployed_files?: string[];
|
|
390
|
+
local_deployed_file_hashes?: Record<string, string>;
|
|
391
|
+
[key: string]: unknown;
|
|
392
|
+
};
|
|
393
|
+
type LockFilename = string;
|
|
394
|
+
/**
|
|
395
|
+
* Loose document bag accepted by serialize/write/equivalence (acceptance helpers
|
|
396
|
+
* extract via `lockOf()` as `Record<string, unknown>`).
|
|
397
|
+
*/
|
|
398
|
+
type LockfileInput = LockfileDocument | Record<string, unknown>;
|
|
399
|
+
type DiscoverLockfileOptions = {
|
|
400
|
+
/** Project root; defaults to `process.cwd()`. No parent walk-up. */
|
|
401
|
+
cwd?: string;
|
|
402
|
+
/** Explicit lockfile path; wins over discovery. */
|
|
403
|
+
path?: string;
|
|
404
|
+
};
|
|
405
|
+
type DiscoveredLockfile = {
|
|
406
|
+
path: string;
|
|
407
|
+
/** Basename of the resolved file (`apm.lock.yaml` / `bapm.lock.yaml`, or explicit). */
|
|
408
|
+
filename: string;
|
|
409
|
+
};
|
|
410
|
+
type LoadLockfileOptions = DiscoverLockfileOptions;
|
|
411
|
+
type LoadLockfileResult = {
|
|
412
|
+
/** Validated document retaining unknown / `x-*` keys. */
|
|
413
|
+
document: LockfileDocument;
|
|
414
|
+
sourcePath: string;
|
|
415
|
+
sourceFilename: string;
|
|
416
|
+
};
|
|
417
|
+
type WriteLockfileOptions = {
|
|
418
|
+
cwd?: string;
|
|
419
|
+
/** Explicit destination path (overrides write-back / fresh default). */
|
|
420
|
+
path?: string;
|
|
421
|
+
/** Loaded filename for same-brand write-back. */
|
|
422
|
+
sourceFilename?: string;
|
|
423
|
+
/** Absolute path that was loaded; preferred write-back target. */
|
|
424
|
+
sourcePath?: string;
|
|
425
|
+
};
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/modules/Lockfile/errors.d.ts
|
|
428
|
+
/** Typed diagnostics for lockfile discovery / YAML load / validate / write. */
|
|
429
|
+
type LockfileErrorCode = "LOCKFILE_NOT_FOUND" | "LOCKFILE_DUAL_CONFLICT" | "LOCKFILE_MISSING_FILE" | "LOCKFILE_YAML_PARSE" | "LOCKFILE_YAML_SAFE_SUBSET" | "LOCKFILE_FORMAT" | "LOCKFILE_UNSUPPORTED_VERSION" | "LOCKFILE_VALIDATION";
|
|
430
|
+
declare class LockfileError extends Error {
|
|
431
|
+
readonly code: LockfileErrorCode;
|
|
432
|
+
readonly path?: string;
|
|
433
|
+
readonly details?: Record<string, unknown>;
|
|
434
|
+
constructor(code: LockfileErrorCode, message: string, options?: {
|
|
435
|
+
path?: string;
|
|
436
|
+
details?: Record<string, unknown>;
|
|
437
|
+
cause?: unknown;
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/modules/Lockfile/discover.d.ts
|
|
442
|
+
declare const APM_LOCK_FILE = "apm.lock.yaml";
|
|
443
|
+
declare const BAPM_LOCK_FILE = "bapm.lock.yaml";
|
|
444
|
+
/**
|
|
445
|
+
* Resolve which lockfile to load.
|
|
446
|
+
* Explicit `path` wins; otherwise exactly one of apm.lock.yaml / bapm.lock.yaml at cwd.
|
|
447
|
+
* Does not walk parent directories. Ignores legacy `apm.lock`.
|
|
448
|
+
*/
|
|
449
|
+
declare function discoverLockfilePath(options?: DiscoverLockfileOptions): DiscoveredLockfile;
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/modules/Lockfile/load.d.ts
|
|
452
|
+
/**
|
|
453
|
+
* Discover → read file → safe YAML → validate.
|
|
454
|
+
* Does not resolve, download, or install.
|
|
455
|
+
*/
|
|
456
|
+
declare function loadLockfile(options?: LoadLockfileOptions): LoadLockfileResult;
|
|
457
|
+
/**
|
|
458
|
+
* Like `loadLockfile`, but returns `null` when neither brand file exists.
|
|
459
|
+
* Dual-conflict and corrupt/invalid files still throw.
|
|
460
|
+
*/
|
|
461
|
+
declare function loadLockfileOrNull(options?: LoadLockfileOptions): LoadLockfileResult | null;
|
|
462
|
+
/**
|
|
463
|
+
* Write lockfile YAML to disk.
|
|
464
|
+
* - Explicit `path` wins
|
|
465
|
+
* - Else write-back to `sourcePath` / `sourceFilename` when provided
|
|
466
|
+
* - Else fresh create → `bapm.lock.yaml` under `cwd`
|
|
467
|
+
*/
|
|
468
|
+
declare function writeLockfile(document: LockfileInput, options?: WriteLockfileOptions): string;
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/modules/Lockfile/parse.d.ts
|
|
471
|
+
/**
|
|
472
|
+
* Validate a pre-parsed JS value as an OpenAPM/APM lockfile document.
|
|
473
|
+
* Retains unknown top-level and per-entry keys (incl. `x-*`).
|
|
474
|
+
*/
|
|
475
|
+
declare function parseLockfileDocument(input: unknown): LockfileDocument;
|
|
476
|
+
/**
|
|
477
|
+
* Parse lockfile YAML text or an already-loaded JS value into a validated document.
|
|
478
|
+
*/
|
|
479
|
+
declare function parseLockfile(input: string | object | null): LockfileDocument;
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/modules/Lockfile/serialize.d.ts
|
|
482
|
+
/**
|
|
483
|
+
* Serialize a lockfile document to YAML.
|
|
484
|
+
* - Always emits explicit `lockfile_version`
|
|
485
|
+
* - Forces `"2"` when any `source: registry` or git-semver fields present
|
|
486
|
+
* - Never demotes a loaded `"2"` → `"1"` (OpenAPM req-lk-002 monotonic)
|
|
487
|
+
* - Sorts dependencies by `(repo_url, virtual_path)`
|
|
488
|
+
* - Omits unset/null placeholders; preserves unknown / `x-*` bags
|
|
489
|
+
*/
|
|
490
|
+
declare function serializeLockfile(document: LockfileInput): string;
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/modules/Lockfile/equivalence.d.ts
|
|
493
|
+
/**
|
|
494
|
+
* Semantic equivalence ignoring `generated_at` / `apm_version` (req-lk-005).
|
|
495
|
+
*/
|
|
496
|
+
declare function isSemanticallyEquivalent(a: LockfileInput, b: LockfileInput): boolean;
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/modules/Lockfile/treeSha256.d.ts
|
|
499
|
+
type TreeSha256Violation = {
|
|
500
|
+
entry: string;
|
|
501
|
+
kind: "missing_field" | "missing_tree" | "mismatch";
|
|
502
|
+
expected?: string;
|
|
503
|
+
observed?: string;
|
|
504
|
+
message: string;
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Compute OpenAPM canonical tree hash for a package root on disk.
|
|
508
|
+
* Returns envelope `sha256:<lowercase-hex>`.
|
|
509
|
+
*/
|
|
510
|
+
declare function computeCanonicalTreeSha256(rootDir: string): string;
|
|
511
|
+
/** Compare two hash envelopes / bare hex for equality. */
|
|
512
|
+
declare function treeSha256Equal(a: string, b: string): boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Format a violation message naming entry + expected/observed envelopes.
|
|
515
|
+
*/
|
|
516
|
+
declare function formatTreeSha256Violation(v: Omit<TreeSha256Violation, "message"> & {
|
|
517
|
+
message?: string;
|
|
518
|
+
}): TreeSha256Violation;
|
|
519
|
+
/** Git-sourced lock entry (not local-path / registry). */
|
|
520
|
+
declare function isGitSourcedLockEntry(dep: LockedDependency): boolean;
|
|
521
|
+
/**
|
|
522
|
+
* Locate materialized git package tree under `apm_modules` for a lock entry.
|
|
523
|
+
*/
|
|
524
|
+
declare function locateGitPackageTree(cwd: string, dep: LockedDependency): string | undefined;
|
|
525
|
+
/**
|
|
526
|
+
* Collect tree_sha256 violations for git-sourced lock entries (audit / frozen).
|
|
527
|
+
* Fail-closed: missing field, missing on-disk tree, or hash mismatch.
|
|
528
|
+
*/
|
|
529
|
+
declare function collectTreeSha256Violations(args: {
|
|
530
|
+
cwd: string;
|
|
531
|
+
document: LockfileDocument;
|
|
532
|
+
}): TreeSha256Violation[];
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region src/modules/Resolver/constants.d.ts
|
|
535
|
+
/** Default modules cache directory (APM wire parity). */
|
|
536
|
+
declare const APM_MODULES_DIR = "apm_modules";
|
|
537
|
+
/** OpenAPM / APM default max resolve depth (req-rs-006). */
|
|
538
|
+
declare const MAX_RESOLVE_DEPTH = 50;
|
|
539
|
+
/** Default parallel download concurrency (APM `--parallel-downloads` default). */
|
|
540
|
+
declare const DEFAULT_PARALLEL_DOWNLOADS = 4;
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/modules/Resolver/errors.d.ts
|
|
543
|
+
type ResolverErrorCode = "RESOLVE_NEST_REFUSED" | "RESOLVE_DEPTH_EXCEEDED" | "RESOLVE_CYCLE" | "RESOLVE_EMPTY_INTERSECTION" | "RESOLVE_REGISTRY_DEFERRED" | "RESOLVE_NO_MATCHING_TAG" | "RESOLVE_FAILED" | "LOCAL_PATH_ESCAPES_PROJECT_ROOT" | "LOCAL_ROOT_TRACKED" | "DOWNLOAD_FAILED" | "CLASSIFY_INVALID";
|
|
544
|
+
declare class ResolverError extends Error {
|
|
545
|
+
readonly code: ResolverErrorCode;
|
|
546
|
+
readonly details?: Record<string, unknown>;
|
|
547
|
+
constructor(code: ResolverErrorCode, message: string, options?: {
|
|
548
|
+
details?: Record<string, unknown>;
|
|
549
|
+
cause?: unknown;
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region src/modules/Resolver/types.d.ts
|
|
554
|
+
/**
|
|
555
|
+
* Injectable ports for git remote / tag listing / download (fake-friendly for tests).
|
|
556
|
+
*/
|
|
557
|
+
type FakeTag = {
|
|
558
|
+
tag: string;
|
|
559
|
+
commit: string;
|
|
560
|
+
/**
|
|
561
|
+
* Positive annotated peel evidence (`refs/tags/…^{}` or injectable stub).
|
|
562
|
+
* Missing/false = lightweight / unknown — revision-pin path fail-closes.
|
|
563
|
+
*/
|
|
564
|
+
annotated?: boolean;
|
|
565
|
+
};
|
|
566
|
+
type TagLister = {
|
|
567
|
+
listTags(repoUrl: string): Promise<FakeTag[]>;
|
|
568
|
+
};
|
|
569
|
+
type GitRemote = {
|
|
570
|
+
/** Resolve a literal ref (branch/tag/commit) to a 40-hex commit. */
|
|
571
|
+
resolveRef(repoUrl: string, ref: string): Promise<string>;
|
|
572
|
+
};
|
|
573
|
+
type DownloadArgs = {
|
|
574
|
+
repoUrl?: string;
|
|
575
|
+
path?: string;
|
|
576
|
+
commit?: string;
|
|
577
|
+
dest: string;
|
|
578
|
+
identity?: string;
|
|
579
|
+
};
|
|
580
|
+
type Downloader = {
|
|
581
|
+
download(args: DownloadArgs): Promise<void>;
|
|
582
|
+
};
|
|
583
|
+
type DependencyKind = "local" | "registry" | "git-semver" | "git-literal" | "marketplace";
|
|
584
|
+
type ClassifiedDependency = {
|
|
585
|
+
kind: DependencyKind;
|
|
586
|
+
/** Original raw input preserved for diagnostics. */
|
|
587
|
+
raw: unknown;
|
|
588
|
+
path?: string;
|
|
589
|
+
git?: string;
|
|
590
|
+
ref?: string;
|
|
591
|
+
id?: string;
|
|
592
|
+
registry?: string;
|
|
593
|
+
alias?: string;
|
|
594
|
+
/** Manifest-level prerelease opt-in for git-semver. */
|
|
595
|
+
prerelease?: boolean;
|
|
596
|
+
/** Marketplace object/string form fields. */
|
|
597
|
+
pluginName?: string;
|
|
598
|
+
marketplaceName?: string;
|
|
599
|
+
versionSpec?: string;
|
|
600
|
+
};
|
|
601
|
+
type ResolvedNode = {
|
|
602
|
+
name: string;
|
|
603
|
+
identity: string;
|
|
604
|
+
kind: DependencyKind;
|
|
605
|
+
depth: number;
|
|
606
|
+
resolved_by: string;
|
|
607
|
+
/** Display / lock repo_url (host/path form without scheme when git). */
|
|
608
|
+
repo_url?: string;
|
|
609
|
+
path?: string;
|
|
610
|
+
resolved_commit?: string;
|
|
611
|
+
/** Pin identity for lock emit / outdated tip (literal ref or picked tag). */
|
|
612
|
+
resolved_ref?: string;
|
|
613
|
+
constraint?: string;
|
|
614
|
+
resolved_tag?: string;
|
|
615
|
+
resolved_at?: string;
|
|
616
|
+
version?: string;
|
|
617
|
+
/** Absolute path to materialized package tree (local source or modules cache). */
|
|
618
|
+
packageRoot?: string;
|
|
619
|
+
/** Artifact format is explicit; portable roots are never treated as apm.yml. */
|
|
620
|
+
artifactFormat?: "openapm" | "agent-plugin";
|
|
621
|
+
/** Registry lock fields (M10). */
|
|
622
|
+
source?: string;
|
|
623
|
+
resolved_url?: string;
|
|
624
|
+
resolved_hash?: string;
|
|
625
|
+
registry_base_url?: string;
|
|
626
|
+
registry_owner?: string;
|
|
627
|
+
registry_repo?: string;
|
|
628
|
+
/** Marketplace-origin provenance (concrete source retained). */
|
|
629
|
+
discovered_via?: string;
|
|
630
|
+
marketplace_plugin_name?: string;
|
|
631
|
+
source_url?: string;
|
|
632
|
+
source_digest?: string;
|
|
633
|
+
};
|
|
634
|
+
type ResolveGraphResult = {
|
|
635
|
+
nodes: ResolvedNode[];
|
|
636
|
+
/** Depth-1 visit order (declaration order among siblings). */
|
|
637
|
+
visitOrder: string[];
|
|
638
|
+
/**
|
|
639
|
+
* Lock-shaped dependency view (includes marketplace provenance).
|
|
640
|
+
* Convenience for callers / acceptance that inspect graph outcomes as lock rows.
|
|
641
|
+
*/
|
|
642
|
+
lockfile?: {
|
|
643
|
+
dependencies: Array<Record<string, unknown>>;
|
|
644
|
+
};
|
|
645
|
+
document?: {
|
|
646
|
+
dependencies: Array<Record<string, unknown>>;
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
type ResolvePorts = {
|
|
650
|
+
gitRemote?: GitRemote;
|
|
651
|
+
tagLister?: TagLister;
|
|
652
|
+
downloader?: Downloader;
|
|
653
|
+
};
|
|
654
|
+
type ResolveDependencyGraphOptions = ResolvePorts & {
|
|
655
|
+
cwd?: string;
|
|
656
|
+
updateRefs?: boolean;
|
|
657
|
+
/**
|
|
658
|
+
* When set with `updateRefs`, only these package names (+ their subtrees)
|
|
659
|
+
* re-resolve; other direct pins stay identical (OpenAPM rs-012).
|
|
660
|
+
* Empty / omitted with updateRefs → full update (rs-011).
|
|
661
|
+
*/
|
|
662
|
+
scope?: string[];
|
|
663
|
+
/** Alias for `scope` (CLI / update API). */
|
|
664
|
+
updatePackageNames?: string[];
|
|
665
|
+
maxDepth?: number;
|
|
666
|
+
/** When set, used for warm replay instead of loading from disk. */
|
|
667
|
+
existingLock?: {
|
|
668
|
+
dependencies?: Array<Record<string, unknown>>;
|
|
669
|
+
} | null;
|
|
670
|
+
/**
|
|
671
|
+
* Plan-only resolve: do not create `apm_modules` or download local path deps.
|
|
672
|
+
* Local packages are read from source paths. Git still materializes when needed
|
|
673
|
+
* to read child manifests (residual pl-002 gap for cold git trees).
|
|
674
|
+
*/
|
|
675
|
+
skipDownload?: boolean;
|
|
676
|
+
/** Alias for `skipDownload` (plan → gate → download). */
|
|
677
|
+
planOnly?: boolean;
|
|
678
|
+
/** Opt-in experimental registries (also via BAPM_EXPERIMENTAL_REGISTRIES=1). */
|
|
679
|
+
experimentalRegistries?: boolean;
|
|
680
|
+
/** Override registry base URL (tests). */
|
|
681
|
+
registryBaseUrl?: string;
|
|
682
|
+
/** Mirror base URL for rs-009 replay (tests / install). */
|
|
683
|
+
mirrorUrl?: string;
|
|
684
|
+
/** Override `~/.bapm` config root for marketplace registry/cache. */
|
|
685
|
+
marketplaceConfigDir?: string;
|
|
686
|
+
/** Alias for marketplaceConfigDir. */
|
|
687
|
+
configDir?: string;
|
|
688
|
+
};
|
|
689
|
+
type DownloadPackageSpec = {
|
|
690
|
+
repoUrl?: string;
|
|
691
|
+
path?: string;
|
|
692
|
+
commit?: string;
|
|
693
|
+
identity?: string;
|
|
694
|
+
name?: string;
|
|
695
|
+
};
|
|
696
|
+
type DownloadPackagesOptions = ResolvePorts & {
|
|
697
|
+
cwd?: string;
|
|
698
|
+
packages: DownloadPackageSpec[];
|
|
699
|
+
parallelDownloads?: number;
|
|
700
|
+
};
|
|
701
|
+
type ResolveAndLockOptions = ResolvePorts & {
|
|
702
|
+
cwd?: string;
|
|
703
|
+
updateRefs?: boolean;
|
|
704
|
+
/** Package scope for update (rs-012); see ResolveDependencyGraphOptions.scope. */
|
|
705
|
+
scope?: string[];
|
|
706
|
+
updatePackageNames?: string[];
|
|
707
|
+
/**
|
|
708
|
+
* When true (default on updateRefs), purge git-semver modules install paths
|
|
709
|
+
* for scoped/full update targets before re-download (lk-010).
|
|
710
|
+
*/
|
|
711
|
+
purgeInstallPaths?: boolean;
|
|
712
|
+
parallelDownloads?: number;
|
|
713
|
+
maxDepth?: number;
|
|
714
|
+
verbose?: boolean;
|
|
715
|
+
/** Explicit policy file path for install/lock gate. */
|
|
716
|
+
policyPath?: string;
|
|
717
|
+
/** Alias for `policyPath`. */
|
|
718
|
+
policy?: string;
|
|
719
|
+
/** Skip policy discovery + checks. */
|
|
720
|
+
noPolicy?: boolean;
|
|
721
|
+
/** Override ordered policy discovery providers. */
|
|
722
|
+
policyProviders?: string[];
|
|
723
|
+
providers?: string[];
|
|
724
|
+
listGitRemotes?: (cwd?: string) => Array<{
|
|
725
|
+
name: string;
|
|
726
|
+
url: string;
|
|
727
|
+
}>;
|
|
728
|
+
remotes?: Array<{
|
|
729
|
+
name: string;
|
|
730
|
+
url: string;
|
|
731
|
+
}>;
|
|
732
|
+
fetchPolicyUrl?: (url: string) => {
|
|
733
|
+
ok?: boolean;
|
|
734
|
+
text?: string;
|
|
735
|
+
body?: string;
|
|
736
|
+
status?: number;
|
|
737
|
+
url?: string;
|
|
738
|
+
};
|
|
739
|
+
httpGet?: (url: string) => {
|
|
740
|
+
ok?: boolean;
|
|
741
|
+
text?: string;
|
|
742
|
+
body?: string;
|
|
743
|
+
status?: number;
|
|
744
|
+
url?: string;
|
|
745
|
+
};
|
|
746
|
+
fetchAncestor?: (ref: string, context: {
|
|
747
|
+
leafHostClass: string;
|
|
748
|
+
chain: string[];
|
|
749
|
+
}) => unknown;
|
|
750
|
+
defaultFetchFailure?: "off" | "warn" | "block";
|
|
751
|
+
implementationDefaultHost?: string;
|
|
752
|
+
experimentalRegistries?: boolean;
|
|
753
|
+
registryBaseUrl?: string;
|
|
754
|
+
mirrorUrl?: string;
|
|
755
|
+
marketplaceConfigDir?: string;
|
|
756
|
+
configDir?: string;
|
|
757
|
+
};
|
|
758
|
+
type ResolveAndLockResult = {
|
|
759
|
+
document: Record<string, unknown>;
|
|
760
|
+
lockPath: string;
|
|
761
|
+
nodes: ResolvedNode[];
|
|
762
|
+
/** Policy gate diagnostics when policy applied (M8). */
|
|
763
|
+
policyDiagnostics?: unknown[];
|
|
764
|
+
};
|
|
765
|
+
//#endregion
|
|
766
|
+
//#region src/modules/Resolver/classify.d.ts
|
|
767
|
+
/**
|
|
768
|
+
* Classify a dependency declaration (OpenAPM kind precedence:
|
|
769
|
+
* local → registry → git-semver → git-literal; marketplace non-normative).
|
|
770
|
+
* Bapm `local` discriminator expands to the effective path before kind: local.
|
|
771
|
+
*/
|
|
772
|
+
declare function classifyDependencyRef(input: unknown): ClassifiedDependency;
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region src/modules/Resolver/resolveGraph.d.ts
|
|
775
|
+
/**
|
|
776
|
+
* BFS transitive resolve with OpenAPM intersection-pick diamonds (not APM first-wins).
|
|
777
|
+
*/
|
|
778
|
+
declare function resolveDependencyGraph(options?: ResolveDependencyGraphOptions): Promise<ResolveGraphResult>;
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/modules/Resolver/download.d.ts
|
|
781
|
+
/**
|
|
782
|
+
* Materialize packages into `<cwd>/apm_modules/` via Downloader port.
|
|
783
|
+
*/
|
|
784
|
+
declare function downloadPackages(options: DownloadPackagesOptions): Promise<string[]>;
|
|
785
|
+
//#endregion
|
|
786
|
+
//#region src/modules/Policy/errors.d.ts
|
|
787
|
+
/** Typed diagnostics for policy discovery / YAML load / validate / gate. */
|
|
788
|
+
type PolicyErrorCode = "POLICY_NOT_FOUND" | "POLICY_DUAL_CONFLICT" | "POLICY_MISSING_FILE" | "POLICY_YAML_PARSE" | "POLICY_YAML_SAFE_SUBSET" | "POLICY_VALIDATION" | "POLICY_VIOLATION" | "POLICY_EXTENDS_CYCLE" | "POLICY_EXTENDS_DEPTH" | "POLICY_EXTENDS_FETCH" | "POLICY_HOST_CLASS_PIN" | "POLICY_REMOTE_AMBIGUOUS" | "POLICY_FETCH_FAILURE";
|
|
789
|
+
declare class PolicyError extends Error {
|
|
790
|
+
readonly code: PolicyErrorCode;
|
|
791
|
+
readonly path?: string;
|
|
792
|
+
readonly details?: Record<string, unknown>;
|
|
793
|
+
constructor(code: PolicyErrorCode, message: string, options?: {
|
|
794
|
+
path?: string;
|
|
795
|
+
details?: Record<string, unknown>;
|
|
796
|
+
cause?: unknown;
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
type PolicyWarning = {
|
|
800
|
+
code: string;
|
|
801
|
+
message: string;
|
|
802
|
+
path?: string;
|
|
803
|
+
};
|
|
804
|
+
//#endregion
|
|
805
|
+
//#region src/modules/Policy/types.d.ts
|
|
806
|
+
type PolicyEnforcement = "off" | "warn" | "block";
|
|
807
|
+
type PolicyDependencies = {
|
|
808
|
+
/** Tri-state: omit/null → unset; [] → explicit empty; [...] → populated. */
|
|
809
|
+
allow?: string[] | null;
|
|
810
|
+
deny?: string[] | null;
|
|
811
|
+
require?: string[] | null;
|
|
812
|
+
max_depth?: number;
|
|
813
|
+
require_pinned_constraint?: boolean;
|
|
814
|
+
};
|
|
815
|
+
/** Org-policy executables floor (sc-011): deny_all + deny list only for claim. */
|
|
816
|
+
type PolicyExecutables = {
|
|
817
|
+
deny_all?: boolean;
|
|
818
|
+
deny?: string[];
|
|
819
|
+
};
|
|
820
|
+
type PolicyDocument = {
|
|
821
|
+
name: string;
|
|
822
|
+
enforcement: PolicyEnforcement;
|
|
823
|
+
fetch_failure: PolicyEnforcement;
|
|
824
|
+
dependencies?: PolicyDependencies;
|
|
825
|
+
executables?: PolicyExecutables;
|
|
826
|
+
/** Extension keys `x-*` and other retained top-level fields. */
|
|
827
|
+
[key: string]: unknown;
|
|
828
|
+
};
|
|
829
|
+
type DiscoverPolicyOptions = {
|
|
830
|
+
cwd?: string;
|
|
831
|
+
/** Explicit path wins over dual-read sibling search. */
|
|
832
|
+
path?: string;
|
|
833
|
+
};
|
|
834
|
+
type DiscoveredPolicy = {
|
|
835
|
+
path: string;
|
|
836
|
+
filename: string;
|
|
837
|
+
absent?: false;
|
|
838
|
+
found?: true;
|
|
839
|
+
} | {
|
|
840
|
+
absent: true;
|
|
841
|
+
found?: false;
|
|
842
|
+
path?: null;
|
|
843
|
+
};
|
|
844
|
+
type LoadPolicyOptions = {
|
|
845
|
+
cwd?: string;
|
|
846
|
+
path?: string;
|
|
847
|
+
};
|
|
848
|
+
type LoadPolicyResult = {
|
|
849
|
+
document: PolicyDocument;
|
|
850
|
+
policy?: PolicyDocument;
|
|
851
|
+
sourcePath: string;
|
|
852
|
+
sourceFilename: string;
|
|
853
|
+
warnings: PolicyWarning[];
|
|
854
|
+
};
|
|
855
|
+
type ParsePolicyResult = {
|
|
856
|
+
document: PolicyDocument;
|
|
857
|
+
policy?: PolicyDocument;
|
|
858
|
+
warnings: PolicyWarning[];
|
|
859
|
+
};
|
|
860
|
+
type PolicyCandidate = {
|
|
861
|
+
id?: string;
|
|
862
|
+
name?: string;
|
|
863
|
+
ref?: string;
|
|
864
|
+
constraint?: string;
|
|
865
|
+
depth?: number;
|
|
866
|
+
direct?: boolean;
|
|
867
|
+
kind?: string;
|
|
868
|
+
path?: string;
|
|
869
|
+
source?: string;
|
|
870
|
+
};
|
|
871
|
+
type PolicyDependencyInput = string | {
|
|
872
|
+
name?: string;
|
|
873
|
+
id?: string;
|
|
874
|
+
ref?: string;
|
|
875
|
+
constraint?: string;
|
|
876
|
+
direct?: boolean;
|
|
877
|
+
depth?: number;
|
|
878
|
+
path?: string;
|
|
879
|
+
source?: string;
|
|
880
|
+
};
|
|
881
|
+
type EvaluatePolicyOptions = {
|
|
882
|
+
policy: PolicyDocument;
|
|
883
|
+
candidates?: PolicyCandidate[];
|
|
884
|
+
dependencies?: PolicyDependencyInput[];
|
|
885
|
+
graphDepth?: number;
|
|
886
|
+
maxDepthObserved?: number;
|
|
887
|
+
};
|
|
888
|
+
type PolicyViolation = {
|
|
889
|
+
code: string;
|
|
890
|
+
message: string;
|
|
891
|
+
identity?: string;
|
|
892
|
+
rule?: string;
|
|
893
|
+
};
|
|
894
|
+
type EvaluatePolicyResult = {
|
|
895
|
+
ok: boolean;
|
|
896
|
+
blocking: boolean;
|
|
897
|
+
blocked?: boolean;
|
|
898
|
+
outcome: "off" | "warn" | "block" | "pass";
|
|
899
|
+
enforcementOutcome?: "off" | "warn" | "block" | "pass";
|
|
900
|
+
mode?: PolicyEnforcement;
|
|
901
|
+
violations: PolicyViolation[];
|
|
902
|
+
warnings: PolicyWarning[];
|
|
903
|
+
findings?: PolicyViolation[];
|
|
904
|
+
errors?: PolicyViolation[];
|
|
905
|
+
};
|
|
906
|
+
type PolicyGateOptions = {
|
|
907
|
+
cwd?: string;
|
|
908
|
+
/** Explicit policy file path (`--policy`). */
|
|
909
|
+
policyPath?: string;
|
|
910
|
+
/** Alias accepted by acceptance helpers. */
|
|
911
|
+
policy?: string;
|
|
912
|
+
/** Skip discovery + checks (`--no-policy`). */
|
|
913
|
+
noPolicy?: boolean;
|
|
914
|
+
candidates?: PolicyCandidate[];
|
|
915
|
+
dependencies?: PolicyDependencyInput[];
|
|
916
|
+
graphDepth?: number;
|
|
917
|
+
maxDepthObserved?: number;
|
|
918
|
+
};
|
|
919
|
+
type PolicyGateResult = {
|
|
920
|
+
skipped: boolean;
|
|
921
|
+
absent: boolean;
|
|
922
|
+
blocking: boolean;
|
|
923
|
+
result?: EvaluatePolicyResult;
|
|
924
|
+
document?: PolicyDocument;
|
|
925
|
+
sourcePath?: string;
|
|
926
|
+
diagnostics: unknown[];
|
|
927
|
+
};
|
|
928
|
+
//#endregion
|
|
929
|
+
//#region src/modules/Policy/remotes.d.ts
|
|
930
|
+
/**
|
|
931
|
+
* pl-012 project remote selection for policy discovery.
|
|
932
|
+
*/
|
|
933
|
+
type GitRemoteEntry = {
|
|
934
|
+
name: string;
|
|
935
|
+
url: string;
|
|
936
|
+
};
|
|
937
|
+
type SelectProjectRemoteOptions = {
|
|
938
|
+
cwd?: string;
|
|
939
|
+
/** Injected remotes (preferred when provided). */
|
|
940
|
+
remotes?: GitRemoteEntry[];
|
|
941
|
+
/** Injectable list reader (acceptance / tests). */
|
|
942
|
+
listGitRemotes?: (cwd?: string) => GitRemoteEntry[];
|
|
943
|
+
};
|
|
944
|
+
type SelectedProjectRemote = (GitRemoteEntry & {
|
|
945
|
+
remote?: GitRemoteEntry;
|
|
946
|
+
skipped?: false;
|
|
947
|
+
absent?: false;
|
|
948
|
+
}) | {
|
|
949
|
+
absent: true;
|
|
950
|
+
skipped: true;
|
|
951
|
+
remote?: null;
|
|
952
|
+
} | null;
|
|
953
|
+
/**
|
|
954
|
+
* Prefer `origin`; else single remote; else fail closed naming candidates; else skip.
|
|
955
|
+
*/
|
|
956
|
+
declare function selectProjectRemote(options?: SelectProjectRemoteOptions): SelectedProjectRemote;
|
|
957
|
+
/** Alias names accepted by acceptance helpers. */
|
|
958
|
+
declare const selectGitRemoteForPolicy: typeof selectProjectRemote;
|
|
959
|
+
declare const resolveProjectRemote: typeof selectProjectRemote;
|
|
960
|
+
/**
|
|
961
|
+
* Production git remote reader (`git remote -v`). Dedupes fetch URLs by name.
|
|
962
|
+
*/
|
|
963
|
+
declare function listGitRemotes(cwd?: string): GitRemoteEntry[];
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/modules/Policy/resolve.d.ts
|
|
966
|
+
/** Max ancestor hops from leaf (OpenAPM pl-003). */
|
|
967
|
+
declare const POLICY_EXTENDS_MAX_DEPTH = 5;
|
|
968
|
+
type FetchAncestorResult = {
|
|
969
|
+
document?: PolicyDocument | Record<string, unknown>;
|
|
970
|
+
policy?: PolicyDocument | Record<string, unknown>;
|
|
971
|
+
source?: string;
|
|
972
|
+
url?: string;
|
|
973
|
+
hostClass?: string;
|
|
974
|
+
path?: string;
|
|
975
|
+
text?: string;
|
|
976
|
+
};
|
|
977
|
+
type FetchAncestor = (ref: string, context: {
|
|
978
|
+
leafHostClass: string;
|
|
979
|
+
chain: string[];
|
|
980
|
+
}) => FetchAncestorResult | PolicyDocument | Record<string, unknown>;
|
|
981
|
+
type ResolvePolicyChainOptions = {
|
|
982
|
+
cwd?: string;
|
|
983
|
+
path?: string;
|
|
984
|
+
leafPath?: string;
|
|
985
|
+
/** Pre-loaded leaf YAML text. */
|
|
986
|
+
leafYaml?: string;
|
|
987
|
+
/** Pre-parsed leaf document. */
|
|
988
|
+
leaf?: PolicyDocument | Record<string, unknown>;
|
|
989
|
+
document?: PolicyDocument | Record<string, unknown>;
|
|
990
|
+
/** Pin class for the leaf (optional; derived from leafHostClass / remotes / local). */
|
|
991
|
+
leafHostClass?: string;
|
|
992
|
+
/** Injectable ancestor fetcher for owner/repo / URL refs. */
|
|
993
|
+
fetchAncestor?: FetchAncestor;
|
|
994
|
+
/** Optional HTTP helper used when fetchAncestor is absent. */
|
|
995
|
+
fetchPolicyUrl?: (url: string) => {
|
|
996
|
+
ok?: boolean;
|
|
997
|
+
text?: string;
|
|
998
|
+
body?: string;
|
|
999
|
+
status?: number;
|
|
1000
|
+
url?: string;
|
|
1001
|
+
};
|
|
1002
|
+
httpGet?: (url: string) => {
|
|
1003
|
+
ok?: boolean;
|
|
1004
|
+
text?: string;
|
|
1005
|
+
body?: string;
|
|
1006
|
+
status?: number;
|
|
1007
|
+
url?: string;
|
|
1008
|
+
};
|
|
1009
|
+
};
|
|
1010
|
+
type ResolvePolicyChainResult = {
|
|
1011
|
+
document: PolicyDocument;
|
|
1012
|
+
policy: PolicyDocument;
|
|
1013
|
+
effective: PolicyDocument;
|
|
1014
|
+
chain: string[];
|
|
1015
|
+
sourcePath?: string;
|
|
1016
|
+
warnings: unknown[];
|
|
1017
|
+
};
|
|
1018
|
+
/**
|
|
1019
|
+
* Resolve `extends:` into one effective policy document.
|
|
1020
|
+
*/
|
|
1021
|
+
declare function resolvePolicyChain(options?: ResolvePolicyChainOptions): ResolvePolicyChainResult;
|
|
1022
|
+
/** Alias names accepted by acceptance helpers. */
|
|
1023
|
+
declare const resolveExtends: typeof resolvePolicyChain;
|
|
1024
|
+
declare const resolvePolicyExtends: typeof resolvePolicyChain;
|
|
1025
|
+
declare const mergePolicyChain: typeof resolvePolicyChain;
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region src/modules/Policy/load.d.ts
|
|
1028
|
+
type LoadPolicyExtendedOptions = LoadPolicyOptions & {
|
|
1029
|
+
/** Skip extends resolve (leaf only). */
|
|
1030
|
+
skipExtends?: boolean;
|
|
1031
|
+
providers?: string[];
|
|
1032
|
+
policyProviders?: string[];
|
|
1033
|
+
listGitRemotes?: (cwd?: string) => GitRemoteEntry[];
|
|
1034
|
+
remotes?: GitRemoteEntry[];
|
|
1035
|
+
fetchAncestor?: FetchAncestor;
|
|
1036
|
+
fetchPolicyUrl?: (url: string) => {
|
|
1037
|
+
ok?: boolean;
|
|
1038
|
+
text?: string;
|
|
1039
|
+
body?: string;
|
|
1040
|
+
status?: number;
|
|
1041
|
+
url?: string;
|
|
1042
|
+
};
|
|
1043
|
+
httpGet?: (url: string) => {
|
|
1044
|
+
ok?: boolean;
|
|
1045
|
+
text?: string;
|
|
1046
|
+
body?: string;
|
|
1047
|
+
status?: number;
|
|
1048
|
+
url?: string;
|
|
1049
|
+
};
|
|
1050
|
+
defaultFetchFailure?: "off" | "warn" | "block";
|
|
1051
|
+
implementationDefaultHost?: string;
|
|
1052
|
+
leafHostClass?: string;
|
|
1053
|
+
};
|
|
1054
|
+
/**
|
|
1055
|
+
* Discover → read → parse → resolve extends → effective document.
|
|
1056
|
+
* Explicit missing path fails closed. Provider-based discovery when no path.
|
|
1057
|
+
*/
|
|
1058
|
+
declare function loadPolicy(options?: LoadPolicyExtendedOptions): LoadPolicyResult;
|
|
1059
|
+
//#endregion
|
|
1060
|
+
//#region src/modules/Policy/status.d.ts
|
|
1061
|
+
type PolicyStatusOutcome = "found" | "absent" | "disabled" | "error";
|
|
1062
|
+
type PolicyStatusRuleCounts = {
|
|
1063
|
+
allow: number;
|
|
1064
|
+
deny: number;
|
|
1065
|
+
require: number;
|
|
1066
|
+
max_depth: number;
|
|
1067
|
+
require_pinned_constraint: number;
|
|
1068
|
+
/** Nested form accepted by flexible readers. */
|
|
1069
|
+
dependencies?: {
|
|
1070
|
+
allow: number;
|
|
1071
|
+
deny: number;
|
|
1072
|
+
require: number;
|
|
1073
|
+
max_depth: number;
|
|
1074
|
+
require_pinned_constraint: number;
|
|
1075
|
+
};
|
|
1076
|
+
};
|
|
1077
|
+
type PolicyStatusReport = {
|
|
1078
|
+
outcome: PolicyStatusOutcome;
|
|
1079
|
+
source: string | null;
|
|
1080
|
+
provider: string;
|
|
1081
|
+
enforcement: PolicyEnforcement | null;
|
|
1082
|
+
extends_chain: string[];
|
|
1083
|
+
rule_counts: PolicyStatusRuleCounts;
|
|
1084
|
+
warnings: unknown[];
|
|
1085
|
+
diagnostics: unknown[];
|
|
1086
|
+
};
|
|
1087
|
+
type PolicyStatusOptions = {
|
|
1088
|
+
cwd?: string;
|
|
1089
|
+
policyPath?: string;
|
|
1090
|
+
policy?: string;
|
|
1091
|
+
noPolicy?: boolean;
|
|
1092
|
+
providers?: string[];
|
|
1093
|
+
policyProviders?: string[];
|
|
1094
|
+
listGitRemotes?: (cwd?: string) => GitRemoteEntry[];
|
|
1095
|
+
remotes?: GitRemoteEntry[];
|
|
1096
|
+
fetchAncestor?: FetchAncestor;
|
|
1097
|
+
fetchPolicyUrl?: LoadPolicyExtendedOptions["fetchPolicyUrl"];
|
|
1098
|
+
httpGet?: LoadPolicyExtendedOptions["httpGet"];
|
|
1099
|
+
defaultFetchFailure?: "off" | "warn" | "block";
|
|
1100
|
+
implementationDefaultHost?: string;
|
|
1101
|
+
leafHostClass?: string;
|
|
1102
|
+
};
|
|
1103
|
+
/**
|
|
1104
|
+
* Compute a structured policy status report without mutating the project.
|
|
1105
|
+
* Soft-maps dual-conflict / fetch / schema failures to `outcome: error` (no throw).
|
|
1106
|
+
*/
|
|
1107
|
+
declare function runPolicyStatus(options?: PolicyStatusOptions): PolicyStatusReport;
|
|
1108
|
+
//#endregion
|
|
1109
|
+
//#region src/modules/Policy/constants.d.ts
|
|
1110
|
+
/** Local dual-read policy filenames (discovery only; schema identical). */
|
|
1111
|
+
declare const APM_POLICY_FILE = "apm-policy.yml";
|
|
1112
|
+
declare const BAPM_POLICY_FILE = "bapm-policy.yml";
|
|
1113
|
+
/**
|
|
1114
|
+
* Ordered discovery provider ids (pl-011).
|
|
1115
|
+
* Default: local dual-read first, then minimal remote `github-owner-dotgithub` (design D2).
|
|
1116
|
+
*/
|
|
1117
|
+
declare const POLICY_PROVIDER_LOCAL: "local";
|
|
1118
|
+
declare const POLICY_PROVIDER_GITHUB_OWNER_DOTGITHUB: "github-owner-dotgithub";
|
|
1119
|
+
/**
|
|
1120
|
+
* Ordered discovery providers (pl-001/011).
|
|
1121
|
+
* Local dual-read first; remote github-owner-dotgithub when local is absent.
|
|
1122
|
+
*/
|
|
1123
|
+
declare const DEFAULT_POLICY_PROVIDERS: readonly ["local", "github-owner-dotgithub"];
|
|
1124
|
+
/** Alias export names accepted by acceptance helpers. */
|
|
1125
|
+
declare const POLICY_DISCOVERY_PROVIDERS: readonly ["local", "github-owner-dotgithub"];
|
|
1126
|
+
declare const defaultPolicyProviders: readonly ["local", "github-owner-dotgithub"];
|
|
1127
|
+
//#endregion
|
|
1128
|
+
//#region src/modules/Policy/discover.d.ts
|
|
1129
|
+
/**
|
|
1130
|
+
* Resolve which local policy file to load.
|
|
1131
|
+
* Explicit `path` wins; otherwise exactly one of apm-policy.yml / bapm-policy.yml at cwd.
|
|
1132
|
+
* Neither → absent (not an error). Does not walk parent directories.
|
|
1133
|
+
*/
|
|
1134
|
+
declare function discoverPolicyPath(options?: DiscoverPolicyOptions): DiscoveredPolicy;
|
|
1135
|
+
/** Alias accepted by acceptance helpers. */
|
|
1136
|
+
declare const discoverLocalPolicyPath: typeof discoverPolicyPath;
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region src/modules/Policy/providers.d.ts
|
|
1139
|
+
type DiscoverPolicyWithProvidersOptions = {
|
|
1140
|
+
cwd?: string;
|
|
1141
|
+
/** Override provider order (else DEFAULT_POLICY_PROVIDERS or discovery:). */
|
|
1142
|
+
providers?: string[];
|
|
1143
|
+
policyProviders?: string[];
|
|
1144
|
+
/** Explicit local path wins. */
|
|
1145
|
+
path?: string;
|
|
1146
|
+
listGitRemotes?: (cwd?: string) => GitRemoteEntry[];
|
|
1147
|
+
remotes?: GitRemoteEntry[];
|
|
1148
|
+
implementationDefaultHost?: string;
|
|
1149
|
+
fetchPolicyUrl?: (url: string) => HttpFetchResult;
|
|
1150
|
+
httpGet?: (url: string) => HttpFetchResult;
|
|
1151
|
+
/** When remote fetch fails before a document exists. */
|
|
1152
|
+
defaultFetchFailure?: "off" | "warn" | "block";
|
|
1153
|
+
};
|
|
1154
|
+
type HttpFetchResult = {
|
|
1155
|
+
ok?: boolean;
|
|
1156
|
+
text?: string;
|
|
1157
|
+
body?: string;
|
|
1158
|
+
status?: number;
|
|
1159
|
+
url?: string;
|
|
1160
|
+
};
|
|
1161
|
+
type DiscoverPolicyWithProvidersResult = {
|
|
1162
|
+
absent?: false;
|
|
1163
|
+
found: true;
|
|
1164
|
+
path?: string;
|
|
1165
|
+
filename?: string;
|
|
1166
|
+
url?: string;
|
|
1167
|
+
provider: string;
|
|
1168
|
+
document?: PolicyDocument;
|
|
1169
|
+
policy?: PolicyDocument;
|
|
1170
|
+
text?: string;
|
|
1171
|
+
source?: string;
|
|
1172
|
+
} | {
|
|
1173
|
+
absent: true;
|
|
1174
|
+
found?: false;
|
|
1175
|
+
path?: null;
|
|
1176
|
+
providers?: string[];
|
|
1177
|
+
skipped?: boolean;
|
|
1178
|
+
};
|
|
1179
|
+
/**
|
|
1180
|
+
* Run ordered discovery providers until one yields a policy.
|
|
1181
|
+
*/
|
|
1182
|
+
declare function discoverPolicyWithProviders(options?: DiscoverPolicyWithProvidersOptions): DiscoverPolicyWithProvidersResult;
|
|
1183
|
+
/** Alias names accepted by acceptance helpers. */
|
|
1184
|
+
declare const runPolicyDiscovery: typeof discoverPolicyWithProviders;
|
|
1185
|
+
declare const discoverPolicyProviders: typeof discoverPolicyWithProviders;
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region src/modules/Policy/parse.d.ts
|
|
1188
|
+
/**
|
|
1189
|
+
* Validate a pre-parsed JS value as an OpenAPM-shaped policy document.
|
|
1190
|
+
* Retains unknown top-level (with warnings) and `x-*` (silent) keys.
|
|
1191
|
+
*/
|
|
1192
|
+
declare function parsePolicyDocument(input: unknown): ParsePolicyResult;
|
|
1193
|
+
/** Back-compat / acceptance entry for already-loaded JS objects. */
|
|
1194
|
+
declare function parsePolicy(input: unknown): ParsePolicyResult;
|
|
1195
|
+
//#endregion
|
|
1196
|
+
//#region src/modules/Policy/merge.d.ts
|
|
1197
|
+
type MergePoliciesResult = {
|
|
1198
|
+
document: PolicyDocument;
|
|
1199
|
+
policy: PolicyDocument;
|
|
1200
|
+
effective: PolicyDocument;
|
|
1201
|
+
};
|
|
1202
|
+
/**
|
|
1203
|
+
* Merge parent into child (child is nearer the leaf). Returns effective document.
|
|
1204
|
+
*/
|
|
1205
|
+
declare function mergePolicies(parent: unknown, child: unknown): MergePoliciesResult;
|
|
1206
|
+
/** Alias names accepted by acceptance helpers. */
|
|
1207
|
+
declare const mergePolicyDocuments: typeof mergePolicies;
|
|
1208
|
+
declare const mergePolicy: typeof mergePolicies;
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region src/modules/Policy/hostClass.d.ts
|
|
1211
|
+
type HostClassInput = string | {
|
|
1212
|
+
url?: string;
|
|
1213
|
+
host?: string;
|
|
1214
|
+
hostname?: string;
|
|
1215
|
+
};
|
|
1216
|
+
/** Implementation-default host for `github-owner-dotgithub` (design D1). */
|
|
1217
|
+
declare const IMPLEMENTATION_DEFAULT_HOST = "github.com";
|
|
1218
|
+
/**
|
|
1219
|
+
* Derive host class from a URL / hostname using PSL eTLD+1 (unified with Auth).
|
|
1220
|
+
*/
|
|
1221
|
+
declare function hostClassOf(input: HostClassInput): string;
|
|
1222
|
+
/** Alias accepted by acceptance helpers. */
|
|
1223
|
+
declare const policyHostClass: typeof hostClassOf;
|
|
1224
|
+
declare const hostClassForPolicy: typeof hostClassOf;
|
|
1225
|
+
declare const resolveHostClass: typeof hostClassOf;
|
|
1226
|
+
//#endregion
|
|
1227
|
+
//#region src/modules/Policy/evaluate.d.ts
|
|
1228
|
+
/**
|
|
1229
|
+
* Evaluate policy rules against install candidates.
|
|
1230
|
+
* Deny wins over allow; enforcement off|warn|block maps to gate outcome.
|
|
1231
|
+
*/
|
|
1232
|
+
declare function evaluateInstallPolicy(options: EvaluatePolicyOptions): EvaluatePolicyResult;
|
|
1233
|
+
/** Aliases accepted by acceptance helpers. */
|
|
1234
|
+
declare const evaluatePolicy: typeof evaluateInstallPolicy;
|
|
1235
|
+
declare const evaluatePolicyRules: typeof evaluateInstallPolicy;
|
|
1236
|
+
//#endregion
|
|
1237
|
+
//#region src/modules/Policy/escape.d.ts
|
|
1238
|
+
/**
|
|
1239
|
+
* Escape hatch: skip discovery + checks (not a discovery provider).
|
|
1240
|
+
* Primary: BAPM_POLICY_DISABLE=1; also honor APM_POLICY_DISABLE=1.
|
|
1241
|
+
*/
|
|
1242
|
+
declare function isPolicyDisabled(options?: {
|
|
1243
|
+
noPolicy?: boolean;
|
|
1244
|
+
}): boolean;
|
|
1245
|
+
//#endregion
|
|
1246
|
+
//#region src/modules/Policy/gate.d.ts
|
|
1247
|
+
type PolicyGateExtendedOptions = PolicyGateOptions & {
|
|
1248
|
+
providers?: string[];
|
|
1249
|
+
policyProviders?: string[];
|
|
1250
|
+
listGitRemotes?: (cwd?: string) => GitRemoteEntry[];
|
|
1251
|
+
remotes?: GitRemoteEntry[];
|
|
1252
|
+
fetchAncestor?: FetchAncestor;
|
|
1253
|
+
fetchPolicyUrl?: LoadPolicyExtendedOptions["fetchPolicyUrl"];
|
|
1254
|
+
httpGet?: LoadPolicyExtendedOptions["httpGet"];
|
|
1255
|
+
defaultFetchFailure?: "off" | "warn" | "block";
|
|
1256
|
+
implementationDefaultHost?: string;
|
|
1257
|
+
leafHostClass?: string;
|
|
1258
|
+
};
|
|
1259
|
+
/**
|
|
1260
|
+
* Discover (+ remote providers) → resolve/merge extends → evaluate install policy gate.
|
|
1261
|
+
* Dual-conflict / missing explicit file / fetch_failure:block fail closed.
|
|
1262
|
+
* Absent policy → ungated (skipped). Escape via noPolicy / env.
|
|
1263
|
+
*/
|
|
1264
|
+
declare function runPolicyGate(options?: PolicyGateExtendedOptions): PolicyGateResult;
|
|
1265
|
+
/**
|
|
1266
|
+
* Assert gate is not blocking; throw PolicyError on block violations.
|
|
1267
|
+
*/
|
|
1268
|
+
declare function assertPolicyGateAllows(options?: PolicyGateExtendedOptions): PolicyGateResult;
|
|
1269
|
+
//#endregion
|
|
1270
|
+
//#region src/modules/Policy/redact.d.ts
|
|
1271
|
+
/**
|
|
1272
|
+
* Redact credential-bearing URLs / refs before status display.
|
|
1273
|
+
* Drops userinfo and query string; also scrub plaintext secrets that survive path.resolve.
|
|
1274
|
+
*/
|
|
1275
|
+
/**
|
|
1276
|
+
* Scrub a single source / extends ref for human + JSON report fields.
|
|
1277
|
+
*/
|
|
1278
|
+
declare function redactPolicyRef(ref: string): string;
|
|
1279
|
+
//#endregion
|
|
1280
|
+
//#region src/modules/Resolver/resolveAndLock.d.ts
|
|
1281
|
+
/**
|
|
1282
|
+
* Orchestrate: load manifest → resolve plan → policy gate → download → write lock.
|
|
1283
|
+
*/
|
|
1284
|
+
declare function resolveAndLock(options?: ResolveAndLockOptions): Promise<ResolveAndLockResult & {
|
|
1285
|
+
policyDiagnostics?: unknown[];
|
|
1286
|
+
}>;
|
|
1287
|
+
declare function materializeRegistryNodes(nodes: ResolvedNode[], options: {
|
|
1288
|
+
cwd: string;
|
|
1289
|
+
mirrorUrl?: string;
|
|
1290
|
+
registryBaseUrl?: string;
|
|
1291
|
+
}): Promise<void>;
|
|
1292
|
+
//#endregion
|
|
1293
|
+
//#region src/modules/Resolver/purge.d.ts
|
|
1294
|
+
type PurgeInstallPathArgs = {
|
|
1295
|
+
cwd: string;
|
|
1296
|
+
/** Package names / identity basenames to purge. */
|
|
1297
|
+
packageNames: string[];
|
|
1298
|
+
/** Optional lock deps to also purge by repo identity cache dirs. */
|
|
1299
|
+
lockDeps?: Array<Record<string, unknown>>;
|
|
1300
|
+
};
|
|
1301
|
+
/**
|
|
1302
|
+
* Remove modules dirs for named packages (and matching identity cache trees)
|
|
1303
|
+
* so download materializes again even when the resolved tag is unchanged.
|
|
1304
|
+
*/
|
|
1305
|
+
declare function purgeModulesInstallPaths(args: PurgeInstallPathArgs): string[];
|
|
1306
|
+
//#endregion
|
|
1307
|
+
//#region src/modules/Resolver/identity.d.ts
|
|
1308
|
+
/**
|
|
1309
|
+
* Minimum-safe repo identity for resolve/cache (req-rs-016).
|
|
1310
|
+
* - Host case folded to lowercase
|
|
1311
|
+
* - Trailing `.git` stripped
|
|
1312
|
+
* - Path case preserved (example/REPO ≠ example/repo)
|
|
1313
|
+
* - Cache keys MUST NOT isolate solely by ref
|
|
1314
|
+
*/
|
|
1315
|
+
declare function normalizeRepoIdentity(repoUrl: string): string;
|
|
1316
|
+
/** Lockfile / display repo_url: host/path without scheme. */
|
|
1317
|
+
declare function toLockRepoUrl(repoUrl: string): string;
|
|
1318
|
+
/**
|
|
1319
|
+
* Safe directory segment for modules cache keyed by identity (not by ref alone).
|
|
1320
|
+
*/
|
|
1321
|
+
declare function identityToCacheDir(identity: string): string;
|
|
1322
|
+
//#endregion
|
|
1323
|
+
//#region src/modules/Resolver/localSource.d.ts
|
|
1324
|
+
/**
|
|
1325
|
+
* Bapm-only `local` source discriminator helpers (expand default / custom path).
|
|
1326
|
+
*/
|
|
1327
|
+
/** Default package root when `local` has no custom path. */
|
|
1328
|
+
declare const DEFAULT_LOCAL_ROOT = ".agents/local";
|
|
1329
|
+
/**
|
|
1330
|
+
* Expand a parsed `local` value to the effective project-relative path.
|
|
1331
|
+
* `true` | `null` | `""` | `undefined` → `.agents/local`; non-empty string → as-is.
|
|
1332
|
+
*/
|
|
1333
|
+
declare function effectiveLocalPath(local: unknown): string;
|
|
1334
|
+
/** Normalize a relative local root to a stable rooted gitignore pattern. */
|
|
1335
|
+
declare function localRootGitignorePattern(effectivePath: string): string;
|
|
1336
|
+
//#endregion
|
|
1337
|
+
//#region src/modules/Resolver/ensureLocalUntracked.d.ts
|
|
1338
|
+
type EnsureLocalRootUntrackedOptions = {
|
|
1339
|
+
projectRoot: string;
|
|
1340
|
+
/** Effective local path as declared / expanded (e.g. `.agents/local`, `./alt-local`). */
|
|
1341
|
+
originalPath: string;
|
|
1342
|
+
};
|
|
1343
|
+
/**
|
|
1344
|
+
* Collect effective paths for every root `local` discriminator in the manifest.
|
|
1345
|
+
* Plain OpenAPM `path:` entries are ignored.
|
|
1346
|
+
*/
|
|
1347
|
+
declare function collectLocalSourcePaths(manifest: BapmManifest): string[];
|
|
1348
|
+
/**
|
|
1349
|
+
* For every `local` source on the root manifest, ensure the effective root is
|
|
1350
|
+
* covered by project `.gitignore` and (when `.git` exists) is not tracked.
|
|
1351
|
+
*/
|
|
1352
|
+
declare function ensureLocalSourcesUntracked(options: {
|
|
1353
|
+
projectRoot: string;
|
|
1354
|
+
manifest: BapmManifest;
|
|
1355
|
+
}): void;
|
|
1356
|
+
/**
|
|
1357
|
+
* Ensure one effective local root is ignored; fail closed if git tracks files under it.
|
|
1358
|
+
*/
|
|
1359
|
+
declare function ensureLocalRootUntracked(options: EnsureLocalRootUntrackedOptions): void;
|
|
1360
|
+
//#endregion
|
|
1361
|
+
//#region src/modules/Resolver/semver.d.ts
|
|
1362
|
+
/**
|
|
1363
|
+
* Pick highest satisfying tag among candidates.
|
|
1364
|
+
* Prereleases excluded unless range opts in (contains prerelease id) or includePrerelease.
|
|
1365
|
+
* Build-metadata ties: highest ASCII full tag string (req-rs-014).
|
|
1366
|
+
*/
|
|
1367
|
+
declare function pickHighestSatisfyingTag(tags: string[], range: string, options?: {
|
|
1368
|
+
includePrerelease?: boolean;
|
|
1369
|
+
}): string | null;
|
|
1370
|
+
/**
|
|
1371
|
+
* Intersect multiple ranges; return highest version among candidate tags in ∩,
|
|
1372
|
+
* or null if empty.
|
|
1373
|
+
*/
|
|
1374
|
+
declare function pickHighestInIntersection(tags: string[], ranges: string[], options?: {
|
|
1375
|
+
includePrerelease?: boolean;
|
|
1376
|
+
}): string | null;
|
|
1377
|
+
/** Which range is "tightest" among a set (prefer narrower / more specific). */
|
|
1378
|
+
declare function pickTightestRange(ranges: string[]): string;
|
|
1379
|
+
//#endregion
|
|
1380
|
+
//#region src/modules/Resolver/defaults.d.ts
|
|
1381
|
+
/**
|
|
1382
|
+
* Default TagLister via `git ls-remote --tags --refs`.
|
|
1383
|
+
* Omits peeled `^{}` lines — used by resolve / constraint paths (stable).
|
|
1384
|
+
*/
|
|
1385
|
+
declare function createDefaultTagLister(): TagLister;
|
|
1386
|
+
/**
|
|
1387
|
+
* Peel-aware TagLister for Outdated full-SHA revision-pin path.
|
|
1388
|
+
* `git ls-remote --tags` (no `--refs`); pairs `refs/tags/X^{}` → annotated.
|
|
1389
|
+
*/
|
|
1390
|
+
declare function createPeelAwareTagLister(): TagLister;
|
|
1391
|
+
/** Default GitRemote via `git ls-remote`. */
|
|
1392
|
+
declare function createDefaultGitRemote(): GitRemote;
|
|
1393
|
+
/** Default Downloader: local copy or shallow git clone into apm_modules. */
|
|
1394
|
+
declare function createDefaultDownloader(): Downloader;
|
|
1395
|
+
//#endregion
|
|
1396
|
+
//#region src/modules/Primitives/types.d.ts
|
|
1397
|
+
type PrimitiveSource = "local" | `dependency:${string}`;
|
|
1398
|
+
type PrimitiveType = string;
|
|
1399
|
+
type AttributedPrimitive = {
|
|
1400
|
+
name: string;
|
|
1401
|
+
type: PrimitiveType;
|
|
1402
|
+
source: PrimitiveSource;
|
|
1403
|
+
path: string;
|
|
1404
|
+
packageName?: string;
|
|
1405
|
+
content?: string;
|
|
1406
|
+
/**
|
|
1407
|
+
* Complete portable skill directory. Present only for Agent Plugins skills so
|
|
1408
|
+
* targets can import auxiliary scripts, references, and assets as one unit.
|
|
1409
|
+
*/
|
|
1410
|
+
skillDirectory?: string;
|
|
1411
|
+
pluginRoot?: string;
|
|
1412
|
+
format?: "agent-plugin";
|
|
1413
|
+
[key: string]: unknown;
|
|
1414
|
+
};
|
|
1415
|
+
type DiscoverPrimitivesOptions = {
|
|
1416
|
+
cwd?: string;
|
|
1417
|
+
/** Modules root; defaults to `<cwd>/apm_modules`. */
|
|
1418
|
+
modulesDir?: string;
|
|
1419
|
+
/** Declaration order of dependency package names (pr-003). */
|
|
1420
|
+
declarationOrder?: string[];
|
|
1421
|
+
};
|
|
1422
|
+
type PrimitiveConflictDiagnostic = {
|
|
1423
|
+
code: string;
|
|
1424
|
+
message: string;
|
|
1425
|
+
name: string;
|
|
1426
|
+
type: string;
|
|
1427
|
+
winnerSource: string;
|
|
1428
|
+
loserSource: string;
|
|
1429
|
+
};
|
|
1430
|
+
type ResolvePrimitiveConflictsOptions = {
|
|
1431
|
+
primitives: AttributedPrimitive[];
|
|
1432
|
+
cwd?: string;
|
|
1433
|
+
declarationOrder?: string[];
|
|
1434
|
+
};
|
|
1435
|
+
type ResolvePrimitiveConflictsResult = {
|
|
1436
|
+
primitives: AttributedPrimitive[];
|
|
1437
|
+
diagnostics: PrimitiveConflictDiagnostic[];
|
|
1438
|
+
};
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region src/modules/Primitives/errors.d.ts
|
|
1441
|
+
type PrimitivesErrorCode = "PRIMITIVES_DISCOVER_FAILED" | "PRIMITIVES_CONFLICT";
|
|
1442
|
+
declare class PrimitivesError extends Error {
|
|
1443
|
+
readonly code: PrimitivesErrorCode;
|
|
1444
|
+
readonly details?: Record<string, unknown>;
|
|
1445
|
+
constructor(code: PrimitivesErrorCode, message: string, options?: {
|
|
1446
|
+
details?: Record<string, unknown>;
|
|
1447
|
+
cause?: unknown;
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
//#endregion
|
|
1451
|
+
//#region src/modules/Primitives/discover.d.ts
|
|
1452
|
+
/**
|
|
1453
|
+
* Discover attributed primitives under the project and dependency modules trees.
|
|
1454
|
+
*/
|
|
1455
|
+
declare function discoverPrimitives(options?: DiscoverPrimitivesOptions): AttributedPrimitive[];
|
|
1456
|
+
//#endregion
|
|
1457
|
+
//#region src/modules/Primitives/conflicts.d.ts
|
|
1458
|
+
/**
|
|
1459
|
+
* Resolve name+type conflicts: local wins over deps (pr-002);
|
|
1460
|
+
* among deps, first-declared wins (pr-003).
|
|
1461
|
+
*/
|
|
1462
|
+
declare function resolvePrimitiveConflicts(options: ResolvePrimitiveConflictsOptions): ResolvePrimitiveConflictsResult;
|
|
1463
|
+
/** Alias for callers that prefer a shorter name. */
|
|
1464
|
+
declare const resolveConflicts: typeof resolvePrimitiveConflicts;
|
|
1465
|
+
//#endregion
|
|
1466
|
+
//#region src/modules/AgentPlugins/types.d.ts
|
|
1467
|
+
declare const AGENT_PLUGIN_MANIFEST_SCHEMA_V1 = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
1468
|
+
type AgentPluginAuthor = {
|
|
1469
|
+
name?: string;
|
|
1470
|
+
email?: string;
|
|
1471
|
+
url?: string;
|
|
1472
|
+
};
|
|
1473
|
+
/** Schema-compatible portable Agent Plugins v1 manifest. */
|
|
1474
|
+
type AgentPluginManifest = {
|
|
1475
|
+
$schema: typeof AGENT_PLUGIN_MANIFEST_SCHEMA_V1;
|
|
1476
|
+
name: string;
|
|
1477
|
+
version?: string;
|
|
1478
|
+
description?: string;
|
|
1479
|
+
author?: AgentPluginAuthor;
|
|
1480
|
+
homepage?: string;
|
|
1481
|
+
repository?: string;
|
|
1482
|
+
license?: string;
|
|
1483
|
+
keywords?: string[];
|
|
1484
|
+
/** Declared command file paths relative to the plugin root. */
|
|
1485
|
+
commands?: string[];
|
|
1486
|
+
/** Declared hook JSON paths relative to the plugin root. */
|
|
1487
|
+
hooks?: string[];
|
|
1488
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
1489
|
+
};
|
|
1490
|
+
type AgentPluginDiagnostic = {
|
|
1491
|
+
code: string;
|
|
1492
|
+
message: string;
|
|
1493
|
+
path?: string;
|
|
1494
|
+
severity: "warning" | "error";
|
|
1495
|
+
};
|
|
1496
|
+
type LoadAgentPluginManifestOptions = {
|
|
1497
|
+
/** Absolute or relative plugin package root. */
|
|
1498
|
+
root: string;
|
|
1499
|
+
};
|
|
1500
|
+
/** Input accepted by the portable v1 producer. */
|
|
1501
|
+
type CreateAgentPluginManifestOptions = {
|
|
1502
|
+
name: string;
|
|
1503
|
+
version?: string;
|
|
1504
|
+
description?: string;
|
|
1505
|
+
author?: AgentPluginAuthor;
|
|
1506
|
+
homepage?: string;
|
|
1507
|
+
repository?: string;
|
|
1508
|
+
license?: string;
|
|
1509
|
+
keywords?: string[];
|
|
1510
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
1511
|
+
};
|
|
1512
|
+
type WriteAgentPluginManifestOptions = CreateAgentPluginManifestOptions & {
|
|
1513
|
+
/** Plugin package root. Created by the writer when absent. */
|
|
1514
|
+
root?: string;
|
|
1515
|
+
/** Explicit output path. Must be `<root>/plugin.json` when root is supplied. */
|
|
1516
|
+
path?: string;
|
|
1517
|
+
};
|
|
1518
|
+
type WrittenAgentPluginManifest = {
|
|
1519
|
+
root: string;
|
|
1520
|
+
manifestPath: string;
|
|
1521
|
+
manifest: AgentPluginManifest;
|
|
1522
|
+
};
|
|
1523
|
+
type LoadedAgentPluginManifest = {
|
|
1524
|
+
root: string;
|
|
1525
|
+
manifestPath: string;
|
|
1526
|
+
manifest: AgentPluginManifest;
|
|
1527
|
+
diagnostics: AgentPluginDiagnostic[];
|
|
1528
|
+
};
|
|
1529
|
+
type AgentPluginSkill = {
|
|
1530
|
+
/** Immediate directory name below `skills/`. */
|
|
1531
|
+
name: string;
|
|
1532
|
+
/** Realpath of the complete skill directory, safe to import as a directory. */
|
|
1533
|
+
directory: string;
|
|
1534
|
+
skillPath: string;
|
|
1535
|
+
};
|
|
1536
|
+
type DiscoverAgentPluginSkillsOptions = LoadAgentPluginManifestOptions & {
|
|
1537
|
+
packageName?: string;
|
|
1538
|
+
};
|
|
1539
|
+
type DiscoverAgentPluginSkillsResult = LoadedAgentPluginManifest & {
|
|
1540
|
+
skills: AgentPluginSkill[];
|
|
1541
|
+
};
|
|
1542
|
+
/** Declared command or hook file under a portable plugin root. */
|
|
1543
|
+
type AgentPluginDeclaredPath = {
|
|
1544
|
+
/** Primitive name derived from the file stem. */
|
|
1545
|
+
name: string;
|
|
1546
|
+
type: "command" | "hook";
|
|
1547
|
+
/** Realpath of the declared file within the plugin root. */
|
|
1548
|
+
path: string;
|
|
1549
|
+
/** Original declared relative path from plugin.json. */
|
|
1550
|
+
declaredPath: string;
|
|
1551
|
+
};
|
|
1552
|
+
type DiscoverAgentPluginDeclaredPathsResult = LoadedAgentPluginManifest & {
|
|
1553
|
+
commands: AgentPluginDeclaredPath[];
|
|
1554
|
+
hooks: AgentPluginDeclaredPath[];
|
|
1555
|
+
};
|
|
1556
|
+
type AgentPluginMcpServer = {
|
|
1557
|
+
name: string;
|
|
1558
|
+
transport: "stdio" | "streamable-http" | "sse";
|
|
1559
|
+
command?: string;
|
|
1560
|
+
args?: string[];
|
|
1561
|
+
url?: string;
|
|
1562
|
+
cwd?: string;
|
|
1563
|
+
env?: Record<string, string>;
|
|
1564
|
+
/** Signals to targets that this must be adapted, rather than passed through. */
|
|
1565
|
+
format: "agent-plugin";
|
|
1566
|
+
};
|
|
1567
|
+
type DiscoverAgentPluginMcpOptions = LoadAgentPluginManifestOptions & {
|
|
1568
|
+
/**
|
|
1569
|
+
* Directory owned by bapm for this installed plugin. It is never taken from
|
|
1570
|
+
* package configuration and is the only expansion target for PLUGIN_DATA.
|
|
1571
|
+
*/
|
|
1572
|
+
dataRoot: string;
|
|
1573
|
+
};
|
|
1574
|
+
type DiscoverAgentPluginMcpResult = LoadedAgentPluginManifest & {
|
|
1575
|
+
servers: AgentPluginMcpServer[];
|
|
1576
|
+
};
|
|
1577
|
+
//#endregion
|
|
1578
|
+
//#region src/modules/AgentPlugins/errors.d.ts
|
|
1579
|
+
type AgentPluginsErrorCode = "AGENT_PLUGIN_ROOT_INVALID" | "AGENT_PLUGIN_MANIFEST_INVALID" | "AGENT_PLUGIN_DECLARED_PATH_INVALID";
|
|
1580
|
+
declare class AgentPluginsError extends Error {
|
|
1581
|
+
readonly code: AgentPluginsErrorCode;
|
|
1582
|
+
readonly details?: Record<string, unknown>;
|
|
1583
|
+
constructor(code: AgentPluginsErrorCode, message: string, details?: Record<string, unknown>);
|
|
1584
|
+
}
|
|
1585
|
+
//#endregion
|
|
1586
|
+
//#region src/modules/AgentPlugins/load.d.ts
|
|
1587
|
+
/**
|
|
1588
|
+
* Load the portable v1 manifest from exactly `<root>/plugin.json`.
|
|
1589
|
+
* This is intentionally offline: `$schema` selects this local validator only.
|
|
1590
|
+
*/
|
|
1591
|
+
declare function loadAgentPluginManifest(options: LoadAgentPluginManifestOptions): LoadedAgentPluginManifest;
|
|
1592
|
+
declare function validateAgentPluginManifest(value: unknown, manifestPath?: string): {
|
|
1593
|
+
manifest: AgentPluginManifest;
|
|
1594
|
+
diagnostics: AgentPluginDiagnostic[];
|
|
1595
|
+
};
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/modules/AgentPlugins/discover.d.ts
|
|
1598
|
+
/**
|
|
1599
|
+
* Discover only immediate `skills/<name>/SKILL.md` entries and return complete,
|
|
1600
|
+
* containment-checked directories for portable import.
|
|
1601
|
+
*/
|
|
1602
|
+
declare function discoverAgentPluginSkills(options: DiscoverAgentPluginSkillsOptions): DiscoverAgentPluginSkillsResult;
|
|
1603
|
+
//#endregion
|
|
1604
|
+
//#region src/modules/AgentPlugins/declaredPaths.d.ts
|
|
1605
|
+
/**
|
|
1606
|
+
* Resolve `plugin.json` `commands` / `hooks` path lists under the plugin root.
|
|
1607
|
+
* Missing or escaping declared paths fail closed (requirements, not hints).
|
|
1608
|
+
*/
|
|
1609
|
+
declare function discoverAgentPluginDeclaredPaths(options: DiscoverAgentPluginSkillsOptions): DiscoverAgentPluginDeclaredPathsResult;
|
|
1610
|
+
//#endregion
|
|
1611
|
+
//#region src/modules/AgentPlugins/mcp.d.ts
|
|
1612
|
+
/** Parse only `<plugin root>/mcp.json`; a bad file never invalidates skills. */
|
|
1613
|
+
declare function discoverAgentPluginMcp(options: DiscoverAgentPluginMcpOptions): DiscoverAgentPluginMcpResult;
|
|
1614
|
+
//#endregion
|
|
1615
|
+
//#region src/modules/AgentPlugins/write.d.ts
|
|
1616
|
+
/**
|
|
1617
|
+
* Build the canonical portable v1 manifest. This is deliberately independent
|
|
1618
|
+
* from Manifest/pluginJson.ts: APM producer metadata has different semantics.
|
|
1619
|
+
*/
|
|
1620
|
+
declare function createAgentPluginManifest(options: CreateAgentPluginManifestOptions): AgentPluginManifest;
|
|
1621
|
+
declare function serializeAgentPluginManifest(manifest: AgentPluginManifest): string;
|
|
1622
|
+
/**
|
|
1623
|
+
* Validate before writing a portable root manifest. The output is always a
|
|
1624
|
+
* regular `plugin.json`; it never creates an APM `bapm.yml` dependency contract.
|
|
1625
|
+
*/
|
|
1626
|
+
declare function writeAgentPluginManifest(options: WriteAgentPluginManifestOptions): WrittenAgentPluginManifest;
|
|
1627
|
+
//#endregion
|
|
1628
|
+
//#region src/modules/Install/types.d.ts
|
|
1629
|
+
type InstallOnlyMode = "apm" | "mcp";
|
|
1630
|
+
type RunInstallOptions = {
|
|
1631
|
+
cwd?: string;
|
|
1632
|
+
frozen?: boolean;
|
|
1633
|
+
/** Rejected when combined with frozen. */
|
|
1634
|
+
update?: boolean;
|
|
1635
|
+
updateRefs?: boolean;
|
|
1636
|
+
/**
|
|
1637
|
+
* Preview-only install: no durable project writes (manifest/lock/modules/harness),
|
|
1638
|
+
* no target materialize / configureMcp. Never forwarded to targets.
|
|
1639
|
+
*/
|
|
1640
|
+
dryRun?: boolean;
|
|
1641
|
+
/**
|
|
1642
|
+
* Accept overwrite / future security-gate bypass. MUST NOT refresh refs,
|
|
1643
|
+
* bypass frozen, or disable policy. Distinct from `forcedTarget`.
|
|
1644
|
+
*/
|
|
1645
|
+
force?: boolean;
|
|
1646
|
+
/** Dual-consent CLI half for direct `http://` dependencies. */
|
|
1647
|
+
allowInsecure?: boolean;
|
|
1648
|
+
/** Repeatable host allowlist for transitive `http://` dependencies (FQDN). */
|
|
1649
|
+
allowInsecureHosts?: string[];
|
|
1650
|
+
/**
|
|
1651
|
+
* When set with `packageRefs`, write under `devDependencies.apm` instead of
|
|
1652
|
+
* `dependencies.apm`. Without positional refs, no-op.
|
|
1653
|
+
*/
|
|
1654
|
+
dev?: boolean;
|
|
1655
|
+
/**
|
|
1656
|
+
* Install mode: `apm` skips MCP configure; `mcp` skips APM package
|
|
1657
|
+
* download/materialize. Omit = both sides.
|
|
1658
|
+
*/
|
|
1659
|
+
only?: InstallOnlyMode;
|
|
1660
|
+
/**
|
|
1661
|
+
* Positional package refs to add under `dependencies.apm` before install
|
|
1662
|
+
* (non-zip). Mutually exclusive with `archivePath`.
|
|
1663
|
+
*/
|
|
1664
|
+
packageRefs?: string[];
|
|
1665
|
+
/**
|
|
1666
|
+
* Skip MCP configure for listed target/runtime ids (e.g. `cursor`).
|
|
1667
|
+
* Does not skip package materialize. Alias: `exclude`.
|
|
1668
|
+
*/
|
|
1669
|
+
excludeTargets?: string[];
|
|
1670
|
+
/** Alias for `excludeTargets`. */
|
|
1671
|
+
exclude?: string[];
|
|
1672
|
+
/**
|
|
1673
|
+
* Force activation of a registered target id even when `detect` is false
|
|
1674
|
+
* (e.g. CLI `--target cursor`). Alias: `forceTarget`.
|
|
1675
|
+
*/
|
|
1676
|
+
forcedTarget?: string;
|
|
1677
|
+
/** Alias for `forcedTarget`. */
|
|
1678
|
+
forceTarget?: string;
|
|
1679
|
+
/** Injected target registry (from @b-apm/integration-api). */
|
|
1680
|
+
integrationRegistry?: IntegrationRegistry;
|
|
1681
|
+
/** Alias accepted by acceptance helpers. */
|
|
1682
|
+
registry?: IntegrationRegistry;
|
|
1683
|
+
/** Override active target ids (else from manifest / detection / forced). */
|
|
1684
|
+
activeTargets?: string[];
|
|
1685
|
+
/**
|
|
1686
|
+
* Download concurrency (default aligned with APM = 4). `0` = serial.
|
|
1687
|
+
*/
|
|
1688
|
+
parallelDownloads?: number;
|
|
1689
|
+
maxDepth?: number;
|
|
1690
|
+
verbose?: boolean;
|
|
1691
|
+
gitRemote?: GitRemote;
|
|
1692
|
+
tagLister?: TagLister;
|
|
1693
|
+
downloader?: Downloader;
|
|
1694
|
+
/**
|
|
1695
|
+
* Local pack zip path — extract into project root before install orchestration
|
|
1696
|
+
* (M7 install-from-archive round-trip).
|
|
1697
|
+
*/
|
|
1698
|
+
archivePath?: string;
|
|
1699
|
+
/** Explicit policy file path (`--policy`). */
|
|
1700
|
+
policyPath?: string;
|
|
1701
|
+
/** Alias for `policyPath`. */
|
|
1702
|
+
policy?: string;
|
|
1703
|
+
/** Skip policy discovery + checks (`--no-policy` / env disable). */
|
|
1704
|
+
noPolicy?: boolean;
|
|
1705
|
+
/** Override ordered policy discovery providers. */
|
|
1706
|
+
policyProviders?: string[];
|
|
1707
|
+
/** Alias for `policyProviders`. */
|
|
1708
|
+
providers?: string[];
|
|
1709
|
+
/** Injectable git remotes for pl-012 / remote discovery. */
|
|
1710
|
+
listGitRemotes?: (cwd?: string) => Array<{
|
|
1711
|
+
name: string;
|
|
1712
|
+
url: string;
|
|
1713
|
+
}>;
|
|
1714
|
+
remotes?: Array<{
|
|
1715
|
+
name: string;
|
|
1716
|
+
url: string;
|
|
1717
|
+
}>;
|
|
1718
|
+
/** Injectable HTTP for remote policy / extends. */
|
|
1719
|
+
fetchPolicyUrl?: (url: string) => {
|
|
1720
|
+
ok?: boolean;
|
|
1721
|
+
text?: string;
|
|
1722
|
+
body?: string;
|
|
1723
|
+
status?: number;
|
|
1724
|
+
url?: string;
|
|
1725
|
+
};
|
|
1726
|
+
httpGet?: (url: string) => {
|
|
1727
|
+
ok?: boolean;
|
|
1728
|
+
text?: string;
|
|
1729
|
+
body?: string;
|
|
1730
|
+
status?: number;
|
|
1731
|
+
url?: string;
|
|
1732
|
+
};
|
|
1733
|
+
/** Injectable extends ancestor fetcher. */
|
|
1734
|
+
fetchAncestor?: (ref: string, context: {
|
|
1735
|
+
leafHostClass: string;
|
|
1736
|
+
chain: string[];
|
|
1737
|
+
}) => unknown;
|
|
1738
|
+
/** When remote fetch fails before a document exists (pl-010). */
|
|
1739
|
+
defaultFetchFailure?: "off" | "warn" | "block";
|
|
1740
|
+
implementationDefaultHost?: string;
|
|
1741
|
+
/**
|
|
1742
|
+
* Deploy transitive (dependency) MCP servers when no grant surface applies
|
|
1743
|
+
* (`--trust-transitive-mcp`). Direct `dependencies.mcp` always eligible.
|
|
1744
|
+
*/
|
|
1745
|
+
trustTransitiveMcp?: boolean;
|
|
1746
|
+
experimentalRegistries?: boolean;
|
|
1747
|
+
registryBaseUrl?: string;
|
|
1748
|
+
mirrorUrl?: string;
|
|
1749
|
+
/** Override `~/.bapm` for marketplace registry during install resolve. */
|
|
1750
|
+
marketplaceConfigDir?: string;
|
|
1751
|
+
configDir?: string;
|
|
1752
|
+
};
|
|
1753
|
+
/** Alias for design naming flexibility. */
|
|
1754
|
+
type InstallOptions = RunInstallOptions;
|
|
1755
|
+
type InstallResult = {
|
|
1756
|
+
ok: true;
|
|
1757
|
+
lockPath?: string;
|
|
1758
|
+
modulesDir: string;
|
|
1759
|
+
activeTargets: string[];
|
|
1760
|
+
primitivesCount: number;
|
|
1761
|
+
diagnostics: unknown[];
|
|
1762
|
+
/** Policy gate warnings / findings (M8). */
|
|
1763
|
+
policyDiagnostics?: unknown[];
|
|
1764
|
+
/** True when install returned after dry-run preview (no durable writes). */
|
|
1765
|
+
dryRun?: boolean;
|
|
1766
|
+
};
|
|
1767
|
+
type EnforceFrozenOptions = {
|
|
1768
|
+
cwd?: string;
|
|
1769
|
+
updateRefs?: boolean;
|
|
1770
|
+
update?: boolean;
|
|
1771
|
+
};
|
|
1772
|
+
//#endregion
|
|
1773
|
+
//#region src/modules/Install/errors.d.ts
|
|
1774
|
+
type InstallErrorCode = "INSTALL_FROZEN_NO_LOCK" | "INSTALL_FROZEN_MISSING_PIN" | "INSTALL_FROZEN_UPDATE_REJECTED" | "INSTALL_FROZEN_HASH_MISMATCH" | "INSTALL_FROZEN_POSITIONAL" | "INSTALL_UNKNOWN_TARGET" | "INSTALL_UNKNOWN_EXCLUDE" | "INSTALL_TARGET_FIELDS" | "INSTALL_ARCHIVE" | "INSTALL_PACKAGE_REF" | "INSTALL_MCP_TRUST" | "INSTALL_MCP_ENV_BAKE" | "INSTALL_INSECURE" | "INSTALL_INVALID_HOST" | "INSTALL_FAILED";
|
|
1775
|
+
declare class InstallError extends Error {
|
|
1776
|
+
readonly code: InstallErrorCode;
|
|
1777
|
+
readonly details?: Record<string, unknown>;
|
|
1778
|
+
constructor(code: InstallErrorCode, message: string, options?: {
|
|
1779
|
+
details?: Record<string, unknown>;
|
|
1780
|
+
cause?: unknown;
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
//#endregion
|
|
1784
|
+
//#region src/modules/Install/frozen.d.ts
|
|
1785
|
+
/**
|
|
1786
|
+
* Basic frozen gate (lk-006): reject frozen+update; require lock; require direct pins.
|
|
1787
|
+
* Call before any modules/lock/target mutation.
|
|
1788
|
+
*/
|
|
1789
|
+
declare function enforceFrozen(options?: EnforceFrozenOptions): void;
|
|
1790
|
+
//#endregion
|
|
1791
|
+
//#region src/modules/Install/ciFrozen.d.ts
|
|
1792
|
+
/**
|
|
1793
|
+
* OpenAPM req-lk-018: CI truthiness and effective frozen resolution.
|
|
1794
|
+
*
|
|
1795
|
+
* Truthy CI: variable present and not "", "0", or "false" (case-insensitive).
|
|
1796
|
+
* Only the `CI` key is consulted — vendor vars (GITHUB_ACTIONS, …) do not imply CI.
|
|
1797
|
+
*/
|
|
1798
|
+
type ResolveEffectiveFrozenOptions = {
|
|
1799
|
+
/** Explicit `--frozen` / force-on. */
|
|
1800
|
+
frozen?: boolean;
|
|
1801
|
+
/** Explicit `--no-frozen` opt-out. */
|
|
1802
|
+
noFrozen?: boolean;
|
|
1803
|
+
/** Env map (defaults to empty — callers pass `process.env` or a test stub). */
|
|
1804
|
+
env?: Record<string, string | undefined>;
|
|
1805
|
+
};
|
|
1806
|
+
/**
|
|
1807
|
+
* OpenAPM CI truthiness: `CI` present and not `""` / `"0"` / `"false"` (case-insensitive).
|
|
1808
|
+
*/
|
|
1809
|
+
declare function isCiEnvTruthy(env?: Record<string, string | undefined>): boolean;
|
|
1810
|
+
/**
|
|
1811
|
+
* Resolve effective frozen mode from flags + env.
|
|
1812
|
+
*
|
|
1813
|
+
* Precedence: `--frozen`+`--no-frozen` conflict → throw;
|
|
1814
|
+
* else `--no-frozen` → false;
|
|
1815
|
+
* else `--frozen` OR truthy CI → true;
|
|
1816
|
+
* else false.
|
|
1817
|
+
*/
|
|
1818
|
+
declare function resolveEffectiveFrozen(options?: ResolveEffectiveFrozenOptions): boolean;
|
|
1819
|
+
//#endregion
|
|
1820
|
+
//#region src/modules/Install/runInstall.d.ts
|
|
1821
|
+
/**
|
|
1822
|
+
* Run install: optional archive extract → frozen gate → plan → policy gate →
|
|
1823
|
+
* download → orphan cleanup → primitives → targets → MCP trust/configure →
|
|
1824
|
+
* write deployed_file_hashes / mcp_* lock fields.
|
|
1825
|
+
*
|
|
1826
|
+
* With `dryRun: true`, returns after direct-deps (+ MCP view) preview and optional
|
|
1827
|
+
* policy preflight — no durable project writes and no target write ports.
|
|
1828
|
+
*/
|
|
1829
|
+
declare function runInstall(options?: RunInstallOptions): Promise<InstallResult>;
|
|
1830
|
+
/** Alias preferred by design docs. */
|
|
1831
|
+
declare const installProject: typeof runInstall;
|
|
1832
|
+
//#endregion
|
|
1833
|
+
//#region src/modules/Install/targets.d.ts
|
|
1834
|
+
/**
|
|
1835
|
+
* Surface declared target id(s) from a manifest for Install intersection (tg-008).
|
|
1836
|
+
* Accepts vendor ids `x-<vendor>-<name>` without requiring a registered impl (tg-004).
|
|
1837
|
+
* Object-map forms contribute their keys (host ids); values are ignored here.
|
|
1838
|
+
*/
|
|
1839
|
+
declare function declaredTargetIds(manifest: BapmManifest): string[];
|
|
1840
|
+
/**
|
|
1841
|
+
* When `target` / `targets` used the object-map form, return the retained
|
|
1842
|
+
* host→package map. Legacy string/array forms → `undefined`.
|
|
1843
|
+
* CLI composition loads/registers these packages before install/compile selection.
|
|
1844
|
+
*/
|
|
1845
|
+
declare function declaredTargetIntegrationMap(manifest: BapmManifest): Readonly<TargetIntegrationMap> | undefined;
|
|
1846
|
+
//#endregion
|
|
1847
|
+
//#region src/modules/Install/deployedInventory.d.ts
|
|
1848
|
+
/** Documented stable hash for deployed_file_hashes. */
|
|
1849
|
+
declare const DEPLOYED_HASH_ALGO: "sha256";
|
|
1850
|
+
declare function hashFileBytes(content: Buffer | string): string;
|
|
1851
|
+
declare function hashFileAt(absPath: string): string;
|
|
1852
|
+
/** Ensure relative path stays inside cwd (no escape). */
|
|
1853
|
+
declare function safeResolveUnderCwd(cwd: string, relPath: string): string | undefined;
|
|
1854
|
+
/**
|
|
1855
|
+
* Remove harness files recorded in previous lock for deps no longer in the resolve set.
|
|
1856
|
+
* No-op when inventory is absent. Never deletes paths outside recorded inventory.
|
|
1857
|
+
*/
|
|
1858
|
+
declare function cleanupOrphanDeployedFiles(args: {
|
|
1859
|
+
cwd: string;
|
|
1860
|
+
previous: LockfileDocument | null | undefined;
|
|
1861
|
+
currentDepNames: Set<string>;
|
|
1862
|
+
}): string[];
|
|
1863
|
+
type DeployedHashViolation = {
|
|
1864
|
+
path: string;
|
|
1865
|
+
kind: "missing" | "mismatch";
|
|
1866
|
+
expected?: string;
|
|
1867
|
+
actual?: string;
|
|
1868
|
+
message: string;
|
|
1869
|
+
};
|
|
1870
|
+
/**
|
|
1871
|
+
* Collect deployed hash / presence violations without throwing (for audit --ci).
|
|
1872
|
+
* No-op (empty) when no inventory present. tree_sha256 is handled separately via
|
|
1873
|
+
* `collectTreeSha256Violations` (lk-015).
|
|
1874
|
+
*/
|
|
1875
|
+
declare function collectDeployedHashViolations(args: {
|
|
1876
|
+
cwd: string;
|
|
1877
|
+
document: LockfileDocument;
|
|
1878
|
+
}): DeployedHashViolation[];
|
|
1879
|
+
/**
|
|
1880
|
+
* Re-verify on-disk content against lock deployed_file_hashes (lk-017 lite).
|
|
1881
|
+
* No-op when no inventory present.
|
|
1882
|
+
*/
|
|
1883
|
+
declare function verifyDeployedFileHashes(args: {
|
|
1884
|
+
cwd: string;
|
|
1885
|
+
document: LockfileDocument;
|
|
1886
|
+
}): void;
|
|
1887
|
+
type ResolvedDeployedFile = {
|
|
1888
|
+
path: string;
|
|
1889
|
+
hash: string;
|
|
1890
|
+
primitive?: {
|
|
1891
|
+
name: string;
|
|
1892
|
+
packageName?: string;
|
|
1893
|
+
};
|
|
1894
|
+
};
|
|
1895
|
+
/** Normalize materialize return / void into path+hash list (core hashes when omitted). */
|
|
1896
|
+
declare function collectDeployedHashes(cwd: string, report: void | MaterializeReport | null | undefined): ResolvedDeployedFile[];
|
|
1897
|
+
/**
|
|
1898
|
+
* Attach deployed_file_hashes onto lock dependency entries (by contributing package).
|
|
1899
|
+
* Unattributed paths go to document-level local_deployed_file_hashes.
|
|
1900
|
+
* Returns whether any hashes were written.
|
|
1901
|
+
*/
|
|
1902
|
+
declare function applyDeployedHashesToLock(args: {
|
|
1903
|
+
document: LockfileDocument;
|
|
1904
|
+
deployed: ResolvedDeployedFile[];
|
|
1905
|
+
primitives: AttributedPrimitive[];
|
|
1906
|
+
}): boolean;
|
|
1907
|
+
//#endregion
|
|
1908
|
+
//#region src/modules/Update/types.d.ts
|
|
1909
|
+
type UpdatePlanEntry = {
|
|
1910
|
+
name: string;
|
|
1911
|
+
action: "update" | "add" | "remove" | "keep";
|
|
1912
|
+
from?: string;
|
|
1913
|
+
to?: string;
|
|
1914
|
+
};
|
|
1915
|
+
type RunUpdateOptions = {
|
|
1916
|
+
cwd?: string;
|
|
1917
|
+
/** Apply without interactive confirm. */
|
|
1918
|
+
yes?: boolean;
|
|
1919
|
+
/** Plan only; no lock/modules mutation. */
|
|
1920
|
+
dryRun?: boolean;
|
|
1921
|
+
"dry-run"?: boolean;
|
|
1922
|
+
/** Frozen context — refuse without override. */
|
|
1923
|
+
frozen?: boolean;
|
|
1924
|
+
/** Explicit override to allow update under frozen (not used in M6 accept). */
|
|
1925
|
+
force?: boolean;
|
|
1926
|
+
override?: boolean;
|
|
1927
|
+
/** Package scope (rs-012). */
|
|
1928
|
+
packages?: string[];
|
|
1929
|
+
scope?: string[];
|
|
1930
|
+
updatePackageNames?: string[];
|
|
1931
|
+
gitRemote?: GitRemote;
|
|
1932
|
+
tagLister?: TagLister;
|
|
1933
|
+
downloader?: Downloader;
|
|
1934
|
+
parallelDownloads?: number;
|
|
1935
|
+
maxDepth?: number;
|
|
1936
|
+
/**
|
|
1937
|
+
* When true, plan text includes `keep` / `[=]` rows.
|
|
1938
|
+
* Default quiet: keep rows are omitted from printed text (plan array stays full).
|
|
1939
|
+
*/
|
|
1940
|
+
verbose?: boolean;
|
|
1941
|
+
/** Injected confirm for TTY tests; return true to apply. */
|
|
1942
|
+
confirm?: () => boolean | Promise<boolean>;
|
|
1943
|
+
/** Whether stdin is a TTY (default: process.stdin.isTTY). */
|
|
1944
|
+
isTTY?: boolean;
|
|
1945
|
+
/** Explicit policy file path. */
|
|
1946
|
+
policyPath?: string;
|
|
1947
|
+
policy?: string;
|
|
1948
|
+
/** Skip policy gate. */
|
|
1949
|
+
noPolicy?: boolean;
|
|
1950
|
+
};
|
|
1951
|
+
type UpdateResult = {
|
|
1952
|
+
ok: boolean;
|
|
1953
|
+
exitCode: number;
|
|
1954
|
+
dryRun: boolean;
|
|
1955
|
+
plan: UpdatePlanEntry[];
|
|
1956
|
+
text: string;
|
|
1957
|
+
lockPath?: string;
|
|
1958
|
+
};
|
|
1959
|
+
//#endregion
|
|
1960
|
+
//#region src/modules/Update/errors.d.ts
|
|
1961
|
+
type UpdateErrorCode = "UPDATE_FROZEN_REFUSED" | "UPDATE_CONFIRM_REQUIRED" | "UPDATE_FAILED";
|
|
1962
|
+
declare class UpdateError extends Error {
|
|
1963
|
+
readonly code: UpdateErrorCode;
|
|
1964
|
+
readonly details?: Record<string, unknown>;
|
|
1965
|
+
constructor(code: UpdateErrorCode, message: string, options?: {
|
|
1966
|
+
details?: Record<string, unknown>;
|
|
1967
|
+
cause?: unknown;
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
//#endregion
|
|
1971
|
+
//#region src/modules/Update/runUpdate.d.ts
|
|
1972
|
+
/**
|
|
1973
|
+
* Plan and optionally apply a full/scoped dependency update.
|
|
1974
|
+
*/
|
|
1975
|
+
declare function runUpdate(options?: RunUpdateOptions): Promise<UpdateResult>;
|
|
1976
|
+
declare const updateProject: typeof runUpdate;
|
|
1977
|
+
//#endregion
|
|
1978
|
+
//#region src/modules/Outdated/types.d.ts
|
|
1979
|
+
type OutdatedStatus = "outdated" | "up-to-date" | "unknown";
|
|
1980
|
+
type OutdatedRow = {
|
|
1981
|
+
name: string;
|
|
1982
|
+
status: OutdatedStatus;
|
|
1983
|
+
current?: string;
|
|
1984
|
+
latest?: string;
|
|
1985
|
+
repo_url?: string;
|
|
1986
|
+
/** Tip ref used for the check (verbose / diagnostics). */
|
|
1987
|
+
tip_ref?: string;
|
|
1988
|
+
/** Skip / path reason when verbose. */
|
|
1989
|
+
detail?: string;
|
|
1990
|
+
};
|
|
1991
|
+
/** APM-aligned default for remote outdated checks. */
|
|
1992
|
+
declare const DEFAULT_PARALLEL_CHECKS = 4;
|
|
1993
|
+
type RunOutdatedOptions = {
|
|
1994
|
+
cwd?: string;
|
|
1995
|
+
gitRemote?: GitRemote;
|
|
1996
|
+
tagLister?: TagLister;
|
|
1997
|
+
/** Richer human-readable detail (chosen tip, skip reasons, candidates). */
|
|
1998
|
+
verbose?: boolean;
|
|
1999
|
+
/**
|
|
2000
|
+
* Max concurrent remote checks (default 4). `0` = serial.
|
|
2001
|
+
* Unresolved/`undefined` resolves to {@link DEFAULT_PARALLEL_CHECKS}.
|
|
2002
|
+
*/
|
|
2003
|
+
parallelChecks?: number;
|
|
2004
|
+
};
|
|
2005
|
+
type OutdatedResult = {
|
|
2006
|
+
ok: boolean;
|
|
2007
|
+
exitCode: number;
|
|
2008
|
+
rows: OutdatedRow[];
|
|
2009
|
+
text: string;
|
|
2010
|
+
message?: string;
|
|
2011
|
+
};
|
|
2012
|
+
//#endregion
|
|
2013
|
+
//#region src/modules/Outdated/errors.d.ts
|
|
2014
|
+
type OutdatedErrorCode = "OUTDATED_NO_LOCK" | "OUTDATED_FAILED";
|
|
2015
|
+
declare class OutdatedError extends Error {
|
|
2016
|
+
readonly code: OutdatedErrorCode;
|
|
2017
|
+
readonly details?: Record<string, unknown>;
|
|
2018
|
+
constructor(code: OutdatedErrorCode, message: string, options?: {
|
|
2019
|
+
details?: Record<string, unknown>;
|
|
2020
|
+
cause?: unknown;
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
//#endregion
|
|
2024
|
+
//#region src/modules/Outdated/runOutdated.d.ts
|
|
2025
|
+
/**
|
|
2026
|
+
* Compare lock pins to remote tips / latest matching semver tags.
|
|
2027
|
+
* Exit 0 even when outdated rows exist; no lock → throw / non-success.
|
|
2028
|
+
* Read-only: never writes project artifacts.
|
|
2029
|
+
*/
|
|
2030
|
+
declare function runOutdated(options?: RunOutdatedOptions): Promise<OutdatedResult>;
|
|
2031
|
+
declare const checkOutdated: typeof runOutdated;
|
|
2032
|
+
declare const outdated: typeof runOutdated;
|
|
2033
|
+
//#endregion
|
|
2034
|
+
//#region src/modules/Outdated/revisionPin.d.ts
|
|
2035
|
+
type AnnotatedTagCandidate = {
|
|
2036
|
+
tag: string;
|
|
2037
|
+
commit: string;
|
|
2038
|
+
};
|
|
2039
|
+
declare function isFullRevisionPin(ref: string | undefined | null): boolean;
|
|
2040
|
+
declare function abbreviateSha(sha: string, n?: number): string;
|
|
2041
|
+
/** Basename for `{name}` tag patterns (repo URL or `path:` virtual). */
|
|
2042
|
+
declare function packageBasenameFromRepo(repoUrl: string): string;
|
|
2043
|
+
/**
|
|
2044
|
+
* Highest non-prerelease annotated semver tag (APM `find_latest_annotated_tag`).
|
|
2045
|
+
* Only `annotated === true`; lightweight / missing evidence excluded (fail-closed).
|
|
2046
|
+
*/
|
|
2047
|
+
declare function findLatestAnnotatedTag(tags: FakeTag[], packageName: string): AnnotatedTagCandidate | null;
|
|
2048
|
+
//#endregion
|
|
2049
|
+
//#region src/modules/Uninstall/types.d.ts
|
|
2050
|
+
type RunUninstallOptions = {
|
|
2051
|
+
cwd?: string;
|
|
2052
|
+
packages?: string[];
|
|
2053
|
+
names?: string[];
|
|
2054
|
+
dryRun?: boolean;
|
|
2055
|
+
"dry-run"?: boolean;
|
|
2056
|
+
};
|
|
2057
|
+
type UninstallResult = {
|
|
2058
|
+
ok: boolean;
|
|
2059
|
+
exitCode: number;
|
|
2060
|
+
dryRun: boolean;
|
|
2061
|
+
removed: string[];
|
|
2062
|
+
text: string;
|
|
2063
|
+
plan?: string[];
|
|
2064
|
+
};
|
|
2065
|
+
//#endregion
|
|
2066
|
+
//#region src/modules/Uninstall/errors.d.ts
|
|
2067
|
+
type UninstallErrorCode = "UNINSTALL_UNKNOWN" | "UNINSTALL_NO_PACKAGES" | "UNINSTALL_FAILED";
|
|
2068
|
+
declare class UninstallError extends Error {
|
|
2069
|
+
readonly code: UninstallErrorCode;
|
|
2070
|
+
readonly details?: Record<string, unknown>;
|
|
2071
|
+
constructor(code: UninstallErrorCode, message: string, options?: {
|
|
2072
|
+
details?: Record<string, unknown>;
|
|
2073
|
+
cause?: unknown;
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
//#endregion
|
|
2077
|
+
//#region src/modules/Uninstall/runUninstall.d.ts
|
|
2078
|
+
/**
|
|
2079
|
+
* Remove named packages from manifest + modules + deployed inventory + lock.
|
|
2080
|
+
*/
|
|
2081
|
+
declare function runUninstall(options?: RunUninstallOptions): Promise<UninstallResult>;
|
|
2082
|
+
declare const uninstallPackages: typeof runUninstall;
|
|
2083
|
+
declare const uninstall: typeof runUninstall;
|
|
2084
|
+
//#endregion
|
|
2085
|
+
//#region src/modules/Prune/types.d.ts
|
|
2086
|
+
type RunPruneOptions = {
|
|
2087
|
+
cwd?: string;
|
|
2088
|
+
dryRun?: boolean;
|
|
2089
|
+
"dry-run"?: boolean;
|
|
2090
|
+
};
|
|
2091
|
+
type PruneResult = {
|
|
2092
|
+
ok: boolean;
|
|
2093
|
+
exitCode: number;
|
|
2094
|
+
dryRun: boolean;
|
|
2095
|
+
orphans: string[];
|
|
2096
|
+
removed: string[];
|
|
2097
|
+
text: string;
|
|
2098
|
+
};
|
|
2099
|
+
//#endregion
|
|
2100
|
+
//#region src/modules/Prune/errors.d.ts
|
|
2101
|
+
type PruneErrorCode = "PRUNE_FAILED";
|
|
2102
|
+
declare class PruneError extends Error {
|
|
2103
|
+
readonly code: PruneErrorCode;
|
|
2104
|
+
constructor(code: PruneErrorCode, message: string, options?: {
|
|
2105
|
+
cause?: unknown;
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
2108
|
+
//#endregion
|
|
2109
|
+
//#region src/modules/Prune/runPrune.d.ts
|
|
2110
|
+
/**
|
|
2111
|
+
* Remove package dirs under apm_modules that are not in the lock graph.
|
|
2112
|
+
*/
|
|
2113
|
+
declare function runPrune(options?: RunPruneOptions): Promise<PruneResult>;
|
|
2114
|
+
declare const pruneModules: typeof runPrune;
|
|
2115
|
+
declare const prune: typeof runPrune;
|
|
2116
|
+
//#endregion
|
|
2117
|
+
//#region src/modules/Deps/types.d.ts
|
|
2118
|
+
type RunDepsOptions = {
|
|
2119
|
+
cwd?: string;
|
|
2120
|
+
package?: string;
|
|
2121
|
+
name?: string;
|
|
2122
|
+
packages?: string[];
|
|
2123
|
+
};
|
|
2124
|
+
type DepsListResult = {
|
|
2125
|
+
ok: boolean;
|
|
2126
|
+
exitCode: number;
|
|
2127
|
+
packages: Array<Record<string, unknown>>;
|
|
2128
|
+
text: string;
|
|
2129
|
+
};
|
|
2130
|
+
type DepsTreeResult = {
|
|
2131
|
+
ok: boolean;
|
|
2132
|
+
exitCode: number;
|
|
2133
|
+
tree: unknown;
|
|
2134
|
+
text: string;
|
|
2135
|
+
};
|
|
2136
|
+
/** Identity + inspect meta for a lock package in why output. */
|
|
2137
|
+
type DepsWhyPackage = {
|
|
2138
|
+
name?: string;
|
|
2139
|
+
repo_url?: string;
|
|
2140
|
+
version: string;
|
|
2141
|
+
source: string;
|
|
2142
|
+
is_direct: boolean;
|
|
2143
|
+
};
|
|
2144
|
+
/** One node in a why path chain (root → target). */
|
|
2145
|
+
type DepsWhyPathNode = {
|
|
2146
|
+
name?: string;
|
|
2147
|
+
repo_url?: string;
|
|
2148
|
+
constraint: string | null;
|
|
2149
|
+
is_direct: boolean;
|
|
2150
|
+
};
|
|
2151
|
+
type DepsWhyPath = {
|
|
2152
|
+
chain: DepsWhyPathNode[];
|
|
2153
|
+
};
|
|
2154
|
+
type DepsWhyError = "no_lockfile" | "not_installed" | "ambiguous";
|
|
2155
|
+
type DepsWhyResult = {
|
|
2156
|
+
ok: boolean;
|
|
2157
|
+
exitCode: number;
|
|
2158
|
+
chains: string[][];
|
|
2159
|
+
text: string;
|
|
2160
|
+
package?: DepsWhyPackage;
|
|
2161
|
+
paths?: DepsWhyPath[];
|
|
2162
|
+
error?: DepsWhyError;
|
|
2163
|
+
query?: string;
|
|
2164
|
+
matches?: Array<{
|
|
2165
|
+
name?: string;
|
|
2166
|
+
repo_url?: string;
|
|
2167
|
+
}>;
|
|
2168
|
+
};
|
|
2169
|
+
//#endregion
|
|
2170
|
+
//#region src/modules/Deps/listDeps.d.ts
|
|
2171
|
+
declare function listDeps(options?: RunDepsOptions): DepsListResult;
|
|
2172
|
+
declare const depsList: typeof listDeps;
|
|
2173
|
+
declare const runDepsList: typeof listDeps;
|
|
2174
|
+
//#endregion
|
|
2175
|
+
//#region src/modules/Deps/treeDeps.d.ts
|
|
2176
|
+
declare function treeDeps(options?: RunDepsOptions): DepsTreeResult;
|
|
2177
|
+
declare const depsTree: typeof treeDeps;
|
|
2178
|
+
declare const runDepsTree: typeof treeDeps;
|
|
2179
|
+
//#endregion
|
|
2180
|
+
//#region src/modules/Deps/resolvePackageQuery.d.ts
|
|
2181
|
+
/**
|
|
2182
|
+
* Staged resolve: exact name|repo_url → unique owner/repo → unique basename.
|
|
2183
|
+
* Stop at the first form with ≥1 match (ambiguous if ≥2 at that form).
|
|
2184
|
+
*/
|
|
2185
|
+
declare function resolvePackageQuery(deps: LockedDependency[], query: string): LockedDependency[];
|
|
2186
|
+
/** Last path segment of `repo_url`, trailing `.git` stripped. */
|
|
2187
|
+
declare function repoBasename(repoUrl: string): string | null;
|
|
2188
|
+
/**
|
|
2189
|
+
* Last two path segments as `owner/repo` (`.git` stripped on repo).
|
|
2190
|
+
* Fewer than two segments → full trimmed `repo_url` as identity.
|
|
2191
|
+
*/
|
|
2192
|
+
declare function repoOwnerRepo(repoUrl: string): string | null;
|
|
2193
|
+
//#endregion
|
|
2194
|
+
//#region src/modules/Deps/whyDeps.d.ts
|
|
2195
|
+
/**
|
|
2196
|
+
* Offline reverse walk from lock edges (rs-005 SHOULD).
|
|
2197
|
+
* Honest exits: 0 success, 1 not_installed/ambiguous, 2 no_lockfile.
|
|
2198
|
+
*/
|
|
2199
|
+
declare function whyDeps(options?: RunDepsOptions): DepsWhyResult;
|
|
2200
|
+
declare const depsWhy: typeof whyDeps;
|
|
2201
|
+
declare const runDepsWhy: typeof whyDeps;
|
|
2202
|
+
//#endregion
|
|
2203
|
+
//#region src/modules/Audit/types.d.ts
|
|
2204
|
+
type AuditCiFormat = "text" | "json" | "sarif";
|
|
2205
|
+
type RunAuditCiOptions = {
|
|
2206
|
+
cwd?: string;
|
|
2207
|
+
ci?: boolean;
|
|
2208
|
+
/** When set, `body` is the serialized document and `text` mirrors it for json/sarif. */
|
|
2209
|
+
format?: AuditCiFormat;
|
|
2210
|
+
};
|
|
2211
|
+
type AuditCiCheckName = "lockfile-exists" | "content-integrity" | "tree-sha256";
|
|
2212
|
+
type AuditCiCheck = {
|
|
2213
|
+
name: AuditCiCheckName;
|
|
2214
|
+
passed: boolean;
|
|
2215
|
+
message: string;
|
|
2216
|
+
details: string[];
|
|
2217
|
+
/**
|
|
2218
|
+
* Project-relative URIs aligned with `details` (or a single fallback) for SARIF.
|
|
2219
|
+
* Omitted from JSON serialization.
|
|
2220
|
+
*/
|
|
2221
|
+
locations?: string[];
|
|
2222
|
+
};
|
|
2223
|
+
type AuditCiSummary = {
|
|
2224
|
+
total: number;
|
|
2225
|
+
passed: number;
|
|
2226
|
+
failed: number;
|
|
2227
|
+
};
|
|
2228
|
+
type AuditCiStructuredReport = {
|
|
2229
|
+
passed: boolean;
|
|
2230
|
+
checks: AuditCiCheck[];
|
|
2231
|
+
summary: AuditCiSummary;
|
|
2232
|
+
};
|
|
2233
|
+
type AuditCiResult = {
|
|
2234
|
+
ok: boolean;
|
|
2235
|
+
exitCode: number;
|
|
2236
|
+
violations: string[];
|
|
2237
|
+
diagnostics: string[];
|
|
2238
|
+
text: string;
|
|
2239
|
+
checks: AuditCiCheck[];
|
|
2240
|
+
/** Same as overall gate: true iff every check passed. */
|
|
2241
|
+
passed: boolean;
|
|
2242
|
+
summary: AuditCiSummary;
|
|
2243
|
+
/** Relative lock path when discovered (SARIF fallback uri). */
|
|
2244
|
+
lockRelativePath?: string;
|
|
2245
|
+
/** Serialized body when `format` was json/sarif. */
|
|
2246
|
+
body?: string;
|
|
2247
|
+
};
|
|
2248
|
+
//#endregion
|
|
2249
|
+
//#region src/modules/Audit/runAuditCi.d.ts
|
|
2250
|
+
/**
|
|
2251
|
+
* CI gate: lock present; deployed files present; hash re-verify (lk-017/sc-001);
|
|
2252
|
+
* git tree_sha256 re-verify (lk-015) — fail-closed on missing/mismatch.
|
|
2253
|
+
* Always emits three structured checks in fixed order.
|
|
2254
|
+
*/
|
|
2255
|
+
declare function runAuditCi(options?: RunAuditCiOptions): Promise<AuditCiResult>;
|
|
2256
|
+
declare const auditCi: typeof runAuditCi;
|
|
2257
|
+
declare const runAudit: typeof runAuditCi;
|
|
2258
|
+
//#endregion
|
|
2259
|
+
//#region src/modules/Audit/formatAuditCi.d.ts
|
|
2260
|
+
declare function summarizeChecks(checks: AuditCiCheck[]): AuditCiSummary;
|
|
2261
|
+
declare function toStructuredReport(result: AuditCiResult): AuditCiStructuredReport;
|
|
2262
|
+
/**
|
|
2263
|
+
* Pure JSON serializer (indent 2, stable top-level key order: passed → checks → summary).
|
|
2264
|
+
*/
|
|
2265
|
+
declare function formatAuditCiJson(result: AuditCiResult): string;
|
|
2266
|
+
/**
|
|
2267
|
+
* Pure SARIF 2.1.0 serializer. No snippets / no file body regions.
|
|
2268
|
+
*/
|
|
2269
|
+
declare function formatAuditCiSarif(result: AuditCiResult): string;
|
|
2270
|
+
//#endregion
|
|
2271
|
+
//#region src/modules/Export/types.d.ts
|
|
2272
|
+
/** Supported SBOM format identifiers (case-insensitive). */
|
|
2273
|
+
declare const FORMAT_CYCLONEDX = "cyclonedx";
|
|
2274
|
+
declare const FORMAT_SPDX = "spdx";
|
|
2275
|
+
declare const SUPPORTED_FORMATS: readonly ["cyclonedx", "spdx"];
|
|
2276
|
+
type SbomFormat = (typeof SUPPORTED_FORMATS)[number];
|
|
2277
|
+
declare const CYCLONEDX_SPEC_VERSION = "1.5";
|
|
2278
|
+
declare const SPDX_VERSION = "SPDX-2.3";
|
|
2279
|
+
declare const FIXED_EPOCH_TIMESTAMP = "1970-01-01T00:00:00Z";
|
|
2280
|
+
type ExportSbomOptions = {
|
|
2281
|
+
/** In-memory lock document; when omitted, load from `cwd`. */
|
|
2282
|
+
document?: LockfileDocument | LockfileInput | Record<string, unknown>;
|
|
2283
|
+
/** Project root for lock discovery when `document` is omitted. */
|
|
2284
|
+
cwd?: string;
|
|
2285
|
+
/** `cyclonedx` (default) or `spdx`. */
|
|
2286
|
+
format?: string;
|
|
2287
|
+
/** Explicit ISO timestamp (wins over SOURCE_DATE_EPOCH / generated_at). */
|
|
2288
|
+
timestamp?: string;
|
|
2289
|
+
};
|
|
2290
|
+
type ExportSbomSuccess = {
|
|
2291
|
+
ok: true;
|
|
2292
|
+
json: string;
|
|
2293
|
+
format: SbomFormat;
|
|
2294
|
+
};
|
|
2295
|
+
type ExportSbomFailure = {
|
|
2296
|
+
ok: false;
|
|
2297
|
+
error: string;
|
|
2298
|
+
};
|
|
2299
|
+
type ExportSbomResult = ExportSbomSuccess | ExportSbomFailure;
|
|
2300
|
+
type InventoryDep = LockedDependency & {
|
|
2301
|
+
declared_license?: string;
|
|
2302
|
+
content_hash?: string;
|
|
2303
|
+
host_type?: string;
|
|
2304
|
+
};
|
|
2305
|
+
//#endregion
|
|
2306
|
+
//#region src/modules/Export/purl.d.ts
|
|
2307
|
+
/**
|
|
2308
|
+
* Remove embedded credentials from *url* before it appears in SBOM output.
|
|
2309
|
+
* Drops userinfo and the entire query string; keeps scheme/host/port/path/fragment.
|
|
2310
|
+
*/
|
|
2311
|
+
declare function scrubUrl(url: string): string;
|
|
2312
|
+
/** Build the Package URL identity for *dep* from lockfile fields only. */
|
|
2313
|
+
declare function buildPurl(dep: InventoryDep): string;
|
|
2314
|
+
declare function componentName(dep: InventoryDep): string;
|
|
2315
|
+
declare function componentVersion(dep: InventoryDep): string | undefined;
|
|
2316
|
+
//#endregion
|
|
2317
|
+
//#region src/modules/Export/license.d.ts
|
|
2318
|
+
/**
|
|
2319
|
+
* Offline SPDX declared-license classifier (APM-aligned three-state).
|
|
2320
|
+
* Uses a compact built-in id set; unrecognized strings render as named, never rejected.
|
|
2321
|
+
*/
|
|
2322
|
+
declare const KIND_ID = "id";
|
|
2323
|
+
declare const KIND_EXPRESSION = "expression";
|
|
2324
|
+
declare const KIND_NAMED = "named";
|
|
2325
|
+
type LicenseKind = typeof KIND_ID | typeof KIND_EXPRESSION | typeof KIND_NAMED;
|
|
2326
|
+
type LicenseClass = {
|
|
2327
|
+
kind: LicenseKind;
|
|
2328
|
+
value: string;
|
|
2329
|
+
};
|
|
2330
|
+
/** Classify a non-empty declared license string for SBOM rendering. */
|
|
2331
|
+
declare function classifyDeclaredLicense(declared: string): LicenseClass;
|
|
2332
|
+
//#endregion
|
|
2333
|
+
//#region src/modules/Export/serialize.d.ts
|
|
2334
|
+
declare function normalizeFormat(fmt: string | undefined): SbomFormat | null;
|
|
2335
|
+
declare function formatUnsupportedMessage(fmt: string): string;
|
|
2336
|
+
/** Serialize lock inventory to deterministic SBOM JSON (indent 2, sorted keys, trailing newline). */
|
|
2337
|
+
declare function serializeSbom(document: LockfileDocument | LockfileInput, format: SbomFormat, timestamp: string): string;
|
|
2338
|
+
//#endregion
|
|
2339
|
+
//#region src/modules/Export/exportSbom.d.ts
|
|
2340
|
+
/**
|
|
2341
|
+
* Export an SBOM inventory from lock fields only (no resolve / network / mutation).
|
|
2342
|
+
*/
|
|
2343
|
+
declare function exportSbom(options?: ExportSbomOptions): Promise<ExportSbomResult>;
|
|
2344
|
+
//#endregion
|
|
2345
|
+
//#region src/modules/Doctor/types.d.ts
|
|
2346
|
+
type DoctorCheck = {
|
|
2347
|
+
name: string;
|
|
2348
|
+
ok: boolean;
|
|
2349
|
+
critical: boolean;
|
|
2350
|
+
message: string;
|
|
2351
|
+
};
|
|
2352
|
+
type RunDoctorOptions = {
|
|
2353
|
+
cwd?: string;
|
|
2354
|
+
/** When true, enrich domain messages and run verbose-only probes (e.g. network). */
|
|
2355
|
+
verbose?: boolean;
|
|
2356
|
+
gitAvailable?: boolean;
|
|
2357
|
+
hasGit?: boolean;
|
|
2358
|
+
whichGit?: () => string | null | undefined;
|
|
2359
|
+
findGit?: () => string | null | undefined;
|
|
2360
|
+
};
|
|
2361
|
+
type DoctorResult = {
|
|
2362
|
+
ok: boolean;
|
|
2363
|
+
exitCode: number;
|
|
2364
|
+
checks: DoctorCheck[];
|
|
2365
|
+
text: string;
|
|
2366
|
+
};
|
|
2367
|
+
//#endregion
|
|
2368
|
+
//#region src/modules/Doctor/runDoctor.d.ts
|
|
2369
|
+
declare function runDoctor(options?: RunDoctorOptions): Promise<DoctorResult>;
|
|
2370
|
+
declare const doctor: typeof runDoctor;
|
|
2371
|
+
declare const checkDoctor: typeof runDoctor;
|
|
2372
|
+
//#endregion
|
|
2373
|
+
//#region src/modules/Pack/types.d.ts
|
|
2374
|
+
type RunPackOptions = {
|
|
2375
|
+
cwd?: string;
|
|
2376
|
+
/** Pack an Agent Plugins v1 portable root (never a marketplace output). */
|
|
2377
|
+
agentPlugins?: boolean;
|
|
2378
|
+
/** Produce a durable archive (MUST path for M7). */
|
|
2379
|
+
archive?: boolean;
|
|
2380
|
+
/** Archive format; only `zip` is supported in M7. */
|
|
2381
|
+
format?: string;
|
|
2382
|
+
/** Validate and collect without writing a durable artifact. */
|
|
2383
|
+
dryRun?: boolean;
|
|
2384
|
+
/** Explicit output zip path; defaults to `{name}-{version}.zip` under cwd. */
|
|
2385
|
+
outputPath?: string;
|
|
2386
|
+
/** Also run pr-004 release gate before packing. */
|
|
2387
|
+
checkRelease?: boolean;
|
|
2388
|
+
/** Tag override for `--check-release`. */
|
|
2389
|
+
tag?: string;
|
|
2390
|
+
/**
|
|
2391
|
+
* CLI `--marketplace` filter: `all` | `none` | comma list / string[].
|
|
2392
|
+
* When omitted, emit all formats enabled in authoring `outputs`.
|
|
2393
|
+
*/
|
|
2394
|
+
marketplace?: string | string[];
|
|
2395
|
+
/** CLI `--marketplace-path FORMAT=PATH` overrides. */
|
|
2396
|
+
marketplacePaths?: Record<string, string> | string[];
|
|
2397
|
+
/** Fail-closed remote resolve without network. */
|
|
2398
|
+
offline?: boolean;
|
|
2399
|
+
/** Include prerelease tags when resolving version ranges. */
|
|
2400
|
+
includePrerelease?: boolean;
|
|
2401
|
+
/** Composition-root registry of marketplace-output integrations. */
|
|
2402
|
+
marketplaceOutputs?: MarketplaceOutputRegistry;
|
|
2403
|
+
/** Injectable ls-remote for tests (forwarded to marketplace builder). */
|
|
2404
|
+
lsRemote?: (repoUrl: string, ref?: string) => Promise<{
|
|
2405
|
+
sha: string;
|
|
2406
|
+
ref: string;
|
|
2407
|
+
}> | {
|
|
2408
|
+
sha: string;
|
|
2409
|
+
ref: string;
|
|
2410
|
+
};
|
|
2411
|
+
};
|
|
2412
|
+
type RunPackResult = {
|
|
2413
|
+
ok: true;
|
|
2414
|
+
dryRun: boolean;
|
|
2415
|
+
archivePath?: string;
|
|
2416
|
+
filesPacked: number;
|
|
2417
|
+
marketplaceWritten?: boolean;
|
|
2418
|
+
};
|
|
2419
|
+
type ExtractPackArchiveOptions = {
|
|
2420
|
+
/** Absolute or relative path to the zip archive. */
|
|
2421
|
+
archivePath?: string;
|
|
2422
|
+
/** Alias for `archivePath`. */
|
|
2423
|
+
path?: string;
|
|
2424
|
+
/** Project / extract root (aliases: `outputDir`, `dest`). */
|
|
2425
|
+
cwd?: string;
|
|
2426
|
+
outputDir?: string;
|
|
2427
|
+
dest?: string;
|
|
2428
|
+
};
|
|
2429
|
+
type ExtractPackArchiveResult = {
|
|
2430
|
+
ok: true;
|
|
2431
|
+
outputDir: string;
|
|
2432
|
+
filesExtracted: number;
|
|
2433
|
+
};
|
|
2434
|
+
type CheckReleaseTagOptions = {
|
|
2435
|
+
cwd?: string;
|
|
2436
|
+
/** Explicit release tag (optional leading `v`). */
|
|
2437
|
+
tag?: string;
|
|
2438
|
+
/**
|
|
2439
|
+
* When true, treat the tag as unsigned for pr-005 advisory.
|
|
2440
|
+
* MUST NOT fail solely for unsigned in M7.
|
|
2441
|
+
*/
|
|
2442
|
+
unsigned?: boolean;
|
|
2443
|
+
/** Hard-require signature — ignored as fail condition in M7 (advisory only). */
|
|
2444
|
+
requireSignature?: boolean;
|
|
2445
|
+
};
|
|
2446
|
+
type CheckReleaseTagResult = {
|
|
2447
|
+
ok: true;
|
|
2448
|
+
exitCode: 0;
|
|
2449
|
+
tag: string;
|
|
2450
|
+
version: string;
|
|
2451
|
+
warnings: string[];
|
|
2452
|
+
};
|
|
2453
|
+
//#endregion
|
|
2454
|
+
//#region src/modules/Pack/errors.d.ts
|
|
2455
|
+
/** Typed diagnostics for pack / extract / release-gate. */
|
|
2456
|
+
type PackErrorCode = "PACK_VALIDATION" | "PACK_SECRET_REFUSED" | "PACK_IO" | "PACK_EXTRACT" | "RELEASE_TAG_MISSING" | "RELEASE_TAG_INVALID" | "RELEASE_TAG_MISMATCH";
|
|
2457
|
+
declare class PackError extends Error {
|
|
2458
|
+
readonly code: PackErrorCode;
|
|
2459
|
+
readonly path?: string;
|
|
2460
|
+
readonly details?: Record<string, unknown>;
|
|
2461
|
+
constructor(code: PackErrorCode, message: string, options?: {
|
|
2462
|
+
path?: string;
|
|
2463
|
+
details?: Record<string, unknown>;
|
|
2464
|
+
cause?: unknown;
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2467
|
+
//#endregion
|
|
2468
|
+
//#region src/modules/Pack/runPack.d.ts
|
|
2469
|
+
/**
|
|
2470
|
+
* Validate project manifest, collect pack set, refuse secrets, optionally write plain zip.
|
|
2471
|
+
* When marketplace authoring + outputs are selected, emit host marketplace.json (design D1–D2).
|
|
2472
|
+
* When `checkRelease` is set, runs pr-004 gate first (fail closed before durable zip).
|
|
2473
|
+
*/
|
|
2474
|
+
declare function runPack(options?: RunPackOptions): Promise<RunPackResult>;
|
|
2475
|
+
/** Alias accepted by acceptance helpers. */
|
|
2476
|
+
declare const packProject: typeof runPack;
|
|
2477
|
+
declare const packArchive: typeof runPack;
|
|
2478
|
+
//#endregion
|
|
2479
|
+
//#region src/modules/Pack/extract.d.ts
|
|
2480
|
+
/**
|
|
2481
|
+
* Extract a pack-produced plain zip into an output directory.
|
|
2482
|
+
* Expects dual-read manifest at archive root after extract.
|
|
2483
|
+
* Uses shared safe-extract (symlink / path-escape / caps / fail-closed cleanup).
|
|
2484
|
+
*/
|
|
2485
|
+
declare function extractPackArchive(options?: ExtractPackArchiveOptions): Promise<ExtractPackArchiveResult>;
|
|
2486
|
+
/** Aliases for acceptance helpers. */
|
|
2487
|
+
declare const unpackArchive: typeof extractPackArchive;
|
|
2488
|
+
declare const extractPack: typeof extractPackArchive;
|
|
2489
|
+
//#endregion
|
|
2490
|
+
//#region src/modules/Pack/safeExtract.d.ts
|
|
2491
|
+
declare const MAX_SAFE_ENTRIES = 10000;
|
|
2492
|
+
declare const MAX_SAFE_UNCOMPRESSED_BYTES: number;
|
|
2493
|
+
declare class SafeExtractError extends Error {
|
|
2494
|
+
readonly path?: string;
|
|
2495
|
+
constructor(message: string, options?: {
|
|
2496
|
+
path?: string;
|
|
2497
|
+
cause?: unknown;
|
|
2498
|
+
});
|
|
2499
|
+
}
|
|
2500
|
+
type ZipCdEntry = {
|
|
2501
|
+
name: string;
|
|
2502
|
+
uncompressedSize: number;
|
|
2503
|
+
compressedSize: number;
|
|
2504
|
+
externalAttr: number;
|
|
2505
|
+
createSystem: number;
|
|
2506
|
+
isDirectory: boolean;
|
|
2507
|
+
};
|
|
2508
|
+
/**
|
|
2509
|
+
* Parse zip central-directory entries (names, sizes, unix external_attr).
|
|
2510
|
+
*/
|
|
2511
|
+
declare function parseZipCentralDirectory(bytes: Uint8Array): ZipCdEntry[];
|
|
2512
|
+
/**
|
|
2513
|
+
* Pre-scan CD: paths, symlink/non-regular, entry + size caps (fail before write).
|
|
2514
|
+
*/
|
|
2515
|
+
declare function assertSafeZipCentralDirectory(entries: ZipCdEntry[]): void;
|
|
2516
|
+
type SafeExtractZipResult = {
|
|
2517
|
+
filesExtracted: number;
|
|
2518
|
+
dest: string;
|
|
2519
|
+
};
|
|
2520
|
+
/**
|
|
2521
|
+
* Fail-closed extract into `dest` via same-filesystem staging + rename.
|
|
2522
|
+
* On any error, staging is removed and `dest` is not left as a half-write from this call.
|
|
2523
|
+
*/
|
|
2524
|
+
declare function safeExtractZip(bytes: Uint8Array, dest: string): SafeExtractZipResult;
|
|
2525
|
+
//#endregion
|
|
2526
|
+
//#region src/modules/Pack/checkRelease.d.ts
|
|
2527
|
+
/**
|
|
2528
|
+
* pr-004: compare release tag (optional leading `v`) to manifest `version`.
|
|
2529
|
+
* Never creates or pushes tags. pr-005 unsigned is advisory only.
|
|
2530
|
+
*/
|
|
2531
|
+
declare function checkReleaseTag(options?: CheckReleaseTagOptions): Promise<CheckReleaseTagResult>;
|
|
2532
|
+
/** Aliases for acceptance helpers. */
|
|
2533
|
+
declare const checkRelease: typeof checkReleaseTag;
|
|
2534
|
+
declare const runCheckRelease: typeof checkReleaseTag;
|
|
2535
|
+
//#endregion
|
|
2536
|
+
//#region src/modules/Pack/secrets.d.ts
|
|
2537
|
+
/**
|
|
2538
|
+
* OpenAPM sc-007 producer secret-pattern refuse (fixed denylist for M7).
|
|
2539
|
+
* Match against basename of paths that would enter the pack set.
|
|
2540
|
+
*/
|
|
2541
|
+
declare function isSecretPackPath(relativePath: string): boolean;
|
|
2542
|
+
declare function describeSecretRefuse(relativePath: string): string;
|
|
2543
|
+
//#endregion
|
|
2544
|
+
//#region src/modules/Auth/types.d.ts
|
|
2545
|
+
/**
|
|
2546
|
+
* Shared Auth types — OpenAPM §10.3 credential host-class / resolve / git child env.
|
|
2547
|
+
*/
|
|
2548
|
+
type ProviderHostClass = "github" | "ghe_cloud" | "ghes" | "gitlab" | "ado" | "generic";
|
|
2549
|
+
type RegistryAliasEntry = {
|
|
2550
|
+
url: string;
|
|
2551
|
+
aliases?: string[];
|
|
2552
|
+
insecure?: boolean;
|
|
2553
|
+
[key: string]: unknown;
|
|
2554
|
+
};
|
|
2555
|
+
type RegistryAliasMap = Record<string, RegistryAliasEntry | string>;
|
|
2556
|
+
type ResolvedCredentials = {
|
|
2557
|
+
/** Secret — never log. */
|
|
2558
|
+
readonly token: string;
|
|
2559
|
+
/** Env / source id for diagnostics (sc-007). */
|
|
2560
|
+
readonly source: string;
|
|
2561
|
+
/** Cache / scope key including class + host + port (sc-013 e). */
|
|
2562
|
+
readonly cacheKey: string;
|
|
2563
|
+
/** Explicit port when present (narrows lookup within class). */
|
|
2564
|
+
readonly port?: number;
|
|
2565
|
+
/** PSL / alias credential host-class. */
|
|
2566
|
+
readonly credentialHostClass: string;
|
|
2567
|
+
/** True when a credential was selected for attach. */
|
|
2568
|
+
readonly attached: boolean;
|
|
2569
|
+
};
|
|
2570
|
+
type ResolveCredentialsOptions = {
|
|
2571
|
+
host: string;
|
|
2572
|
+
url?: string;
|
|
2573
|
+
port?: number;
|
|
2574
|
+
env?: NodeJS.ProcessEnv;
|
|
2575
|
+
registries?: RegistryAliasMap;
|
|
2576
|
+
/** Named registry for BAPM_REGISTRY_<NAME>_TOKEN. */
|
|
2577
|
+
registryName?: string;
|
|
2578
|
+
};
|
|
2579
|
+
type SameCredentialHostClassOptions = {
|
|
2580
|
+
registries?: RegistryAliasMap;
|
|
2581
|
+
/** Ignored — redirects never collapse classes (sc-005). */
|
|
2582
|
+
viaRedirect?: boolean;
|
|
2583
|
+
};
|
|
2584
|
+
type BuildGitChildEnvOptions = {
|
|
2585
|
+
host: string;
|
|
2586
|
+
url: string;
|
|
2587
|
+
env?: NodeJS.ProcessEnv;
|
|
2588
|
+
registries?: RegistryAliasMap;
|
|
2589
|
+
};
|
|
2590
|
+
type FetchWithRedirectAuthDropInit = RequestInit & {
|
|
2591
|
+
/** Max redirect hops (default 10). */
|
|
2592
|
+
maxRedirects?: number;
|
|
2593
|
+
/** Alias map for credential class compare. */
|
|
2594
|
+
registries?: RegistryAliasMap;
|
|
2595
|
+
};
|
|
2596
|
+
//#endregion
|
|
2597
|
+
//#region src/modules/Auth/credentialHostClass.d.ts
|
|
2598
|
+
/**
|
|
2599
|
+
* Credential host-class = Public Suffix List eTLD+1 (registrable domain).
|
|
2600
|
+
* Empty / invalid hostnames fall back to the normalized hostname string.
|
|
2601
|
+
*/
|
|
2602
|
+
declare function credentialHostClassOf(hostname: string): string;
|
|
2603
|
+
declare const credentialHostClass: typeof credentialHostClassOf;
|
|
2604
|
+
declare const authHostClassOf: typeof credentialHostClassOf;
|
|
2605
|
+
declare const hostClassForCredentials: typeof credentialHostClassOf;
|
|
2606
|
+
/**
|
|
2607
|
+
* Build union: each aliases[] hostname joins the same credential class as the
|
|
2608
|
+
* registry entry's `url` hostname.
|
|
2609
|
+
*/
|
|
2610
|
+
declare function buildAliasCredentialClassMap(registries?: RegistryAliasMap): Map<string, string>;
|
|
2611
|
+
/**
|
|
2612
|
+
* Effective credential class for a hostname, applying registries.*.aliases union.
|
|
2613
|
+
*/
|
|
2614
|
+
declare function credentialHostClassForHost(hostname: string, registries?: RegistryAliasMap): string;
|
|
2615
|
+
/**
|
|
2616
|
+
* Two hostnames share a credential class iff same PSL eTLD+1 or alias union.
|
|
2617
|
+
* Redirect / CNAME / SAN observation MUST NOT collapse classes.
|
|
2618
|
+
*/
|
|
2619
|
+
declare function sameCredentialHostClass(a: string, b: string, options?: SameCredentialHostClassOptions): boolean;
|
|
2620
|
+
declare const credentialHostClassesEqual: typeof sameCredentialHostClass;
|
|
2621
|
+
declare const hostsShareCredentialClass: typeof sameCredentialHostClass;
|
|
2622
|
+
//#endregion
|
|
2623
|
+
//#region src/modules/Auth/selectProviderClass.d.ts
|
|
2624
|
+
declare function collectAdoHosts(env: NodeJS.ProcessEnv): Set<string>;
|
|
2625
|
+
/**
|
|
2626
|
+
* Select exactly one provider class for a hostname.
|
|
2627
|
+
* Precedence: ado allowlist → (GHES∩GitLab fail) → github.com / ghe.com /
|
|
2628
|
+
* GITHUB_HOST → gitlab allowlist / gitlab.com → ado cloud → generic.
|
|
2629
|
+
*/
|
|
2630
|
+
declare function selectProviderClassForHost(host: string, env?: NodeJS.ProcessEnv): ProviderHostClass;
|
|
2631
|
+
declare const effectiveProviderClassForHost: typeof selectProviderClassForHost;
|
|
2632
|
+
declare const classifyProviderHostClass: typeof selectProviderClassForHost;
|
|
2633
|
+
//#endregion
|
|
2634
|
+
//#region src/modules/Auth/resolveCredentials.d.ts
|
|
2635
|
+
/**
|
|
2636
|
+
* Resolve at most one credential for the host's selected class.
|
|
2637
|
+
* Provider env tokens are never returned for a distinct registry host class,
|
|
2638
|
+
* and registry tokens are never returned for github.com-class provider hosts.
|
|
2639
|
+
*/
|
|
2640
|
+
declare function resolveCredentialsForHost(options: ResolveCredentialsOptions): ResolvedCredentials | null;
|
|
2641
|
+
declare const resolveAuthCredentialsForHost: typeof resolveCredentialsForHost;
|
|
2642
|
+
declare const resolveHostCredentials: typeof resolveCredentialsForHost;
|
|
2643
|
+
/** Auth header map for a resolved credential + provider class. */
|
|
2644
|
+
declare function authHeadersForResolved(resolved: ResolvedCredentials | null, providerClass: ProviderHostClass): Record<string, string>;
|
|
2645
|
+
//#endregion
|
|
2646
|
+
//#region src/modules/Auth/fetchRedirectAuthDrop.d.ts
|
|
2647
|
+
/**
|
|
2648
|
+
* Fetch with redirect: 'manual' hop budget; strip Auth on cross-class Location.
|
|
2649
|
+
* Same-class redirects MAY retain Authorization.
|
|
2650
|
+
*/
|
|
2651
|
+
declare function fetchWithRedirectAuthDrop(input: string | URL | Request, init?: FetchWithRedirectAuthDropInit): Promise<Response>;
|
|
2652
|
+
declare const fetchRedirectAuthDrop: typeof fetchWithRedirectAuthDrop;
|
|
2653
|
+
declare const redirectSafeFetch: typeof fetchWithRedirectAuthDrop;
|
|
2654
|
+
declare const fetchWithCredentialHostClassRedirects: typeof fetchWithRedirectAuthDrop;
|
|
2655
|
+
//#endregion
|
|
2656
|
+
//#region src/modules/Auth/gitChildEnv.d.ts
|
|
2657
|
+
/** Platform token env names cleared before every consumer git spawn. */
|
|
2658
|
+
declare const PLATFORM_TOKEN_ENV_NAMES: readonly ["GITHUB_TOKEN", "GH_TOKEN", "GITHUB_APM_PAT", "GITLAB_TOKEN", "GITLAB_APM_PAT", "ADO_APM_PAT", "AZURE_DEVOPS_EXT_PAT", "SYSTEM_ACCESSTOKEN"];
|
|
2659
|
+
/**
|
|
2660
|
+
* sc-008: refuse credential attach on non-https git-HTTP unless loopback or insecure.
|
|
2661
|
+
* Ambient suppress still applies.
|
|
2662
|
+
*/
|
|
2663
|
+
declare function mayAttachGitCredential(options: {
|
|
2664
|
+
url: string;
|
|
2665
|
+
host: string;
|
|
2666
|
+
registries?: RegistryAliasMap;
|
|
2667
|
+
}): boolean;
|
|
2668
|
+
/**
|
|
2669
|
+
* Build env for a git child process:
|
|
2670
|
+
* 1) clone parent env
|
|
2671
|
+
* 2) clear platform token names
|
|
2672
|
+
* 3) strip inherited Auth / http.extraheader
|
|
2673
|
+
* 4) attach selected-class credential only when sc-008 allows
|
|
2674
|
+
*/
|
|
2675
|
+
declare function buildGitChildEnv(options: BuildGitChildEnvOptions): NodeJS.ProcessEnv;
|
|
2676
|
+
declare const buildHardenedGitEnv: typeof buildGitChildEnv;
|
|
2677
|
+
declare const createGitChildEnv: typeof buildGitChildEnv;
|
|
2678
|
+
declare const gitChildEnvForHost: typeof buildGitChildEnv;
|
|
2679
|
+
//#endregion
|
|
2680
|
+
//#region src/modules/ExecutableTrust/types.d.ts
|
|
2681
|
+
/** Grant entry for one package under allow/deny. */
|
|
2682
|
+
type ExecutableGrantEntry = {
|
|
2683
|
+
mcp?: boolean;
|
|
2684
|
+
[key: string]: unknown;
|
|
2685
|
+
};
|
|
2686
|
+
/**
|
|
2687
|
+
* Parsed grant surface. `present` is true when the consuming manifest declared
|
|
2688
|
+
* `executables.allow` / `allowExecutables` (even if empty).
|
|
2689
|
+
*/
|
|
2690
|
+
type ExecutableGrantSurface = {
|
|
2691
|
+
present: boolean;
|
|
2692
|
+
allow: Record<string, ExecutableGrantEntry>;
|
|
2693
|
+
deny: Record<string, ExecutableGrantEntry>;
|
|
2694
|
+
};
|
|
2695
|
+
type ExecutableTrustOutcome = "allow" | "withhold" | "deny" | "skip";
|
|
2696
|
+
type ExecutableTrustDecision = {
|
|
2697
|
+
allowed: boolean;
|
|
2698
|
+
outcome: ExecutableTrustOutcome;
|
|
2699
|
+
packageName: string;
|
|
2700
|
+
executableType: string;
|
|
2701
|
+
reason?: string;
|
|
2702
|
+
withhold?: boolean;
|
|
2703
|
+
unapproved?: boolean;
|
|
2704
|
+
};
|
|
2705
|
+
type GrantSurfaceInput = ExecutableGrantSurface | {
|
|
2706
|
+
allow?: Record<string, unknown>;
|
|
2707
|
+
deny?: Record<string, unknown>;
|
|
2708
|
+
present?: boolean;
|
|
2709
|
+
} | null | undefined;
|
|
2710
|
+
type OrgExecutables = {
|
|
2711
|
+
deny_all?: boolean;
|
|
2712
|
+
deny?: string[];
|
|
2713
|
+
};
|
|
2714
|
+
type EvaluateExecutableTrustOptions = {
|
|
2715
|
+
/** Parsed surface or raw `{ allow }` bag accepted by acceptance helpers. */
|
|
2716
|
+
grantSurface?: GrantSurfaceInput;
|
|
2717
|
+
packageName: string;
|
|
2718
|
+
executableType?: string;
|
|
2719
|
+
/** Alias for executableType. */
|
|
2720
|
+
type?: string;
|
|
2721
|
+
};
|
|
2722
|
+
/** Layered deny-wins options (sc-011): org + project + user. */
|
|
2723
|
+
type ResolveExecutableTrustOptions = {
|
|
2724
|
+
packageName: string;
|
|
2725
|
+
executableType?: string;
|
|
2726
|
+
type?: string;
|
|
2727
|
+
orgExecutables?: OrgExecutables | null;
|
|
2728
|
+
projectSurface?: GrantSurfaceInput;
|
|
2729
|
+
userSurface?: GrantSurfaceInput;
|
|
2730
|
+
/** Back-compat alias → projectSurface. */
|
|
2731
|
+
grantSurface?: GrantSurfaceInput;
|
|
2732
|
+
};
|
|
2733
|
+
type ParseExecutableGrantsOptions = {
|
|
2734
|
+
/** Manifest document (or bag with executables / allowExecutables). */
|
|
2735
|
+
manifest?: Record<string, unknown>;
|
|
2736
|
+
/** Direct grant bag when manifest is not passed. */
|
|
2737
|
+
executables?: unknown;
|
|
2738
|
+
allowExecutables?: unknown;
|
|
2739
|
+
};
|
|
2740
|
+
/** Lockfile-presence require evaluation (sc-012). */
|
|
2741
|
+
type RequiredPackageTrustOutcome = {
|
|
2742
|
+
outcome?: string;
|
|
2743
|
+
allowed?: boolean;
|
|
2744
|
+
withhold?: boolean;
|
|
2745
|
+
[key: string]: unknown;
|
|
2746
|
+
};
|
|
2747
|
+
type EvaluateRequiredPackagePresenceOptions = {
|
|
2748
|
+
require?: string[];
|
|
2749
|
+
lockPackageIds?: string[];
|
|
2750
|
+
trustByPackage?: Record<string, RequiredPackageTrustOutcome>;
|
|
2751
|
+
};
|
|
2752
|
+
type RequiredPackagePresenceDiagnostic = {
|
|
2753
|
+
code: string;
|
|
2754
|
+
message: string;
|
|
2755
|
+
identity?: string;
|
|
2756
|
+
};
|
|
2757
|
+
type EvaluateRequiredPackagePresenceResult = {
|
|
2758
|
+
ok: boolean;
|
|
2759
|
+
satisfied: boolean;
|
|
2760
|
+
diagnostics: RequiredPackagePresenceDiagnostic[];
|
|
2761
|
+
violations: RequiredPackagePresenceDiagnostic[];
|
|
2762
|
+
codes: string[];
|
|
2763
|
+
};
|
|
2764
|
+
//#endregion
|
|
2765
|
+
//#region src/modules/ExecutableTrust/userStore.d.ts
|
|
2766
|
+
type UserExecutableStoreOptions = {
|
|
2767
|
+
/** Override config root (defaults to `~/.bapm`). */
|
|
2768
|
+
configRoot?: string;
|
|
2769
|
+
/** Alias for configRoot (Marketplace / acceptance). */
|
|
2770
|
+
configDir?: string;
|
|
2771
|
+
};
|
|
2772
|
+
type UserExecutableGrants = {
|
|
2773
|
+
allow: Record<string, ExecutableGrantEntry>;
|
|
2774
|
+
deny: Record<string, ExecutableGrantEntry>;
|
|
2775
|
+
executables: {
|
|
2776
|
+
allow: Record<string, ExecutableGrantEntry>;
|
|
2777
|
+
deny: Record<string, ExecutableGrantEntry>;
|
|
2778
|
+
};
|
|
2779
|
+
/** True when config.json declared an `executables` key (even if empty). */
|
|
2780
|
+
present: boolean;
|
|
2781
|
+
};
|
|
2782
|
+
type SaveUserExecutableGrantsOptions = UserExecutableStoreOptions & {
|
|
2783
|
+
allow?: Record<string, unknown>;
|
|
2784
|
+
deny?: Record<string, unknown>;
|
|
2785
|
+
executables?: {
|
|
2786
|
+
allow?: Record<string, unknown>;
|
|
2787
|
+
deny?: Record<string, unknown>;
|
|
2788
|
+
};
|
|
2789
|
+
packageName?: string;
|
|
2790
|
+
grant?: "allow" | "deny";
|
|
2791
|
+
executableType?: string;
|
|
2792
|
+
};
|
|
2793
|
+
/** Resolve config root: explicit override → `~/.bapm`. */
|
|
2794
|
+
declare function resolveUserConfigRoot(opts?: UserExecutableStoreOptions): string;
|
|
2795
|
+
declare function userConfigJsonPath(opts?: UserExecutableStoreOptions): string;
|
|
2796
|
+
/**
|
|
2797
|
+
* Load user-local executables grants from `<configRoot>/config.json`.
|
|
2798
|
+
* Missing file → empty allow/deny (surface not present until keys exist).
|
|
2799
|
+
*/
|
|
2800
|
+
declare function loadUserExecutableGrants(opts?: UserExecutableStoreOptions): UserExecutableGrants;
|
|
2801
|
+
/** Alias preferred by acceptance helpers. */
|
|
2802
|
+
declare const loadUserExecutables: typeof loadUserExecutableGrants;
|
|
2803
|
+
declare const loadExecutableUserGrants: typeof loadUserExecutableGrants;
|
|
2804
|
+
declare const readUserExecutableGrants: typeof loadUserExecutableGrants;
|
|
2805
|
+
/**
|
|
2806
|
+
* Save user-local executables grants to `<configRoot>/config.json`.
|
|
2807
|
+
* Merges into existing JSON; prefers full `executables`/`allow`/`deny` bags,
|
|
2808
|
+
* or incremental `packageName` + `grant` + `executableType`.
|
|
2809
|
+
*/
|
|
2810
|
+
declare function saveUserExecutableGrants(opts: SaveUserExecutableGrantsOptions): UserExecutableGrants;
|
|
2811
|
+
/** Alias preferred by acceptance helpers. */
|
|
2812
|
+
declare const saveUserExecutables: typeof saveUserExecutableGrants;
|
|
2813
|
+
declare const saveExecutableUserGrants: typeof saveUserExecutableGrants;
|
|
2814
|
+
declare const writeUserExecutableGrants: typeof saveUserExecutableGrants;
|
|
2815
|
+
declare const persistUserExecutableGrant: typeof saveUserExecutableGrants;
|
|
2816
|
+
/** Convert loaded user grants into a grant surface. */
|
|
2817
|
+
declare function userGrantsToSurface(grants: UserExecutableGrants, opts?: {
|
|
2818
|
+
present?: boolean;
|
|
2819
|
+
}): ExecutableGrantSurface;
|
|
2820
|
+
//#endregion
|
|
2821
|
+
//#region src/modules/ExecutableTrust/evaluate.d.ts
|
|
2822
|
+
/**
|
|
2823
|
+
* True when the consuming project declared a grant surface
|
|
2824
|
+
* (`executables.allow` / `allowExecutables`), including an empty allow map.
|
|
2825
|
+
*/
|
|
2826
|
+
declare function hasGrantSurface(surface: ExecutableGrantSurface | {
|
|
2827
|
+
present?: boolean;
|
|
2828
|
+
} | null | undefined): boolean;
|
|
2829
|
+
/**
|
|
2830
|
+
* Parse grant vocabulary from a manifest document.
|
|
2831
|
+
* Preferred: `executables.allow` / `executables.deny`.
|
|
2832
|
+
* Alias: top-level `allowExecutables` (OpenAPM text drop-in).
|
|
2833
|
+
*/
|
|
2834
|
+
declare function parseExecutableGrants(input?: ParseExecutableGrantsOptions | Record<string, unknown>): ExecutableGrantSurface;
|
|
2835
|
+
/**
|
|
2836
|
+
* Layered deny-wins resolver (sc-011):
|
|
2837
|
+
* org deny_all / org deny → project|user deny → project allow → user allow →
|
|
2838
|
+
* withhold if any grant surface present else skip.
|
|
2839
|
+
*/
|
|
2840
|
+
declare function resolveExecutableTrust(options: ResolveExecutableTrustOptions): ExecutableTrustDecision;
|
|
2841
|
+
/** Audit/trust classifier twin — identical to resolveExecutableTrust (sc-011). */
|
|
2842
|
+
declare const classifyExecutableTrust: typeof resolveExecutableTrust;
|
|
2843
|
+
/**
|
|
2844
|
+
* Evaluate whether a package may deploy an executable type (default: mcp).
|
|
2845
|
+
* Project-grant-only thin wrapper over `resolveExecutableTrust` (sc-009).
|
|
2846
|
+
*/
|
|
2847
|
+
declare function evaluateExecutableTrust(options: EvaluateExecutableTrustOptions): ExecutableTrustDecision;
|
|
2848
|
+
/** Alias preferred by acceptance helpers. */
|
|
2849
|
+
declare const evaluateMcpExecutableTrust: typeof evaluateExecutableTrust;
|
|
2850
|
+
/** Alias preferred by design docs. */
|
|
2851
|
+
declare const gateExecutableMcp: typeof evaluateExecutableTrust;
|
|
2852
|
+
/** Alias preferred by acceptance helpers. */
|
|
2853
|
+
declare const checkExecutableTrust: typeof evaluateExecutableTrust;
|
|
2854
|
+
//#endregion
|
|
2855
|
+
//#region src/modules/ExecutableTrust/presence.d.ts
|
|
2856
|
+
/**
|
|
2857
|
+
* Evaluate `dependencies.require` from lockfile presence (sc-012).
|
|
2858
|
+
* Present + MCP withheld → presence OK + distinct `EXEC_TRUST_WITHHELD`.
|
|
2859
|
+
* Missing from lock → `POLICY_REQUIRE`.
|
|
2860
|
+
*/
|
|
2861
|
+
declare function evaluateRequiredPackagePresence(options?: EvaluateRequiredPackagePresenceOptions): EvaluateRequiredPackagePresenceResult;
|
|
2862
|
+
/** Alias preferred by acceptance helpers. */
|
|
2863
|
+
declare const classifyRequiredPackagePresence: typeof evaluateRequiredPackagePresence;
|
|
2864
|
+
declare const evaluateRequireLockPresence: typeof evaluateRequiredPackagePresence;
|
|
2865
|
+
declare const evaluateRequiredPackagesFromLock: typeof evaluateRequiredPackagePresence;
|
|
2866
|
+
//#endregion
|
|
2867
|
+
//#region src/modules/Mcp/types.d.ts
|
|
2868
|
+
type CollectedMcpServer = McpServerConfig & {
|
|
2869
|
+
/** `direct` = root dependencies.mcp; `dependency` = from a package. */
|
|
2870
|
+
origin: "direct" | "dependency";
|
|
2871
|
+
packageName: string;
|
|
2872
|
+
};
|
|
2873
|
+
type CollectMcpServersOptions = {
|
|
2874
|
+
cwd?: string;
|
|
2875
|
+
rootManifest: BapmManifest;
|
|
2876
|
+
nodes?: ResolvedNode[];
|
|
2877
|
+
/** Deploy transitive MCP when no grant gate applies. */
|
|
2878
|
+
trustTransitiveMcp?: boolean;
|
|
2879
|
+
/** Parsed grant surface (when present, dep MCP is evaluated even without trust flag). */
|
|
2880
|
+
grantSurface?: ExecutableGrantSurface;
|
|
2881
|
+
};
|
|
2882
|
+
type CollectMcpServersResult = {
|
|
2883
|
+
/** Servers eligible for deploy after collection rules (before trust withhold). */
|
|
2884
|
+
servers: CollectedMcpServer[];
|
|
2885
|
+
/** Dependency packages that contributed MCP candidates needing trust evaluation. */
|
|
2886
|
+
dependencyPackages: string[];
|
|
2887
|
+
diagnostics: unknown[];
|
|
2888
|
+
};
|
|
2889
|
+
type ApplyMcpInventoryOptions = {
|
|
2890
|
+
document: LockfileDocument;
|
|
2891
|
+
servers: Array<{
|
|
2892
|
+
name: string;
|
|
2893
|
+
packageName?: string;
|
|
2894
|
+
[key: string]: unknown;
|
|
2895
|
+
}>;
|
|
2896
|
+
configPath: string;
|
|
2897
|
+
targetId: string;
|
|
2898
|
+
};
|
|
2899
|
+
//#endregion
|
|
2900
|
+
//#region src/modules/Mcp/bake.d.ts
|
|
2901
|
+
/**
|
|
2902
|
+
* Bake-time resolution of MCP env/header placeholder syntaxes.
|
|
2903
|
+
* Cursor path: legacy bake only (literals), no runtime translate-mode.
|
|
2904
|
+
*
|
|
2905
|
+
* Supported forms:
|
|
2906
|
+
* - APM: `${VAR}` / `${env:VAR}` / legacy `<VAR>` (uppercase identifier only)
|
|
2907
|
+
* - bapm-only: `{bake:NAME}` / `{bake:env:NAME}`
|
|
2908
|
+
*/
|
|
2909
|
+
type BakeMcpStringMapOptions = {
|
|
2910
|
+
/** Prefer these over `env` / `process.env` when non-empty. */
|
|
2911
|
+
overrides?: Record<string, string>;
|
|
2912
|
+
/** Lookup environment; defaults to `process.env`. */
|
|
2913
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
2914
|
+
/**
|
|
2915
|
+
* Project manifest top-level `env` defaults.
|
|
2916
|
+
* Lookup order: overrides → process/`env` → `manifestEnv` (non-empty only).
|
|
2917
|
+
*/
|
|
2918
|
+
manifestEnv?: Record<string, string>;
|
|
2919
|
+
/**
|
|
2920
|
+
* `bake` (default): resolve APM `${VAR}` / `${env:VAR}` / `<VAR>` and `{bake:NAME}`.
|
|
2921
|
+
* `translate`: leave APM placeholders untouched; still resolve `{bake:NAME}` (fail-closed).
|
|
2922
|
+
*/
|
|
2923
|
+
mode?: "bake" | "translate";
|
|
2924
|
+
};
|
|
2925
|
+
declare class McpEnvBakeError extends Error {
|
|
2926
|
+
readonly code = "MCP_ENV_BAKE";
|
|
2927
|
+
readonly missing: string[];
|
|
2928
|
+
constructor(missing: string[]);
|
|
2929
|
+
}
|
|
2930
|
+
/**
|
|
2931
|
+
* Resolve placeholders in a single string. Throws {@link McpEnvBakeError} if any
|
|
2932
|
+
* required placeholder cannot be resolved to a non-empty value.
|
|
2933
|
+
*/
|
|
2934
|
+
declare function bakeMcpStringValue(value: string, options?: BakeMcpStringMapOptions): string;
|
|
2935
|
+
/**
|
|
2936
|
+
* Bake-time resolve for MCP `env` / `headers` string maps.
|
|
2937
|
+
* Values without placeholders pass through unchanged.
|
|
2938
|
+
*/
|
|
2939
|
+
declare function bakeMcpStringMap(map: Record<string, string>, options?: BakeMcpStringMapOptions): Record<string, string>;
|
|
2940
|
+
type BakeableMcpServer = {
|
|
2941
|
+
env?: Record<string, string>;
|
|
2942
|
+
headers?: Record<string, string>;
|
|
2943
|
+
[key: string]: unknown;
|
|
2944
|
+
};
|
|
2945
|
+
/**
|
|
2946
|
+
* Bake `env` and `headers` on a server config; other fields unchanged.
|
|
2947
|
+
*/
|
|
2948
|
+
declare function bakeMcpServerMaps<T extends BakeableMcpServer>(server: T, options?: BakeMcpStringMapOptions): T;
|
|
2949
|
+
//#endregion
|
|
2950
|
+
//#region src/modules/Mcp/collect.d.ts
|
|
2951
|
+
/**
|
|
2952
|
+
* Collect MCP server definitions for deploy.
|
|
2953
|
+
* - Direct `dependencies.mcp` always included.
|
|
2954
|
+
* - Dependency MCP included when `--trust-transitive-mcp` OR grant surface is present
|
|
2955
|
+
* (caller still runs sc-009 withhold for unapproved packages).
|
|
2956
|
+
*/
|
|
2957
|
+
declare function collectMcpServers(options: CollectMcpServersOptions): CollectMcpServersResult;
|
|
2958
|
+
//#endregion
|
|
2959
|
+
//#region src/modules/Mcp/lockInventory.d.ts
|
|
2960
|
+
/**
|
|
2961
|
+
* Populate lock top-level `mcp_*` fields from configured servers.
|
|
2962
|
+
* Preserves unknown / `x-*` keys already on the document.
|
|
2963
|
+
*/
|
|
2964
|
+
declare function applyMcpInventoryToLock(options: ApplyMcpInventoryOptions): LockfileDocument;
|
|
2965
|
+
//#endregion
|
|
2966
|
+
//#region src/modules/Compile/types.d.ts
|
|
2967
|
+
type CompileAttributionEntry = {
|
|
2968
|
+
name: string;
|
|
2969
|
+
type: string;
|
|
2970
|
+
path?: string;
|
|
2971
|
+
};
|
|
2972
|
+
type CompileAgentsMdOptions = {
|
|
2973
|
+
cwd?: string;
|
|
2974
|
+
/** When true, discover/validate only — do not write target output. */
|
|
2975
|
+
validate?: boolean;
|
|
2976
|
+
/** When true (and not validate), compute content but do not write. */
|
|
2977
|
+
dryRun?: boolean;
|
|
2978
|
+
/** When true, include thin attribution on the result for CLI printing. */
|
|
2979
|
+
verbose?: boolean;
|
|
2980
|
+
/** Target-relative output override; the target owns its default. */
|
|
2981
|
+
outputFile?: string;
|
|
2982
|
+
modulesDir?: string;
|
|
2983
|
+
/** Registry of host target capabilities supplied by the application. */
|
|
2984
|
+
integrationRegistry?: IntegrationRegistry;
|
|
2985
|
+
/** Explicit registered target id, bypassing target detection. */
|
|
2986
|
+
forcedTarget?: string;
|
|
2987
|
+
};
|
|
2988
|
+
type CompileAgentsMdResult = {
|
|
2989
|
+
ok: boolean;
|
|
2990
|
+
path?: string;
|
|
2991
|
+
content: string;
|
|
2992
|
+
wrote: boolean;
|
|
2993
|
+
primitivesCount: number;
|
|
2994
|
+
/** Thin source attribution (name / type / path when known). */
|
|
2995
|
+
attribution: CompileAttributionEntry[];
|
|
2996
|
+
};
|
|
2997
|
+
//#endregion
|
|
2998
|
+
//#region src/modules/Compile/compileAgentsMd.d.ts
|
|
2999
|
+
/**
|
|
3000
|
+
* Discover conflict-resolved primitives then delegate output emission to a
|
|
3001
|
+
* selected registered target capability.
|
|
3002
|
+
*/
|
|
3003
|
+
declare function compileAgentsMd(options?: CompileAgentsMdOptions): Promise<CompileAgentsMdResult>;
|
|
3004
|
+
declare const compileProject: typeof compileAgentsMd;
|
|
3005
|
+
declare const runCompile: typeof compileAgentsMd;
|
|
3006
|
+
declare const emitAgentsMd: typeof compileAgentsMd;
|
|
3007
|
+
//#endregion
|
|
3008
|
+
//#region src/modules/Cache/types.d.ts
|
|
3009
|
+
type CacheInfoOptions = {
|
|
3010
|
+
cwd?: string;
|
|
3011
|
+
/** Override modules-cache root (default: `<cwd>/apm_modules`). */
|
|
3012
|
+
cacheRoot?: string;
|
|
3013
|
+
};
|
|
3014
|
+
type CacheInfoResult = {
|
|
3015
|
+
cacheRoot: string;
|
|
3016
|
+
exists: boolean;
|
|
3017
|
+
entries: number;
|
|
3018
|
+
sizeBytes: number;
|
|
3019
|
+
empty: boolean;
|
|
3020
|
+
text: string;
|
|
3021
|
+
};
|
|
3022
|
+
type CacheCleanOptions = {
|
|
3023
|
+
cwd?: string;
|
|
3024
|
+
cacheRoot?: string;
|
|
3025
|
+
/** Proceed without confirmation (`-y`). */
|
|
3026
|
+
yes?: boolean;
|
|
3027
|
+
/** Alias for yes. */
|
|
3028
|
+
y?: boolean;
|
|
3029
|
+
/**
|
|
3030
|
+
* When true and `yes` is false, refuse to delete (non-interactive).
|
|
3031
|
+
* Default true — callers must pass yes or confirm.
|
|
3032
|
+
*/
|
|
3033
|
+
requireYes?: boolean;
|
|
3034
|
+
/**
|
|
3035
|
+
* Preview wipe: list would-remove entries, never delete, skip yes-refuse.
|
|
3036
|
+
* `removedEntries` is the would-remove count; `cleaned` stays false.
|
|
3037
|
+
*/
|
|
3038
|
+
dryRun?: boolean;
|
|
3039
|
+
};
|
|
3040
|
+
type CacheCleanResult = {
|
|
3041
|
+
ok: boolean;
|
|
3042
|
+
cleaned: boolean;
|
|
3043
|
+
cacheRoot: string;
|
|
3044
|
+
removedEntries: number;
|
|
3045
|
+
message: string;
|
|
3046
|
+
refused?: boolean;
|
|
3047
|
+
};
|
|
3048
|
+
//#endregion
|
|
3049
|
+
//#region src/modules/Cache/cacheOps.d.ts
|
|
3050
|
+
/**
|
|
3051
|
+
* Report modules-cache root + size/entry stats (project `apm_modules`).
|
|
3052
|
+
* Does not introduce a shared APM git/http cache (rs-016 identity preserved).
|
|
3053
|
+
*/
|
|
3054
|
+
declare function cacheInfo(options?: CacheInfoOptions): CacheInfoResult;
|
|
3055
|
+
declare const getCacheInfo: typeof cacheInfo;
|
|
3056
|
+
declare const modulesCacheInfo: typeof cacheInfo;
|
|
3057
|
+
/**
|
|
3058
|
+
* Remove modules-cache content. Without `yes`/`-y`, refuses (non-silent).
|
|
3059
|
+
* With `dryRun`, previews would-remove count/names and never deletes.
|
|
3060
|
+
*/
|
|
3061
|
+
declare function cacheClean(options?: CacheCleanOptions): CacheCleanResult;
|
|
3062
|
+
declare const cleanModulesCache: typeof cacheClean;
|
|
3063
|
+
//#endregion
|
|
3064
|
+
//#region src/modules/Registry/types.d.ts
|
|
3065
|
+
type RegistryHttpRequest = {
|
|
3066
|
+
method: string;
|
|
3067
|
+
url: string;
|
|
3068
|
+
headers?: Record<string, string>;
|
|
3069
|
+
body?: Uint8Array | Buffer;
|
|
3070
|
+
};
|
|
3071
|
+
type RegistryHttpResponse = {
|
|
3072
|
+
status: number;
|
|
3073
|
+
headers: Record<string, string>;
|
|
3074
|
+
body: Uint8Array;
|
|
3075
|
+
};
|
|
3076
|
+
/** Injectable HTTP transport for registry client (mock-friendly). */
|
|
3077
|
+
type RegistryHttpTransport = {
|
|
3078
|
+
fetch(request: RegistryHttpRequest): Promise<RegistryHttpResponse>;
|
|
3079
|
+
};
|
|
3080
|
+
type CreateRegistryClientOptions = {
|
|
3081
|
+
/** Registry base URL (aliases accepted by acceptance helpers). */
|
|
3082
|
+
baseUrl?: string;
|
|
3083
|
+
url?: string;
|
|
3084
|
+
registryUrl?: string;
|
|
3085
|
+
/** Bearer token; falls back to env when unset. */
|
|
3086
|
+
token?: string;
|
|
3087
|
+
/** Named registry key for `BAPM_REGISTRY_<NAME>_TOKEN`. */
|
|
3088
|
+
registryName?: string;
|
|
3089
|
+
/** Injectable transport (defaults to real fetch). */
|
|
3090
|
+
transport?: RegistryHttpTransport;
|
|
3091
|
+
/** JSON body hard cap for list responses (~10 MiB). */
|
|
3092
|
+
maxJsonBytes?: number;
|
|
3093
|
+
};
|
|
3094
|
+
type RegistryVersionInfo = {
|
|
3095
|
+
version: string;
|
|
3096
|
+
digest: string;
|
|
3097
|
+
published_at?: string;
|
|
3098
|
+
};
|
|
3099
|
+
type RegistryClient = {
|
|
3100
|
+
baseUrl: string;
|
|
3101
|
+
listVersions(owner: string, repo: string): Promise<RegistryVersionInfo[]>;
|
|
3102
|
+
download(owner: string, repo: string, version: string): Promise<Uint8Array>;
|
|
3103
|
+
publish(owner: string, repo: string, version: string, bytes: Uint8Array): Promise<void>;
|
|
3104
|
+
};
|
|
3105
|
+
type BuildPublishArchiveOptions = {
|
|
3106
|
+
cwd?: string;
|
|
3107
|
+
/** When true, still build bytes but callers skip PUT. */
|
|
3108
|
+
dryRun?: boolean;
|
|
3109
|
+
/** Optional docs to include at zip root. */
|
|
3110
|
+
includeDocs?: boolean;
|
|
3111
|
+
};
|
|
3112
|
+
type BuildPublishArchiveResult = {
|
|
3113
|
+
bytes: Uint8Array;
|
|
3114
|
+
owner: string;
|
|
3115
|
+
repo: string;
|
|
3116
|
+
version: string;
|
|
3117
|
+
name: string;
|
|
3118
|
+
};
|
|
3119
|
+
type CheckSelfUpdateOptions = {
|
|
3120
|
+
currentVersion?: string;
|
|
3121
|
+
/** npm registry base (or mock). Env: BAPM_SELF_UPDATE_METADATA_URL / BAPM_NPM_REGISTRY. */
|
|
3122
|
+
registryUrl?: string;
|
|
3123
|
+
packageName?: string;
|
|
3124
|
+
/** dist-tag; default `latest`. */
|
|
3125
|
+
distTag?: string;
|
|
3126
|
+
/** Injectable metadata fetch. */
|
|
3127
|
+
fetchMetadata?: (url: string) => Promise<unknown>;
|
|
3128
|
+
};
|
|
3129
|
+
type CheckSelfUpdateResult = {
|
|
3130
|
+
currentVersion: string;
|
|
3131
|
+
latestVersion?: string;
|
|
3132
|
+
updateAvailable: boolean;
|
|
3133
|
+
unknownVersion: boolean;
|
|
3134
|
+
message: string;
|
|
3135
|
+
};
|
|
3136
|
+
//#endregion
|
|
3137
|
+
//#region src/modules/Registry/errors.d.ts
|
|
3138
|
+
type RegistryErrorCode = "REGISTRY_HTTP" | "REGISTRY_AUTH" | "REGISTRY_CONFLICT" | "REGISTRY_VALIDATION" | "REGISTRY_DIGEST" | "REGISTRY_GATE" | "REGISTRY_CONFIG" | "REGISTRY_PARSE" | "REGISTRY_PUBLISH" | "SELF_UPDATE";
|
|
3139
|
+
declare class RegistryError extends Error {
|
|
3140
|
+
readonly code: RegistryErrorCode;
|
|
3141
|
+
readonly details?: Record<string, unknown>;
|
|
3142
|
+
readonly status?: number;
|
|
3143
|
+
constructor(code: RegistryErrorCode, message: string, options?: {
|
|
3144
|
+
details?: Record<string, unknown>;
|
|
3145
|
+
cause?: unknown;
|
|
3146
|
+
status?: number;
|
|
3147
|
+
});
|
|
3148
|
+
}
|
|
3149
|
+
//#endregion
|
|
3150
|
+
//#region src/modules/Registry/gate.d.ts
|
|
3151
|
+
declare const EXPERIMENTAL_REGISTRIES_ENV = "BAPM_EXPERIMENTAL_REGISTRIES";
|
|
3152
|
+
declare function isExperimentalRegistriesEnabled(options?: {
|
|
3153
|
+
experimentalRegistries?: boolean;
|
|
3154
|
+
env?: NodeJS.ProcessEnv;
|
|
3155
|
+
}): boolean;
|
|
3156
|
+
declare function experimentalRegistriesRemediation(): string;
|
|
3157
|
+
declare function assertExperimentalRegistriesEnabled(options?: {
|
|
3158
|
+
experimentalRegistries?: boolean;
|
|
3159
|
+
env?: NodeJS.ProcessEnv;
|
|
3160
|
+
action?: string;
|
|
3161
|
+
}): void;
|
|
3162
|
+
//#endregion
|
|
3163
|
+
//#region src/modules/Registry/createClient.d.ts
|
|
3164
|
+
declare function createRegistryClient(options?: CreateRegistryClientOptions): RegistryClient;
|
|
3165
|
+
declare function sha256Hex(content: Uint8Array | Buffer | string): string;
|
|
3166
|
+
declare function sha256Digest(content: Uint8Array | Buffer | string): string;
|
|
3167
|
+
/** Normalize and compare digests (`sha256:<hex>` or bare hex). */
|
|
3168
|
+
declare function digestsEqual(expected: string, actualHexOrDigest: string): boolean;
|
|
3169
|
+
declare function verifyArchiveDigest(bytes: Uint8Array, expectedDigest: string, options?: {
|
|
3170
|
+
label?: string;
|
|
3171
|
+
}): string;
|
|
3172
|
+
//#endregion
|
|
3173
|
+
//#region src/modules/Registry/transport.d.ts
|
|
3174
|
+
/** Default real-fetch transport — redirect-safe for Authed requests (sc-003). */
|
|
3175
|
+
declare function createFetchTransport(): RegistryHttpTransport;
|
|
3176
|
+
declare function resolveRegistryToken(options?: {
|
|
3177
|
+
token?: string;
|
|
3178
|
+
registryName?: string;
|
|
3179
|
+
env?: NodeJS.ProcessEnv;
|
|
3180
|
+
}): string | undefined;
|
|
3181
|
+
//#endregion
|
|
3182
|
+
//#region src/modules/Registry/publishArchive.d.ts
|
|
3183
|
+
/**
|
|
3184
|
+
* Build flat registry publish zip: `apm.yml` at root + `.apm/**` (+ optional docs).
|
|
3185
|
+
* Does NOT call M7 pack product API — zip I/O only via fflate.
|
|
3186
|
+
* Wire `apm.yml` is serialized from the **dual-read base** only (no `bapm.local.yml` merge).
|
|
3187
|
+
* Never includes personal overlay `bapm.local.yml` as a zip member.
|
|
3188
|
+
*/
|
|
3189
|
+
declare function buildPublishArchive(options?: BuildPublishArchiveOptions): BuildPublishArchiveResult;
|
|
3190
|
+
//#endregion
|
|
3191
|
+
//#region src/modules/Registry/selfUpdate.d.ts
|
|
3192
|
+
/**
|
|
3193
|
+
* Compare running CLI version to npm dist-tag (primary metadata source).
|
|
3194
|
+
* Injectable `fetchMetadata` for acceptance tests.
|
|
3195
|
+
*/
|
|
3196
|
+
declare function checkSelfUpdate(options?: CheckSelfUpdateOptions): Promise<CheckSelfUpdateResult>;
|
|
3197
|
+
//#endregion
|
|
3198
|
+
//#region src/modules/Registry/resolveHelpers.d.ts
|
|
3199
|
+
/**
|
|
3200
|
+
* Resolve registry base URL from manifest `registries:` + per-dep name.
|
|
3201
|
+
*/
|
|
3202
|
+
declare function resolveRegistryBaseUrl(args: {
|
|
3203
|
+
registries?: Record<string, RegistryEntry | string>;
|
|
3204
|
+
registryName?: string;
|
|
3205
|
+
/** Override (tests / CLI). */
|
|
3206
|
+
registryBaseUrl?: string;
|
|
3207
|
+
}): {
|
|
3208
|
+
baseUrl: string;
|
|
3209
|
+
registryName?: string;
|
|
3210
|
+
};
|
|
3211
|
+
declare function parsePackageId(id: string): {
|
|
3212
|
+
owner: string;
|
|
3213
|
+
repo: string;
|
|
3214
|
+
};
|
|
3215
|
+
declare function registryRepoUrl(baseUrl: string, packageId: string): string;
|
|
3216
|
+
declare function downloadUrl(baseUrl: string, owner: string, repo: string, version: string): string;
|
|
3217
|
+
declare function pickRegistryVersion(versions: RegistryVersionInfo[], constraint: string): RegistryVersionInfo;
|
|
3218
|
+
type MaterializeRegistryPackageOptions = {
|
|
3219
|
+
cwd: string;
|
|
3220
|
+
dest: string;
|
|
3221
|
+
bytes: Uint8Array;
|
|
3222
|
+
expectedDigest: string;
|
|
3223
|
+
label?: string;
|
|
3224
|
+
};
|
|
3225
|
+
/**
|
|
3226
|
+
* lk-013: verify digest then shared safe-extract into dest. On mismatch, dest is untouched.
|
|
3227
|
+
*/
|
|
3228
|
+
declare function materializeRegistryArchive(options: MaterializeRegistryPackageOptions): void;
|
|
3229
|
+
declare function fetchAndMaterializeRegistry(args: {
|
|
3230
|
+
cwd: string;
|
|
3231
|
+
baseUrl: string;
|
|
3232
|
+
owner: string;
|
|
3233
|
+
repo: string;
|
|
3234
|
+
version: string;
|
|
3235
|
+
expectedDigest: string;
|
|
3236
|
+
dest: string;
|
|
3237
|
+
client?: RegistryClient;
|
|
3238
|
+
/** Alternate fetch URL (rs-009 mirror) — still verify expectedDigest. */
|
|
3239
|
+
fetchUrl?: string;
|
|
3240
|
+
}): Promise<Uint8Array>;
|
|
3241
|
+
declare function rewriteDownloadBase(resolvedUrl: string, mirrorBase: string): string;
|
|
3242
|
+
declare function modulesRegistryDest(cwd: string, packageId: string, version: string): string;
|
|
3243
|
+
//#endregion
|
|
3244
|
+
//#region src/modules/Registry/index.d.ts
|
|
3245
|
+
/** Aliases accepted by acceptance helpers. */
|
|
3246
|
+
declare const createRegistryHttpClient: typeof createRegistryClient;
|
|
3247
|
+
declare const createPackageRegistryClient: typeof createRegistryClient;
|
|
3248
|
+
declare const createPublishArchive: typeof buildPublishArchive;
|
|
3249
|
+
declare const packPublishArchive: typeof buildPublishArchive;
|
|
3250
|
+
declare const buildRegistryPublishZip: typeof buildPublishArchive;
|
|
3251
|
+
declare const compareSelfUpdate: typeof checkSelfUpdate;
|
|
3252
|
+
declare const runSelfUpdateCheck: typeof checkSelfUpdate;
|
|
3253
|
+
declare const fetchLatestCliVersion: typeof checkSelfUpdate;
|
|
3254
|
+
//#endregion
|
|
3255
|
+
//#region src/modules/Find/types.d.ts
|
|
3256
|
+
/** Offline find / reverse-index types. */
|
|
3257
|
+
declare const WORKSPACE_OWNER_KEY: ".";
|
|
3258
|
+
/** path → ordered owner keys (dependency packageKey or workspace `.`). */
|
|
3259
|
+
type ReverseIndex = Map<string, string[]>;
|
|
3260
|
+
type FindPathOptions = {
|
|
3261
|
+
cwd?: string;
|
|
3262
|
+
/** Query path (alias: `query`). */
|
|
3263
|
+
path?: string;
|
|
3264
|
+
query?: string;
|
|
3265
|
+
/** Append origin (`--source`). */
|
|
3266
|
+
source?: boolean;
|
|
3267
|
+
showSource?: boolean;
|
|
3268
|
+
/** Print why-chains (`--path`). */
|
|
3269
|
+
why?: boolean;
|
|
3270
|
+
showPath?: boolean;
|
|
3271
|
+
pathDetail?: boolean;
|
|
3272
|
+
};
|
|
3273
|
+
type FindPathResult = {
|
|
3274
|
+
ok: boolean;
|
|
3275
|
+
exitCode: number;
|
|
3276
|
+
text: string;
|
|
3277
|
+
stderr: string;
|
|
3278
|
+
owners?: string[];
|
|
3279
|
+
};
|
|
3280
|
+
//#endregion
|
|
3281
|
+
//#region src/modules/Find/buildReverseIndex.d.ts
|
|
3282
|
+
/** Stable owner key aligned with Deps inspect (`name` else `repo_url`). */
|
|
3283
|
+
declare function packageOwnerKey(dep: LockedDependency): string;
|
|
3284
|
+
/**
|
|
3285
|
+
* Build reverse index: deployed path → ordered owner keys.
|
|
3286
|
+
* Hash-map keys are primary; `deployed_files` / `local_deployed_files` are unioned.
|
|
3287
|
+
* Owner order: lock dependency array order, then workspace local.
|
|
3288
|
+
*/
|
|
3289
|
+
declare function buildReverseIndex(document: LockfileDocument | Record<string, unknown>): ReverseIndex;
|
|
3290
|
+
declare const build_reverse_index: typeof buildReverseIndex;
|
|
3291
|
+
declare const buildFindReverseIndex: typeof buildReverseIndex;
|
|
3292
|
+
//#endregion
|
|
3293
|
+
//#region src/modules/Find/lookup.d.ts
|
|
3294
|
+
/**
|
|
3295
|
+
* Normalize a find query: `\`→`/`, strip leading `/` and `./`.
|
|
3296
|
+
*/
|
|
3297
|
+
declare function normalizeFindPath(query: string): string;
|
|
3298
|
+
/**
|
|
3299
|
+
* Lookup owners for a query path: exact match, else longest `/`-suffix directory prefix.
|
|
3300
|
+
* Also treats a query that ends with `/` as a directory prefix over indexed entries (APM parity).
|
|
3301
|
+
*/
|
|
3302
|
+
declare function lookupInIndex(query: string, index: ReverseIndex | Map<string, string[]> | Record<string, string[]>): string[];
|
|
3303
|
+
declare const lookup: typeof lookupInIndex;
|
|
3304
|
+
declare const lookupFindPath: typeof lookupInIndex;
|
|
3305
|
+
declare const lookupReverseIndex: typeof lookupInIndex;
|
|
3306
|
+
//#endregion
|
|
3307
|
+
//#region src/modules/Find/format.d.ts
|
|
3308
|
+
/**
|
|
3309
|
+
* Human owner label: workspace `.`; else `repo_url` if set, otherwise `name`.
|
|
3310
|
+
*/
|
|
3311
|
+
declare function formatFindOwnerLabel(owner: string | LockedDependency | Record<string, unknown>, dep?: LockedDependency | Record<string, unknown> | null): string;
|
|
3312
|
+
declare const ownerLabel: typeof formatFindOwnerLabel;
|
|
3313
|
+
declare const formatOwnerLabel: typeof formatFindOwnerLabel;
|
|
3314
|
+
declare const findOwnerLabel: typeof formatFindOwnerLabel;
|
|
3315
|
+
/**
|
|
3316
|
+
* Origin fragment for `--source` (APM priority).
|
|
3317
|
+
* Workspace owner → `. (workspace)`.
|
|
3318
|
+
*/
|
|
3319
|
+
declare function formatFindOrigin(owner: string | LockedDependency | Record<string, unknown> | null | undefined, dep?: LockedDependency | Record<string, unknown> | null): string;
|
|
3320
|
+
declare const formatOrigin: typeof formatFindOrigin;
|
|
3321
|
+
declare const formatSourceOrigin: typeof formatFindOrigin;
|
|
3322
|
+
declare const _formatOrigin: typeof formatFindOrigin;
|
|
3323
|
+
//#endregion
|
|
3324
|
+
//#region src/modules/Find/findPath.d.ts
|
|
3325
|
+
/**
|
|
3326
|
+
* Offline find orchestration: load lock → reverse index → lookup → format.
|
|
3327
|
+
* Exits: 0 tracked, 1 unknown path, 2 missing/unreadable lock.
|
|
3328
|
+
*/
|
|
3329
|
+
declare function findPath(options?: FindPathOptions): FindPathResult;
|
|
3330
|
+
declare const runFind: typeof findPath;
|
|
3331
|
+
declare const findDeployedPath: typeof findPath;
|
|
3332
|
+
declare const runFindPath: typeof findPath;
|
|
3333
|
+
//#endregion
|
|
3334
|
+
//#region src/modules/View/types.d.ts
|
|
3335
|
+
type ViewPackageOptions = {
|
|
3336
|
+
cwd?: string;
|
|
3337
|
+
package?: string;
|
|
3338
|
+
name?: string;
|
|
3339
|
+
query?: string;
|
|
3340
|
+
};
|
|
3341
|
+
type ViewIdentity = {
|
|
3342
|
+
name?: string;
|
|
3343
|
+
repo_url?: string;
|
|
3344
|
+
};
|
|
3345
|
+
type ViewError = "no_lockfile" | "not_installed" | "ambiguous";
|
|
3346
|
+
type ViewPackageResult = {
|
|
3347
|
+
ok: boolean;
|
|
3348
|
+
exitCode: number;
|
|
3349
|
+
text: string;
|
|
3350
|
+
identity?: ViewIdentity;
|
|
3351
|
+
/** Pin string: version → resolved_ref → resolved_tag → short commit. */
|
|
3352
|
+
version?: string;
|
|
3353
|
+
pin?: string;
|
|
3354
|
+
modulesPath?: string;
|
|
3355
|
+
summary?: string;
|
|
3356
|
+
error?: ViewError;
|
|
3357
|
+
query?: string;
|
|
3358
|
+
matches?: Array<{
|
|
3359
|
+
name?: string;
|
|
3360
|
+
repo_url?: string;
|
|
3361
|
+
}>;
|
|
3362
|
+
};
|
|
3363
|
+
//#endregion
|
|
3364
|
+
//#region src/modules/View/viewPackage.d.ts
|
|
3365
|
+
/**
|
|
3366
|
+
* Offline local package view: lock resolve → modules path → optional summary.
|
|
3367
|
+
* Honest exits: 0 success, 1 not_installed/ambiguous, 2 no_lockfile.
|
|
3368
|
+
* No network / registry I/O.
|
|
3369
|
+
*/
|
|
3370
|
+
declare function viewPackage(options?: ViewPackageOptions): ViewPackageResult;
|
|
3371
|
+
declare const runView: typeof viewPackage;
|
|
3372
|
+
declare const viewLocalPackage: typeof viewPackage;
|
|
3373
|
+
declare const localView: typeof viewPackage;
|
|
3374
|
+
//#endregion
|
|
3375
|
+
//#region src/modules/Marketplace/errors.d.ts
|
|
3376
|
+
/** Marketplace-specific error hierarchy. */
|
|
3377
|
+
declare class MarketplaceError extends Error {
|
|
3378
|
+
constructor(message: string);
|
|
3379
|
+
}
|
|
3380
|
+
declare class MarketplaceNotFoundError extends MarketplaceError {
|
|
3381
|
+
readonly marketplaceName: string;
|
|
3382
|
+
constructor(marketplaceName: string, host?: string);
|
|
3383
|
+
}
|
|
3384
|
+
declare class MarketplaceFetchError extends MarketplaceError {
|
|
3385
|
+
readonly marketplaceName: string;
|
|
3386
|
+
readonly reason: string;
|
|
3387
|
+
constructor(marketplaceName: string, reason?: string);
|
|
3388
|
+
}
|
|
3389
|
+
declare class MarketplacePluginNotFoundError extends MarketplaceError {
|
|
3390
|
+
readonly pluginName: string;
|
|
3391
|
+
readonly marketplaceName: string;
|
|
3392
|
+
constructor(pluginName: string, marketplaceName: string);
|
|
3393
|
+
}
|
|
3394
|
+
declare class MarketplaceUnsupportedSourceError extends MarketplaceError {
|
|
3395
|
+
readonly pluginName: string;
|
|
3396
|
+
readonly reason: string;
|
|
3397
|
+
constructor(pluginName: string, reason: string);
|
|
3398
|
+
}
|
|
3399
|
+
//#endregion
|
|
3400
|
+
//#region src/modules/Marketplace/modules/Authoring/errors.d.ts
|
|
3401
|
+
/** Authoring schema / editor / detect / migrate errors. */
|
|
3402
|
+
declare class MarketplaceAuthoringError extends MarketplaceError {
|
|
3403
|
+
readonly exitCode: number;
|
|
3404
|
+
constructor(message: string, exitCode?: number);
|
|
3405
|
+
}
|
|
3406
|
+
//#endregion
|
|
3407
|
+
//#region src/modules/Marketplace/modules/Authoring/types.d.ts
|
|
3408
|
+
/** Marketplace authoring types (bapm.yml `marketplace:` block). Separate from consumer JSON models. */
|
|
3409
|
+
type MarketplaceAuthoringOwner = string | {
|
|
3410
|
+
name: string;
|
|
3411
|
+
url?: string;
|
|
3412
|
+
email?: string;
|
|
3413
|
+
};
|
|
3414
|
+
type MarketplaceAuthoringBuild = {
|
|
3415
|
+
tagPattern?: string;
|
|
3416
|
+
};
|
|
3417
|
+
type MarketplaceAuthoringOutputs = Record<string, unknown>;
|
|
3418
|
+
type PackageEntry = {
|
|
3419
|
+
name: string;
|
|
3420
|
+
source: string;
|
|
3421
|
+
version?: string;
|
|
3422
|
+
ref?: string;
|
|
3423
|
+
subdir?: string;
|
|
3424
|
+
tag_pattern?: string;
|
|
3425
|
+
include_prerelease?: boolean;
|
|
3426
|
+
description?: string;
|
|
3427
|
+
homepage?: string;
|
|
3428
|
+
tags?: string[];
|
|
3429
|
+
author?: string | Record<string, string>;
|
|
3430
|
+
license?: string;
|
|
3431
|
+
repository?: string;
|
|
3432
|
+
keywords?: string[];
|
|
3433
|
+
category?: string;
|
|
3434
|
+
/** Derived: source begins with `./`. */
|
|
3435
|
+
isLocal: boolean;
|
|
3436
|
+
/** Snake alias for APM parity. */
|
|
3437
|
+
is_local: boolean;
|
|
3438
|
+
};
|
|
3439
|
+
type MarketplaceAuthoringConfig = {
|
|
3440
|
+
name?: string;
|
|
3441
|
+
description?: string;
|
|
3442
|
+
version?: string;
|
|
3443
|
+
owner?: MarketplaceAuthoringOwner;
|
|
3444
|
+
sourceBase?: string;
|
|
3445
|
+
build?: MarketplaceAuthoringBuild;
|
|
3446
|
+
outputs?: MarketplaceAuthoringOutputs;
|
|
3447
|
+
/** Legacy single-output / pass-through keys retained when present. */
|
|
3448
|
+
output?: unknown;
|
|
3449
|
+
claude?: unknown;
|
|
3450
|
+
codex?: unknown;
|
|
3451
|
+
metadata?: Record<string, unknown>;
|
|
3452
|
+
versioning?: unknown;
|
|
3453
|
+
packages: PackageEntry[];
|
|
3454
|
+
};
|
|
3455
|
+
type LoadMarketplaceFromBapmYmlOptions = {
|
|
3456
|
+
cwd?: string;
|
|
3457
|
+
path?: string;
|
|
3458
|
+
};
|
|
3459
|
+
type LoadMarketplaceResult = {
|
|
3460
|
+
ok: true;
|
|
3461
|
+
config: MarketplaceAuthoringConfig;
|
|
3462
|
+
path: string;
|
|
3463
|
+
source: "bapm.yml" | "marketplace.yml";
|
|
3464
|
+
};
|
|
3465
|
+
type DetectAuthoringConfigSourceOptions = {
|
|
3466
|
+
cwd?: string;
|
|
3467
|
+
};
|
|
3468
|
+
type DetectAuthoringConfigSourceResult = {
|
|
3469
|
+
kind: "bapm.yml";
|
|
3470
|
+
ok: true;
|
|
3471
|
+
path: string;
|
|
3472
|
+
} | {
|
|
3473
|
+
kind: "marketplace.yml";
|
|
3474
|
+
ok: true;
|
|
3475
|
+
path: string;
|
|
3476
|
+
} | {
|
|
3477
|
+
kind: "both";
|
|
3478
|
+
ok: false;
|
|
3479
|
+
error: string;
|
|
3480
|
+
} | {
|
|
3481
|
+
kind: "none";
|
|
3482
|
+
ok: false;
|
|
3483
|
+
message: string;
|
|
3484
|
+
error: string;
|
|
3485
|
+
};
|
|
3486
|
+
type AuthoringPackageEditOptions = {
|
|
3487
|
+
cwd?: string;
|
|
3488
|
+
path?: string;
|
|
3489
|
+
name: string;
|
|
3490
|
+
source?: string;
|
|
3491
|
+
version?: string;
|
|
3492
|
+
ref?: string;
|
|
3493
|
+
subdir?: string;
|
|
3494
|
+
tagPattern?: string;
|
|
3495
|
+
tag_pattern?: string;
|
|
3496
|
+
tags?: string[] | string;
|
|
3497
|
+
includePrerelease?: boolean;
|
|
3498
|
+
include_prerelease?: boolean;
|
|
3499
|
+
description?: string;
|
|
3500
|
+
category?: string;
|
|
3501
|
+
/** Skip git ls-remote verify on add. */
|
|
3502
|
+
noVerify?: boolean;
|
|
3503
|
+
};
|
|
3504
|
+
type AuthoringPackageRemoveOptions = {
|
|
3505
|
+
cwd?: string;
|
|
3506
|
+
path?: string;
|
|
3507
|
+
name: string;
|
|
3508
|
+
};
|
|
3509
|
+
type EditorResult = {
|
|
3510
|
+
ok: true;
|
|
3511
|
+
path: string;
|
|
3512
|
+
} | {
|
|
3513
|
+
ok: false;
|
|
3514
|
+
error: string;
|
|
3515
|
+
};
|
|
3516
|
+
type CheckMarketplaceAuthoringOptions = {
|
|
3517
|
+
cwd?: string;
|
|
3518
|
+
path?: string;
|
|
3519
|
+
offline?: boolean;
|
|
3520
|
+
/** Injectable ls-remote for tests. */
|
|
3521
|
+
lsRemote?: (repoUrl: string, ref?: string) => Promise<void> | void;
|
|
3522
|
+
};
|
|
3523
|
+
type CheckMarketplaceAuthoringResult = {
|
|
3524
|
+
ok: boolean;
|
|
3525
|
+
exitCode: number;
|
|
3526
|
+
errors: string[];
|
|
3527
|
+
warnings: string[];
|
|
3528
|
+
};
|
|
3529
|
+
type MigrateMarketplaceYmlOptions = {
|
|
3530
|
+
cwd?: string;
|
|
3531
|
+
dryRun?: boolean;
|
|
3532
|
+
force?: boolean;
|
|
3533
|
+
yes?: boolean;
|
|
3534
|
+
};
|
|
3535
|
+
type MigrateMarketplaceYmlResult = {
|
|
3536
|
+
ok: boolean;
|
|
3537
|
+
dryRun: boolean;
|
|
3538
|
+
message?: string;
|
|
3539
|
+
error?: string;
|
|
3540
|
+
};
|
|
3541
|
+
type RenderMarketplaceBlockOptions = {
|
|
3542
|
+
owner?: string;
|
|
3543
|
+
name?: string;
|
|
3544
|
+
cwd?: string;
|
|
3545
|
+
};
|
|
3546
|
+
//#endregion
|
|
3547
|
+
//#region src/modules/Marketplace/modules/Authoring/source.d.ts
|
|
3548
|
+
type SourceValidationResult = {
|
|
3549
|
+
ok: true;
|
|
3550
|
+
} | {
|
|
3551
|
+
ok: false;
|
|
3552
|
+
error: string;
|
|
3553
|
+
};
|
|
3554
|
+
/**
|
|
3555
|
+
* Validate authoring package `source` (req-mf-017 / APM SOURCE_RE).
|
|
3556
|
+
* Returns `{ ok }` shape (also usable as boolean via helpers).
|
|
3557
|
+
*/
|
|
3558
|
+
declare function validateMarketplaceAuthoringSource(source: string): SourceValidationResult;
|
|
3559
|
+
/** Boolean / throw-friendly alias. */
|
|
3560
|
+
declare function isValidMarketplaceAuthoringSource(source: string): boolean;
|
|
3561
|
+
//#endregion
|
|
3562
|
+
//#region src/modules/Marketplace/modules/Authoring/load.d.ts
|
|
3563
|
+
/**
|
|
3564
|
+
* Load marketplace authoring config from `bapm.yml` `marketplace:` block.
|
|
3565
|
+
* Inherits top-level name/description/version when omitted in the block.
|
|
3566
|
+
*/
|
|
3567
|
+
declare function loadMarketplaceFromBapmYml(options?: LoadMarketplaceFromBapmYmlOptions): LoadMarketplaceResult;
|
|
3568
|
+
/** Load legacy standalone marketplace.yml (top-level marketplace keys). */
|
|
3569
|
+
declare function loadMarketplaceFromLegacyYml(options?: {
|
|
3570
|
+
cwd?: string;
|
|
3571
|
+
path?: string;
|
|
3572
|
+
}): LoadMarketplaceResult;
|
|
3573
|
+
//#endregion
|
|
3574
|
+
//#region src/modules/Marketplace/modules/Authoring/detect.d.ts
|
|
3575
|
+
/**
|
|
3576
|
+
* Detect authoring config source: preferred bapm.yml block / legacy / both / none.
|
|
3577
|
+
*/
|
|
3578
|
+
declare function detectAuthoringConfigSource(options?: DetectAuthoringConfigSourceOptions): DetectAuthoringConfigSourceResult;
|
|
3579
|
+
/**
|
|
3580
|
+
* Smart loader: detect source, load, warn if legacy.
|
|
3581
|
+
* Throws MarketplaceAuthoringError on both/none/validation.
|
|
3582
|
+
*/
|
|
3583
|
+
declare function loadMarketplaceAuthoringConfig(options?: {
|
|
3584
|
+
cwd?: string;
|
|
3585
|
+
warn?: (message: string) => void;
|
|
3586
|
+
}): LoadMarketplaceResult;
|
|
3587
|
+
//#endregion
|
|
3588
|
+
//#region src/modules/Marketplace/modules/Authoring/initTemplate.d.ts
|
|
3589
|
+
/**
|
|
3590
|
+
* Render a `marketplace:` YAML block template (~APM render_marketplace_block).
|
|
3591
|
+
* Does not write host marketplace.json artifacts.
|
|
3592
|
+
*/
|
|
3593
|
+
declare function renderMarketplaceBlock(options?: RenderMarketplaceBlockOptions): string;
|
|
3594
|
+
/** Alias used by some call sites / acceptance soft-resolve. */
|
|
3595
|
+
declare const renderInitMarketplaceBlock: typeof renderMarketplaceBlock;
|
|
3596
|
+
declare const createMarketplaceAuthoringTemplate: typeof renderMarketplaceBlock;
|
|
3597
|
+
//#endregion
|
|
3598
|
+
//#region src/modules/Marketplace/modules/Authoring/init.d.ts
|
|
3599
|
+
type InitMarketplaceAuthoringOptions = {
|
|
3600
|
+
cwd?: string;
|
|
3601
|
+
path?: string;
|
|
3602
|
+
owner?: string;
|
|
3603
|
+
name?: string;
|
|
3604
|
+
force?: boolean;
|
|
3605
|
+
};
|
|
3606
|
+
type InitMarketplaceAuthoringResult = {
|
|
3607
|
+
ok: true;
|
|
3608
|
+
path: string;
|
|
3609
|
+
createdManifest: boolean;
|
|
3610
|
+
} | {
|
|
3611
|
+
ok: false;
|
|
3612
|
+
error: string;
|
|
3613
|
+
};
|
|
3614
|
+
/**
|
|
3615
|
+
* Scaffold or overwrite `marketplace:` in bapm.yml. Creates stub manifest if missing.
|
|
3616
|
+
*/
|
|
3617
|
+
declare function initMarketplaceAuthoring(options?: InitMarketplaceAuthoringOptions): InitMarketplaceAuthoringResult;
|
|
3618
|
+
//#endregion
|
|
3619
|
+
//#region src/modules/Marketplace/modules/Authoring/editor.d.ts
|
|
3620
|
+
/**
|
|
3621
|
+
* Add a package entry to bapm.yml marketplace.packages; re-validate after write.
|
|
3622
|
+
*/
|
|
3623
|
+
declare function addMarketplacePackage(options: AuthoringPackageEditOptions): EditorResult;
|
|
3624
|
+
/**
|
|
3625
|
+
* Update fields on an existing package entry.
|
|
3626
|
+
*/
|
|
3627
|
+
declare function setMarketplacePackage(options: AuthoringPackageEditOptions): EditorResult;
|
|
3628
|
+
/**
|
|
3629
|
+
* Remove a package entry by name.
|
|
3630
|
+
*/
|
|
3631
|
+
declare function removeMarketplacePackage(options: AuthoringPackageRemoveOptions): EditorResult;
|
|
3632
|
+
//#endregion
|
|
3633
|
+
//#region src/modules/Marketplace/modules/Authoring/check.d.ts
|
|
3634
|
+
/**
|
|
3635
|
+
* Authoring check: schema load; offline = no network; online probes for unlocked remotes.
|
|
3636
|
+
* Generic hosts: fail-soft warning. Unlocked remotes with token: required probe.
|
|
3637
|
+
*/
|
|
3638
|
+
declare function checkMarketplaceAuthoring(options?: CheckMarketplaceAuthoringOptions): Promise<CheckMarketplaceAuthoringResult>;
|
|
3639
|
+
declare const checkAuthoringMarketplace: typeof checkMarketplaceAuthoring;
|
|
3640
|
+
declare const runMarketplaceAuthoringCheck: typeof checkMarketplaceAuthoring;
|
|
3641
|
+
//#endregion
|
|
3642
|
+
//#region src/modules/Marketplace/modules/Authoring/migrate.d.ts
|
|
3643
|
+
/**
|
|
3644
|
+
* Fold legacy marketplace.yml into bapm.yml `marketplace:` block.
|
|
3645
|
+
*/
|
|
3646
|
+
declare function migrateMarketplaceYml(options?: MigrateMarketplaceYmlOptions): MigrateMarketplaceYmlResult;
|
|
3647
|
+
declare const migrateLegacyMarketplaceYml: typeof migrateMarketplaceYml;
|
|
3648
|
+
declare const runMarketplaceMigrate: typeof migrateMarketplaceYml;
|
|
3649
|
+
//#endregion
|
|
3650
|
+
//#region src/modules/Marketplace/types.d.ts
|
|
3651
|
+
/** Shared option bags for Marketplace public APIs. */
|
|
3652
|
+
type MarketplaceConfigOptions = {
|
|
3653
|
+
/** Override config root (defaults to `~/.bapm`). */
|
|
3654
|
+
configDir?: string;
|
|
3655
|
+
};
|
|
3656
|
+
type MarketplaceFetchOptions = MarketplaceConfigOptions & {
|
|
3657
|
+
forceRefresh?: boolean;
|
|
3658
|
+
/** Injectable HTTP transport (tests / custom clients). */
|
|
3659
|
+
fetch?: typeof globalThis.fetch;
|
|
3660
|
+
};
|
|
3661
|
+
type MarketplaceSourceInit = {
|
|
3662
|
+
name: string;
|
|
3663
|
+
url?: string;
|
|
3664
|
+
ref?: string;
|
|
3665
|
+
path?: string;
|
|
3666
|
+
owner?: string;
|
|
3667
|
+
repo?: string;
|
|
3668
|
+
host?: string;
|
|
3669
|
+
branch?: string;
|
|
3670
|
+
};
|
|
3671
|
+
type MarketplaceSourceKind = "local" | "url" | "github" | "gitlab" | "ado" | "git";
|
|
3672
|
+
type ValidationResult = {
|
|
3673
|
+
checkName: string;
|
|
3674
|
+
passed: boolean;
|
|
3675
|
+
warnings: string[];
|
|
3676
|
+
errors: string[];
|
|
3677
|
+
};
|
|
3678
|
+
//#endregion
|
|
3679
|
+
//#region src/modules/Marketplace/paths.d.ts
|
|
3680
|
+
/** Resolve the bapm config root (`~/.bapm` or injectable override). */
|
|
3681
|
+
declare function getBapmConfigDir(opts?: MarketplaceConfigOptions): string;
|
|
3682
|
+
declare function marketplacesJsonPath(opts?: MarketplaceConfigOptions): string;
|
|
3683
|
+
declare function marketplaceCacheDir(opts?: MarketplaceConfigOptions): string;
|
|
3684
|
+
/** Ensure config root exists (mode 0o700 when newly created). */
|
|
3685
|
+
declare function ensureBapmConfigDir(opts?: MarketplaceConfigOptions): string;
|
|
3686
|
+
//#endregion
|
|
3687
|
+
//#region src/modules/Marketplace/models.d.ts
|
|
3688
|
+
/** True when url is an HTTPS hosted marketplace.json document. */
|
|
3689
|
+
declare function urlNamesRemoteManifest(url: string): boolean;
|
|
3690
|
+
type MarketplacePlugin = {
|
|
3691
|
+
readonly name: string;
|
|
3692
|
+
readonly source: unknown;
|
|
3693
|
+
readonly description: string;
|
|
3694
|
+
readonly version: string;
|
|
3695
|
+
readonly tags: readonly string[];
|
|
3696
|
+
readonly sourceMarketplace: string;
|
|
3697
|
+
readonly registry: string;
|
|
3698
|
+
readonly tagPattern: string | null;
|
|
3699
|
+
};
|
|
3700
|
+
type MarketplaceManifest = {
|
|
3701
|
+
readonly name: string;
|
|
3702
|
+
readonly plugins: readonly MarketplacePlugin[];
|
|
3703
|
+
readonly ownerName: string;
|
|
3704
|
+
readonly description: string;
|
|
3705
|
+
readonly pluginRoot: string;
|
|
3706
|
+
readonly sourceUrl: string;
|
|
3707
|
+
readonly sourceDigest: string;
|
|
3708
|
+
findPlugin(pluginName: string): MarketplacePlugin | undefined;
|
|
3709
|
+
search(query: string): MarketplacePlugin[];
|
|
3710
|
+
};
|
|
3711
|
+
declare function createMarketplaceManifest(init: {
|
|
3712
|
+
name: string;
|
|
3713
|
+
plugins?: readonly MarketplacePlugin[];
|
|
3714
|
+
ownerName?: string;
|
|
3715
|
+
description?: string;
|
|
3716
|
+
pluginRoot?: string;
|
|
3717
|
+
sourceUrl?: string;
|
|
3718
|
+
sourceDigest?: string;
|
|
3719
|
+
}): MarketplaceManifest;
|
|
3720
|
+
declare function createMarketplacePlugin(init: {
|
|
3721
|
+
name: string;
|
|
3722
|
+
source?: unknown;
|
|
3723
|
+
description?: string;
|
|
3724
|
+
version?: string;
|
|
3725
|
+
tags?: readonly string[];
|
|
3726
|
+
sourceMarketplace?: string;
|
|
3727
|
+
registry?: string;
|
|
3728
|
+
tagPattern?: string | null;
|
|
3729
|
+
}): MarketplacePlugin;
|
|
3730
|
+
declare class MarketplaceSource {
|
|
3731
|
+
readonly name: string;
|
|
3732
|
+
readonly url: string;
|
|
3733
|
+
readonly ref: string;
|
|
3734
|
+
readonly path: string;
|
|
3735
|
+
readonly owner: string;
|
|
3736
|
+
readonly repo: string;
|
|
3737
|
+
readonly host: string;
|
|
3738
|
+
readonly branch: string;
|
|
3739
|
+
constructor(init: MarketplaceSourceInit);
|
|
3740
|
+
get isRemoteManifestUrl(): boolean;
|
|
3741
|
+
get kind(): MarketplaceSourceKind;
|
|
3742
|
+
get localPath(): string;
|
|
3743
|
+
get displaySource(): string;
|
|
3744
|
+
toDict(): Record<string, unknown>;
|
|
3745
|
+
static fromDict(data: Record<string, unknown>): MarketplaceSource;
|
|
3746
|
+
}
|
|
3747
|
+
/** Factory preferred by public API / soft-resolve helpers. */
|
|
3748
|
+
declare function createMarketplaceSource(init: MarketplaceSourceInit): MarketplaceSource;
|
|
3749
|
+
declare function resolveLocalFilesystemPath(source: MarketplaceSource): string;
|
|
3750
|
+
//#endregion
|
|
3751
|
+
//#region src/modules/Marketplace/hostClassify.d.ts
|
|
3752
|
+
/** Fine-grained marketplace host class for auth/API base selection. */
|
|
3753
|
+
type MarketplaceHostClass = ProviderHostClass;
|
|
3754
|
+
/**
|
|
3755
|
+
* Classify a marketplace hostname using env allowlists.
|
|
3756
|
+
* Throws on GHES↔GitLab overlap; ADO_HOST wins over GITHUB_HOST on same FQDN.
|
|
3757
|
+
*/
|
|
3758
|
+
declare function classifyMarketplaceHost(host: string, env?: NodeJS.ProcessEnv): MarketplaceHostClass;
|
|
3759
|
+
/** Map fine-grained class → MarketplaceSource.kind. */
|
|
3760
|
+
declare function marketplaceKindFromHostClass(cls: MarketplaceHostClass): MarketplaceSourceKind;
|
|
3761
|
+
/** Convenience: host → source kind (throws on overlap). */
|
|
3762
|
+
declare function classifyMarketplaceHostKind(host: string, env?: NodeJS.ProcessEnv): MarketplaceSourceKind;
|
|
3763
|
+
/** GitHub Contents API base for a github-class host. */
|
|
3764
|
+
declare function githubApiBaseForHost(host: string, env?: NodeJS.ProcessEnv): string;
|
|
3765
|
+
/** True when host is unlocked for marketplace fetch / authoring probe. */
|
|
3766
|
+
declare function isUnlockedMarketplaceHost(host: string, env?: NodeJS.ProcessEnv): boolean;
|
|
3767
|
+
//#endregion
|
|
3768
|
+
//#region src/modules/Marketplace/resolveToken.d.ts
|
|
3769
|
+
type ResolvedMarketplaceToken = {
|
|
3770
|
+
/** Secret value — never log. */
|
|
3771
|
+
readonly token: string;
|
|
3772
|
+
/** Env source id for diagnostics (e.g. GITHUB_TOKEN). */
|
|
3773
|
+
readonly source: string;
|
|
3774
|
+
};
|
|
3775
|
+
/**
|
|
3776
|
+
* Resolve at most one env token for the host's class (or null).
|
|
3777
|
+
* Fail-closed cross-class: never returns another class's env value.
|
|
3778
|
+
*/
|
|
3779
|
+
declare function resolveTokenForHost(host: string, env?: NodeJS.ProcessEnv): ResolvedMarketplaceToken | null;
|
|
3780
|
+
/** Alias preferred by some soft-resolve helpers. */
|
|
3781
|
+
declare const resolveMarketplaceTokenForHost: typeof resolveTokenForHost;
|
|
3782
|
+
declare const resolveAuthTokenForHost: typeof resolveTokenForHost;
|
|
3783
|
+
/** Auth headers for a given host class (empty when no token). */
|
|
3784
|
+
declare function authHeadersForHost(host: string, env?: NodeJS.ProcessEnv): Record<string, string>;
|
|
3785
|
+
//#endregion
|
|
3786
|
+
//#region src/modules/Marketplace/parse.d.ts
|
|
3787
|
+
/**
|
|
3788
|
+
* Parse marketplace.json (string or object) into a MarketplaceManifest.
|
|
3789
|
+
* Accepts Copilot (`repository`) and Claude (`source`) plugin shapes.
|
|
3790
|
+
*/
|
|
3791
|
+
declare function parseMarketplaceJson(input: string | object, sourceName?: string, opts?: {
|
|
3792
|
+
sourceUrl?: string;
|
|
3793
|
+
sourceDigest?: string;
|
|
3794
|
+
}): MarketplaceManifest;
|
|
3795
|
+
//#endregion
|
|
3796
|
+
//#region src/modules/Marketplace/registry.d.ts
|
|
3797
|
+
declare function listMarketplaces(opts?: MarketplaceConfigOptions): MarketplaceSource[];
|
|
3798
|
+
declare function getMarketplace(name: string, opts?: MarketplaceConfigOptions): MarketplaceSource;
|
|
3799
|
+
declare function addMarketplace(source: MarketplaceSource | Record<string, unknown>, opts?: MarketplaceConfigOptions): MarketplaceSource;
|
|
3800
|
+
declare function removeMarketplace(name: string, opts?: MarketplaceConfigOptions): void;
|
|
3801
|
+
//#endregion
|
|
3802
|
+
//#region src/modules/Marketplace/cache.d.ts
|
|
3803
|
+
declare const CACHE_TTL_SECONDS = 3600;
|
|
3804
|
+
declare function sanitizeCacheName(name: string): string;
|
|
3805
|
+
declare function cacheKeyForSource(source: MarketplaceSource): string;
|
|
3806
|
+
declare function readMarketplaceCache(key: string, opts?: MarketplaceConfigOptions): Record<string, unknown> | null;
|
|
3807
|
+
declare function writeMarketplaceCache(key: string, data: Record<string, unknown>, opts?: MarketplaceConfigOptions & {
|
|
3808
|
+
indexDigest?: string;
|
|
3809
|
+
etag?: string;
|
|
3810
|
+
lastModified?: string;
|
|
3811
|
+
}): void;
|
|
3812
|
+
//#endregion
|
|
3813
|
+
//#region src/modules/Marketplace/fetch.d.ts
|
|
3814
|
+
declare const MAX_MARKETPLACE_JSON_BYTES: number;
|
|
3815
|
+
declare const MARKETPLACE_PATHS: readonly ["marketplace.json", ".github/plugin/marketplace.json", ".claude-plugin/marketplace.json"];
|
|
3816
|
+
/**
|
|
3817
|
+
* Fetch and parse a marketplace manifest (github | gitlab | ado | url | local).
|
|
3818
|
+
*/
|
|
3819
|
+
declare function fetchMarketplace(source: MarketplaceSource | Record<string, unknown>, opts?: MarketplaceFetchOptions): Promise<MarketplaceManifest>;
|
|
3820
|
+
declare function clearMarketplaceCache(source: MarketplaceSource | Record<string, unknown>, opts?: MarketplaceConfigOptions): number;
|
|
3821
|
+
declare function autoDetectMarketplacePath(source: MarketplaceSource, opts?: MarketplaceFetchOptions): Promise<string>;
|
|
3822
|
+
//#endregion
|
|
3823
|
+
//#region src/modules/Marketplace/validate.d.ts
|
|
3824
|
+
/** Thin validate: schema (name+source) + case-insensitive duplicate names. */
|
|
3825
|
+
declare function validateMarketplace(manifest: MarketplaceManifest): ValidationResult[];
|
|
3826
|
+
//#endregion
|
|
3827
|
+
//#region src/modules/Marketplace/resolver.d.ts
|
|
3828
|
+
type ParsedMarketplaceRef = {
|
|
3829
|
+
pluginName: string;
|
|
3830
|
+
marketplaceName: string;
|
|
3831
|
+
ref: string | null;
|
|
3832
|
+
};
|
|
3833
|
+
type MarketplaceProvenance = {
|
|
3834
|
+
discovered_via: string;
|
|
3835
|
+
marketplace_plugin_name: string;
|
|
3836
|
+
source_url?: string;
|
|
3837
|
+
source_digest?: string;
|
|
3838
|
+
};
|
|
3839
|
+
/** Concrete dependency declaration for Resolver/Install (string or object form). */
|
|
3840
|
+
type MarketplaceConcreteDep = string | {
|
|
3841
|
+
path: string;
|
|
3842
|
+
} | {
|
|
3843
|
+
git: string;
|
|
3844
|
+
ref?: string;
|
|
3845
|
+
};
|
|
3846
|
+
type MarketplacePluginResolution = {
|
|
3847
|
+
/** Canonical string or structured concrete dependency. */
|
|
3848
|
+
dependency: MarketplaceConcreteDep;
|
|
3849
|
+
/** Alias for soft-resolve helpers / APM parity. */
|
|
3850
|
+
canonical: string | MarketplaceConcreteDep;
|
|
3851
|
+
plugin: MarketplacePlugin;
|
|
3852
|
+
source_url: string;
|
|
3853
|
+
source_digest: string;
|
|
3854
|
+
provenance(marketplaceName?: string, pluginName?: string): MarketplaceProvenance;
|
|
3855
|
+
};
|
|
3856
|
+
type ResolveMarketplacePluginOptions = MarketplaceFetchOptions & {
|
|
3857
|
+
/** Alias accepted by acceptance helpers. */
|
|
3858
|
+
marketplaceConfigDir?: string;
|
|
3859
|
+
};
|
|
3860
|
+
/**
|
|
3861
|
+
* Parse `NAME@MARKETPLACE[#ref]`.
|
|
3862
|
+
* Returns null when the specifier is not a marketplace ref.
|
|
3863
|
+
* Throws when `#ref` contains semver-range characters.
|
|
3864
|
+
*/
|
|
3865
|
+
declare function parseMarketplaceRef(specifier: string): ParsedMarketplaceRef | null;
|
|
3866
|
+
/**
|
|
3867
|
+
* Resolve a marketplace plugin via `~/.bapm` registry + fetch/cache → concrete dep.
|
|
3868
|
+
*/
|
|
3869
|
+
declare function resolveMarketplacePlugin(pluginName: string, marketplaceName: string, versionSpec?: string | null, opts?: ResolveMarketplacePluginOptions): Promise<MarketplacePluginResolution>;
|
|
3870
|
+
//#endregion
|
|
3871
|
+
//#region src/modules/Marketplace/modules/PackOutputs/errors.d.ts
|
|
3872
|
+
/** Marketplace pack-outputs / builder errors (fail-closed emit). */
|
|
3873
|
+
declare class MarketplacePackOutputsError extends MarketplaceError {
|
|
3874
|
+
readonly exitCode: number;
|
|
3875
|
+
constructor(message: string, exitCode?: number);
|
|
3876
|
+
}
|
|
3877
|
+
//#endregion
|
|
3878
|
+
//#region src/modules/Marketplace/modules/PackOutputs/types.d.ts
|
|
3879
|
+
/** Supported host marketplace output formats. */
|
|
3880
|
+
type MarketplaceOutputFormat = string;
|
|
3881
|
+
/** Package after ref resolution (local pass-through or remote sha). */
|
|
3882
|
+
type ResolvedPackage = {
|
|
3883
|
+
name: string;
|
|
3884
|
+
/** Repository path without host (`owner/repo`) or local `./…` source. */
|
|
3885
|
+
sourceRepo: string;
|
|
3886
|
+
/** Original authoring source string. */
|
|
3887
|
+
source: string;
|
|
3888
|
+
subdir?: string;
|
|
3889
|
+
/** Concrete ref (tag / branch / sha short-name). */
|
|
3890
|
+
ref?: string;
|
|
3891
|
+
/** 40-char git SHA when remote. */
|
|
3892
|
+
sha?: string;
|
|
3893
|
+
requestedVersion?: string;
|
|
3894
|
+
tags: string[];
|
|
3895
|
+
isLocal: boolean;
|
|
3896
|
+
isPrerelease: boolean;
|
|
3897
|
+
host?: string;
|
|
3898
|
+
sourceUrl?: string;
|
|
3899
|
+
effectiveTagPattern?: string;
|
|
3900
|
+
category?: string;
|
|
3901
|
+
entry: PackageEntry;
|
|
3902
|
+
};
|
|
3903
|
+
type LsRemoteResult = {
|
|
3904
|
+
sha: string;
|
|
3905
|
+
/** Ref name that matched (e.g. `refs/tags/v1.0.0` stripped or as given). */
|
|
3906
|
+
ref: string;
|
|
3907
|
+
};
|
|
3908
|
+
type LsRemoteFn = (repoUrl: string, ref?: string) => Promise<LsRemoteResult> | LsRemoteResult;
|
|
3909
|
+
type BuildMarketplaceOutputsOptions = {
|
|
3910
|
+
cwd?: string;
|
|
3911
|
+
/** Authoring config path override. */
|
|
3912
|
+
path?: string;
|
|
3913
|
+
/**
|
|
3914
|
+
* CLI `--marketplace` filter:
|
|
3915
|
+
* - `undefined` / `"all"` — all enabled outputs from config
|
|
3916
|
+
* - `"none"` — skip emit
|
|
3917
|
+
* - comma list or string[] — only named formats
|
|
3918
|
+
*/
|
|
3919
|
+
marketplace?: string | string[];
|
|
3920
|
+
/** CLI `--marketplace-path FORMAT=PATH` overrides. */
|
|
3921
|
+
marketplacePaths?: Record<string, string> | Array<string | {
|
|
3922
|
+
format: string;
|
|
3923
|
+
path: string;
|
|
3924
|
+
}>;
|
|
3925
|
+
dryRun?: boolean;
|
|
3926
|
+
offline?: boolean;
|
|
3927
|
+
includePrerelease?: boolean;
|
|
3928
|
+
/** Injectable ls-remote for tests. */
|
|
3929
|
+
lsRemote?: LsRemoteFn;
|
|
3930
|
+
/** Pre-loaded config (skips detect/load). */
|
|
3931
|
+
config?: MarketplaceAuthoringConfig;
|
|
3932
|
+
/** Registered host-owned marketplace output capabilities. */
|
|
3933
|
+
marketplaceOutputs?: MarketplaceOutputRegistry;
|
|
3934
|
+
};
|
|
3935
|
+
type MarketplaceOutputWritten = {
|
|
3936
|
+
format: MarketplaceOutputFormat;
|
|
3937
|
+
path: string;
|
|
3938
|
+
dryRun: boolean;
|
|
3939
|
+
};
|
|
3940
|
+
type BuildMarketplaceOutputsResult = {
|
|
3941
|
+
ok: true;
|
|
3942
|
+
success: true;
|
|
3943
|
+
dryRun: boolean;
|
|
3944
|
+
skipped: boolean;
|
|
3945
|
+
packages: ResolvedPackage[];
|
|
3946
|
+
resolved: ResolvedPackage[];
|
|
3947
|
+
written: MarketplaceOutputWritten[];
|
|
3948
|
+
warnings: string[];
|
|
3949
|
+
};
|
|
3950
|
+
type ResolveMarketplacePackagesOptions = {
|
|
3951
|
+
cwd?: string;
|
|
3952
|
+
path?: string;
|
|
3953
|
+
offline?: boolean;
|
|
3954
|
+
includePrerelease?: boolean;
|
|
3955
|
+
lsRemote?: LsRemoteFn;
|
|
3956
|
+
config?: MarketplaceAuthoringConfig;
|
|
3957
|
+
};
|
|
3958
|
+
type ResolveMarketplacePackagesResult = {
|
|
3959
|
+
packages: ResolvedPackage[];
|
|
3960
|
+
resolved: ResolvedPackage[];
|
|
3961
|
+
};
|
|
3962
|
+
//#endregion
|
|
3963
|
+
//#region src/modules/Marketplace/modules/PackOutputs/profiles.d.ts
|
|
3964
|
+
/** Ensure candidate resolves under project root (path jail). */
|
|
3965
|
+
declare function ensureMarketplacePathWithin(absolutePath: string, projectRoot: string): string;
|
|
3966
|
+
type ResolveEffectiveOutputPathOptions = {
|
|
3967
|
+
cwd: string;
|
|
3968
|
+
format: MarketplaceOutputFormat;
|
|
3969
|
+
defaultOutput: string;
|
|
3970
|
+
/** Explicit override path (CLI or caller). */
|
|
3971
|
+
path?: string;
|
|
3972
|
+
config?: MarketplaceAuthoringConfig;
|
|
3973
|
+
};
|
|
3974
|
+
/**
|
|
3975
|
+
* Resolve effective output path with precedence:
|
|
3976
|
+
* CLI override → outputs.<fmt>.path → profile default.
|
|
3977
|
+
* Confined under project root.
|
|
3978
|
+
*/
|
|
3979
|
+
declare function resolveEffectiveOutputPath(options: ResolveEffectiveOutputPathOptions): string;
|
|
3980
|
+
/** Alias for acceptance soft-resolve. */
|
|
3981
|
+
declare const resolveMarketplaceOutputPath: typeof resolveEffectiveOutputPath;
|
|
3982
|
+
/**
|
|
3983
|
+
* Formats enabled by authoring `outputs` map (and legacy top-level claude/codex keys).
|
|
3984
|
+
*/
|
|
3985
|
+
declare function formatsEnabledInConfig(config: MarketplaceAuthoringConfig, knownFormats: Iterable<string>): MarketplaceOutputFormat[];
|
|
3986
|
+
type ParseMarketplaceFilterResult = {
|
|
3987
|
+
kind: "all";
|
|
3988
|
+
} | {
|
|
3989
|
+
kind: "none";
|
|
3990
|
+
} | {
|
|
3991
|
+
kind: "list";
|
|
3992
|
+
formats: MarketplaceOutputFormat[];
|
|
3993
|
+
};
|
|
3994
|
+
/**
|
|
3995
|
+
* Parse CLI `--marketplace` filter. Unknown format → hard error.
|
|
3996
|
+
*/
|
|
3997
|
+
declare function parseMarketplaceFilter(marketplace: string | string[] | undefined, knownFormats?: ReadonlySet<string>): ParseMarketplaceFilterResult;
|
|
3998
|
+
/** Intersect config-enabled formats with CLI filter. */
|
|
3999
|
+
declare function selectOutputFormats(config: MarketplaceAuthoringConfig, marketplace: string | string[] | undefined, knownFormats?: ReadonlySet<string>): MarketplaceOutputFormat[];
|
|
4000
|
+
declare function normalizeMarketplacePathOverrides(input: Record<string, string> | Array<string | {
|
|
4001
|
+
format: string;
|
|
4002
|
+
path: string;
|
|
4003
|
+
}> | undefined, knownFormats?: ReadonlySet<string>): Record<string, string>;
|
|
4004
|
+
//#endregion
|
|
4005
|
+
//#region src/modules/Marketplace/modules/PackOutputs/resolve.d.ts
|
|
4006
|
+
/**
|
|
4007
|
+
* Resolve authoring packages → ResolvedPackage[] (local pass-through; github via ls-remote).
|
|
4008
|
+
*/
|
|
4009
|
+
declare function resolveMarketplacePackages(options?: ResolveMarketplacePackagesOptions): Promise<ResolveMarketplacePackagesResult>;
|
|
4010
|
+
/** Alias for acceptance soft-resolve. */
|
|
4011
|
+
declare const resolveAuthoringPackages: typeof resolveMarketplacePackages;
|
|
4012
|
+
declare const resolveMarketplacePackPackages: typeof resolveMarketplacePackages;
|
|
4013
|
+
//#endregion
|
|
4014
|
+
//#region src/modules/Marketplace/modules/PackOutputs/mappers.d.ts
|
|
4015
|
+
/** Serialize host-owned marketplace documents with stable formatting. */
|
|
4016
|
+
declare function serializeMarketplaceJson(doc: Record<string, unknown>): string;
|
|
4017
|
+
//#endregion
|
|
4018
|
+
//#region src/modules/Marketplace/modules/PackOutputs/write.d.ts
|
|
4019
|
+
/**
|
|
4020
|
+
* Atomically write marketplace.json (temp + rename) and create parent dirs.
|
|
4021
|
+
*/
|
|
4022
|
+
declare function atomicWriteMarketplaceJson(absolutePath: string, contents: string): void;
|
|
4023
|
+
//#endregion
|
|
4024
|
+
//#region src/modules/Marketplace/modules/PackOutputs/build.d.ts
|
|
4025
|
+
/**
|
|
4026
|
+
* Load authoring → resolve once → map → atomic multi-output write (or dry-run).
|
|
4027
|
+
*/
|
|
4028
|
+
declare function buildMarketplaceOutputs(options?: BuildMarketplaceOutputsOptions): Promise<BuildMarketplaceOutputsResult>;
|
|
4029
|
+
/** Aliases accepted by acceptance soft-resolve. */
|
|
4030
|
+
declare const emitMarketplacePackOutputs: typeof buildMarketplaceOutputs;
|
|
4031
|
+
declare const runMarketplaceBuilder: typeof buildMarketplaceOutputs;
|
|
4032
|
+
declare const writeMarketplacePackOutputs: typeof buildMarketplaceOutputs;
|
|
4033
|
+
/**
|
|
4034
|
+
* Detect whether cwd has a loadable marketplace authoring block (no throw on none).
|
|
4035
|
+
*/
|
|
4036
|
+
declare function tryLoadMarketplaceAuthoring(cwd: string): MarketplaceAuthoringConfig | undefined;
|
|
4037
|
+
//#endregion
|
|
4038
|
+
//#region src/common/packageVersion.d.ts
|
|
4039
|
+
/**
|
|
4040
|
+
* Runtime package version from `@b-apm/core` package.json (lockstep with CLI releases).
|
|
4041
|
+
* Resolves both `src/app/` (tests/dev) and `dist/` (published) layouts.
|
|
4042
|
+
*/
|
|
4043
|
+
declare function getVersion(): string;
|
|
4044
|
+
//#endregion
|
|
4045
|
+
//#region src/app/publicApi.d.ts
|
|
4046
|
+
declare const BAPM_NAME = "bapm";
|
|
4047
|
+
//#endregion
|
|
4048
|
+
export { AGENT_PLUGIN_MANIFEST_SCHEMA_V1, APM_LOCAL_MANIFEST_FILE, APM_LOCK_FILE, APM_MANIFEST_FILE, APM_MODULES_DIR, APM_POLICY_FILE, type AgentPluginAuthor, type AgentPluginDeclaredPath, type AgentPluginDiagnostic, type AgentPluginManifest, type AgentPluginMcpServer, type AgentPluginSkill, AgentPluginsError, type AgentPluginsErrorCode, type AnnotatedTagCandidate, type ApplyMcpInventoryOptions, type AttributedPrimitive, type AuditCiCheck, type AuditCiCheckName, type AuditCiFormat, type AuditCiResult, type AuditCiStructuredReport, type AuditCiSummary, BAPM_LOCAL_MANIFEST_FILE, BAPM_LOCK_FILE, BAPM_MANIFEST_FILE, BAPM_NAME, BAPM_POLICY_FILE, type BakeMcpStringMapOptions, type BakeableMcpServer, type BapmDependency, type BapmManifest, type BuildGitChildEnvOptions, type BuildMarketplaceOutputsOptions, type BuildMarketplaceOutputsResult, type BuildPublishArchiveOptions, type BuildPublishArchiveResult, CACHE_TTL_SECONDS, CANONICAL_TARGET_TOKENS, CYCLONEDX_SPEC_VERSION, type CacheCleanOptions, type CacheCleanResult, type CacheInfoOptions, type CacheInfoResult, type CheckMarketplaceAuthoringResult, type CheckReleaseTagOptions, type CheckReleaseTagResult, type CheckSelfUpdateOptions, type CheckSelfUpdateResult, type ClassifiedDependency, type CollectMcpServersOptions, type CollectMcpServersResult, type CollectedMcpServer, type CompileAgentsMdOptions, type CompileAgentsMdResult, type CompileAttributionEntry, type CreateAgentPluginManifestOptions, type CreateMinimalManifestOptions, type CreatePluginJsonOptions, type CreateRegistryClientOptions, DEFAULT_LOCAL_ROOT, DEFAULT_PARALLEL_CHECKS, DEFAULT_PARALLEL_DOWNLOADS, DEFAULT_POLICY_PROVIDERS, DEPLOYED_HASH_ALGO, type DependencyEntry, type DependencyKind, type DependencyLists, type DeployedHashViolation, type DepsListResult, type DepsTreeResult, type DepsWhyError, type DepsWhyPackage, type DepsWhyPath, type DepsWhyPathNode, type DepsWhyResult, type DetectAuthoringConfigSourceResult, type DiscoverAgentPluginDeclaredPathsResult, type DiscoverAgentPluginMcpOptions, type DiscoverAgentPluginMcpResult, type DiscoverAgentPluginSkillsOptions, type DiscoverAgentPluginSkillsResult, type DiscoverLockfileOptions, type DiscoverManifestOptions, type DiscoverPolicyOptions, type DiscoverPrimitivesOptions, type DiscoveredLockfile, type DiscoveredManifest, type DiscoveredPolicy, type DoctorCheck, type DoctorResult, type DownloadArgs, type DownloadPackageSpec, type DownloadPackagesOptions, type Downloader, EXPERIMENTAL_REGISTRIES_ENV, type EditorResult, type EnforceFrozenOptions, type EvaluateExecutableTrustOptions, type EvaluatePolicyOptions, type EvaluatePolicyResult, type EvaluateRequiredPackagePresenceOptions, type EvaluateRequiredPackagePresenceResult, type ExecutableGrantEntry, type ExecutableGrantSurface, type ExecutableTrustDecision, type ExecutableTrustOutcome, type ExportSbomFailure, type ExportSbomOptions, type ExportSbomResult, type ExportSbomSuccess, type ExtractPackArchiveOptions, type ExtractPackArchiveResult, FIXED_EPOCH_TIMESTAMP, FORMAT_CYCLONEDX, FORMAT_SPDX, type FakeTag, type FetchWithRedirectAuthDropInit, type FindPathOptions, type FindPathResult, type GitRemote, type GrantSurfaceInput, IMPLEMENTATION_DEFAULT_HOST, InstallError, type InstallErrorCode, type InstallOptions, type InstallResult, type InventoryDep, KIND_EXPRESSION, KIND_ID, KIND_NAMED, type LicenseClass, type LicenseKind, type LoadAgentPluginManifestOptions, type LoadLockfileOptions, type LoadLockfileResult, type LoadManifestOptions, type LoadManifestResult, type LoadMarketplaceResult, type LoadPolicyOptions, type LoadPolicyResult, type LoadedAgentPluginManifest, type LockFilename, type LockedDependency, type LockfileDocument, LockfileError, type LockfileErrorCode, type LockfileInput, type LsRemoteFn, type LsRemoteResult, MARKETPLACE_PATHS, MAX_MARKETPLACE_JSON_BYTES, MAX_RESOLVE_DEPTH, MAX_SAFE_ENTRIES, MAX_SAFE_UNCOMPRESSED_BYTES, ManifestError, type ManifestErrorCode, type ManifestFilename, type ManifestWarning, type MarketplaceAuthoringConfig, MarketplaceAuthoringError, type MarketplaceConcreteDep, type MarketplaceConfigOptions, MarketplaceError, MarketplaceFetchError, type MarketplaceFetchOptions, type MarketplaceHostClass, type MarketplaceManifest, MarketplaceNotFoundError, type MarketplaceOutputFormat, type MarketplaceOutputWritten, MarketplacePackOutputsError, type MarketplacePlugin, MarketplacePluginNotFoundError, type MarketplacePluginResolution, type MarketplaceProvenance, MarketplaceSource, type MarketplaceSourceInit, type MarketplaceSourceKind, MarketplaceUnsupportedSourceError, McpEnvBakeError, type MigrateMarketplaceYmlResult, type ObjectDependency, type OrgExecutables, OutdatedError, type OutdatedErrorCode, type OutdatedResult, type OutdatedRow, PLATFORM_TOKEN_ENV_NAMES, POLICY_DISCOVERY_PROVIDERS, POLICY_EXTENDS_MAX_DEPTH, POLICY_PROVIDER_GITHUB_OWNER_DOTGITHUB, POLICY_PROVIDER_LOCAL, PackError, type PackErrorCode, type PackageEntry, type ParseExecutableGrantsOptions, type ParseMarketplaceFilterResult, type ParsePolicyResult, type ParsedMarketplaceRef, type PluginJsonAuthor, type PluginJsonDocument, type PolicyCandidate, type PolicyDependencies, type PolicyDependencyInput, type PolicyDocument, type PolicyEnforcement, PolicyError, type PolicyErrorCode, type PolicyExecutables, type PolicyGateOptions, type PolicyGateResult, type PolicyStatusOptions, type PolicyStatusOutcome, type PolicyStatusReport, type PolicyStatusRuleCounts, type PolicyViolation, type PolicyWarning, type PrimitiveConflictDiagnostic, type PrimitiveSource, type PrimitiveType, PrimitivesError, type PrimitivesErrorCode, type ProviderHostClass, PruneError, type PruneErrorCode, type PruneResult, type PurgeInstallPathArgs, type RegistryAliasEntry, type RegistryAliasMap, type RegistryClient, type RegistryEntry, RegistryError, type RegistryErrorCode, type RegistryHttpRequest, type RegistryHttpResponse, type RegistryHttpTransport, type RegistryVersionInfo, type RequiredPackagePresenceDiagnostic, type RequiredPackageTrustOutcome, type ResolveAndLockOptions, type ResolveAndLockResult, type ResolveCredentialsOptions, type ResolveDependencyGraphOptions, type ResolveEffectiveFrozenOptions, type ResolveEffectiveOutputPathOptions, type ResolveExecutableTrustOptions, type ResolveGraphResult, type ResolveMarketplacePackagesOptions, type ResolveMarketplacePackagesResult, type ResolveMarketplacePluginOptions, type ResolvePorts, type ResolvePrimitiveConflictsOptions, type ResolvePrimitiveConflictsResult, type ResolvedCredentials, type ResolvedDeployedFile, type ResolvedMarketplaceToken, type ResolvedNode, type ResolvedPackage, ResolverError, type ResolverErrorCode, type ReverseIndex, type RunAuditCiOptions, type RunDepsOptions, type RunDoctorOptions, type RunInstallOptions, type RunOutdatedOptions, type RunPackOptions, type RunPackResult, type RunPruneOptions, type RunUninstallOptions, type RunUpdateOptions, SPDX_VERSION, SUPPORTED_FORMATS, SafeExtractError, type SameCredentialHostClassOptions, type SaveUserExecutableGrantsOptions, type SbomFormat, type SourceValidationResult, TARGET_ALIAS_TOKENS, type TagLister, type TargetIntegrationMap, type TreeSha256Violation, UninstallError, type UninstallErrorCode, type UninstallResult, UpdateError, type UpdateErrorCode, type UpdatePlanEntry, type UpdateResult, type UserExecutableGrants, type UserExecutableStoreOptions, VENDOR_TARGET_RE, type ValidationResult, type ViewError, type ViewIdentity, type ViewPackageOptions, type ViewPackageResult, WORKSPACE_OWNER_KEY, type WriteAgentPluginManifestOptions, type WriteLockfileOptions, type WriteManifestOptions, type WritePluginJsonOptions, type WriteProducerManifestOptions, type WriteProducerManifestResult, type WrittenAgentPluginManifest, _formatOrigin, abbreviateSha, addMarketplace, addMarketplacePackage, applyDeployedHashesToLock, applyMcpInventoryToLock, assertExperimentalRegistriesEnabled, assertPolicyGateAllows, assertSafeZipCentralDirectory, atomicWriteMarketplaceJson, auditCi, authHeadersForHost, authHeadersForResolved, authHostClassOf, autoDetectMarketplacePath, bakeMcpServerMaps, bakeMcpStringMap, bakeMcpStringValue, buildAliasCredentialClassMap, buildFindReverseIndex, buildGitChildEnv, buildHardenedGitEnv, buildMarketplaceOutputs, buildPluginJson, buildPublishArchive, buildPurl, buildRegistryPublishZip, buildReverseIndex, build_reverse_index, cacheClean, cacheInfo, cacheKeyForSource, checkAuthoringMarketplace, checkDoctor, checkExecutableTrust, checkMarketplaceAuthoring, checkOutdated, checkRelease, checkReleaseTag, checkSelfUpdate, classifyDeclaredLicense, classifyDependencyRef, classifyExecutableTrust, classifyMarketplaceHost, classifyMarketplaceHostKind, classifyProviderHostClass, classifyRequiredPackagePresence, cleanModulesCache, cleanupOrphanDeployedFiles, clearMarketplaceCache, collectAdoHosts, collectDeployedHashViolations, collectDeployedHashes, collectLocalSourcePaths, collectMcpServers, collectTreeSha256Violations, compareSelfUpdate, compileAgentsMd, compileProject, componentName, componentVersion, computeCanonicalTreeSha256, createAgentPluginManifest, createDefaultDownloader, createDefaultGitRemote, createDefaultTagLister, createFetchTransport, createGitChildEnv, createMarketplaceAuthoringTemplate, createMarketplaceManifest, createMarketplacePlugin, createMarketplaceSource, createMinimalManifest, createMinimalManifestDocument, createPackageRegistryClient, createPeelAwareTagLister, createPluginJson, createPluginJsonDocument, createPublishArchive, createRegistryClient, createRegistryHttpClient, credentialHostClass, credentialHostClassForHost, credentialHostClassOf, credentialHostClassesEqual, declaredTargetIds, declaredTargetIntegrationMap, defaultPolicyProviders, depsList, depsTree, depsWhy, describeSecretRefuse, detectAuthoringConfigSource, digestsEqual, discoverAgentPluginDeclaredPaths, discoverAgentPluginMcp, discoverAgentPluginSkills, discoverLocalPolicyPath, discoverLockfilePath, discoverManifestPath, discoverPolicyPath, discoverPolicyProviders, discoverPolicyWithProviders, discoverPrimitives, doctor, downloadPackages, downloadUrl, effectiveLocalPath, effectiveProviderClassForHost, emitAgentsMd, emitManifest, emitMarketplacePackOutputs, emitPluginJson, enforceFrozen, ensureBapmConfigDir, ensureLocalRootUntracked, ensureLocalSourcesUntracked, ensureMarketplacePathWithin, evaluateExecutableTrust, evaluateInstallPolicy, evaluateMcpExecutableTrust, evaluatePolicy, evaluatePolicyRules, evaluateRequireLockPresence, evaluateRequiredPackagePresence, evaluateRequiredPackagesFromLock, experimentalRegistriesRemediation, exportSbom, extractPack, extractPackArchive, fetchAndMaterializeRegistry, fetchLatestCliVersion, fetchMarketplace, fetchRedirectAuthDrop, fetchWithCredentialHostClassRedirects, fetchWithRedirectAuthDrop, findDeployedPath, findLatestAnnotatedTag, findOwnerLabel, findPath, formatAuditCiJson, formatAuditCiSarif, formatFindOrigin, formatFindOwnerLabel, formatOrigin, formatOwnerLabel, formatSourceOrigin, formatTreeSha256Violation, formatUnsupportedMessage, formatsEnabledInConfig, gateExecutableMcp, getBapmConfigDir, getCacheInfo, getMarketplace, getVersion, gitChildEnvForHost, githubApiBaseForHost, hasGrantSurface, hashFileAt, hashFileBytes, hostClassForCredentials, hostClassForPolicy, hostClassOf, hostsShareCredentialClass, identityToCacheDir, initMarketplaceAuthoring, installProject, isCiEnvTruthy, isExemptInsecureHost, isExperimentalRegistriesEnabled, isFullRevisionPin, isGitSourcedLockEntry, isPolicyDisabled, isSecretPackPath, isSemanticallyEquivalent, isUnlockedMarketplaceHost, isValidMarketplaceAuthoringSource, isValidPluginName, isValidProjectName, isValidTargetToken, listDeps, listGitRemotes, listMarketplaces, loadAgentPluginManifest, loadBaseManifest, loadEffectiveManifest, loadExecutableUserGrants, loadLockfile, loadLockfileOrNull, loadManifest, loadMarketplaceAuthoringConfig, loadMarketplaceFromBapmYml, loadMarketplaceFromLegacyYml, loadPolicy, loadUserExecutableGrants, loadUserExecutables, loadYamlDocument, localRootGitignorePattern, localView, locateGitPackageTree, lookup, lookupFindPath, lookupInIndex, lookupReverseIndex, marketplaceCacheDir, marketplaceKindFromHostClass, marketplacesJsonPath, materializeRegistryArchive, materializeRegistryNodes, mayAttachGitCredential, mergeLocalOverlay, mergePolicies, mergePolicy, mergePolicyChain, mergePolicyDocuments, migrateLegacyMarketplaceYml, migrateMarketplaceYml, modulesCacheInfo, modulesRegistryDest, normalizeFindPath, normalizeFormat, normalizeMarketplacePathOverrides, normalizeRepoIdentity, outdated, ownerLabel, packArchive, packProject, packPublishArchive, packageBasenameFromRepo, packageOwnerKey, parseExecutableGrants, parseLocalOverlayDocument, parseLockfile, parseLockfileDocument, parseManifest, parseManifestDocument, parseMarketplaceFilter, parseMarketplaceJson, parseMarketplaceRef, parsePackageId, parsePolicy, parsePolicyDocument, parseZipCentralDirectory, persistUserExecutableGrant, pickHighestInIntersection, pickHighestSatisfyingTag, pickRegistryVersion, pickTightestRange, policyHostClass, prune, pruneModules, purgeModulesInstallPaths, readMarketplaceCache, readUserExecutableGrants, redactPolicyRef, redirectSafeFetch, registryRepoUrl, removeMarketplace, removeMarketplacePackage, renderInitMarketplaceBlock, renderMarketplaceBlock, repoBasename, repoOwnerRepo, resolveAndLock, resolveAuthCredentialsForHost, resolveAuthTokenForHost, resolveAuthoringPackages, resolveConflicts, resolveCredentialsForHost, resolveDependencyGraph, resolveEffectiveFrozen, resolveEffectiveOutputPath, resolveExecutableTrust, resolveExtends, resolveHostClass, resolveHostCredentials, resolveLocalFilesystemPath, resolveMarketplaceOutputPath, resolveMarketplacePackPackages, resolveMarketplacePackages, resolveMarketplacePlugin, resolveMarketplaceTokenForHost, resolvePackageQuery, resolvePolicyChain, resolvePolicyExtends, resolvePrimitiveConflicts, resolveProjectRemote, resolveRegistryBaseUrl, resolveRegistryToken, resolveTokenForHost, resolveUserConfigRoot, rewriteDownloadBase, runAudit, runAuditCi, runCheckRelease, runCompile, runDepsList, runDepsTree, runDepsWhy, runDoctor, runFind, runFindPath, runInstall, runMarketplaceAuthoringCheck, runMarketplaceBuilder, runMarketplaceMigrate, runOutdated, runPack, runPolicyDiscovery, runPolicyGate, runPolicyStatus, runPrune, runSelfUpdateCheck, runUninstall, runUpdate, runView, safeExtractZip, safeResolveUnderCwd, sameCredentialHostClass, sanitizeCacheName, saveExecutableUserGrants, saveUserExecutableGrants, saveUserExecutables, scrubUrl, selectGitRemoteForPolicy, selectOutputFormats, selectProjectRemote, selectProviderClassForHost, serializeAgentPluginManifest, serializeLockfile, serializeManifest, serializeMarketplaceJson, serializePluginJson, serializeSbom, setMarketplacePackage, sha256Digest, sha256Hex, summarizeChecks, toLockRepoUrl, toStructuredReport, treeDeps, treeSha256Equal, tryLoadMarketplaceAuthoring, uninstall, uninstallPackages, unpackArchive, updateProject, urlNamesRemoteManifest, userConfigJsonPath, userGrantsToSurface, validateAgentPluginManifest, validateManifestEnv, validateMarketplace, validateMarketplaceAuthoringSource, validatePluginName, validateProjectName, verifyArchiveDigest, verifyDeployedFileHashes, viewLocalPackage, viewPackage, whyDeps, writeAgentPluginManifest, writeLockfile, writeManifest, writeManifestValidated, writeMarketplaceCache, writeMarketplacePackOutputs, writePluginJson, writePluginJsonFile, writeProducerManifest, writeUserExecutableGrants };
|