arkgate 4.8.20 → 4.8.22

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +172 -5
  2. package/README.md +107 -117
  3. package/bin/ark-check-runtime.mjs +3 -4
  4. package/bin/ark-layer-match.mjs +110 -18
  5. package/bin/lib/analysis-engine.mjs +13 -6
  6. package/bin/lib/config-contract.mjs +5 -0
  7. package/bin/lib/diagnostic-catalog.mjs +1 -0
  8. package/bin/lib/doctor-advisories.mjs +20 -0
  9. package/bin/lib/doctor-human.mjs +11 -9
  10. package/bin/lib/doctor-plan.mjs +15 -14
  11. package/bin/lib/first-run-help.mjs +7 -1
  12. package/bin/lib/html-report-advisories.mjs +8 -0
  13. package/bin/lib/html-report-depth.mjs +9 -8
  14. package/bin/lib/invariant-coverage.mjs +417 -72
  15. package/bin/lib/managed-upgrade.mjs +59 -14
  16. package/bin/lib/pilot-loop.mjs +183 -37
  17. package/bin/lib/upgrade-behavior-changes.mjs +83 -0
  18. package/bin/lib/upgrade-command.mjs +69 -31
  19. package/bin/lib/upgrade-outcome.mjs +359 -0
  20. package/bin/lib/violations.mjs +109 -0
  21. package/dist/{configTypes-VVknqcTJ.d.ts → configTypes-CTELo87-.d.ts} +7 -0
  22. package/dist/{diagnosticCatalog-BPYWNyJR.d.ts → diagnosticCatalog-WD2TPSwZ.d.ts} +78 -5
  23. package/dist/eslint/index.cjs +4 -4
  24. package/dist/eslint/index.d.ts +26 -3
  25. package/dist/eslint/index.js +4 -4
  26. package/dist/index.cjs +32 -25
  27. package/dist/index.d.ts +9 -4
  28. package/dist/index.js +33 -26
  29. package/dist/nestjs/index.cjs +9 -9
  30. package/dist/nestjs/index.d.ts +3 -3
  31. package/dist/nestjs/index.js +9 -9
  32. package/dist/runtime/index.cjs +22 -15
  33. package/dist/runtime/index.d.ts +6 -6
  34. package/dist/runtime/index.js +22 -15
  35. package/dist/{types-p_fCp6P-.d.ts → types-fQ9-KrBj.d.ts} +1 -1
  36. package/dist/{types-Cs-46DRu.d.ts → types-yDNEQ603.d.ts} +1 -1
  37. package/docs/README.md +5 -3
  38. package/docs/agent-guide.md +15 -7
  39. package/docs/brownfield-adoption.md +4 -3
  40. package/docs/configuration.md +34 -11
  41. package/docs/diagnostics.md +12 -2
  42. package/docs/package-surface.md +3 -2
  43. package/docs/product-voice.md +11 -3
  44. package/package.json +2 -1
  45. package/schemas/ark.config.schema.json +8 -0
  46. package/server.json +2 -2
  47. package/templates/agent-skills/README.md +1 -1
  48. package/templates/agent-skills/ark-adopt/SKILL.md +5 -2
  49. package/templates/agent-skills/ark-architect/SKILL.md +2 -0
  50. package/templates/agent-skills/ark-autopilot/SKILL.md +6 -4
  51. package/templates/agent-skills/ark-contract/SKILL.md +2 -0
  52. package/templates/agent-skills/ark-coverage/SKILL.md +2 -0
  53. package/templates/agent-skills/ark-explain/SKILL.md +2 -0
  54. package/templates/agent-skills/ark-explore/SKILL.md +4 -2
  55. package/templates/agent-skills/ark-fix/SKILL.md +2 -0
  56. package/templates/agent-skills/ark-loop/SKILL.md +2 -0
  57. package/templates/agent-skills/ark-order/SKILL.md +2 -0
  58. package/templates/agent-skills/ark-place/SKILL.md +2 -0
  59. package/templates/agent-skills/ark-runtime/SKILL.md +2 -0
  60. package/templates/agent-skills/ark-think/SKILL.md +2 -0
  61. package/templates/agent-skills/ark-upgrade/SKILL.md +20 -7
  62. package/templates/skills/ark-adopt.md +5 -2
  63. package/templates/skills/ark-architect.md +2 -0
  64. package/templates/skills/ark-autopilot.md +6 -4
  65. package/templates/skills/ark-contract.md +2 -0
  66. package/templates/skills/ark-coverage.md +2 -0
  67. package/templates/skills/ark-explain.md +2 -0
  68. package/templates/skills/ark-explore.md +4 -2
  69. package/templates/skills/ark-fix.md +2 -0
  70. package/templates/skills/ark-loop.md +2 -0
  71. package/templates/skills/ark-order.md +2 -0
  72. package/templates/skills/ark-place.md +2 -0
  73. package/templates/skills/ark-runtime.md +2 -0
  74. package/templates/skills/ark-think.md +2 -0
  75. package/templates/skills/ark-upgrade.md +20 -7
@@ -1,5 +1,5 @@
1
- import { e as CreateArchitectureProfileOptions, b as ArchitectureProfile, d as ArkCheckConfig, C as CreateArchitectureProfileFromArkConfigOptions, f as CreateElevenLayerArkConfigOptions, i as Policy, j as IntentCreator, I as IntentName } from './types-p_fCp6P-.js';
2
- import { A as ArkConfig, c as ArkConfigLoadResult } from './configTypes-VVknqcTJ.js';
1
+ import { e as CreateArchitectureProfileOptions, b as ArchitectureProfile, d as ArkCheckConfig, C as CreateArchitectureProfileFromArkConfigOptions, f as CreateElevenLayerArkConfigOptions, i as Policy, j as IntentCreator, I as IntentName } from './types-fQ9-KrBj.js';
2
+ import { A as ArkConfig, c as ArkConfigLoadResult } from './configTypes-CTELo87-.js';
3
3
 
4
4
  /** Versioned public result contract types + JSON Schema (adapter envelope). */
5
5
  /**
@@ -392,7 +392,7 @@ declare function createAdapterResult(input: {
392
392
  }): CurrentAdapterResult;
393
393
 
394
394
  /** ArkGate library version — single source of truth. */
395
- declare const version = "4.8.20";
395
+ declare const version = "4.8.22";
396
396
 
397
397
  /**
398
398
  * AI Code Gate (basic).
@@ -1722,10 +1722,65 @@ type EffectiveArkRules = {
1722
1722
  /**
1723
1723
  * Pure invariant coverage evidence (ADR 0014 / AR09–AR10).
1724
1724
  *
1725
- * Mines test titles and symbol presence against the Effective ArkRules catalog.
1725
+ * Mines test titles and symbol declarations against the Effective ArkRules catalog.
1726
+ * `classifyCoverage` returns one verdict; `countsAsCoverage` is the policy;
1727
+ * `describeCoverage` is the sentence. A bare mention is never coverage.
1726
1728
  * No filesystem — Tooling supplies file contents and test globs.
1727
1729
  */
1728
1730
 
1731
+ /**
1732
+ * How a `coverage.symbol` identifier is declared. `type`, `interface`, and
1733
+ * `enum` are declarations — the same witness as function, class, const, and
1734
+ * method.
1735
+ */
1736
+ type DeclarationShape = 'function' | 'class' | 'const' | 'method' | 'type' | 'interface' | 'enum';
1737
+ /** Where a bare mention of an id or symbol sat. Never coverage. */
1738
+ type MentionContext = 'test-body' | 'comment' | 'string' | 'import';
1739
+ /**
1740
+ * One coverage verdict. Best evidence wins: test-title, then declaration,
1741
+ * then mention-only, then none. A comment in another file, when the symbol
1742
+ * still occurs in code, is `declaration-miss` and does not count.
1743
+ * Regexes, the test-file vs source split, and `Aggregate.method` lookup stay
1744
+ * behind this value.
1745
+ */
1746
+ type CoverageEvidence = {
1747
+ kind: 'test-title';
1748
+ file: string;
1749
+ title: string;
1750
+ } | {
1751
+ kind: 'declaration';
1752
+ file: string;
1753
+ shape: DeclarationShape;
1754
+ } | {
1755
+ kind: 'mention-only';
1756
+ file: string;
1757
+ context: MentionContext;
1758
+ } | {
1759
+ kind: 'declaration-miss';
1760
+ symbol: string;
1761
+ } | {
1762
+ kind: 'none';
1763
+ };
1764
+ /** Invariant fields the classifier reads. A full catalog entry is assignable. */
1765
+ type CoverageInvariant = {
1766
+ id: string;
1767
+ coverage?: {
1768
+ test?: boolean;
1769
+ symbol?: string;
1770
+ } | null;
1771
+ };
1772
+ /** File set the classifier reads. Tooling has already loaded the contents. */
1773
+ type CoverageFiles = {
1774
+ /** Project-relative path → file contents (tests and sources). */
1775
+ fileContents: Readonly<Record<string, string>>;
1776
+ /** Paths already classified as tests. */
1777
+ testFiles?: readonly string[];
1778
+ /**
1779
+ * Declared runner roots. A test title inside a root beats one outside it.
1780
+ * The outside-roots finding stays a separate verdict.
1781
+ */
1782
+ coverageRoots?: readonly string[];
1783
+ };
1729
1784
  type InvariantCoverageEvidence = {
1730
1785
  invariantId: string;
1731
1786
  layer: string;
@@ -1744,6 +1799,11 @@ type InvariantCoverageEvidence = {
1744
1799
  * declaration text, not a passing suite.
1745
1800
  */
1746
1801
  symbolEvidenceFile?: string;
1802
+ /**
1803
+ * Declaration shape when `evidence` includes `symbol`. Additive: readers that
1804
+ * only know `test-title` | `symbol` ignore it.
1805
+ */
1806
+ shape?: DeclarationShape;
1747
1807
  /**
1748
1808
  * The only covering test found sits outside `coverage.coverageRoots` — the
1749
1809
  * places the project declares its runner executes. ArkGate never runs tests,
@@ -1841,6 +1901,19 @@ type InvariantCoverageStats = {
1841
1901
  outOfRoot: number;
1842
1902
  };
1843
1903
  };
1904
+ /**
1905
+ * Best coverage evidence for `invariant` in `files`.
1906
+ * test-title beats a declaration; a declaration beats a bare mention; a bare
1907
+ * mention beats silence. Callers do not re-scan to explain the verdict.
1908
+ */
1909
+ declare function classifyCoverage(invariant: CoverageInvariant, files: CoverageFiles): CoverageEvidence;
1910
+ /**
1911
+ * Policy: a test title or any declaration counts, including type, interface,
1912
+ * and enum. A mention-only verdict never counts. `none` does not count.
1913
+ */
1914
+ declare function countsAsCoverage(ev: CoverageEvidence): boolean;
1915
+ /** Sentence for the verdict. `INVARIANT_UNCOVERED` prints this; it does not re-derive it. */
1916
+ declare function describeCoverage(invariant: CoverageInvariant, ev: CoverageEvidence): string;
1844
1917
  declare function evaluateInvariantCoverage(input: EvaluateInvariantCoverageInput): {
1845
1918
  coverage: InvariantCoverageEvidence[];
1846
1919
  violations: InvariantCoverageViolation[];
@@ -2490,4 +2563,4 @@ declare function catalogFixForRuleId(ruleId: string | null | undefined): string
2490
2563
  */
2491
2564
  declare function catalogWhyForRuleId(ruleId: string | null | undefined): string | undefined;
2492
2565
 
2493
- export { type ArchitectureChangeMapFile as $, type AdapterViolationInput as A, type AdapterResult as B, type AdapterSeverity as C, type AnalysisCapabilityUse as D, type EffectiveArkRules as E, type AnalysisCompilerOptions as F, type AnalysisCompleteness as G, type AnalysisContract as H, type AnalysisEvidence as I, type AnalysisFile as J, type AnalysisFileChange as K, type AnalysisFileInput as L, type AnalysisImportEdge as M, type AnalysisIr as N, type AnalysisMode as O, type AnalysisResult as P, type AnalysisViolation as Q, type ResolvedArkRunKernelCallKind as R, type AnalyzeArchitectureConvergenceInput as S, type AnalyzeChangeInput as T, type AnalyzePolicyDeltaInput as U, type AnalyzeProjectInput as V, type AnalyzeResolvedProjectInput as W, type ArchitectureActualChange as X, type ArchitectureChangeMap as Y, type ArchitectureChangeMapContract as Z, type ArchitectureChangeMapDependency as _, type ArkRulesFile as a, type SemanticDependencyKind as a$, type ArchitectureChangeOperation as a0, type ArchitectureConvergenceClassification as a1, type ArchitectureConvergenceFinding as a2, type ArchitectureConvergenceResult as a3, type ArchitectureDependency as a4, type ArchitectureEngineEdge as a5, type ArchitectureEngineResult as a6, type ArchitectureEngineViolation as a7, type ArkDesignDeltaResult as a8, type ArkEnforcementHost as a9, type PolicyDeltaAcknowledgement as aA, type PolicyDeltaAnalysis as aB, type PolicyDeltaClassification as aC, type PolicyDeltaFinding as aD, type PreflightResolvedChangeInput as aE, type PreparedChangeFile as aF, RESOLVED_CANDIDATE_FACTS_SCHEMA as aG, RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION as aH, type ResolvedAmbientFact as aI, type ResolvedAnalysisFile as aJ, type ResolvedAnalysisIr as aK, type ResolvedAnalysisResult as aL, type ResolvedCandidateFacts as aM, type ResolvedCandidateFactsInput as aN, type ResolvedCapability as aO, type ResolvedCapabilityFact as aP, type ResolvedChangePreflightResult as aQ, type ResolvedDependencyKind as aR, type ResolvedDependencyState as aS, type ResolvedFactsCompleteness as aT, type ResolvedFileFact as aU, type ResolvedIntentReferenceFact as aV, type ResolvedPublishFact as aW, type ResolvedSafetyFact as aX, type ResolvedSafetyKind as aY, type ResolvedSafetyReport as aZ, type SemanticDependency as a_, type ArkEnforcementState as aa, type ArkRuleSensorViolation as ab, type ChangePreflightResult as ac, type ClassShapeFact as ad, type CollectAnalysisConfigWarningsInput as ae, DIAGNOSTIC_CATALOG as af, DIAGNOSTIC_CATALOG_SCHEMA_VERSION as ag, DIAGNOSTIC_DOCS_RELATIVE_PATH as ah, DIAGNOSTIC_RULE_IDS as ai, type DesignDeltaChange as aj, type DesignDeltaEnforcementScope as ak, type DesignDeltaIdentity as al, type DesignSmellEvidence as am, type DesignSmellFinding as an, type DesignSmellId as ao, type DiagnosticCatalogEntry as ap, type DiagnosticCategory as aq, type EnforcementBoundaryState as ar, type EnforcementEvidence as as, type EnforcementEvidenceField as at, type EnforcementVerification as au, type EvaluateArchitectureGraphInput as av, type ForbiddenCapabilityUse as aw, type InvariantCoverageEvidence as ax, POLICY_DELTA_SCHEMA_VERSION as ay, type PolicyDelta as az, type ResolvedArkRunDeclarationFact as b, analyzeArchitectureConvergence as b0, analyzeChange as b1, analyzePolicyDelta as b2, analyzeProject as b3, analyzeResolvedProject as b4, buildArkRuleFileHints as b5, canPromoteInvariant as b6, catalogFixForRuleId as b7, catalogWhyForRuleId as b8, classifyArkPolicyDelta as b9, policyDeltaAcknowledgementMatches as bA, preflightChange as bB, preflightResolvedChange as bC, resolvedFactsEvidenceRequirementsHash as bD, serializeDiagnosticCatalog as bE, stableSerialize as bF, toAdapterDiagnostic as bG, version as bH, collectAnalysisConfigWarnings as ba, collectEmptyAppliesToFindings as bb, collectForbiddenCapabilityUses as bc, createAICodeGate as bd, createAdapterResult as be, createArchitectureProfile as bf, createArchitectureProfileFromArkConfig as bg, createElevenLayerArkConfig as bh, createResolvedCandidateFacts as bi, deriveArkRuleFileHints as bj, detectArchitectureCycles as bk, deterministicHash as bl, diagnosticDocsFragment as bm, diagnosticDocsPath as bn, elevenLayerProfile as bo, evaluateArchitectureGraph as bp, evaluateArkRuleSensors as bq, evaluateInvariantCoverage as br, explainViolation as bs, extractClassShapesFromSource as bt, extractSemanticDependencies as bu, getDiagnosticCatalogEntry as bv, isCataloguedOrArkRuleFamily as bw, isKnownDiagnosticCode as bx, loadContract as by, loadResolvedCandidateFacts as bz, type ResolvedArkRunKernelCallFact as c, type ResolvedArkRunManagedNewFact as d, type ResolvedDependencyFact as e, type ResolvedArkRunCompositionRootHitFact as f, type ResolvedFactsReason as g, type ResolvedArkOrderPlaneCallFact as h, type ResolvedArkOrderGenericUpdateFact as i, type ResolvedArkOrderRootHitFact as j, type ResolvedArkOrderXiFieldWriteFact as k, type ResolvedArkOrderIngestWriteFact as l, ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH as m, type AICodeGate as n, type AICodeGateContext as o, type AICodeGateOptions as p, type AICodeGateResult as q, type AICodeGateViolation as r, type AIGateExtension as s, ANALYSIS_IR_SCHEMA_VERSION as t, ARK_ANALYSIS_RESULT_SCHEMA as u, ARK_ANALYSIS_RESULT_SCHEMA_VERSION as v, ARK_DESIGN_DELTA_SCHEMA_VERSION as w, ARK_ENFORCEMENT_STATE_SCHEMA_VERSION as x, type AdapterCompletenessReason as y, type AdapterDiagnostic as z };
2566
+ export { type ArchitectureChangeMapFile as $, type AdapterViolationInput as A, type AdapterResult as B, type AdapterSeverity as C, type AnalysisCapabilityUse as D, type EffectiveArkRules as E, type AnalysisCompilerOptions as F, type AnalysisCompleteness as G, type AnalysisContract as H, type AnalysisEvidence as I, type AnalysisFile as J, type AnalysisFileChange as K, type AnalysisFileInput as L, type AnalysisImportEdge as M, type AnalysisIr as N, type AnalysisMode as O, type AnalysisResult as P, type AnalysisViolation as Q, type ResolvedArkRunKernelCallKind as R, type AnalyzeArchitectureConvergenceInput as S, type AnalyzeChangeInput as T, type AnalyzePolicyDeltaInput as U, type AnalyzeProjectInput as V, type AnalyzeResolvedProjectInput as W, type ArchitectureActualChange as X, type ArchitectureChangeMap as Y, type ArchitectureChangeMapContract as Z, type ArchitectureChangeMapDependency as _, type ArkRulesFile as a, type ResolvedPublishFact as a$, type ArchitectureChangeOperation as a0, type ArchitectureConvergenceClassification as a1, type ArchitectureConvergenceFinding as a2, type ArchitectureConvergenceResult as a3, type ArchitectureDependency as a4, type ArchitectureEngineEdge as a5, type ArchitectureEngineResult as a6, type ArchitectureEngineViolation as a7, type ArkDesignDeltaResult as a8, type ArkEnforcementHost as a9, type ForbiddenCapabilityUse as aA, type InvariantCoverageEvidence as aB, type MentionContext as aC, POLICY_DELTA_SCHEMA_VERSION as aD, type PolicyDelta as aE, type PolicyDeltaAcknowledgement as aF, type PolicyDeltaAnalysis as aG, type PolicyDeltaClassification as aH, type PolicyDeltaFinding as aI, type PreflightResolvedChangeInput as aJ, type PreparedChangeFile as aK, RESOLVED_CANDIDATE_FACTS_SCHEMA as aL, RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION as aM, type ResolvedAmbientFact as aN, type ResolvedAnalysisFile as aO, type ResolvedAnalysisIr as aP, type ResolvedAnalysisResult as aQ, type ResolvedCandidateFacts as aR, type ResolvedCandidateFactsInput as aS, type ResolvedCapability as aT, type ResolvedCapabilityFact as aU, type ResolvedChangePreflightResult as aV, type ResolvedDependencyKind as aW, type ResolvedDependencyState as aX, type ResolvedFactsCompleteness as aY, type ResolvedFileFact as aZ, type ResolvedIntentReferenceFact as a_, type ArkEnforcementState as aa, type ArkRuleSensorViolation as ab, type ChangePreflightResult as ac, type ClassShapeFact as ad, type CollectAnalysisConfigWarningsInput as ae, type CoverageEvidence as af, type CoverageFiles as ag, type CoverageInvariant as ah, DIAGNOSTIC_CATALOG as ai, DIAGNOSTIC_CATALOG_SCHEMA_VERSION as aj, DIAGNOSTIC_DOCS_RELATIVE_PATH as ak, DIAGNOSTIC_RULE_IDS as al, type DeclarationShape as am, type DesignDeltaChange as an, type DesignDeltaEnforcementScope as ao, type DesignDeltaIdentity as ap, type DesignSmellEvidence as aq, type DesignSmellFinding as ar, type DesignSmellId as as, type DiagnosticCatalogEntry as at, type DiagnosticCategory as au, type EnforcementBoundaryState as av, type EnforcementEvidence as aw, type EnforcementEvidenceField as ax, type EnforcementVerification as ay, type EvaluateArchitectureGraphInput as az, type ResolvedArkRunDeclarationFact as b, type ResolvedSafetyFact as b0, type ResolvedSafetyKind as b1, type ResolvedSafetyReport as b2, type SemanticDependency as b3, type SemanticDependencyKind as b4, analyzeArchitectureConvergence as b5, analyzeChange as b6, analyzePolicyDelta as b7, analyzeProject as b8, analyzeResolvedProject as b9, explainViolation as bA, extractClassShapesFromSource as bB, extractSemanticDependencies as bC, getDiagnosticCatalogEntry as bD, isCataloguedOrArkRuleFamily as bE, isKnownDiagnosticCode as bF, loadContract as bG, loadResolvedCandidateFacts as bH, policyDeltaAcknowledgementMatches as bI, preflightChange as bJ, preflightResolvedChange as bK, resolvedFactsEvidenceRequirementsHash as bL, serializeDiagnosticCatalog as bM, stableSerialize as bN, toAdapterDiagnostic as bO, version as bP, buildArkRuleFileHints as ba, canPromoteInvariant as bb, catalogFixForRuleId as bc, catalogWhyForRuleId as bd, classifyArkPolicyDelta as be, classifyCoverage as bf, collectAnalysisConfigWarnings as bg, collectEmptyAppliesToFindings as bh, collectForbiddenCapabilityUses as bi, countsAsCoverage as bj, createAICodeGate as bk, createAdapterResult as bl, createArchitectureProfile as bm, createArchitectureProfileFromArkConfig as bn, createElevenLayerArkConfig as bo, createResolvedCandidateFacts as bp, deriveArkRuleFileHints as bq, describeCoverage as br, detectArchitectureCycles as bs, deterministicHash as bt, diagnosticDocsFragment as bu, diagnosticDocsPath as bv, elevenLayerProfile as bw, evaluateArchitectureGraph as bx, evaluateArkRuleSensors as by, evaluateInvariantCoverage as bz, type ResolvedArkRunKernelCallFact as c, type ResolvedArkRunManagedNewFact as d, type ResolvedDependencyFact as e, type ResolvedArkRunCompositionRootHitFact as f, type ResolvedFactsReason as g, type ResolvedArkOrderPlaneCallFact as h, type ResolvedArkOrderGenericUpdateFact as i, type ResolvedArkOrderRootHitFact as j, type ResolvedArkOrderXiFieldWriteFact as k, type ResolvedArkOrderIngestWriteFact as l, ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH as m, type AICodeGate as n, type AICodeGateContext as o, type AICodeGateOptions as p, type AICodeGateResult as q, type AICodeGateViolation as r, type AIGateExtension as s, ANALYSIS_IR_SCHEMA_VERSION as t, ARK_ANALYSIS_RESULT_SCHEMA as u, ARK_ANALYSIS_RESULT_SCHEMA_VERSION as v, ARK_DESIGN_DELTA_SCHEMA_VERSION as w, ARK_ENFORCEMENT_STATE_SCHEMA_VERSION as x, type AdapterCompletenessReason as y, type AdapterDiagnostic as z };