arkgate 3.7.0 → 3.8.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/CHANGELOG.md +76 -1145
- package/README.md +59 -19
- package/bin/ark-check-runtime.mjs +1598 -0
- package/bin/ark-check.mjs +32 -1565
- package/bin/ark-mcp-runtime.mjs +1976 -0
- package/bin/ark-mcp.mjs +84 -1495
- package/bin/ark-shared.mjs +34 -38
- package/bin/ark.mjs +33 -66
- package/bin/lib/adapter-contract.mjs +161 -9
- package/bin/lib/agent-gates.mjs +1 -0
- package/bin/lib/analysis-completeness.mjs +28 -0
- package/bin/lib/analysis-engine.mjs +8 -8
- package/bin/lib/analysis-policy.mjs +27 -0
- package/bin/lib/architecture-scan.mjs +70 -357
- package/bin/lib/auto-patch.mjs +76 -8
- package/bin/lib/ci-and-commands.mjs +1 -1
- package/bin/lib/codex-home.mjs +43 -16
- package/bin/lib/design-delta.mjs +4 -0
- package/bin/lib/doctor-advisories.mjs +4 -3
- package/bin/lib/doctor-plan.mjs +40 -41
- package/bin/lib/enforcement-state.mjs +2 -0
- package/bin/lib/github-enforcement.mjs +443 -0
- package/bin/lib/hook-templates.mjs +12 -148
- package/bin/lib/html-report-advisories.mjs +1 -1
- package/bin/lib/html-report-depth.mjs +9 -0
- package/bin/lib/html-report.mjs +5 -5
- package/bin/lib/install-migrate.mjs +83 -79
- package/bin/lib/managed-upgrade.mjs +622 -0
- package/bin/lib/mcp-adoption.mjs +3 -1
- package/bin/lib/parse-health.mjs +6 -5
- package/bin/lib/port-proof.mjs +2 -2
- package/bin/lib/prepare-change.mjs +68 -38
- package/bin/lib/prepare-write.mjs +7 -1
- package/bin/lib/resident-doctor-client.mjs +55 -0
- package/bin/lib/resident-hook.mjs +247 -0
- package/bin/lib/resolved-candidate-facts.mjs +1160 -0
- package/bin/lib/scan-files.mjs +19 -6
- package/bin/lib/snippet-analysis.mjs +119 -0
- package/bin/lib/source-policy.mjs +24 -0
- package/bin/lib/typescript-host.mjs +15 -18
- package/bin/lib/unavailable-analysis.mjs +76 -0
- package/bin/lib/upgrade-command.mjs +115 -0
- package/bin/lib/weakest-link.mjs +21 -179
- package/bin/lib/write-path-capabilities.mjs +167 -16
- package/bin/lib/write-path-detect.mjs +3 -2
- package/dist/eslint/index.cjs +3 -3
- package/dist/eslint/index.d.ts +3 -0
- package/dist/eslint/index.js +3 -3
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +1073 -141
- package/dist/index.js +7 -7
- package/docs/agent-guide.md +103 -59
- package/docs/ai-gates.md +97 -16
- package/docs/demos/01-write-gate-self-correction.md +2 -2
- package/docs/enthusiast/README.md +10 -10
- package/docs/enthusiast/how-to-gallery-starter.md +2 -2
- package/docs/enthusiast/reference-commands.md +18 -1
- package/docs/enthusiast/tutorial-first-project.md +2 -2
- package/docs/package-surface.md +98 -12
- package/docs/typescript-support.md +109 -37
- package/package.json +32 -4
- package/schemas/ark.analysis-result.schema.json +159 -2
- package/schemas/ark.design-delta.schema.json +1 -0
- package/schemas/ark.enforcement-state.schema.json +84 -0
- package/schemas/ark.resolved-candidate-facts.schema.json +1 -0
- package/server.json +2 -2
- package/templates/skills/ark-explore.md +5 -5
- package/templates/skills/ark-fix.md +1 -1
- package/templates/skills/ark-runtime.md +15 -8
- package/templates/skills/ark-upgrade.md +122 -182
- package/bin/lib/ai-velocity.mjs +0 -293
- package/bin/lib/graph-cycles.mjs +0 -6
- package/bin/lib/safety-diagnostics.mjs +0 -284
- package/bin/lib/ts-resolve.mjs +0 -228
- package/dist/configTypes-DAPvBqK6.d.cts +0 -61
- package/dist/eslint/index.d.cts +0 -146
- package/dist/index.d.cts +0 -986
package/dist/index.d.cts
DELETED
|
@@ -1,986 +0,0 @@
|
|
|
1
|
-
import { a as ArkConfigRule, b as ArkConfigSchemaVersion, c as ArkConfigLoadResult, d as ArkConfigLayer, A as ArkConfig } from './configTypes-DAPvBqK6.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Canonical, pure contract for ark.config.json.
|
|
5
|
-
*
|
|
6
|
-
* Tooling adapters own filesystem I/O; this module owns JSON parsing, deterministic
|
|
7
|
-
* migration, defaults, validation, diagnostics, and the published JSON Schema.
|
|
8
|
-
* The standalone CLI artifact is generated into bin/lib/config-contract.mjs.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
declare const ARK_CONFIG_SCHEMA_VERSION: ArkConfigSchemaVersion;
|
|
12
|
-
declare const ARK_CONFIG_SCHEMA: {
|
|
13
|
-
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
14
|
-
readonly $id: "https://unpkg.com/arkgate@2/schemas/ark.config.schema.json";
|
|
15
|
-
readonly title: "ArkGate architecture contract";
|
|
16
|
-
readonly description: "Versioned contract consumed identically by ArkGate CLI, MCP, and ESLint surfaces.";
|
|
17
|
-
readonly type: "object";
|
|
18
|
-
readonly additionalProperties: false;
|
|
19
|
-
readonly required: readonly ["$schema", "schemaVersion", "include", "layers", "rules"];
|
|
20
|
-
readonly properties: {
|
|
21
|
-
readonly $schema: {
|
|
22
|
-
readonly type: "string";
|
|
23
|
-
readonly minLength: 1;
|
|
24
|
-
readonly default: "https://unpkg.com/arkgate@2/schemas/ark.config.schema.json";
|
|
25
|
-
readonly description: "Editor-facing URL or local path for this JSON Schema.";
|
|
26
|
-
};
|
|
27
|
-
readonly schemaVersion: {
|
|
28
|
-
readonly type: "string";
|
|
29
|
-
readonly const: "1.0";
|
|
30
|
-
readonly default: "1.0";
|
|
31
|
-
};
|
|
32
|
-
readonly name: {
|
|
33
|
-
readonly type: "string";
|
|
34
|
-
readonly minLength: 1;
|
|
35
|
-
};
|
|
36
|
-
readonly include: {
|
|
37
|
-
readonly minItems: 1;
|
|
38
|
-
readonly default: readonly ["src"];
|
|
39
|
-
readonly type: "array";
|
|
40
|
-
readonly items: {
|
|
41
|
-
readonly type: "string";
|
|
42
|
-
readonly minLength: 1;
|
|
43
|
-
};
|
|
44
|
-
readonly uniqueItems: true;
|
|
45
|
-
};
|
|
46
|
-
readonly exclude: {
|
|
47
|
-
readonly default: readonly [];
|
|
48
|
-
readonly type: "array";
|
|
49
|
-
readonly items: {
|
|
50
|
-
readonly type: "string";
|
|
51
|
-
readonly minLength: 1;
|
|
52
|
-
};
|
|
53
|
-
readonly uniqueItems: true;
|
|
54
|
-
};
|
|
55
|
-
readonly excludeGenerated: {
|
|
56
|
-
readonly type: "boolean";
|
|
57
|
-
readonly default: true;
|
|
58
|
-
};
|
|
59
|
-
readonly frameworkOverlay: {
|
|
60
|
-
readonly type: "string";
|
|
61
|
-
readonly minLength: 1;
|
|
62
|
-
};
|
|
63
|
-
readonly layers: {
|
|
64
|
-
readonly type: "array";
|
|
65
|
-
readonly default: readonly [];
|
|
66
|
-
readonly items: {
|
|
67
|
-
readonly $ref: "#/$defs/layer";
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
readonly rules: {
|
|
71
|
-
readonly type: "array";
|
|
72
|
-
readonly default: ArkConfigRule[];
|
|
73
|
-
readonly items: {
|
|
74
|
-
readonly $ref: "#/$defs/rule";
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
readonly cyclePolicy: {
|
|
78
|
-
readonly type: "string";
|
|
79
|
-
readonly enum: readonly ["strict", "soft", "framework-soft", "off"];
|
|
80
|
-
readonly default: "strict";
|
|
81
|
-
};
|
|
82
|
-
readonly dynamicImportAllowlist: {
|
|
83
|
-
readonly default: readonly [];
|
|
84
|
-
readonly type: "array";
|
|
85
|
-
readonly items: {
|
|
86
|
-
readonly type: "string";
|
|
87
|
-
readonly minLength: 1;
|
|
88
|
-
};
|
|
89
|
-
readonly uniqueItems: true;
|
|
90
|
-
};
|
|
91
|
-
readonly safety: {
|
|
92
|
-
readonly $ref: "#/$defs/safety";
|
|
93
|
-
readonly default: {
|
|
94
|
-
readonly maxTsSuppressions: 0;
|
|
95
|
-
readonly maxAnyCasts: 0;
|
|
96
|
-
readonly allowInMemory: false;
|
|
97
|
-
readonly allowDisabledPeerIsolation: false;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
readonly $defs: {
|
|
102
|
-
readonly layer: {
|
|
103
|
-
readonly type: "object";
|
|
104
|
-
readonly additionalProperties: false;
|
|
105
|
-
readonly required: readonly ["name", "patterns"];
|
|
106
|
-
readonly properties: {
|
|
107
|
-
readonly name: {
|
|
108
|
-
readonly type: "string";
|
|
109
|
-
readonly minLength: 1;
|
|
110
|
-
};
|
|
111
|
-
readonly patterns: {
|
|
112
|
-
readonly minItems: 1;
|
|
113
|
-
readonly type: "array";
|
|
114
|
-
readonly items: {
|
|
115
|
-
readonly type: "string";
|
|
116
|
-
readonly minLength: 1;
|
|
117
|
-
};
|
|
118
|
-
readonly uniqueItems: true;
|
|
119
|
-
};
|
|
120
|
-
readonly exclude: {
|
|
121
|
-
readonly type: "array";
|
|
122
|
-
readonly items: {
|
|
123
|
-
readonly type: "string";
|
|
124
|
-
readonly minLength: 1;
|
|
125
|
-
};
|
|
126
|
-
readonly uniqueItems: true;
|
|
127
|
-
};
|
|
128
|
-
readonly intentPrefixes: {
|
|
129
|
-
readonly type: "array";
|
|
130
|
-
readonly items: {
|
|
131
|
-
readonly type: "string";
|
|
132
|
-
readonly minLength: 1;
|
|
133
|
-
};
|
|
134
|
-
readonly uniqueItems: true;
|
|
135
|
-
};
|
|
136
|
-
readonly description: {
|
|
137
|
-
readonly type: "string";
|
|
138
|
-
readonly minLength: 1;
|
|
139
|
-
};
|
|
140
|
-
readonly forbiddenGlobals: {
|
|
141
|
-
readonly type: "array";
|
|
142
|
-
readonly items: {
|
|
143
|
-
readonly type: "string";
|
|
144
|
-
readonly minLength: 1;
|
|
145
|
-
};
|
|
146
|
-
readonly uniqueItems: true;
|
|
147
|
-
};
|
|
148
|
-
readonly capabilities: {
|
|
149
|
-
readonly type: "object";
|
|
150
|
-
readonly additionalProperties: false;
|
|
151
|
-
readonly properties: {
|
|
152
|
-
readonly deny: {
|
|
153
|
-
readonly type: "array";
|
|
154
|
-
readonly uniqueItems: true;
|
|
155
|
-
readonly items: {
|
|
156
|
-
readonly type: "string";
|
|
157
|
-
readonly enum: readonly ["network", "filesystem", "clock", "randomness", "environment", "process", "persistence"];
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
readonly pure: {
|
|
163
|
-
readonly type: "boolean";
|
|
164
|
-
};
|
|
165
|
-
readonly mayImportInfrastructure: {
|
|
166
|
-
readonly type: "boolean";
|
|
167
|
-
};
|
|
168
|
-
readonly optional: {
|
|
169
|
-
readonly type: "boolean";
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
readonly rule: {
|
|
174
|
-
readonly type: "object";
|
|
175
|
-
readonly additionalProperties: false;
|
|
176
|
-
readonly required: readonly ["from", "to", "allowed"];
|
|
177
|
-
readonly properties: {
|
|
178
|
-
readonly from: {
|
|
179
|
-
readonly type: "string";
|
|
180
|
-
readonly minLength: 1;
|
|
181
|
-
};
|
|
182
|
-
readonly to: {
|
|
183
|
-
readonly type: "string";
|
|
184
|
-
readonly minLength: 1;
|
|
185
|
-
};
|
|
186
|
-
readonly allowed: {
|
|
187
|
-
readonly type: "boolean";
|
|
188
|
-
};
|
|
189
|
-
readonly message: {
|
|
190
|
-
readonly type: "string";
|
|
191
|
-
readonly minLength: 1;
|
|
192
|
-
};
|
|
193
|
-
readonly peerIsolation: {
|
|
194
|
-
readonly type: "boolean";
|
|
195
|
-
};
|
|
196
|
-
readonly sliceFolders: {
|
|
197
|
-
readonly minItems: 1;
|
|
198
|
-
readonly type: "array";
|
|
199
|
-
readonly items: {
|
|
200
|
-
readonly type: "string";
|
|
201
|
-
readonly minLength: 1;
|
|
202
|
-
};
|
|
203
|
-
readonly uniqueItems: true;
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
readonly safety: {
|
|
208
|
-
readonly type: "object";
|
|
209
|
-
readonly additionalProperties: false;
|
|
210
|
-
readonly properties: {
|
|
211
|
-
readonly maxTsSuppressions: {
|
|
212
|
-
readonly type: "integer";
|
|
213
|
-
readonly minimum: 0;
|
|
214
|
-
readonly default: 0;
|
|
215
|
-
};
|
|
216
|
-
readonly maxAnyCasts: {
|
|
217
|
-
readonly type: "integer";
|
|
218
|
-
readonly minimum: 0;
|
|
219
|
-
readonly default: 0;
|
|
220
|
-
};
|
|
221
|
-
readonly allowInMemory: {
|
|
222
|
-
readonly type: "boolean";
|
|
223
|
-
readonly default: false;
|
|
224
|
-
};
|
|
225
|
-
readonly allowDisabledPeerIsolation: {
|
|
226
|
-
readonly type: "boolean";
|
|
227
|
-
readonly default: false;
|
|
228
|
-
};
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
declare function loadArkConfigContract(input: unknown, source?: string): ArkConfigLoadResult;
|
|
234
|
-
declare function parseArkConfigJson(json: string, source?: string): ArkConfigLoadResult;
|
|
235
|
-
|
|
236
|
-
/** ArkGate library version — single source of truth. */
|
|
237
|
-
declare const version = "3.7.0";
|
|
238
|
-
|
|
239
|
-
/** Versioned public result contract shared by every ArkGate enforcement adapter. */
|
|
240
|
-
declare const ARK_ANALYSIS_RESULT_SCHEMA_VERSION: "1.1";
|
|
241
|
-
type AdapterSeverity = 'error' | 'warning';
|
|
242
|
-
type AdapterViolationInput = {
|
|
243
|
-
ruleId?: unknown;
|
|
244
|
-
code?: unknown;
|
|
245
|
-
message?: unknown;
|
|
246
|
-
file?: unknown;
|
|
247
|
-
line?: unknown;
|
|
248
|
-
column?: unknown;
|
|
249
|
-
target?: unknown;
|
|
250
|
-
fromLayer?: unknown;
|
|
251
|
-
toLayer?: unknown;
|
|
252
|
-
typeOnly?: unknown;
|
|
253
|
-
targetTypeOnlyExports?: unknown;
|
|
254
|
-
namedBindingsTypeOnly?: unknown;
|
|
255
|
-
peerIsolation?: unknown;
|
|
256
|
-
severity?: unknown;
|
|
257
|
-
nextAction?: unknown;
|
|
258
|
-
/** U04: the denied capability id on CAPABILITY_VIOLATION. */
|
|
259
|
-
capability?: unknown;
|
|
260
|
-
};
|
|
261
|
-
type AdapterDiagnostic = {
|
|
262
|
-
ruleId: string;
|
|
263
|
-
severity: AdapterSeverity;
|
|
264
|
-
message: string;
|
|
265
|
-
location: {
|
|
266
|
-
file: string;
|
|
267
|
-
line: number;
|
|
268
|
-
column: number;
|
|
269
|
-
};
|
|
270
|
-
evidence: {
|
|
271
|
-
target?: string;
|
|
272
|
-
fromLayer?: string;
|
|
273
|
-
toLayer?: string;
|
|
274
|
-
typeOnly?: boolean;
|
|
275
|
-
};
|
|
276
|
-
/** Added in schema 1.1; optional in TypeScript so 1.0 consumer-owned values remain valid. */
|
|
277
|
-
nextAction?: string;
|
|
278
|
-
};
|
|
279
|
-
type AdapterResult = {
|
|
280
|
-
schemaVersion: '1.0' | typeof ARK_ANALYSIS_RESULT_SCHEMA_VERSION;
|
|
281
|
-
valid: boolean;
|
|
282
|
-
diagnostics: AdapterDiagnostic[];
|
|
283
|
-
};
|
|
284
|
-
declare function toAdapterDiagnostic(violation: AdapterViolationInput, fallbackSeverity?: AdapterSeverity): AdapterDiagnostic;
|
|
285
|
-
declare function createAdapterResult(input: {
|
|
286
|
-
valid: boolean;
|
|
287
|
-
violations?: readonly AdapterViolationInput[];
|
|
288
|
-
warnings?: readonly AdapterViolationInput[];
|
|
289
|
-
}): AdapterResult;
|
|
290
|
-
declare const ARK_ANALYSIS_RESULT_SCHEMA: {
|
|
291
|
-
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
292
|
-
readonly $id: "https://unpkg.com/arkgate@2/schemas/ark.analysis-result.schema.json";
|
|
293
|
-
readonly title: "ArkGate analysis result";
|
|
294
|
-
readonly type: "object";
|
|
295
|
-
readonly additionalProperties: false;
|
|
296
|
-
readonly required: readonly ["schemaVersion", "valid", "diagnostics"];
|
|
297
|
-
readonly properties: {
|
|
298
|
-
readonly schemaVersion: {
|
|
299
|
-
readonly const: "1.1";
|
|
300
|
-
};
|
|
301
|
-
readonly valid: {
|
|
302
|
-
readonly type: "boolean";
|
|
303
|
-
};
|
|
304
|
-
readonly diagnostics: {
|
|
305
|
-
readonly type: "array";
|
|
306
|
-
readonly items: {
|
|
307
|
-
readonly type: "object";
|
|
308
|
-
readonly additionalProperties: false;
|
|
309
|
-
readonly required: readonly ["ruleId", "severity", "message", "location", "evidence"];
|
|
310
|
-
readonly properties: {
|
|
311
|
-
readonly ruleId: {
|
|
312
|
-
readonly type: "string";
|
|
313
|
-
readonly minLength: 1;
|
|
314
|
-
};
|
|
315
|
-
readonly severity: {
|
|
316
|
-
readonly enum: readonly ["error", "warning"];
|
|
317
|
-
};
|
|
318
|
-
readonly message: {
|
|
319
|
-
readonly type: "string";
|
|
320
|
-
readonly minLength: 1;
|
|
321
|
-
};
|
|
322
|
-
readonly location: {
|
|
323
|
-
readonly type: "object";
|
|
324
|
-
readonly additionalProperties: false;
|
|
325
|
-
readonly required: readonly ["file", "line", "column"];
|
|
326
|
-
readonly properties: {
|
|
327
|
-
readonly file: {
|
|
328
|
-
readonly type: "string";
|
|
329
|
-
readonly minLength: 1;
|
|
330
|
-
};
|
|
331
|
-
readonly line: {
|
|
332
|
-
readonly type: "integer";
|
|
333
|
-
readonly minimum: 1;
|
|
334
|
-
};
|
|
335
|
-
readonly column: {
|
|
336
|
-
readonly type: "integer";
|
|
337
|
-
readonly minimum: 1;
|
|
338
|
-
};
|
|
339
|
-
};
|
|
340
|
-
};
|
|
341
|
-
readonly evidence: {
|
|
342
|
-
readonly type: "object";
|
|
343
|
-
readonly additionalProperties: false;
|
|
344
|
-
readonly properties: {
|
|
345
|
-
readonly target: {
|
|
346
|
-
readonly type: "string";
|
|
347
|
-
};
|
|
348
|
-
readonly fromLayer: {
|
|
349
|
-
readonly type: "string";
|
|
350
|
-
};
|
|
351
|
-
readonly toLayer: {
|
|
352
|
-
readonly type: "string";
|
|
353
|
-
};
|
|
354
|
-
readonly typeOnly: {
|
|
355
|
-
readonly type: "boolean";
|
|
356
|
-
};
|
|
357
|
-
};
|
|
358
|
-
};
|
|
359
|
-
readonly nextAction: {
|
|
360
|
-
readonly type: "string";
|
|
361
|
-
readonly minLength: 1;
|
|
362
|
-
};
|
|
363
|
-
};
|
|
364
|
-
};
|
|
365
|
-
};
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* AI Code Gate (basic).
|
|
371
|
-
*
|
|
372
|
-
* Allows validation of generated source code against the defined architecture.
|
|
373
|
-
*/
|
|
374
|
-
interface AICodeGateViolation {
|
|
375
|
-
/** Stable rule identifier for agents and CI pipelines. */
|
|
376
|
-
ruleId: string;
|
|
377
|
-
/** @deprecated Use ruleId — kept for backward compatibility. */
|
|
378
|
-
code: string;
|
|
379
|
-
message: string;
|
|
380
|
-
line?: number;
|
|
381
|
-
suggestion?: string;
|
|
382
|
-
source?: string;
|
|
383
|
-
filePath?: string;
|
|
384
|
-
target?: string;
|
|
385
|
-
fromLayer?: string;
|
|
386
|
-
toLayer?: string;
|
|
387
|
-
details?: unknown;
|
|
388
|
-
}
|
|
389
|
-
/** Extension point for external analyzers (AST, semantic, etc.). */
|
|
390
|
-
interface AIGateExtension<Context = unknown> {
|
|
391
|
-
readonly name: string;
|
|
392
|
-
analyze(source: string, context?: Context): AICodeGateViolation[];
|
|
393
|
-
}
|
|
394
|
-
interface AICodeGateContext {
|
|
395
|
-
filePath?: string;
|
|
396
|
-
agentId?: string;
|
|
397
|
-
layer?: string;
|
|
398
|
-
[key: string]: unknown;
|
|
399
|
-
}
|
|
400
|
-
interface AICodeGateResult {
|
|
401
|
-
valid: boolean;
|
|
402
|
-
violations: AICodeGateViolation[];
|
|
403
|
-
}
|
|
404
|
-
interface AICodeGate<Context = AICodeGateContext> {
|
|
405
|
-
validate(source: string, context?: Context): AICodeGateResult;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Policy types for the Ark kernel.
|
|
410
|
-
*
|
|
411
|
-
* Policies allow declaring architectural rules that can be checked at runtime.
|
|
412
|
-
* Supports both hard policies (must never be violated) and soft policies (warnings).
|
|
413
|
-
*/
|
|
414
|
-
type PolicySeverity = 'hard' | 'soft';
|
|
415
|
-
type PolicyEnforcementMode = 'runtime' | 'static' | 'runtime-and-static' | 'advisory';
|
|
416
|
-
/**
|
|
417
|
-
* Represents a single violation of a policy.
|
|
418
|
-
*/
|
|
419
|
-
interface PolicyViolation {
|
|
420
|
-
/** Name of the policy that was violated */
|
|
421
|
-
policyName: string;
|
|
422
|
-
/** Severity level of the policy */
|
|
423
|
-
severity: PolicySeverity;
|
|
424
|
-
/** Human-readable explanation of the violation */
|
|
425
|
-
message: string;
|
|
426
|
-
/** Optional additional structured details */
|
|
427
|
-
details?: unknown;
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* A Policy defines a rule that can be evaluated against a context.
|
|
431
|
-
*
|
|
432
|
-
* @template Context - The shape of data the policy evaluates (e.g. { registry, events })
|
|
433
|
-
*/
|
|
434
|
-
interface Policy<Context = unknown> {
|
|
435
|
-
/** Unique name of the policy (used in violations and reporting) */
|
|
436
|
-
readonly name: string;
|
|
437
|
-
/** Whether this is a hard rule (enforced strictly) or soft (advisory) */
|
|
438
|
-
readonly severity: PolicySeverity;
|
|
439
|
-
/** Optional tags for policy classification (e.g. 'layer', 'naming') */
|
|
440
|
-
readonly tags?: readonly string[];
|
|
441
|
-
readonly owner?: string;
|
|
442
|
-
readonly version?: string;
|
|
443
|
-
readonly rationale?: string;
|
|
444
|
-
readonly enforcementMode?: PolicyEnforcementMode;
|
|
445
|
-
readonly deprecated?: boolean | string;
|
|
446
|
-
readonly replacedBy?: string;
|
|
447
|
-
/**
|
|
448
|
-
* Evaluates the policy against the given context.
|
|
449
|
-
* Return true / [] for pass, false / single violation / array for failure.
|
|
450
|
-
*/
|
|
451
|
-
check(context: Context): boolean | PolicyViolation | PolicyViolation[];
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Core domain primitives for Ark.
|
|
456
|
-
* These types are the foundation for all governance concepts.
|
|
457
|
-
*/
|
|
458
|
-
/**
|
|
459
|
-
* Semantic intent names follow a convention:
|
|
460
|
-
* - Domain.* for domain events and entities
|
|
461
|
-
* - Application.* for use-cases / orchestration
|
|
462
|
-
* - Adapter.* for integration points
|
|
463
|
-
* - Workflow.* for sagas and processes
|
|
464
|
-
* - Job.* for background jobs and scheduling
|
|
465
|
-
* - Presentation.* for UI/API adapters
|
|
466
|
-
* - Reporting.* for read models and projections
|
|
467
|
-
* - Metadata.* for extensibility contracts
|
|
468
|
-
* - Security.* / Audit.* / Observability.* for cross-cutting kernel concerns
|
|
469
|
-
* - Kernel.* for Ark-owned governance signals
|
|
470
|
-
*/
|
|
471
|
-
type IntentName = `Domain.${string}` | `Application.${string}` | `Adapter.${string}` | `Workflow.${string}` | `Job.${string}` | `Presentation.${string}` | `Reporting.${string}` | `Metadata.${string}` | `Security.${string}` | `Audit.${string}` | `Observability.${string}` | `Kernel.${string}`;
|
|
472
|
-
type CorrelationId = string;
|
|
473
|
-
interface EventMetadata {
|
|
474
|
-
occurredAt: string;
|
|
475
|
-
source: string;
|
|
476
|
-
kernelInstanceId?: string;
|
|
477
|
-
eventVersion?: string;
|
|
478
|
-
schemaVersion?: string;
|
|
479
|
-
allowInterception?: boolean;
|
|
480
|
-
interceptions?: Array<{
|
|
481
|
-
interceptorId: string;
|
|
482
|
-
timestamp: string;
|
|
483
|
-
}>;
|
|
484
|
-
correlationId?: CorrelationId;
|
|
485
|
-
causationId?: string;
|
|
486
|
-
traceId?: string;
|
|
487
|
-
spanId?: string;
|
|
488
|
-
parentSpanId?: string;
|
|
489
|
-
[key: string]: unknown;
|
|
490
|
-
}
|
|
491
|
-
interface DomainEvent<Name extends IntentName = IntentName, Payload = unknown> {
|
|
492
|
-
intent: Name;
|
|
493
|
-
payload: Payload;
|
|
494
|
-
metadata: EventMetadata;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* Intent-specific types for the Ark kernel.
|
|
499
|
-
*
|
|
500
|
-
* Intents provide semantic naming for every important concept in the system
|
|
501
|
-
* (domain events, application operations, adapters, workflows).
|
|
502
|
-
*/
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* An IntentCreator is a callable that creates a strongly-typed DomainEvent
|
|
506
|
-
* when invoked with a payload.
|
|
507
|
-
*
|
|
508
|
-
* It also carries the semantic `name`.
|
|
509
|
-
*
|
|
510
|
-
* @example
|
|
511
|
-
* const OrderPlaced = defineIntent<'Domain.Order.OrderPlaced', { orderId: string }>('Domain.Order.OrderPlaced');
|
|
512
|
-
* const event = OrderPlaced({ orderId: 'o-1' });
|
|
513
|
-
*/
|
|
514
|
-
interface IntentCreator<Name extends IntentName, Payload = unknown> {
|
|
515
|
-
/**
|
|
516
|
-
* Creates a DomainEvent for this intent.
|
|
517
|
-
*/
|
|
518
|
-
(payload: Payload): DomainEvent<Name, Payload>;
|
|
519
|
-
/**
|
|
520
|
-
* The fully-qualified semantic name of the intent (e.g. "Domain.Order.OrderPlaced").
|
|
521
|
-
*/
|
|
522
|
-
readonly name: Name;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* Architecture layer profiles.
|
|
527
|
-
*
|
|
528
|
-
* A profile turns semantic names such as `Domain.Order.Placed` into governed
|
|
529
|
-
* layer names and dependency rules.
|
|
530
|
-
*/
|
|
531
|
-
|
|
532
|
-
interface ArchitectureLayer {
|
|
533
|
-
name: string;
|
|
534
|
-
prefixes: string[];
|
|
535
|
-
/**
|
|
536
|
-
* Custom matcher for teams whose intent names don't follow prefix conventions.
|
|
537
|
-
* Checked before any prefix matching, in layer declaration order. A layer may
|
|
538
|
-
* use `match` alone (with `prefixes: []`), prefixes alone, or both.
|
|
539
|
-
*/
|
|
540
|
-
match?: (name: string) => boolean;
|
|
541
|
-
description?: string;
|
|
542
|
-
order?: number;
|
|
543
|
-
}
|
|
544
|
-
type ArchitectureRule = ArkConfigRule;
|
|
545
|
-
interface ArchitectureProfile {
|
|
546
|
-
name: string;
|
|
547
|
-
layers: ArchitectureLayer[];
|
|
548
|
-
rules: ArchitectureRule[];
|
|
549
|
-
resolveLayer(name: string): string | undefined;
|
|
550
|
-
}
|
|
551
|
-
interface CreateArchitectureProfileOptions {
|
|
552
|
-
name: string;
|
|
553
|
-
layers: ArchitectureLayer[];
|
|
554
|
-
rules?: ArchitectureRule[];
|
|
555
|
-
}
|
|
556
|
-
interface CreateArchitectureProfileFromArkConfigOptions {
|
|
557
|
-
/** Runtime profile name. Default: config.name or "ark.config.json". */
|
|
558
|
-
name?: string;
|
|
559
|
-
}
|
|
560
|
-
type ArchitectureLayerConfig = ArkConfigLayer;
|
|
561
|
-
type ArkCheckConfig = Omit<ArkConfig, '$schema' | 'schemaVersion' | 'rules'> & {
|
|
562
|
-
$schema?: string;
|
|
563
|
-
schemaVersion?: ArkConfig['schemaVersion'];
|
|
564
|
-
rules?: ArchitectureRule[];
|
|
565
|
-
};
|
|
566
|
-
interface CreateElevenLayerArkConfigOptions {
|
|
567
|
-
/** Source root used in generated file patterns. Default: "src". */
|
|
568
|
-
rootDir?: string;
|
|
569
|
-
/** Include entries for ark-check. Default: [rootDir]. */
|
|
570
|
-
include?: string[];
|
|
571
|
-
/** Mark generated layers optional. Default: true. */
|
|
572
|
-
optionalLayers?: boolean;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
declare function createArchitectureProfile(options: CreateArchitectureProfileOptions): ArchitectureProfile;
|
|
576
|
-
declare function createArchitectureProfileFromArkConfig(config: ArkCheckConfig, options?: CreateArchitectureProfileFromArkConfigOptions): ArchitectureProfile;
|
|
577
|
-
declare const elevenLayerProfile: ArchitectureProfile;
|
|
578
|
-
declare function createElevenLayerArkConfig(options?: CreateElevenLayerArkConfigOptions): ArkCheckConfig;
|
|
579
|
-
|
|
580
|
-
/**
|
|
581
|
-
* Basic AI Code Gate implementation.
|
|
582
|
-
*
|
|
583
|
-
* Uses simple string heuristics + registered intent names to detect obvious
|
|
584
|
-
* architectural violations in generated code (e.g. direct infra imports from domain).
|
|
585
|
-
* Not a full static analyzer — documented limitation.
|
|
586
|
-
*/
|
|
587
|
-
|
|
588
|
-
interface AICodeGatePolicyContext<Context = AICodeGateContext> {
|
|
589
|
-
source: string;
|
|
590
|
-
context?: Context;
|
|
591
|
-
}
|
|
592
|
-
interface AICodeGateOptions<Context = AICodeGateContext> {
|
|
593
|
-
policies?: Policy<AICodeGatePolicyContext<Context>>[];
|
|
594
|
-
intents?: Array<string | Pick<IntentCreator<IntentName, unknown>, 'name'>>;
|
|
595
|
-
/**
|
|
596
|
-
* Additional forbidden patterns (regex or strings).
|
|
597
|
-
*/
|
|
598
|
-
forbiddenPatterns?: Array<string | RegExp>;
|
|
599
|
-
/**
|
|
600
|
-
* External analyzer extensions (type-only contract; plug in AST tools later).
|
|
601
|
-
*/
|
|
602
|
-
extensions?: AIGateExtension<Context>[];
|
|
603
|
-
/**
|
|
604
|
-
* Optional architecture profile for layer-aware generated-code checks.
|
|
605
|
-
* When context.layer is provided, intent references are checked against it.
|
|
606
|
-
*/
|
|
607
|
-
architectureProfile?: ArchitectureProfile;
|
|
608
|
-
/**
|
|
609
|
-
* When true, flag string literals that look like intent names but are not registered.
|
|
610
|
-
*/
|
|
611
|
-
enforceIntentAllowlist?: boolean;
|
|
612
|
-
/**
|
|
613
|
-
* Optional TypeScript module object. When provided, AICodeGate adds AST-backed checks
|
|
614
|
-
* for publish misuse without taking a runtime dependency on TypeScript.
|
|
615
|
-
*/
|
|
616
|
-
typescript?: unknown;
|
|
617
|
-
/**
|
|
618
|
-
* Ambient globals forbidden per layer (layer name → entries such as "fetch" or
|
|
619
|
-
* "Date.now"). Checked only when `typescript` is provided and context.layer resolves
|
|
620
|
-
* to a listed layer — mirrors ark-check's FORBIDDEN_GLOBAL rule.
|
|
621
|
-
*/
|
|
622
|
-
forbiddenGlobals?: Record<string, string[]>;
|
|
623
|
-
/**
|
|
624
|
-
* Layer → effective capability deny set (U04 walls; ADR 0009). Enforced like
|
|
625
|
-
* forbiddenGlobals when the target file's layer is known. An ambient use
|
|
626
|
-
* already covered by the layer's forbiddenGlobals reports only
|
|
627
|
-
* FORBIDDEN_GLOBAL (D7 — one violation, one voice).
|
|
628
|
-
*/
|
|
629
|
-
capabilityWalls?: Record<string, string[]>;
|
|
630
|
-
/**
|
|
631
|
-
* Layer names whose role is infrastructure and may therefore import infrastructure
|
|
632
|
-
* (a persistence adapter importing the DB is correct, not a violation). The built-in
|
|
633
|
-
* infra-import heuristics are suppressed for these layers and for any layer whose
|
|
634
|
-
* name matches the conventional infra tokens. Populate from ark.config.json layers
|
|
635
|
-
* flagged `mayImportInfrastructure: true`, so unconventionally-named infra layers
|
|
636
|
-
* opt in explicitly. User-supplied `forbiddenPatterns` still apply everywhere.
|
|
637
|
-
*/
|
|
638
|
-
infrastructureLayers?: string[];
|
|
639
|
-
/**
|
|
640
|
-
* Preferred single resolve step: import specifier or absolute source file →
|
|
641
|
-
* `{ layer, relPath }` for contract + peerIsolation. Prefer this over the
|
|
642
|
-
* legacy layer-only callback.
|
|
643
|
-
*/
|
|
644
|
-
resolveImportTarget?: (specifierOrFilePath: string, fromFilePath?: string) => {
|
|
645
|
-
layer?: string;
|
|
646
|
-
relPath?: string;
|
|
647
|
-
} | undefined;
|
|
648
|
-
/**
|
|
649
|
-
* @deprecated Prefer resolveImportTarget. Layer-only resolve for governed imports.
|
|
650
|
-
*/
|
|
651
|
-
resolveImportLayer?: (specifier: string, fromFilePath?: string) => string | undefined;
|
|
652
|
-
/**
|
|
653
|
-
* Layer configs (patterns) used to infer sliceFolders when a peerIsolation rule
|
|
654
|
-
* omits an explicit list.
|
|
655
|
-
*/
|
|
656
|
-
architectureLayers?: Array<{
|
|
657
|
-
name: string;
|
|
658
|
-
patterns?: string[];
|
|
659
|
-
}>;
|
|
660
|
-
/** Explicit file-level escape hatch for reviewed non-literal import()/require() calls. */
|
|
661
|
-
allowNonLiteralDynamicImport?: (filePath?: string) => boolean;
|
|
662
|
-
}
|
|
663
|
-
declare function createAICodeGate<Context = AICodeGateContext>(options?: AICodeGateOptions<Context>): AICodeGate<Context>;
|
|
664
|
-
|
|
665
|
-
declare const ARK_CHANGE_MAP_SCHEMA_VERSION: "1.0";
|
|
666
|
-
type ArchitectureChangeOperation = 'create' | 'update' | 'delete';
|
|
667
|
-
type ArchitectureChangeMapFile = {
|
|
668
|
-
path: string;
|
|
669
|
-
operation: ArchitectureChangeOperation;
|
|
670
|
-
layer: string;
|
|
671
|
-
};
|
|
672
|
-
type ArchitectureChangeMapDependency = {
|
|
673
|
-
from: string;
|
|
674
|
-
to: string;
|
|
675
|
-
};
|
|
676
|
-
type ArchitectureChangeMap = {
|
|
677
|
-
$schema: string;
|
|
678
|
-
schemaVersion: typeof ARK_CHANGE_MAP_SCHEMA_VERSION;
|
|
679
|
-
files: ArchitectureChangeMapFile[];
|
|
680
|
-
dependencies: ArchitectureChangeMapDependency[];
|
|
681
|
-
};
|
|
682
|
-
type ArchitectureChangeMapContract = {
|
|
683
|
-
map: ArchitectureChangeMap;
|
|
684
|
-
hash: string;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
type ArchitectureDependency = {
|
|
688
|
-
from: string;
|
|
689
|
-
to: string;
|
|
690
|
-
};
|
|
691
|
-
type ArchitectureActualChange = {
|
|
692
|
-
path: string;
|
|
693
|
-
operation: ArchitectureChangeOperation;
|
|
694
|
-
};
|
|
695
|
-
type ArchitectureConvergenceClassification = 'satisfied' | 'missing' | 'contradictory' | 'unplanned';
|
|
696
|
-
type ArchitectureConvergenceFinding = {
|
|
697
|
-
id: string;
|
|
698
|
-
classification: ArchitectureConvergenceClassification;
|
|
699
|
-
subject: 'file' | 'dependency';
|
|
700
|
-
message: string;
|
|
701
|
-
nextAction?: string;
|
|
702
|
-
path?: string;
|
|
703
|
-
from?: string;
|
|
704
|
-
to?: string;
|
|
705
|
-
expectedOperation?: ArchitectureChangeOperation;
|
|
706
|
-
actualOperation?: ArchitectureChangeOperation | 'added' | 'removed';
|
|
707
|
-
};
|
|
708
|
-
type ArchitectureConvergenceResult = {
|
|
709
|
-
schemaVersion: '1.0';
|
|
710
|
-
readOnly: true;
|
|
711
|
-
changeMapHash: string;
|
|
712
|
-
structurallyConverged: boolean;
|
|
713
|
-
behavioralCompletion: 'not-evaluated';
|
|
714
|
-
summary: Record<ArchitectureConvergenceClassification, number>;
|
|
715
|
-
findings: ArchitectureConvergenceFinding[];
|
|
716
|
-
};
|
|
717
|
-
type AnalyzeArchitectureConvergenceInput = {
|
|
718
|
-
changeMap: ArchitectureChangeMapContract;
|
|
719
|
-
changes: readonly ArchitectureActualChange[];
|
|
720
|
-
baseDependencies: readonly ArchitectureDependency[];
|
|
721
|
-
candidateDependencies: readonly ArchitectureDependency[];
|
|
722
|
-
};
|
|
723
|
-
declare function analyzeArchitectureConvergence(input: AnalyzeArchitectureConvergenceInput): ArchitectureConvergenceResult;
|
|
724
|
-
|
|
725
|
-
type SemanticDependencyKind = 'import' | 'export' | 'dynamic-import' | 'require';
|
|
726
|
-
type SemanticDependency = {
|
|
727
|
-
specifier?: string;
|
|
728
|
-
kind: SemanticDependencyKind;
|
|
729
|
-
line: number;
|
|
730
|
-
typeOnly: boolean;
|
|
731
|
-
unresolved: boolean;
|
|
732
|
-
node: unknown;
|
|
733
|
-
};
|
|
734
|
-
type ForbiddenCapabilityUse = {
|
|
735
|
-
name: string;
|
|
736
|
-
line: number;
|
|
737
|
-
node: unknown;
|
|
738
|
-
};
|
|
739
|
-
/** Extract every dependency form whose specifier is statically knowable, plus unresolved calls. */
|
|
740
|
-
declare function extractSemanticDependencies(ts: any, sourceFile: any): SemanticDependency[];
|
|
741
|
-
/** Resolve forbidden ambient capabilities through symbols, aliases, globalThis, and static keys. */
|
|
742
|
-
declare function collectForbiddenCapabilityUses(ts: any, sourceFile: any, forbidden: readonly string[]): ForbiddenCapabilityUse[];
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* Stable, pure vocabulary for ArkGate's importable analysis engine.
|
|
746
|
-
*
|
|
747
|
-
* Parsing and filesystem discovery belong to adapters. This module intentionally
|
|
748
|
-
* contains only the versioned data contract and deterministic hash primitives.
|
|
749
|
-
*/
|
|
750
|
-
declare const ANALYSIS_IR_SCHEMA_VERSION: "1.0";
|
|
751
|
-
type AnalysisFileInput = {
|
|
752
|
-
path: string;
|
|
753
|
-
content: string;
|
|
754
|
-
};
|
|
755
|
-
type AnalysisFileChange = {
|
|
756
|
-
path: string;
|
|
757
|
-
content: string;
|
|
758
|
-
} | {
|
|
759
|
-
path: string;
|
|
760
|
-
delete: true;
|
|
761
|
-
};
|
|
762
|
-
type AnalysisCompilerOptions = Readonly<Record<string, unknown>>;
|
|
763
|
-
type AnalysisFile = AnalysisFileInput & {
|
|
764
|
-
contentHash: string;
|
|
765
|
-
layer: string | null;
|
|
766
|
-
};
|
|
767
|
-
type AnalysisImportEdge = {
|
|
768
|
-
from: string;
|
|
769
|
-
specifier: string;
|
|
770
|
-
to: string | null;
|
|
771
|
-
resolution: 'resolved' | 'unresolved';
|
|
772
|
-
fromLayer: string | null;
|
|
773
|
-
toLayer: string | null;
|
|
774
|
-
evidence: AnalysisEvidence;
|
|
775
|
-
};
|
|
776
|
-
/** A capability use is reserved for C04's symbol-aware implementation. */
|
|
777
|
-
type AnalysisCapabilityUse = {
|
|
778
|
-
file: string;
|
|
779
|
-
symbol: string;
|
|
780
|
-
capability: string;
|
|
781
|
-
evidence: AnalysisEvidence;
|
|
782
|
-
};
|
|
783
|
-
type AnalysisEvidence = {
|
|
784
|
-
kind: 'import' | 'policy';
|
|
785
|
-
file: string;
|
|
786
|
-
line: number;
|
|
787
|
-
excerpt: string;
|
|
788
|
-
};
|
|
789
|
-
type AnalysisViolation = {
|
|
790
|
-
ruleId: string;
|
|
791
|
-
message: string;
|
|
792
|
-
edge?: AnalysisImportEdge;
|
|
793
|
-
/** U04 (additive): present on CAPABILITY_VIOLATION — the denied capability id. */
|
|
794
|
-
capability?: string;
|
|
795
|
-
/** U04 (additive): the matched module specifier or ambient path. */
|
|
796
|
-
symbol?: string;
|
|
797
|
-
evidence: AnalysisEvidence;
|
|
798
|
-
};
|
|
799
|
-
type AnalysisIr = {
|
|
800
|
-
schemaVersion: typeof ANALYSIS_IR_SCHEMA_VERSION;
|
|
801
|
-
policyHash: string;
|
|
802
|
-
compilerOptionsHash: string;
|
|
803
|
-
files: AnalysisFile[];
|
|
804
|
-
layers: string[];
|
|
805
|
-
edges: AnalysisImportEdge[];
|
|
806
|
-
capabilityUses: AnalysisCapabilityUse[];
|
|
807
|
-
violations: AnalysisViolation[];
|
|
808
|
-
};
|
|
809
|
-
/**
|
|
810
|
-
* Stable FNV-1a hash. It is an identity/fingerprint, not a security primitive.
|
|
811
|
-
* The output is deliberately portable across the CLI, MCP, hooks, and browserless
|
|
812
|
-
* consumers without Node's crypto runtime.
|
|
813
|
-
*/
|
|
814
|
-
declare function deterministicHash(value: string): string;
|
|
815
|
-
/** Serialize JSON-like values with sorted object keys for reproducible hashes. */
|
|
816
|
-
declare function stableSerialize(value: unknown): string;
|
|
817
|
-
|
|
818
|
-
declare const POLICY_DELTA_SCHEMA_VERSION: "1.0";
|
|
819
|
-
type PolicyDeltaClassification = 'strengthening' | 'neutral' | 'judgment-required' | 'weakening';
|
|
820
|
-
type PolicyDeltaFinding = {
|
|
821
|
-
id: string;
|
|
822
|
-
path: string;
|
|
823
|
-
classification: Exclude<PolicyDeltaClassification, 'neutral'>;
|
|
824
|
-
message: string;
|
|
825
|
-
nextAction?: string;
|
|
826
|
-
before?: unknown;
|
|
827
|
-
after?: unknown;
|
|
828
|
-
};
|
|
829
|
-
type PolicyDelta = {
|
|
830
|
-
schemaVersion: typeof POLICY_DELTA_SCHEMA_VERSION;
|
|
831
|
-
classification: PolicyDeltaClassification;
|
|
832
|
-
findings: PolicyDeltaFinding[];
|
|
833
|
-
};
|
|
834
|
-
type PolicyDeltaAcknowledgement = {
|
|
835
|
-
schemaVersion: typeof POLICY_DELTA_SCHEMA_VERSION;
|
|
836
|
-
basePolicyHash: string;
|
|
837
|
-
candidatePolicyHash: string;
|
|
838
|
-
findingIds: readonly string[];
|
|
839
|
-
reason: string;
|
|
840
|
-
};
|
|
841
|
-
declare function classifyArkPolicyDelta(base: ArkConfig, candidate: ArkConfig): PolicyDelta;
|
|
842
|
-
declare function policyDeltaAcknowledgementMatches(acknowledgement: PolicyDeltaAcknowledgement | undefined, expected: {
|
|
843
|
-
basePolicyHash: string;
|
|
844
|
-
candidatePolicyHash: string;
|
|
845
|
-
findingIds: readonly string[];
|
|
846
|
-
}): boolean;
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Public type vocabulary of the canonical analysis API (U02 pilot 2).
|
|
850
|
-
*
|
|
851
|
-
* Declarations only — the C02 entry point src/kernel/analysis.ts re-exports
|
|
852
|
-
* everything here, so consumer import paths never change.
|
|
853
|
-
*/
|
|
854
|
-
|
|
855
|
-
type AnalysisContract = ArkConfigLoadResult & {
|
|
856
|
-
policyHash: string;
|
|
857
|
-
};
|
|
858
|
-
type AnalyzeProjectInput = {
|
|
859
|
-
contract: AnalysisContract;
|
|
860
|
-
files: readonly AnalysisFileInput[];
|
|
861
|
-
compilerOptions?: AnalysisCompilerOptions;
|
|
862
|
-
};
|
|
863
|
-
type AnalyzeChangeInput = AnalyzeProjectInput & {
|
|
864
|
-
changes: readonly AnalysisFileChange[];
|
|
865
|
-
changeMap?: ArchitectureChangeMapContract;
|
|
866
|
-
};
|
|
867
|
-
type AnalysisResult = {
|
|
868
|
-
ir: AnalysisIr;
|
|
869
|
-
};
|
|
870
|
-
type AnalyzePolicyDeltaInput = {
|
|
871
|
-
baseConfig: unknown;
|
|
872
|
-
candidateConfig: unknown;
|
|
873
|
-
acknowledgement?: PolicyDeltaAcknowledgement;
|
|
874
|
-
baseSource?: string;
|
|
875
|
-
candidateSource?: string;
|
|
876
|
-
};
|
|
877
|
-
type PolicyDeltaAnalysis = {
|
|
878
|
-
schemaVersion: '1.0';
|
|
879
|
-
basePolicyHash: string;
|
|
880
|
-
candidatePolicyHash: string;
|
|
881
|
-
classification: PolicyDeltaClassification;
|
|
882
|
-
findings: PolicyDeltaFinding[];
|
|
883
|
-
blockingFindingIds: string[];
|
|
884
|
-
requiresAcknowledgement: boolean;
|
|
885
|
-
acknowledged: boolean;
|
|
886
|
-
valid: boolean;
|
|
887
|
-
};
|
|
888
|
-
type ArchitectureEngineViolation = {
|
|
889
|
-
ruleId: string;
|
|
890
|
-
message: string;
|
|
891
|
-
file?: string;
|
|
892
|
-
line?: number;
|
|
893
|
-
target?: string;
|
|
894
|
-
fromLayer?: string;
|
|
895
|
-
toLayer?: string;
|
|
896
|
-
nextAction?: string;
|
|
897
|
-
[key: string]: unknown;
|
|
898
|
-
};
|
|
899
|
-
type ArchitectureEngineEdge = {
|
|
900
|
-
from: string;
|
|
901
|
-
fromLayer: string;
|
|
902
|
-
to?: string;
|
|
903
|
-
toLayer?: string;
|
|
904
|
-
line: number;
|
|
905
|
-
kind: string;
|
|
906
|
-
typeOnly?: boolean;
|
|
907
|
-
targetTypeOnlyExports?: boolean;
|
|
908
|
-
sourcePureTypeModule?: boolean;
|
|
909
|
-
namedBindingsTypeOnly?: boolean;
|
|
910
|
-
portProofEligible?: boolean;
|
|
911
|
-
};
|
|
912
|
-
type EvaluateArchitectureGraphInput = {
|
|
913
|
-
config: ArkConfig;
|
|
914
|
-
rules: ArkConfig['rules'];
|
|
915
|
-
files: readonly string[];
|
|
916
|
-
contentViolations: readonly ArchitectureEngineViolation[];
|
|
917
|
-
edges: readonly ArchitectureEngineEdge[];
|
|
918
|
-
warnings?: readonly ArchitectureEngineViolation[];
|
|
919
|
-
safety?: unknown;
|
|
920
|
-
};
|
|
921
|
-
type ArchitectureEngineResult = {
|
|
922
|
-
violations: ArchitectureEngineViolation[];
|
|
923
|
-
warnings: ArchitectureEngineViolation[];
|
|
924
|
-
safety?: unknown;
|
|
925
|
-
};
|
|
926
|
-
type PreparedChangeFile = {
|
|
927
|
-
path: string;
|
|
928
|
-
operation: 'create' | 'update' | 'delete';
|
|
929
|
-
beforeContentHash?: string;
|
|
930
|
-
candidateContentHash?: string;
|
|
931
|
-
};
|
|
932
|
-
type ChangePreflightResult = {
|
|
933
|
-
schemaVersion: '1.0';
|
|
934
|
-
valid: boolean;
|
|
935
|
-
readOnly: true;
|
|
936
|
-
policyHash: string;
|
|
937
|
-
compilerOptionsHash: string;
|
|
938
|
-
baseTreeHash: string;
|
|
939
|
-
candidateTreeHash: string;
|
|
940
|
-
changeMapHash?: string;
|
|
941
|
-
convergence?: ArchitectureConvergenceResult;
|
|
942
|
-
changes: PreparedChangeFile[];
|
|
943
|
-
violations: ArchitectureEngineViolation[];
|
|
944
|
-
warnings: ArchitectureEngineViolation[];
|
|
945
|
-
};
|
|
946
|
-
type CollectAnalysisConfigWarningsInput = {
|
|
947
|
-
config: ArkConfig;
|
|
948
|
-
rules: ArkConfig['rules'];
|
|
949
|
-
files: readonly string[];
|
|
950
|
-
manifest?: {
|
|
951
|
-
architecture?: {
|
|
952
|
-
layers?: readonly {
|
|
953
|
-
name?: string;
|
|
954
|
-
prefixes?: readonly string[];
|
|
955
|
-
}[];
|
|
956
|
-
};
|
|
957
|
-
};
|
|
958
|
-
};
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* Contract loading, project/change analysis, and policy-delta analysis
|
|
962
|
-
* (U02 pilot 2). Reached through the src/kernel/analysis.ts facade; consumer
|
|
963
|
-
* import paths never change.
|
|
964
|
-
*/
|
|
965
|
-
|
|
966
|
-
declare function loadContract(input: unknown, source?: string): AnalysisContract;
|
|
967
|
-
declare function analyzePolicyDelta(input: AnalyzePolicyDeltaInput): PolicyDeltaAnalysis;
|
|
968
|
-
declare function analyzeProject(input: AnalyzeProjectInput): AnalysisResult;
|
|
969
|
-
declare function analyzeChange(input: AnalyzeChangeInput): AnalysisResult;
|
|
970
|
-
declare function explainViolation(violation: AnalysisViolation): string;
|
|
971
|
-
|
|
972
|
-
declare function detectArchitectureCycles(graph: ReadonlyMap<string, ReadonlySet<string>>): ArchitectureEngineViolation[];
|
|
973
|
-
/** Canonical graph and layer-policy evaluator shared by library, CLI, and MCP adapters. */
|
|
974
|
-
declare function evaluateArchitectureGraph(input: EvaluateArchitectureGraphInput): ArchitectureEngineResult;
|
|
975
|
-
|
|
976
|
-
/**
|
|
977
|
-
* Evaluate one create/update/delete set as a single in-memory candidate.
|
|
978
|
-
* The function never writes and returns hashes that bind a later host commit to
|
|
979
|
-
* the exact base, policy, compiler options, and candidate contents it checked.
|
|
980
|
-
*/
|
|
981
|
-
declare function preflightChange(input: AnalyzeChangeInput): ChangePreflightResult;
|
|
982
|
-
|
|
983
|
-
/** Canonical config diagnostics over repo-relative file paths. */
|
|
984
|
-
declare function collectAnalysisConfigWarnings(input: CollectAnalysisConfigWarningsInput): ArchitectureEngineViolation[];
|
|
985
|
-
|
|
986
|
-
export { type AICodeGate, type AICodeGateContext, type AICodeGateOptions, type AICodeGateResult, type AICodeGateViolation, type AIGateExtension, ANALYSIS_IR_SCHEMA_VERSION, ARK_ANALYSIS_RESULT_SCHEMA, ARK_ANALYSIS_RESULT_SCHEMA_VERSION, ARK_CONFIG_SCHEMA, ARK_CONFIG_SCHEMA_VERSION, type AdapterDiagnostic, type AdapterResult, type AdapterSeverity, type AdapterViolationInput, type AnalysisCapabilityUse, type AnalysisCompilerOptions, type AnalysisContract, type AnalysisEvidence, type AnalysisFile, type AnalysisFileChange, type AnalysisFileInput, type AnalysisImportEdge, type AnalysisIr, type AnalysisResult, type AnalysisViolation, type AnalyzeArchitectureConvergenceInput, type AnalyzeChangeInput, type AnalyzePolicyDeltaInput, type AnalyzeProjectInput, type ArchitectureActualChange, type ArchitectureChangeMap, type ArchitectureChangeMapContract, type ArchitectureChangeMapDependency, type ArchitectureChangeMapFile, type ArchitectureChangeOperation, type ArchitectureConvergenceClassification, type ArchitectureConvergenceFinding, type ArchitectureConvergenceResult, type ArchitectureDependency, type ArchitectureEngineEdge, type ArchitectureEngineResult, type ArchitectureEngineViolation, type ArchitectureLayer, type ArchitectureLayerConfig, type ArchitectureProfile, type ArchitectureRule, type ArkCheckConfig, ArkConfig, ArkConfigLoadResult, type ChangePreflightResult, type CollectAnalysisConfigWarningsInput, type CreateArchitectureProfileFromArkConfigOptions, type CreateArchitectureProfileOptions, type CreateElevenLayerArkConfigOptions, type EvaluateArchitectureGraphInput, type ForbiddenCapabilityUse, POLICY_DELTA_SCHEMA_VERSION, type PolicyDelta, type PolicyDeltaAcknowledgement, type PolicyDeltaAnalysis, type PolicyDeltaClassification, type PolicyDeltaFinding, type PreparedChangeFile, type SemanticDependency, type SemanticDependencyKind, analyzeArchitectureConvergence, analyzeChange, analyzePolicyDelta, analyzeProject, classifyArkPolicyDelta, collectAnalysisConfigWarnings, collectForbiddenCapabilityUses, createAICodeGate, createAdapterResult, createArchitectureProfile, createArchitectureProfileFromArkConfig, createElevenLayerArkConfig, detectArchitectureCycles, deterministicHash, elevenLayerProfile, evaluateArchitectureGraph, explainViolation, extractSemanticDependencies, loadArkConfigContract, loadContract, parseArkConfigJson, policyDeltaAcknowledgementMatches, preflightChange, stableSerialize, toAdapterDiagnostic, version };
|