arkgate 3.9.2 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -0
- package/README.md +16 -4
- package/bin/ark-check-runtime.mjs +75 -3
- package/bin/ark-mcp-runtime.mjs +94 -0
- package/bin/lib/adapter-contract.mjs +14 -1
- package/bin/lib/analysis-engine.mjs +8 -8
- package/bin/lib/architecture-scan.mjs +35 -2
- package/bin/lib/arkrule-file-hints.mjs +71 -0
- package/bin/lib/arkrules-contract.mjs +382 -0
- package/bin/lib/arkrules-sensors.mjs +411 -0
- package/bin/lib/config-contract.mjs +85 -6
- package/bin/lib/doctor-advisories.mjs +14 -1
- package/bin/lib/doctor-plan.mjs +21 -0
- package/bin/lib/effective-contract-load.mjs +116 -0
- package/bin/lib/field-install.mjs +104 -0
- package/bin/lib/graph-blind.mjs +20 -1
- package/bin/lib/html-report-advisories.mjs +12 -5
- package/bin/lib/install-migrate.mjs +20 -2
- package/bin/lib/invariant-coverage-io.mjs +157 -0
- package/bin/lib/invariant-coverage.mjs +127 -0
- package/bin/lib/managed-upgrade.mjs +1 -1
- package/bin/lib/policy-delta-io.mjs +33 -0
- package/bin/lib/presets.mjs +241 -1
- package/bin/lib/remediation.mjs +28 -0
- package/bin/lib/resolved-candidate-facts.mjs +14 -1
- package/bin/lib/rules-inventory.mjs +144 -0
- package/bin/lib/rules-under-contract.mjs +320 -0
- package/bin/lib/start-preview.mjs +24 -7
- package/bin/lib/upgrade-command.mjs +373 -16
- package/dist/{configTypes-DAPvBqK6.d.ts → configTypes-CC0FEXoF.d.ts} +16 -3
- package/dist/eslint/index.cjs +2 -2
- package/dist/eslint/index.d.ts +1 -1
- package/dist/eslint/index.js +2 -2
- package/dist/index.cjs +14 -7
- package/dist/index.d.ts +615 -20
- package/dist/index.js +13 -6
- package/docs/README.md +5 -3
- package/docs/agent-guide.md +7 -3
- package/docs/ai-gates.md +6 -1
- package/docs/brownfield-adoption.md +22 -0
- package/docs/configuration.md +53 -4
- package/docs/develop.md +8 -2
- package/docs/enthusiast/README.md +11 -0
- package/docs/package-surface.md +13 -10
- package/docs/product-voice.md +11 -2
- package/docs/use.md +11 -0
- package/package.json +4 -17
- package/schemas/ark.analysis-result.schema.json +9 -1
- package/schemas/ark.arkrules.schema.json +141 -0
- package/schemas/ark.config.schema.json +10 -2
- package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
- package/server.json +2 -2
- package/templates/arkrules/ApplicationOrchestration.json +14 -0
- package/templates/arkrules/DomainModel.json +32 -0
- package/templates/arkrules/PersistenceAdapters.json +14 -0
- package/templates/arkrules/PresentationAdapters.json +14 -0
- package/templates/skills/ark-adopt.md +28 -1
- package/templates/skills/ark-architect.md +23 -0
- package/templates/skills/ark-autopilot.md +27 -1
- package/templates/skills/ark-contract.md +27 -1
- package/templates/skills/ark-coverage.md +23 -0
- package/templates/skills/ark-explain.md +39 -3
- package/templates/skills/ark-explore.md +26 -1
- package/templates/skills/ark-fix.md +23 -0
- package/templates/skills/ark-loop.md +23 -0
- package/templates/skills/ark-place.md +26 -0
- package/templates/skills/ark-runtime.md +4 -0
- package/templates/skills/ark-think.md +24 -1
- package/templates/skills/ark-upgrade.md +80 -11
- package/compat/nestjs.cjs +0 -2
- package/compat/nestjs.d.ts +0 -2
- package/compat/nestjs.js +0 -1
- package/compat/runtime.cjs +0 -2
- package/compat/runtime.d.ts +0 -2
- package/compat/runtime.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ArkConfigRule, b as ArkConfigSchemaVersion, c as ArkConfigLoadResult, d as ArkConfigLayer, A as ArkConfig } from './configTypes-
|
|
1
|
+
import { a as ArkConfigRule, b as ArkConfigSchemaVersion, c as ArkConfigLoadResult, d as ArkConfigLayer, A as ArkConfig, e as ArkConfigIssue } from './configTypes-CC0FEXoF.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Canonical, pure contract for ark.config.json.
|
|
@@ -8,6 +8,7 @@ import { a as ArkConfigRule, b as ArkConfigSchemaVersion, c as ArkConfigLoadResu
|
|
|
8
8
|
* The standalone CLI artifact is generated into bin/lib/config-contract.mjs.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
/** Current published ark.config.json schema version (ADR 0012: 1.1 adds optional arkRules). */
|
|
11
12
|
declare const ARK_CONFIG_SCHEMA_VERSION: ArkConfigSchemaVersion;
|
|
12
13
|
declare const ARK_CONFIG_SCHEMA: {
|
|
13
14
|
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
@@ -26,8 +27,8 @@ declare const ARK_CONFIG_SCHEMA: {
|
|
|
26
27
|
};
|
|
27
28
|
readonly schemaVersion: {
|
|
28
29
|
readonly type: "string";
|
|
29
|
-
readonly const: "1.
|
|
30
|
-
readonly default: "1.
|
|
30
|
+
readonly const: "1.1";
|
|
31
|
+
readonly default: "1.1";
|
|
31
32
|
};
|
|
32
33
|
readonly name: {
|
|
33
34
|
readonly type: "string";
|
|
@@ -97,6 +98,15 @@ declare const ARK_CONFIG_SCHEMA: {
|
|
|
97
98
|
readonly allowDisabledPeerIsolation: false;
|
|
98
99
|
};
|
|
99
100
|
};
|
|
101
|
+
/** ADR 0012 — layer name → relative path to arkrules/<Layer>.json */
|
|
102
|
+
readonly arkRules: {
|
|
103
|
+
readonly type: "object";
|
|
104
|
+
readonly additionalProperties: {
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
readonly minLength: 1;
|
|
107
|
+
};
|
|
108
|
+
readonly default: {};
|
|
109
|
+
};
|
|
100
110
|
};
|
|
101
111
|
readonly $defs: {
|
|
102
112
|
readonly layer: {
|
|
@@ -234,10 +244,11 @@ declare function loadArkConfigContract(input: unknown, source?: string): ArkConf
|
|
|
234
244
|
declare function parseArkConfigJson(json: string, source?: string): ArkConfigLoadResult;
|
|
235
245
|
|
|
236
246
|
/** ArkGate library version — single source of truth. */
|
|
237
|
-
declare const version = "
|
|
247
|
+
declare const version = "4.0.1";
|
|
238
248
|
|
|
239
249
|
/** Versioned public result contract shared by every ArkGate enforcement adapter. */
|
|
240
|
-
|
|
250
|
+
/** 1.4 adds optional evidence.arkruleId + evidence.arkruleSource (ADR 0012 / AR03). */
|
|
251
|
+
declare const ARK_ANALYSIS_RESULT_SCHEMA_VERSION: "1.4";
|
|
241
252
|
type AdapterSeverity = 'error' | 'warning';
|
|
242
253
|
type AnalysisCompleteness = 'complete' | 'partial' | 'unavailable';
|
|
243
254
|
type AnalysisMode = 'lexical-compatibility' | 'resolved-candidate-facts';
|
|
@@ -267,6 +278,10 @@ type AdapterViolationInput = {
|
|
|
267
278
|
nextAction?: unknown;
|
|
268
279
|
/** U04: the denied capability id on CAPABILITY_VIOLATION. */
|
|
269
280
|
capability?: unknown;
|
|
281
|
+
/** AR03: ArkRule identity for structure/invariant diagnostics. */
|
|
282
|
+
arkruleId?: unknown;
|
|
283
|
+
/** AR03: project-relative ArkRules source file that declared the rule. */
|
|
284
|
+
arkruleSource?: unknown;
|
|
270
285
|
};
|
|
271
286
|
type AdapterDiagnostic = {
|
|
272
287
|
ruleId: string;
|
|
@@ -289,6 +304,10 @@ type AdapterDiagnostic = {
|
|
|
289
304
|
peerIsolation?: boolean;
|
|
290
305
|
capability?: string;
|
|
291
306
|
edgeKind?: string;
|
|
307
|
+
/** AR03 — ArkRule id (structure or invariant). */
|
|
308
|
+
arkruleId?: string;
|
|
309
|
+
/** AR03 — ArkRules source file path. */
|
|
310
|
+
arkruleSource?: string;
|
|
292
311
|
};
|
|
293
312
|
/** Added in schema 1.1; optional in TypeScript so 1.0 consumer-owned values remain valid. */
|
|
294
313
|
nextAction?: string;
|
|
@@ -422,7 +441,7 @@ declare const ARK_ANALYSIS_RESULT_SCHEMA: {
|
|
|
422
441
|
}];
|
|
423
442
|
readonly properties: {
|
|
424
443
|
readonly schemaVersion: {
|
|
425
|
-
readonly const: "1.
|
|
444
|
+
readonly const: "1.4";
|
|
426
445
|
};
|
|
427
446
|
readonly mode: {
|
|
428
447
|
readonly enum: readonly ["lexical-compatibility", "resolved-candidate-facts"];
|
|
@@ -547,6 +566,14 @@ declare const ARK_ANALYSIS_RESULT_SCHEMA: {
|
|
|
547
566
|
readonly type: "string";
|
|
548
567
|
readonly minLength: 1;
|
|
549
568
|
};
|
|
569
|
+
readonly arkruleId: {
|
|
570
|
+
readonly type: "string";
|
|
571
|
+
readonly minLength: 1;
|
|
572
|
+
};
|
|
573
|
+
readonly arkruleSource: {
|
|
574
|
+
readonly type: "string";
|
|
575
|
+
readonly minLength: 1;
|
|
576
|
+
};
|
|
550
577
|
};
|
|
551
578
|
};
|
|
552
579
|
readonly nextAction: {
|
|
@@ -879,7 +906,8 @@ declare function stableSerialize(value: unknown): string;
|
|
|
879
906
|
* Pure declarations + schema version identity. Create/load live in
|
|
880
907
|
* resolvedCandidateFacts.ts; JSON Schema lives in resolvedCandidateFactsSchema.ts.
|
|
881
908
|
*/
|
|
882
|
-
|
|
909
|
+
/** 1.1 adds optional classShapes[] (ADR 0013). 1.0 payloads remain loadable. */
|
|
910
|
+
declare const RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION: "1.1";
|
|
883
911
|
type ResolvedFactsCompleteness = 'complete' | 'partial' | 'unavailable';
|
|
884
912
|
type ResolvedDependencyKind = 'import' | 'export' | 'dynamic-import' | 'require';
|
|
885
913
|
type ResolvedDependencyState = 'resolved-project' | 'resolved-external' | 'unresolved' | 'dynamic';
|
|
@@ -898,6 +926,21 @@ type ResolvedFileFact = {
|
|
|
898
926
|
typeOnlyExportNames: string[];
|
|
899
927
|
hasTopLevelSideEffects: boolean;
|
|
900
928
|
};
|
|
929
|
+
/** ADR 0013 class-shape evidence for ArkRules structure sensors. */
|
|
930
|
+
type ResolvedClassShapeFact = {
|
|
931
|
+
file: string;
|
|
932
|
+
className: string;
|
|
933
|
+
exported: boolean;
|
|
934
|
+
hasPublicMutableFields: boolean;
|
|
935
|
+
hasPublicSetters: boolean;
|
|
936
|
+
hasPublicConstructor: boolean;
|
|
937
|
+
hasStaticFactory: boolean;
|
|
938
|
+
mutatingMethods: readonly {
|
|
939
|
+
name: string;
|
|
940
|
+
referencesGuardOrPublish: boolean;
|
|
941
|
+
}[];
|
|
942
|
+
dataOnly?: boolean;
|
|
943
|
+
};
|
|
901
944
|
type ResolvedDependencyFact = {
|
|
902
945
|
from: string;
|
|
903
946
|
specifier?: string;
|
|
@@ -947,7 +990,7 @@ type ResolvedSafetyFact = {
|
|
|
947
990
|
symbol?: string;
|
|
948
991
|
};
|
|
949
992
|
type ResolvedCandidateFactsInput = {
|
|
950
|
-
schemaVersion: typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
|
|
993
|
+
schemaVersion: '1.0' | typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
|
|
951
994
|
completeness: ResolvedFactsCompleteness;
|
|
952
995
|
completenessReasons: readonly ResolvedFactsReason[];
|
|
953
996
|
resolverIdentity: string;
|
|
@@ -963,8 +1006,11 @@ type ResolvedCandidateFactsInput = {
|
|
|
963
1006
|
publishCalls: readonly ResolvedPublishFact[];
|
|
964
1007
|
intentReferences: readonly ResolvedIntentReferenceFact[];
|
|
965
1008
|
safetyUses: readonly ResolvedSafetyFact[];
|
|
1009
|
+
/** ADR 0013 — optional on 1.0; default [] on load. */
|
|
1010
|
+
classShapes?: readonly ResolvedClassShapeFact[];
|
|
966
1011
|
};
|
|
967
|
-
type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHash'> & {
|
|
1012
|
+
type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHash' | 'classShapes'> & {
|
|
1013
|
+
schemaVersion: typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
|
|
968
1014
|
completenessReasons: ResolvedFactsReason[];
|
|
969
1015
|
candidateTreeHash: string;
|
|
970
1016
|
files: ResolvedFileFact[];
|
|
@@ -974,6 +1020,7 @@ type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHa
|
|
|
974
1020
|
publishCalls: ResolvedPublishFact[];
|
|
975
1021
|
intentReferences: ResolvedIntentReferenceFact[];
|
|
976
1022
|
safetyUses: ResolvedSafetyFact[];
|
|
1023
|
+
classShapes: ResolvedClassShapeFact[];
|
|
977
1024
|
factsHash: string;
|
|
978
1025
|
};
|
|
979
1026
|
|
|
@@ -998,7 +1045,7 @@ declare const RESOLVED_CANDIDATE_FACTS_SCHEMA: {
|
|
|
998
1045
|
readonly required: readonly ["schemaVersion", "completeness", "completenessReasons", "resolverIdentity", "compilerIdentity", "compilerOptionsHash", "tsconfigHash", "candidateTreeHash", "evidenceRequirementsHash", "files", "dependencies", "capabilityUses", "ambientUses", "publishCalls", "intentReferences", "safetyUses", "factsHash"];
|
|
999
1046
|
readonly properties: {
|
|
1000
1047
|
readonly schemaVersion: {
|
|
1001
|
-
readonly
|
|
1048
|
+
readonly enum: readonly ["1.0", "1.1"];
|
|
1002
1049
|
};
|
|
1003
1050
|
readonly completeness: {
|
|
1004
1051
|
readonly enum: readonly ["complete", "partial", "unavailable"];
|
|
@@ -1363,6 +1410,60 @@ declare const RESOLVED_CANDIDATE_FACTS_SCHEMA: {
|
|
|
1363
1410
|
}];
|
|
1364
1411
|
};
|
|
1365
1412
|
};
|
|
1413
|
+
readonly classShapes: {
|
|
1414
|
+
readonly type: "array";
|
|
1415
|
+
readonly items: {
|
|
1416
|
+
readonly type: "object";
|
|
1417
|
+
readonly additionalProperties: false;
|
|
1418
|
+
readonly required: readonly ["file", "className", "exported", "hasPublicMutableFields", "hasPublicSetters", "hasPublicConstructor", "hasStaticFactory", "mutatingMethods"];
|
|
1419
|
+
readonly properties: {
|
|
1420
|
+
readonly file: {
|
|
1421
|
+
readonly type: "string";
|
|
1422
|
+
readonly minLength: 1;
|
|
1423
|
+
readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
|
|
1424
|
+
};
|
|
1425
|
+
readonly className: {
|
|
1426
|
+
readonly type: "string";
|
|
1427
|
+
readonly minLength: 1;
|
|
1428
|
+
};
|
|
1429
|
+
readonly exported: {
|
|
1430
|
+
readonly type: "boolean";
|
|
1431
|
+
};
|
|
1432
|
+
readonly hasPublicMutableFields: {
|
|
1433
|
+
readonly type: "boolean";
|
|
1434
|
+
};
|
|
1435
|
+
readonly hasPublicSetters: {
|
|
1436
|
+
readonly type: "boolean";
|
|
1437
|
+
};
|
|
1438
|
+
readonly hasPublicConstructor: {
|
|
1439
|
+
readonly type: "boolean";
|
|
1440
|
+
};
|
|
1441
|
+
readonly hasStaticFactory: {
|
|
1442
|
+
readonly type: "boolean";
|
|
1443
|
+
};
|
|
1444
|
+
readonly dataOnly: {
|
|
1445
|
+
readonly type: "boolean";
|
|
1446
|
+
};
|
|
1447
|
+
readonly mutatingMethods: {
|
|
1448
|
+
readonly type: "array";
|
|
1449
|
+
readonly items: {
|
|
1450
|
+
readonly type: "object";
|
|
1451
|
+
readonly additionalProperties: false;
|
|
1452
|
+
readonly required: readonly ["name", "referencesGuardOrPublish"];
|
|
1453
|
+
readonly properties: {
|
|
1454
|
+
readonly name: {
|
|
1455
|
+
readonly type: "string";
|
|
1456
|
+
readonly minLength: 1;
|
|
1457
|
+
};
|
|
1458
|
+
readonly referencesGuardOrPublish: {
|
|
1459
|
+
readonly type: "boolean";
|
|
1460
|
+
};
|
|
1461
|
+
};
|
|
1462
|
+
};
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
};
|
|
1466
|
+
};
|
|
1366
1467
|
readonly factsHash: {
|
|
1367
1468
|
readonly type: "string";
|
|
1368
1469
|
readonly minLength: 1;
|
|
@@ -1566,6 +1667,209 @@ declare function extractSemanticDependencies(ts: any, sourceFile: any): Semantic
|
|
|
1566
1667
|
/** Resolve forbidden ambient capabilities through symbols, aliases, globalThis, and static keys. */
|
|
1567
1668
|
declare function collectForbiddenCapabilityUses(ts: any, sourceFile: any, forbidden: readonly string[]): ForbiddenCapabilityUse[];
|
|
1568
1669
|
|
|
1670
|
+
/**
|
|
1671
|
+
* Type vocabulary for ArkRules files (ADR 0012).
|
|
1672
|
+
*
|
|
1673
|
+
* Pure declarations only — runtime validation and the published JSON Schema live in
|
|
1674
|
+
* ./arkRulesContract.ts so generate:cli-pure can emit a self-contained artifact.
|
|
1675
|
+
*/
|
|
1676
|
+
/** Closed sensor vocabulary (ADR 0013). Unknown sensors fail closed at load time. */
|
|
1677
|
+
declare const ARK_RULE_SENSOR_IDS: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "no-anemic-model", "invariant-coverage"];
|
|
1678
|
+
type ArkRuleSensorId = (typeof ARK_RULE_SENSOR_IDS)[number];
|
|
1679
|
+
type ArkRuleMode = 'advisory' | 'enforced';
|
|
1680
|
+
type ArkRuleStructureEntry = {
|
|
1681
|
+
id: string;
|
|
1682
|
+
sensor: ArkRuleSensorId;
|
|
1683
|
+
mode?: ArkRuleMode;
|
|
1684
|
+
appliesTo?: string[];
|
|
1685
|
+
description?: string;
|
|
1686
|
+
};
|
|
1687
|
+
type ArkRuleInvariantCoverage = {
|
|
1688
|
+
test?: boolean;
|
|
1689
|
+
symbol?: string;
|
|
1690
|
+
};
|
|
1691
|
+
type ArkRuleInvariantEntry = {
|
|
1692
|
+
id: string;
|
|
1693
|
+
description: string;
|
|
1694
|
+
aggregate?: string;
|
|
1695
|
+
coverage?: ArkRuleInvariantCoverage;
|
|
1696
|
+
mode?: ArkRuleMode;
|
|
1697
|
+
appliesTo?: string[];
|
|
1698
|
+
};
|
|
1699
|
+
type ArkRulesFile = {
|
|
1700
|
+
$schema?: string;
|
|
1701
|
+
schemaVersion: '1.0';
|
|
1702
|
+
layer: string;
|
|
1703
|
+
structure?: ArkRuleStructureEntry[];
|
|
1704
|
+
invariants?: ArkRuleInvariantEntry[];
|
|
1705
|
+
};
|
|
1706
|
+
type ArkRuleProvenance = {
|
|
1707
|
+
sourceFile: string;
|
|
1708
|
+
ruleId: string;
|
|
1709
|
+
layer: string;
|
|
1710
|
+
};
|
|
1711
|
+
type EffectiveStructureRule = ArkRuleStructureEntry & {
|
|
1712
|
+
mode: ArkRuleMode;
|
|
1713
|
+
provenance: ArkRuleProvenance;
|
|
1714
|
+
};
|
|
1715
|
+
type EffectiveInvariantRule = ArkRuleInvariantEntry & {
|
|
1716
|
+
mode: ArkRuleMode;
|
|
1717
|
+
provenance: ArkRuleProvenance;
|
|
1718
|
+
};
|
|
1719
|
+
type EffectiveArkRules = {
|
|
1720
|
+
schemaVersion: '1.0';
|
|
1721
|
+
byLayer: Record<string, {
|
|
1722
|
+
sourceFile: string;
|
|
1723
|
+
structure: EffectiveStructureRule[];
|
|
1724
|
+
invariants: EffectiveInvariantRule[];
|
|
1725
|
+
}>;
|
|
1726
|
+
structure: EffectiveStructureRule[];
|
|
1727
|
+
invariants: EffectiveInvariantRule[];
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
/**
|
|
1731
|
+
* Pure invariant coverage evidence (ADR 0014 / AR09–AR10).
|
|
1732
|
+
*
|
|
1733
|
+
* Mines test titles and symbol presence against the Effective ArkRules catalog.
|
|
1734
|
+
* No filesystem — Tooling supplies file contents and test globs.
|
|
1735
|
+
*/
|
|
1736
|
+
|
|
1737
|
+
type InvariantCoverageEvidence = {
|
|
1738
|
+
invariantId: string;
|
|
1739
|
+
layer: string;
|
|
1740
|
+
sourceFile: string;
|
|
1741
|
+
mode: 'advisory' | 'enforced';
|
|
1742
|
+
covered: boolean;
|
|
1743
|
+
evidence: Array<'test-title' | 'symbol'>;
|
|
1744
|
+
/** When no test globs were supplied, coverage cannot be proven. */
|
|
1745
|
+
partial: boolean;
|
|
1746
|
+
description: string;
|
|
1747
|
+
};
|
|
1748
|
+
type InvariantCoverageViolation = {
|
|
1749
|
+
ruleId: 'INVARIANT_UNCOVERED';
|
|
1750
|
+
message: string;
|
|
1751
|
+
file: string;
|
|
1752
|
+
line: number;
|
|
1753
|
+
arkruleId: string;
|
|
1754
|
+
arkruleSource: string;
|
|
1755
|
+
fromLayer: string;
|
|
1756
|
+
severity: 'error' | 'warning';
|
|
1757
|
+
failsStrict: boolean;
|
|
1758
|
+
};
|
|
1759
|
+
type EvaluateInvariantCoverageInput = {
|
|
1760
|
+
arkRules: EffectiveArkRules;
|
|
1761
|
+
/** Project-relative path → file contents (tests + domain sources). */
|
|
1762
|
+
fileContents: Readonly<Record<string, string>>;
|
|
1763
|
+
/** Paths considered tests (already filtered by Tooling via globs). */
|
|
1764
|
+
testFiles?: readonly string[];
|
|
1765
|
+
/** When true, missing test files make coverage partial (never green covered). */
|
|
1766
|
+
testGlobsMissing?: boolean;
|
|
1767
|
+
};
|
|
1768
|
+
declare function evaluateInvariantCoverage(input: EvaluateInvariantCoverageInput): {
|
|
1769
|
+
coverage: InvariantCoverageEvidence[];
|
|
1770
|
+
violations: InvariantCoverageViolation[];
|
|
1771
|
+
partial: boolean;
|
|
1772
|
+
};
|
|
1773
|
+
/**
|
|
1774
|
+
* Deterministic promotion gate: refuse advisory→enforced when invariant is uncovered.
|
|
1775
|
+
*/
|
|
1776
|
+
declare function canPromoteInvariant(coverage: InvariantCoverageEvidence | undefined): {
|
|
1777
|
+
ok: boolean;
|
|
1778
|
+
reason: string;
|
|
1779
|
+
};
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* Pure ArkRules structure sensor evaluation (ADR 0013).
|
|
1783
|
+
*
|
|
1784
|
+
* Consumes closed class-shape / file facts + Effective ArkRules. Emits violations with
|
|
1785
|
+
* arkrule provenance. No filesystem, no TypeScript compiler.
|
|
1786
|
+
*/
|
|
1787
|
+
|
|
1788
|
+
type ClassShapeFact = {
|
|
1789
|
+
file: string;
|
|
1790
|
+
className: string;
|
|
1791
|
+
exported: boolean;
|
|
1792
|
+
hasPublicMutableFields: boolean;
|
|
1793
|
+
hasPublicSetters: boolean;
|
|
1794
|
+
hasPublicConstructor: boolean;
|
|
1795
|
+
hasStaticFactory: boolean;
|
|
1796
|
+
mutatingMethods: readonly {
|
|
1797
|
+
name: string;
|
|
1798
|
+
referencesGuardOrPublish: boolean;
|
|
1799
|
+
}[];
|
|
1800
|
+
/** Heuristic: data-only class (fields, no methods beyond accessors). */
|
|
1801
|
+
dataOnly?: boolean;
|
|
1802
|
+
};
|
|
1803
|
+
type ArkRuleSensorViolation = {
|
|
1804
|
+
ruleId: string;
|
|
1805
|
+
code: string;
|
|
1806
|
+
message: string;
|
|
1807
|
+
file: string;
|
|
1808
|
+
line: number;
|
|
1809
|
+
fromLayer?: string;
|
|
1810
|
+
arkruleId: string;
|
|
1811
|
+
arkruleSource: string;
|
|
1812
|
+
severity: 'error' | 'warning';
|
|
1813
|
+
sensor: ArkRuleSensorId;
|
|
1814
|
+
/** When true, advisory surfaces only (does not fail strict). */
|
|
1815
|
+
failsStrict: boolean;
|
|
1816
|
+
};
|
|
1817
|
+
type EvaluateArkRuleSensorsInput = {
|
|
1818
|
+
arkRules: EffectiveArkRules;
|
|
1819
|
+
classShapes: readonly ClassShapeFact[];
|
|
1820
|
+
/** Project-relative paths in scope for the analysis. */
|
|
1821
|
+
files: readonly string[];
|
|
1822
|
+
/**
|
|
1823
|
+
* Optional layer membership: path → layer name. When omitted, structure rules
|
|
1824
|
+
* apply by appliesTo globs only (or all files when appliesTo is absent).
|
|
1825
|
+
*/
|
|
1826
|
+
layerForFile?: (path: string) => string | null | undefined;
|
|
1827
|
+
/**
|
|
1828
|
+
* Optional thin/orchestration heuristic flags per file (Tooling-supplied).
|
|
1829
|
+
*/
|
|
1830
|
+
fileHints?: Readonly<Record<string, {
|
|
1831
|
+
orchestrationHeavy?: boolean;
|
|
1832
|
+
adapterThick?: boolean;
|
|
1833
|
+
}>>;
|
|
1834
|
+
};
|
|
1835
|
+
/**
|
|
1836
|
+
* Evaluate all structure sensors. Empty Effective Contract → no findings (byte-for-byte parity).
|
|
1837
|
+
*/
|
|
1838
|
+
declare function evaluateArkRuleSensors(input: EvaluateArkRuleSensorsInput): ArkRuleSensorViolation[];
|
|
1839
|
+
/**
|
|
1840
|
+
* ADR 0012 D3 — a structure rule whose appliesTo matches zero governed files is
|
|
1841
|
+
* never silent green. Advisory → warning; enforced → failsStrict.
|
|
1842
|
+
* Rules without appliesTo (whole-layer) never emit this signal.
|
|
1843
|
+
*/
|
|
1844
|
+
declare function collectEmptyAppliesToFindings(arkRules: EffectiveArkRules, files: readonly string[]): ArkRuleSensorViolation[];
|
|
1845
|
+
/**
|
|
1846
|
+
* Pure Tooling/Domain heuristic for orchestration-only / thin-adapter fileHints.
|
|
1847
|
+
* Prefers false negatives over false positives (ADR 0013 discipline).
|
|
1848
|
+
* Returns null when neither flag is set (callers may omit the path).
|
|
1849
|
+
*/
|
|
1850
|
+
declare function deriveArkRuleFileHints(_file: string, content: string): {
|
|
1851
|
+
orchestrationHeavy?: boolean;
|
|
1852
|
+
adapterThick?: boolean;
|
|
1853
|
+
} | null;
|
|
1854
|
+
/**
|
|
1855
|
+
* Build fileHints map from path→content. Omits paths with no flags (sparse map).
|
|
1856
|
+
*/
|
|
1857
|
+
declare function buildArkRuleFileHints(fileContents: Readonly<Record<string, string>>): Record<string, {
|
|
1858
|
+
orchestrationHeavy?: boolean;
|
|
1859
|
+
adapterThick?: boolean;
|
|
1860
|
+
}>;
|
|
1861
|
+
/**
|
|
1862
|
+
* Lightweight class-shape extraction from TypeScript source text (no compiler).
|
|
1863
|
+
* Conservative: prefers false negatives over false positives for mutability.
|
|
1864
|
+
* Tooling may replace with TypeScript-API facts; sensors consume the same shape.
|
|
1865
|
+
*
|
|
1866
|
+
* Limitation (AR05/AR06): only `export class` / `export abstract class` forms.
|
|
1867
|
+
* `export default class`, re-exported classes, and non-exported aggregates are
|
|
1868
|
+
* invisible — enforced structure sensors stay silent (false negative). Silence
|
|
1869
|
+
* is never proof of compliance.
|
|
1870
|
+
*/
|
|
1871
|
+
declare function extractClassShapesFromSource(file: string, content: string): ClassShapeFact[];
|
|
1872
|
+
|
|
1569
1873
|
declare const POLICY_DELTA_SCHEMA_VERSION: "1.0";
|
|
1570
1874
|
type PolicyDeltaClassification = 'strengthening' | 'neutral' | 'judgment-required' | 'weakening';
|
|
1571
1875
|
type PolicyDeltaFinding = {
|
|
@@ -1589,22 +1893,35 @@ type PolicyDeltaAcknowledgement = {
|
|
|
1589
1893
|
findingIds: readonly string[];
|
|
1590
1894
|
reason: string;
|
|
1591
1895
|
};
|
|
1592
|
-
|
|
1896
|
+
type ClassifyArkPolicyDeltaOptions = {
|
|
1897
|
+
baseArkRules?: EffectiveArkRules;
|
|
1898
|
+
candidateArkRules?: EffectiveArkRules;
|
|
1899
|
+
/**
|
|
1900
|
+
* AR11 — coverage evidence for candidate invariants. Required to auto-allow
|
|
1901
|
+
* advisory→enforced promotion; without it (or when uncovered), promotion is
|
|
1902
|
+
* judgment-required / refused.
|
|
1903
|
+
*/
|
|
1904
|
+
candidateInvariantCoverage?: readonly InvariantCoverageEvidence[];
|
|
1905
|
+
};
|
|
1906
|
+
declare function classifyArkPolicyDelta(base: ArkConfig, candidate: ArkConfig, options?: ClassifyArkPolicyDeltaOptions): PolicyDelta;
|
|
1593
1907
|
declare function policyDeltaAcknowledgementMatches(acknowledgement: PolicyDeltaAcknowledgement | undefined, expected: {
|
|
1594
1908
|
basePolicyHash: string;
|
|
1595
1909
|
candidatePolicyHash: string;
|
|
1596
1910
|
findingIds: readonly string[];
|
|
1597
1911
|
}): boolean;
|
|
1598
1912
|
|
|
1599
|
-
/**
|
|
1600
|
-
* Public type vocabulary of the canonical analysis API (U02 pilot 2).
|
|
1601
|
-
*
|
|
1602
|
-
* Declarations only — the C02 entry point src/kernel/analysis.ts re-exports
|
|
1603
|
-
* everything here, so consumer import paths never change.
|
|
1604
|
-
*/
|
|
1605
|
-
|
|
1606
1913
|
type AnalysisContract = ArkConfigLoadResult & {
|
|
1607
1914
|
policyHash: string;
|
|
1915
|
+
/**
|
|
1916
|
+
* ADR 0012 Effective ArkRules (empty when arkRules is absent).
|
|
1917
|
+
* Included in policyHash when non-empty so arkrules edits invalidate identity.
|
|
1918
|
+
*/
|
|
1919
|
+
arkRules?: EffectiveArkRules;
|
|
1920
|
+
/**
|
|
1921
|
+
* ADR 0013 class-shape facts for ArkRules sensors (Tooling-supplied).
|
|
1922
|
+
* Empty / absent when ArkRules are not active.
|
|
1923
|
+
*/
|
|
1924
|
+
classShapes?: ClassShapeFact[];
|
|
1608
1925
|
};
|
|
1609
1926
|
type AnalyzeProjectInput = {
|
|
1610
1927
|
contract: AnalysisContract;
|
|
@@ -1625,6 +1942,25 @@ type AnalysisResult = {
|
|
|
1625
1942
|
type AnalyzeResolvedProjectInput = {
|
|
1626
1943
|
contract: AnalysisContract;
|
|
1627
1944
|
facts: unknown;
|
|
1945
|
+
/**
|
|
1946
|
+
* AR10 — Tooling-supplied contents for invariant coverage evidence.
|
|
1947
|
+
* When omitted and the Effective Contract has invariants, coverage is partial
|
|
1948
|
+
* (never false green covered).
|
|
1949
|
+
*/
|
|
1950
|
+
coverageInputs?: {
|
|
1951
|
+
fileContents: Readonly<Record<string, string>>;
|
|
1952
|
+
testFiles?: readonly string[];
|
|
1953
|
+
testGlobsMissing?: boolean;
|
|
1954
|
+
};
|
|
1955
|
+
/**
|
|
1956
|
+
* AR07 — Tooling-supplied orchestration/thin-adapter heuristics per file.
|
|
1957
|
+
* Prefer deriveArkRuleFileHints / buildArkRuleFileHints (Domain pure).
|
|
1958
|
+
* When omitted, orchestration-only and thin-adapter sensors stay silent.
|
|
1959
|
+
*/
|
|
1960
|
+
fileHints?: Readonly<Record<string, {
|
|
1961
|
+
orchestrationHeavy?: boolean;
|
|
1962
|
+
adapterThick?: boolean;
|
|
1963
|
+
}>>;
|
|
1628
1964
|
};
|
|
1629
1965
|
type PreflightResolvedChangeInput = {
|
|
1630
1966
|
contract: AnalysisContract;
|
|
@@ -1723,6 +2059,14 @@ type AnalyzePolicyDeltaInput = {
|
|
|
1723
2059
|
acknowledgement?: PolicyDeltaAcknowledgement;
|
|
1724
2060
|
baseSource?: string;
|
|
1725
2061
|
candidateSource?: string;
|
|
2062
|
+
/** Optional pre-resolved Effective ArkRules for each side (ADR 0012 / AR02). */
|
|
2063
|
+
baseArkRules?: EffectiveArkRules;
|
|
2064
|
+
candidateArkRules?: EffectiveArkRules;
|
|
2065
|
+
/**
|
|
2066
|
+
* AR11 — optional coverage evidence for candidate invariants.
|
|
2067
|
+
* When omitted, advisory→enforced promotion is judgment-required (refuse auto-allow).
|
|
2068
|
+
*/
|
|
2069
|
+
candidateInvariantCoverage?: readonly InvariantCoverageEvidence[];
|
|
1726
2070
|
};
|
|
1727
2071
|
type PolicyDeltaAnalysis = {
|
|
1728
2072
|
schemaVersion: '1.0';
|
|
@@ -1812,13 +2156,164 @@ type CollectAnalysisConfigWarningsInput = {
|
|
|
1812
2156
|
};
|
|
1813
2157
|
};
|
|
1814
2158
|
|
|
2159
|
+
/**
|
|
2160
|
+
* Canonical, pure contract for arkrules/<Layer>.json (ADR 0012).
|
|
2161
|
+
*
|
|
2162
|
+
* Tooling adapters own filesystem I/O; this module owns JSON parsing, validation,
|
|
2163
|
+
* diagnostics, and the published JSON Schema. The standalone CLI artifact is generated
|
|
2164
|
+
* into bin/lib/arkrules-contract.mjs + schemas/ark.arkrules.schema.json.
|
|
2165
|
+
*/
|
|
2166
|
+
|
|
2167
|
+
declare const ARK_RULES_SCHEMA_VERSION: "1.0";
|
|
2168
|
+
/** Closed sensor vocabulary — keep in lockstep with arkRulesTypes.ARK_RULE_SENSOR_IDS. */
|
|
2169
|
+
declare const ARK_RULE_SENSORS: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "no-anemic-model", "invariant-coverage"];
|
|
2170
|
+
declare const ARK_RULES_SCHEMA: {
|
|
2171
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
2172
|
+
readonly $id: "https://unpkg.com/arkgate/schemas/ark.arkrules.schema.json";
|
|
2173
|
+
readonly title: "ArkGate ArkRules (intra-layer contract)";
|
|
2174
|
+
readonly description: "Per-layer structure sensors and invariant catalog consumed by the ArkGate Effective Contract.";
|
|
2175
|
+
readonly type: "object";
|
|
2176
|
+
readonly additionalProperties: false;
|
|
2177
|
+
readonly required: readonly ["schemaVersion", "layer"];
|
|
2178
|
+
readonly properties: {
|
|
2179
|
+
readonly $schema: {
|
|
2180
|
+
readonly type: "string";
|
|
2181
|
+
readonly minLength: 1;
|
|
2182
|
+
readonly default: "https://unpkg.com/arkgate/schemas/ark.arkrules.schema.json";
|
|
2183
|
+
};
|
|
2184
|
+
readonly schemaVersion: {
|
|
2185
|
+
readonly type: "string";
|
|
2186
|
+
readonly const: "1.0";
|
|
2187
|
+
readonly default: "1.0";
|
|
2188
|
+
};
|
|
2189
|
+
readonly layer: {
|
|
2190
|
+
readonly type: "string";
|
|
2191
|
+
readonly minLength: 1;
|
|
2192
|
+
};
|
|
2193
|
+
readonly structure: {
|
|
2194
|
+
readonly type: "array";
|
|
2195
|
+
readonly default: readonly [];
|
|
2196
|
+
readonly items: {
|
|
2197
|
+
readonly $ref: "#/$defs/structureEntry";
|
|
2198
|
+
};
|
|
2199
|
+
};
|
|
2200
|
+
readonly invariants: {
|
|
2201
|
+
readonly type: "array";
|
|
2202
|
+
readonly default: readonly [];
|
|
2203
|
+
readonly items: {
|
|
2204
|
+
readonly $ref: "#/$defs/invariantEntry";
|
|
2205
|
+
};
|
|
2206
|
+
};
|
|
2207
|
+
};
|
|
2208
|
+
readonly $defs: {
|
|
2209
|
+
readonly structureEntry: {
|
|
2210
|
+
readonly type: "object";
|
|
2211
|
+
readonly additionalProperties: false;
|
|
2212
|
+
readonly required: readonly ["id", "sensor"];
|
|
2213
|
+
readonly properties: {
|
|
2214
|
+
readonly id: {
|
|
2215
|
+
readonly type: "string";
|
|
2216
|
+
readonly minLength: 1;
|
|
2217
|
+
};
|
|
2218
|
+
readonly sensor: {
|
|
2219
|
+
readonly type: "string";
|
|
2220
|
+
readonly enum: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "no-anemic-model", "invariant-coverage"];
|
|
2221
|
+
};
|
|
2222
|
+
readonly mode: {
|
|
2223
|
+
readonly type: "string";
|
|
2224
|
+
readonly enum: readonly ["advisory", "enforced"];
|
|
2225
|
+
readonly default: "advisory";
|
|
2226
|
+
};
|
|
2227
|
+
readonly appliesTo: {
|
|
2228
|
+
readonly type: "array";
|
|
2229
|
+
readonly items: {
|
|
2230
|
+
readonly type: "string";
|
|
2231
|
+
readonly minLength: 1;
|
|
2232
|
+
};
|
|
2233
|
+
readonly uniqueItems: true;
|
|
2234
|
+
};
|
|
2235
|
+
readonly description: {
|
|
2236
|
+
readonly type: "string";
|
|
2237
|
+
readonly minLength: 1;
|
|
2238
|
+
};
|
|
2239
|
+
};
|
|
2240
|
+
};
|
|
2241
|
+
readonly invariantEntry: {
|
|
2242
|
+
readonly type: "object";
|
|
2243
|
+
readonly additionalProperties: false;
|
|
2244
|
+
readonly required: readonly ["id", "description"];
|
|
2245
|
+
readonly properties: {
|
|
2246
|
+
readonly id: {
|
|
2247
|
+
readonly type: "string";
|
|
2248
|
+
readonly minLength: 1;
|
|
2249
|
+
};
|
|
2250
|
+
readonly description: {
|
|
2251
|
+
readonly type: "string";
|
|
2252
|
+
readonly minLength: 1;
|
|
2253
|
+
};
|
|
2254
|
+
readonly aggregate: {
|
|
2255
|
+
readonly type: "string";
|
|
2256
|
+
readonly minLength: 1;
|
|
2257
|
+
};
|
|
2258
|
+
readonly coverage: {
|
|
2259
|
+
readonly type: "object";
|
|
2260
|
+
readonly additionalProperties: false;
|
|
2261
|
+
readonly properties: {
|
|
2262
|
+
readonly test: {
|
|
2263
|
+
readonly type: "boolean";
|
|
2264
|
+
};
|
|
2265
|
+
readonly symbol: {
|
|
2266
|
+
readonly type: "string";
|
|
2267
|
+
readonly minLength: 1;
|
|
2268
|
+
};
|
|
2269
|
+
};
|
|
2270
|
+
};
|
|
2271
|
+
readonly mode: {
|
|
2272
|
+
readonly type: "string";
|
|
2273
|
+
readonly enum: readonly ["advisory", "enforced"];
|
|
2274
|
+
readonly default: "advisory";
|
|
2275
|
+
};
|
|
2276
|
+
readonly appliesTo: {
|
|
2277
|
+
readonly type: "array";
|
|
2278
|
+
readonly items: {
|
|
2279
|
+
readonly type: "string";
|
|
2280
|
+
readonly minLength: 1;
|
|
2281
|
+
};
|
|
2282
|
+
readonly uniqueItems: true;
|
|
2283
|
+
};
|
|
2284
|
+
};
|
|
2285
|
+
};
|
|
2286
|
+
};
|
|
2287
|
+
};
|
|
2288
|
+
declare function loadArkRulesContract(input: unknown, source?: string, expectedLayer?: string): {
|
|
2289
|
+
config: ArkRulesFile;
|
|
2290
|
+
};
|
|
2291
|
+
declare function parseArkRulesJson(json: string, source?: string, expectedLayer?: string): {
|
|
2292
|
+
config: ArkRulesFile;
|
|
2293
|
+
};
|
|
2294
|
+
/**
|
|
2295
|
+
* Build the Effective Contract from already-validated ArkRules files.
|
|
2296
|
+
* Callers supply `{ layer → { sourceFile, file } }` after resolving references.
|
|
2297
|
+
*/
|
|
2298
|
+
declare function buildEffectiveArkRules(parts: ReadonlyArray<{
|
|
2299
|
+
layer: string;
|
|
2300
|
+
sourceFile: string;
|
|
2301
|
+
file: ArkRulesFile;
|
|
2302
|
+
}>): EffectiveArkRules;
|
|
2303
|
+
/** Empty Effective Contract used when `arkRules` is absent (byte-for-byte verdict parity). */
|
|
2304
|
+
declare function emptyEffectiveArkRules(): EffectiveArkRules;
|
|
2305
|
+
|
|
1815
2306
|
/**
|
|
1816
2307
|
* Contract loading, project/change analysis, and policy-delta analysis
|
|
1817
2308
|
* (U02 pilot 2). Reached through the src/kernel/analysis.ts facade; consumer
|
|
1818
2309
|
* import paths never change.
|
|
1819
2310
|
*/
|
|
1820
2311
|
|
|
1821
|
-
|
|
2312
|
+
type LoadContractOptions = {
|
|
2313
|
+
/** Pre-resolved Effective ArkRules (from resolveEffectiveContract). */
|
|
2314
|
+
arkRules?: EffectiveArkRules;
|
|
2315
|
+
};
|
|
2316
|
+
declare function loadContract(input: unknown, source?: string, options?: LoadContractOptions): AnalysisContract;
|
|
1822
2317
|
declare function analyzePolicyDelta(input: AnalyzePolicyDeltaInput): PolicyDeltaAnalysis;
|
|
1823
2318
|
declare function analyzeProject(input: AnalyzeProjectInput): AnalysisResult;
|
|
1824
2319
|
declare function analyzeChange(input: AnalyzeChangeInput): AnalysisResult;
|
|
@@ -1856,6 +2351,106 @@ declare function preflightResolvedChange(input: PreflightResolvedChangeInput): R
|
|
|
1856
2351
|
/** Canonical config diagnostics over repo-relative file paths. */
|
|
1857
2352
|
declare function collectAnalysisConfigWarnings(input: CollectAnalysisConfigWarningsInput): ArchitectureEngineViolation[];
|
|
1858
2353
|
|
|
2354
|
+
/**
|
|
2355
|
+
* Pure Effective Contract composition (ADR 0012).
|
|
2356
|
+
*
|
|
2357
|
+
* Resolves `arkRules` references against a supplied file-content map (Tooling owns I/O),
|
|
2358
|
+
* validates each part, and returns one in-memory contract with per-rule provenance.
|
|
2359
|
+
* The serialized effective rules feed policyHash via the analysis contract loader.
|
|
2360
|
+
*/
|
|
2361
|
+
|
|
2362
|
+
type EffectiveContractWarning = {
|
|
2363
|
+
path: string;
|
|
2364
|
+
message: string;
|
|
2365
|
+
/** advisory | error — errors fail closed; warnings surface drift (unreferenced files). */
|
|
2366
|
+
severity: 'advisory' | 'error';
|
|
2367
|
+
};
|
|
2368
|
+
type EffectiveContract = {
|
|
2369
|
+
config: ArkConfig;
|
|
2370
|
+
arkRules: EffectiveArkRules;
|
|
2371
|
+
warnings: EffectiveContractWarning[];
|
|
2372
|
+
};
|
|
2373
|
+
type ResolveEffectiveContractInput = {
|
|
2374
|
+
config: ArkConfig;
|
|
2375
|
+
/**
|
|
2376
|
+
* Project-relative path → file contents. Missing keys mean the file is absent.
|
|
2377
|
+
* Paths must use forward slashes and match the arkRules map values exactly.
|
|
2378
|
+
*/
|
|
2379
|
+
fileContents: Readonly<Record<string, string>>;
|
|
2380
|
+
/**
|
|
2381
|
+
* Optional inventory of files under arkrules/ (or other dirs) used only to
|
|
2382
|
+
* detect unreferenced ArkRules files (advisory drift).
|
|
2383
|
+
*/
|
|
2384
|
+
discoveredArkRulesFiles?: readonly string[];
|
|
2385
|
+
};
|
|
2386
|
+
declare class EffectiveContractError extends Error {
|
|
2387
|
+
readonly issues: ArkConfigIssue[];
|
|
2388
|
+
readonly source: string;
|
|
2389
|
+
constructor(source: string, issues: ArkConfigIssue[]);
|
|
2390
|
+
}
|
|
2391
|
+
/**
|
|
2392
|
+
* Resolve arkRules references into a single Effective Contract.
|
|
2393
|
+
* Fail-closed for missing, unparsable, or schema-invalid referenced files.
|
|
2394
|
+
*/
|
|
2395
|
+
declare function resolveEffectiveContract(input: ResolveEffectiveContractInput, source?: string): EffectiveContract;
|
|
2396
|
+
/**
|
|
2397
|
+
* Canonical payload for policyHash: root config + sorted effective ArkRules.
|
|
2398
|
+
* Absence of arkRules yields the same payload shape with empty structure/invariants.
|
|
2399
|
+
*/
|
|
2400
|
+
declare function effectiveContractPolicyPayload(contract: EffectiveContract): unknown;
|
|
2401
|
+
|
|
2402
|
+
/**
|
|
2403
|
+
* Deterministic brownfield rules inventory (AR13).
|
|
2404
|
+
*
|
|
2405
|
+
* Scans supplied file contents for spaghetti rule candidates:
|
|
2406
|
+
* validation-in-controller, magic business constants, anemic entities.
|
|
2407
|
+
* Confidence is direct-evidence | heuristic — never a numeric score.
|
|
2408
|
+
*/
|
|
2409
|
+
type RulesInventoryConfidence = 'direct-evidence' | 'heuristic';
|
|
2410
|
+
type RulesInventoryCandidate = {
|
|
2411
|
+
id: string;
|
|
2412
|
+
kind: 'validation-in-controller' | 'magic-business-constant' | 'anemic-entity' | 'mutation-without-guard';
|
|
2413
|
+
file: string;
|
|
2414
|
+
line: number;
|
|
2415
|
+
message: string;
|
|
2416
|
+
confidence: RulesInventoryConfidence;
|
|
2417
|
+
suggestedArkRule?: {
|
|
2418
|
+
layer: string;
|
|
2419
|
+
structureId?: string;
|
|
2420
|
+
sensor?: string;
|
|
2421
|
+
invariantId?: string;
|
|
2422
|
+
};
|
|
2423
|
+
neverMechanicalSafe: true;
|
|
2424
|
+
};
|
|
2425
|
+
type RulesInventoryResult = {
|
|
2426
|
+
candidates: RulesInventoryCandidate[];
|
|
2427
|
+
inventoried: number;
|
|
2428
|
+
underContract: number;
|
|
2429
|
+
frozen: number;
|
|
2430
|
+
notAScore: true;
|
|
2431
|
+
};
|
|
2432
|
+
type BuildRulesInventoryInput = {
|
|
2433
|
+
fileContents: Readonly<Record<string, string>>;
|
|
2434
|
+
/** Invariant / structure ids already under contract (to compute underContract count). */
|
|
2435
|
+
contractedRuleIds?: readonly string[];
|
|
2436
|
+
/** Baseline keys currently frozen for arkrule residual. */
|
|
2437
|
+
frozenKeys?: readonly string[];
|
|
2438
|
+
};
|
|
2439
|
+
declare function buildRulesInventory(input: BuildRulesInventoryInput): RulesInventoryResult;
|
|
2440
|
+
/** Build a pilotLoop extraction card for the top inventory candidate (AR14). */
|
|
2441
|
+
declare function inventoryToExtractionCard(candidate: RulesInventoryCandidate): {
|
|
2442
|
+
pilot: string;
|
|
2443
|
+
pilotTarget: string;
|
|
2444
|
+
smellId: string;
|
|
2445
|
+
move: string;
|
|
2446
|
+
doNot: string[];
|
|
2447
|
+
successSignal: string;
|
|
2448
|
+
killSwitch: string;
|
|
2449
|
+
neverMechanicalSafe: true;
|
|
2450
|
+
class: 'judgment';
|
|
2451
|
+
next: string;
|
|
2452
|
+
};
|
|
2453
|
+
|
|
1859
2454
|
/** Public, evidence-backed enforcement state shared by doctor adapters. */
|
|
1860
2455
|
declare const ARK_ENFORCEMENT_STATE_SCHEMA_VERSION: "1.1";
|
|
1861
2456
|
type EnforcementVerification = boolean | 'unverified';
|
|
@@ -1943,4 +2538,4 @@ type ArkDesignDeltaResult = {
|
|
|
1943
2538
|
error?: string;
|
|
1944
2539
|
};
|
|
1945
2540
|
|
|
1946
|
-
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, ARK_DESIGN_DELTA_SCHEMA_VERSION, ARK_ENFORCEMENT_STATE_SCHEMA_VERSION, type AdapterCompletenessReason, type AdapterDiagnostic, type AdapterResult, type AdapterSeverity, type AdapterViolationInput, type AnalysisCapabilityUse, type AnalysisCompilerOptions, type AnalysisCompleteness, type AnalysisContract, type AnalysisEvidence, type AnalysisFile, type AnalysisFileChange, type AnalysisFileInput, type AnalysisImportEdge, type AnalysisIr, type AnalysisMode, type AnalysisResult, type AnalysisViolation, type AnalyzeArchitectureConvergenceInput, type AnalyzeChangeInput, type AnalyzePolicyDeltaInput, type AnalyzeProjectInput, type AnalyzeResolvedProjectInput, 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 ArkDesignDeltaResult, type ArkEnforcementHost, type ArkEnforcementState, type ChangePreflightResult, type CollectAnalysisConfigWarningsInput, type CreateArchitectureProfileFromArkConfigOptions, type CreateArchitectureProfileOptions, type CreateElevenLayerArkConfigOptions, type DesignDeltaChange, type DesignDeltaIdentity, type DesignSmellEvidence, type DesignSmellFinding, type DesignSmellId, type EnforcementBoundaryState, type EnforcementEvidence, type EnforcementEvidenceField, type EnforcementVerification, type EvaluateArchitectureGraphInput, type ForbiddenCapabilityUse, POLICY_DELTA_SCHEMA_VERSION, type PolicyDelta, type PolicyDeltaAcknowledgement, type PolicyDeltaAnalysis, type PolicyDeltaClassification, type PolicyDeltaFinding, type PreflightResolvedChangeInput, type PreparedChangeFile, RESOLVED_CANDIDATE_FACTS_SCHEMA, RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION, type ResolvedAmbientFact, type ResolvedAnalysisFile, type ResolvedAnalysisIr, type ResolvedAnalysisResult, type ResolvedCandidateFacts, type ResolvedCandidateFactsInput, type ResolvedCapability, type ResolvedCapabilityFact, type ResolvedChangePreflightResult, type ResolvedDependencyFact, type ResolvedDependencyKind, type ResolvedDependencyState, type ResolvedFactsCompleteness, type ResolvedFactsReason, type ResolvedFileFact, type ResolvedIntentReferenceFact, type ResolvedPublishFact, type ResolvedSafetyFact, type ResolvedSafetyKind, type ResolvedSafetyReport, type SemanticDependency, type SemanticDependencyKind, analyzeArchitectureConvergence, analyzeChange, analyzePolicyDelta, analyzeProject, analyzeResolvedProject, classifyArkPolicyDelta, collectAnalysisConfigWarnings, collectForbiddenCapabilityUses, createAICodeGate, createAdapterResult, createArchitectureProfile, createArchitectureProfileFromArkConfig, createElevenLayerArkConfig, createResolvedCandidateFacts, detectArchitectureCycles, deterministicHash, elevenLayerProfile, evaluateArchitectureGraph, explainViolation, extractSemanticDependencies, loadArkConfigContract, loadContract, loadResolvedCandidateFacts, parseArkConfigJson, policyDeltaAcknowledgementMatches, preflightChange, preflightResolvedChange, resolvedFactsEvidenceRequirementsHash, stableSerialize, toAdapterDiagnostic, version };
|
|
2541
|
+
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, ARK_DESIGN_DELTA_SCHEMA_VERSION, ARK_ENFORCEMENT_STATE_SCHEMA_VERSION, ARK_RULES_SCHEMA, ARK_RULES_SCHEMA_VERSION, ARK_RULE_SENSORS, type AdapterCompletenessReason, type AdapterDiagnostic, type AdapterResult, type AdapterSeverity, type AdapterViolationInput, type AnalysisCapabilityUse, type AnalysisCompilerOptions, type AnalysisCompleteness, type AnalysisContract, type AnalysisEvidence, type AnalysisFile, type AnalysisFileChange, type AnalysisFileInput, type AnalysisImportEdge, type AnalysisIr, type AnalysisMode, type AnalysisResult, type AnalysisViolation, type AnalyzeArchitectureConvergenceInput, type AnalyzeChangeInput, type AnalyzePolicyDeltaInput, type AnalyzeProjectInput, type AnalyzeResolvedProjectInput, 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 ArkDesignDeltaResult, type ArkEnforcementHost, type ArkEnforcementState, type ArkRuleSensorViolation, type ArkRulesFile, type ChangePreflightResult, type ClassShapeFact, type CollectAnalysisConfigWarningsInput, type CreateArchitectureProfileFromArkConfigOptions, type CreateArchitectureProfileOptions, type CreateElevenLayerArkConfigOptions, type DesignDeltaChange, type DesignDeltaIdentity, type DesignSmellEvidence, type DesignSmellFinding, type DesignSmellId, type EffectiveArkRules, type EffectiveContract, EffectiveContractError, type EffectiveContractWarning, type EnforcementBoundaryState, type EnforcementEvidence, type EnforcementEvidenceField, type EnforcementVerification, type EvaluateArchitectureGraphInput, type ForbiddenCapabilityUse, type InvariantCoverageEvidence, POLICY_DELTA_SCHEMA_VERSION, type PolicyDelta, type PolicyDeltaAcknowledgement, type PolicyDeltaAnalysis, type PolicyDeltaClassification, type PolicyDeltaFinding, type PreflightResolvedChangeInput, type PreparedChangeFile, RESOLVED_CANDIDATE_FACTS_SCHEMA, RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION, type ResolvedAmbientFact, type ResolvedAnalysisFile, type ResolvedAnalysisIr, type ResolvedAnalysisResult, type ResolvedCandidateFacts, type ResolvedCandidateFactsInput, type ResolvedCapability, type ResolvedCapabilityFact, type ResolvedChangePreflightResult, type ResolvedDependencyFact, type ResolvedDependencyKind, type ResolvedDependencyState, type ResolvedFactsCompleteness, type ResolvedFactsReason, type ResolvedFileFact, type ResolvedIntentReferenceFact, type ResolvedPublishFact, type ResolvedSafetyFact, type ResolvedSafetyKind, type ResolvedSafetyReport, type RulesInventoryCandidate, type RulesInventoryResult, type SemanticDependency, type SemanticDependencyKind, analyzeArchitectureConvergence, analyzeChange, analyzePolicyDelta, analyzeProject, analyzeResolvedProject, buildArkRuleFileHints, buildEffectiveArkRules, buildRulesInventory, canPromoteInvariant, classifyArkPolicyDelta, collectAnalysisConfigWarnings, collectEmptyAppliesToFindings, collectForbiddenCapabilityUses, createAICodeGate, createAdapterResult, createArchitectureProfile, createArchitectureProfileFromArkConfig, createElevenLayerArkConfig, createResolvedCandidateFacts, deriveArkRuleFileHints, detectArchitectureCycles, deterministicHash, effectiveContractPolicyPayload, elevenLayerProfile, emptyEffectiveArkRules, evaluateArchitectureGraph, evaluateArkRuleSensors, evaluateInvariantCoverage, explainViolation, extractClassShapesFromSource, extractSemanticDependencies, inventoryToExtractionCard, loadArkConfigContract, loadArkRulesContract, loadContract, loadResolvedCandidateFacts, parseArkConfigJson, parseArkRulesJson, policyDeltaAcknowledgementMatches, preflightChange, preflightResolvedChange, resolveEffectiveContract, resolvedFactsEvidenceRequirementsHash, stableSerialize, toAdapterDiagnostic, version };
|