arkgate 4.8.23 → 4.8.25

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 (201) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +7 -5
  3. package/bin/ark-check-runtime.mjs +41 -91
  4. package/bin/ark-dashboard.mjs +56 -53
  5. package/bin/ark-layer-match.mjs +707 -121
  6. package/bin/ark-mcp-runtime.mjs +448 -169
  7. package/bin/ark-mcp.mjs +68 -4
  8. package/bin/ark-shared.mjs +42 -22
  9. package/bin/ark.mjs +65 -97
  10. package/bin/lib/adapter-contract-types.mjs +5 -0
  11. package/bin/lib/adapter-contract.mjs +15 -0
  12. package/bin/lib/adoption-stance.mjs +2 -2
  13. package/bin/lib/adr-path.mjs +3 -3
  14. package/bin/lib/agent-gates.mjs +0 -61
  15. package/bin/lib/agent-homes.mjs +12 -21
  16. package/bin/lib/agent-projection-command.mjs +9 -5
  17. package/bin/lib/ambient-state.mjs +9 -30
  18. package/bin/lib/analysis-engine.mjs +15 -11
  19. package/bin/lib/architecture-scan.mjs +61 -15
  20. package/bin/lib/ark-order-doctor.mjs +4 -29
  21. package/bin/lib/ark-order-facts.mjs +319 -17
  22. package/bin/lib/ark-order-sensors.mjs +28 -101
  23. package/bin/lib/ark-order-types.mjs +3 -2
  24. package/bin/lib/ark-run-doctor.mjs +17 -28
  25. package/bin/lib/ark-run-facts.mjs +461 -48
  26. package/bin/lib/ark-run-sensors.mjs +6 -4
  27. package/bin/lib/arkgate-pins.mjs +91 -0
  28. package/bin/lib/arkrule-file-hints.mjs +2 -47
  29. package/bin/lib/arkrules-contract.mjs +124 -133
  30. package/bin/lib/arkrules-sensors.mjs +55 -252
  31. package/bin/lib/check-args.mjs +85 -1
  32. package/bin/lib/ci-and-commands.mjs +24 -78
  33. package/bin/lib/ci-merge-boundary.mjs +1 -1
  34. package/bin/lib/class-source-scan.mjs +479 -0
  35. package/bin/lib/clone-detection.mjs +474 -0
  36. package/bin/lib/codex-home.mjs +5 -3
  37. package/bin/lib/config-contract-slices.mjs +739 -0
  38. package/bin/lib/config-contract.mjs +42 -607
  39. package/bin/lib/config-extras.mjs +16 -22
  40. package/bin/lib/config-warnings.mjs +32 -0
  41. package/bin/lib/contract-smells.mjs +33 -15
  42. package/bin/lib/core-ratchet.mjs +0 -2
  43. package/bin/lib/dashboard-cli.mjs +62 -0
  44. package/bin/lib/deep-module-coach.mjs +2 -4
  45. package/bin/lib/deploy-path.mjs +13 -38
  46. package/bin/lib/design-delta.mjs +1 -1
  47. package/bin/lib/design-smells.mjs +2 -2
  48. package/bin/lib/diagnostic-catalog.mjs +23 -9
  49. package/bin/lib/doctor-advisories.mjs +78 -8
  50. package/bin/lib/doctor-green-cite.mjs +1 -1
  51. package/bin/lib/doctor-human.mjs +1 -1
  52. package/bin/lib/doctor-next-actions.mjs +19 -4
  53. package/bin/lib/doctor-plan.mjs +9 -13
  54. package/bin/lib/duplication-io.mjs +572 -0
  55. package/bin/lib/effective-contract-load.mjs +282 -83
  56. package/bin/lib/enforcement-profiles.mjs +40 -4
  57. package/bin/lib/entry-points-io.mjs +424 -0
  58. package/bin/lib/extra-merge-teeth.mjs +36 -0
  59. package/bin/lib/field-install.mjs +38 -14
  60. package/bin/lib/first-run-help.mjs +10 -5
  61. package/bin/lib/flat-parent-importers.mjs +139 -0
  62. package/bin/lib/flat-parent-pilot.mjs +40 -100
  63. package/bin/lib/gate-files.mjs +58 -90
  64. package/bin/lib/git-change-scope.mjs +109 -0
  65. package/bin/lib/github-enforcement.mjs +166 -29
  66. package/bin/lib/golden-pattern.mjs +1 -1
  67. package/bin/lib/hook-templates.mjs +17 -15
  68. package/bin/lib/host-support-matrix.mjs +3 -1
  69. package/bin/lib/html-report-advisories.mjs +4 -0
  70. package/bin/lib/html-report-depth.mjs +2 -2
  71. package/bin/lib/html-report.mjs +2 -2
  72. package/bin/lib/import-graph-projection.mjs +112 -0
  73. package/bin/lib/import-resolve.mjs +13 -1
  74. package/bin/lib/improvement-compass-doctor.mjs +1 -24
  75. package/bin/lib/install-migrate.mjs +50 -73
  76. package/bin/lib/invariant-coverage-io.mjs +4 -3
  77. package/bin/lib/invariant-coverage.mjs +85 -11
  78. package/bin/lib/invariant-probe-cli.mjs +347 -0
  79. package/bin/lib/invariant-probe-io.mjs +165 -0
  80. package/bin/lib/invariant-probe-runner.mjs +268 -0
  81. package/bin/lib/invariant-probe-sites.mjs +174 -0
  82. package/bin/lib/invariant-probe-workspace.mjs +183 -0
  83. package/bin/lib/invariant-probe.mjs +461 -0
  84. package/bin/lib/invariant-tests-path.mjs +16 -22
  85. package/bin/lib/literal-path-drift.mjs +4 -2
  86. package/bin/lib/managed-upgrade.mjs +2 -8
  87. package/bin/lib/mcp-adoption.mjs +13 -6
  88. package/bin/lib/mcp-hook-payload.mjs +403 -63
  89. package/bin/lib/orphan-modules-io.mjs +458 -0
  90. package/bin/lib/orphan-modules.mjs +251 -0
  91. package/bin/lib/outside-importers.mjs +197 -0
  92. package/bin/lib/package-manager.mjs +60 -2
  93. package/bin/lib/parse-health.mjs +1 -1
  94. package/bin/lib/passthrough-commands.mjs +83 -0
  95. package/bin/lib/persistence-write-hint.mjs +106 -0
  96. package/bin/lib/pin-dependent-gates.mjs +117 -0
  97. package/bin/lib/policy-delta-io.mjs +219 -14
  98. package/bin/lib/post-green-path.mjs +1 -1
  99. package/bin/lib/prepare-change.mjs +115 -7
  100. package/bin/lib/prepare-write.mjs +2 -2
  101. package/bin/lib/presets.mjs +59 -73
  102. package/bin/lib/product-copy.mjs +1 -6
  103. package/bin/lib/project-root.mjs +31 -62
  104. package/bin/lib/remediation.mjs +23 -4
  105. package/bin/lib/resolved-candidate-facts.mjs +405 -117
  106. package/bin/lib/rules-inventory.mjs +22 -3
  107. package/bin/lib/rules-under-contract.mjs +247 -9
  108. package/bin/lib/scan-files.mjs +36 -4
  109. package/bin/lib/schema-validation.mjs +130 -0
  110. package/bin/lib/sensor-promote-cli.mjs +2 -11
  111. package/bin/lib/sensor-promote-io.mjs +33 -22
  112. package/bin/lib/sensor-promotion.mjs +1 -1
  113. package/bin/lib/skill-catalog-apply.mjs +1 -1
  114. package/bin/lib/skill-install.mjs +42 -38
  115. package/bin/lib/snippet-analysis.mjs +140 -6
  116. package/bin/lib/source-policy.mjs +34 -0
  117. package/bin/lib/start-install-recovery.mjs +72 -2
  118. package/bin/lib/start-preview.mjs +31 -1
  119. package/bin/lib/states-transitions-presence.mjs +3 -3
  120. package/bin/lib/status-command.mjs +35 -22
  121. package/bin/lib/status-manifest.mjs +50 -30
  122. package/bin/lib/status-transition-catalog.mjs +0 -6
  123. package/bin/lib/suggestions.mjs +3 -3
  124. package/bin/lib/team-parliament-io.mjs +76 -88
  125. package/bin/lib/team-parliament.mjs +21 -10
  126. package/bin/lib/upgrade-behavior-changes.mjs +2 -2
  127. package/bin/lib/upgrade-command.mjs +2 -24
  128. package/bin/lib/upgrade-outcome.mjs +1 -1
  129. package/bin/lib/upstream-report.mjs +21 -10
  130. package/bin/lib/violations.mjs +10 -9
  131. package/bin/lib/weakest-link.mjs +13 -0
  132. package/bin/lib/write-path-capabilities.mjs +6 -4
  133. package/dist/chunk-A5EIY3HI.cjs +5 -0
  134. package/dist/chunk-AHACEKSV.js +16 -0
  135. package/dist/chunk-SVSQVGFJ.js +5 -0
  136. package/dist/chunk-UN5EH4QV.cjs +16 -0
  137. package/dist/{configTypes-Bbf_MFGe.d.ts → configTypes-GPvvdleM.d.cts} +30 -4
  138. package/dist/configTypes-GPvvdleM.d.ts +257 -0
  139. package/dist/eslint/index.cjs +18 -5
  140. package/dist/eslint/index.d.cts +368 -0
  141. package/dist/eslint/index.d.ts +139 -156
  142. package/dist/eslint/index.js +11 -5
  143. package/dist/index.cjs +36 -35
  144. package/dist/index.d.cts +5547 -0
  145. package/dist/index.d.ts +3283 -198
  146. package/dist/index.js +36 -35
  147. package/dist/inspectorListen-6DQVJ4DC.js +1 -0
  148. package/dist/inspectorListen-KGMIQ2TF.cjs +1 -0
  149. package/dist/nestjs/index.cjs +1 -18
  150. package/dist/nestjs/index.d.cts +22 -0
  151. package/dist/nestjs/index.d.ts +1 -3
  152. package/dist/nestjs/index.js +1 -18
  153. package/dist/order/index.cjs +1 -1
  154. package/dist/order/index.d.cts +155 -0
  155. package/dist/order/index.d.ts +15 -3
  156. package/dist/order/index.js +1 -1
  157. package/dist/runtime/index.cjs +13 -30
  158. package/dist/{diagnosticCatalog-35mrwAHe.d.ts → runtime/index.d.cts} +828 -276
  159. package/dist/runtime/index.d.ts +2741 -133
  160. package/dist/runtime/index.js +13 -30
  161. package/dist/{types-Bdj32QwA.d.ts → types-CnauMQQL.d.cts} +607 -163
  162. package/dist/types-CnauMQQL.d.ts +1800 -0
  163. package/docs/README.md +3 -1
  164. package/docs/agent-guide.md +217 -16
  165. package/docs/ai-gates.md +174 -26
  166. package/docs/arkorder.md +32 -15
  167. package/docs/brownfield-adoption.md +5 -1
  168. package/docs/configuration.md +230 -31
  169. package/docs/develop.md +2 -1
  170. package/docs/diagnostics.md +212 -19
  171. package/docs/package-surface.md +35 -9
  172. package/docs/product-voice.md +7 -1
  173. package/package.json +69 -19
  174. package/schemas/ark.analysis-result.schema.json +15 -0
  175. package/schemas/ark.config.schema.json +77 -12
  176. package/schemas/ark.invariant-probe.schema.json +368 -0
  177. package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
  178. package/schemas/ark.status-manifest.schema.json +22 -0
  179. package/server.json +3 -9
  180. package/templates/agent-skills/README.md +1 -1
  181. package/templates/agent-skills/ark-adopt/SKILL.md +5 -1
  182. package/templates/agent-skills/ark-contract/SKILL.md +17 -0
  183. package/templates/agent-skills/ark-coverage/SKILL.md +2 -0
  184. package/templates/agent-skills/ark-explore/SKILL.md +7 -0
  185. package/templates/agent-skills/ark-fix/SKILL.md +20 -0
  186. package/templates/agent-skills/ark-order/SKILL.md +4 -2
  187. package/templates/agent-skills/ark-place/SKILL.md +8 -0
  188. package/templates/agent-skills/ark-runtime/SKILL.md +6 -1
  189. package/templates/arkrules/PersistenceAdapters.json +1 -1
  190. package/templates/arkrules/PresentationAdapters.json +1 -1
  191. package/templates/skills/ark-adopt.md +5 -1
  192. package/templates/skills/ark-contract.md +17 -0
  193. package/templates/skills/ark-coverage.md +2 -0
  194. package/templates/skills/ark-explore.md +7 -0
  195. package/templates/skills/ark-fix.md +20 -0
  196. package/templates/skills/ark-order.md +4 -2
  197. package/templates/skills/ark-place.md +8 -0
  198. package/templates/skills/ark-runtime.md +6 -1
  199. package/bin/lib/ark-order-error.mjs +0 -18
  200. package/bin/lib/ark-order-invariants.mjs +0 -346
  201. package/dist/types-Ik_OakcI.d.ts +0 -183
@@ -1,183 +0,0 @@
1
- import { a as ArkConfigRule, f as ArkConfigLayer, A as ArkConfig } from './configTypes-Bbf_MFGe.js';
2
-
3
- /**
4
- * Policy types for the Ark kernel.
5
- *
6
- * Policies allow declaring architectural rules that can be checked at runtime.
7
- * Supports both hard policies (must never be violated) and soft policies (warnings).
8
- */
9
- type PolicySeverity = 'hard' | 'soft';
10
- type PolicyEnforcementMode = 'runtime' | 'static' | 'runtime-and-static' | 'advisory';
11
- /**
12
- * Represents a single violation of a policy.
13
- */
14
- interface PolicyViolation {
15
- /** Name of the policy that was violated */
16
- policyName: string;
17
- /** Severity level of the policy */
18
- severity: PolicySeverity;
19
- /** Human-readable explanation of the violation */
20
- message: string;
21
- /** Optional additional structured details */
22
- details?: unknown;
23
- }
24
- /**
25
- * A Policy defines a rule that can be evaluated against a context.
26
- *
27
- * @template Context - The shape of data the policy evaluates (e.g. { registry, events })
28
- */
29
- interface Policy<Context = unknown> {
30
- /** Unique name of the policy (used in violations and reporting) */
31
- readonly name: string;
32
- /** Whether this is a hard rule (enforced strictly) or soft (advisory) */
33
- readonly severity: PolicySeverity;
34
- /** Optional tags for policy classification (e.g. 'layer', 'naming') */
35
- readonly tags?: readonly string[];
36
- readonly owner?: string;
37
- readonly version?: string;
38
- readonly rationale?: string;
39
- readonly enforcementMode?: PolicyEnforcementMode;
40
- readonly deprecated?: boolean | string;
41
- readonly replacedBy?: string;
42
- /**
43
- * Evaluates the policy against the given context.
44
- * Return true / [] for pass, false / single violation / array for failure.
45
- */
46
- check(context: Context): boolean | PolicyViolation | PolicyViolation[];
47
- }
48
-
49
- /**
50
- * Core domain primitives for Ark.
51
- * These types are the foundation for all governance concepts.
52
- */
53
- /**
54
- * Semantic intent names follow a convention:
55
- * - Domain.* for domain events and entities
56
- * - Application.* for use-cases / orchestration
57
- * - Adapter.* for integration points
58
- * - Workflow.* for sagas and processes
59
- * - Job.* for background jobs and scheduling
60
- * - Presentation.* for UI/API adapters
61
- * - Reporting.* for read models and projections
62
- * - Metadata.* for extensibility contracts
63
- * - Security.* / Audit.* / Observability.* for cross-cutting kernel concerns
64
- * - Kernel.* for Ark-owned governance signals
65
- */
66
- 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}`;
67
- type CorrelationId = string;
68
- interface EventMetadata {
69
- occurredAt: string;
70
- source: string;
71
- kernelInstanceId?: string;
72
- eventVersion?: string;
73
- schemaVersion?: string;
74
- allowInterception?: boolean;
75
- interceptions?: Array<{
76
- interceptorId: string;
77
- timestamp: string;
78
- }>;
79
- correlationId?: CorrelationId;
80
- causationId?: string;
81
- traceId?: string;
82
- spanId?: string;
83
- parentSpanId?: string;
84
- [key: string]: unknown;
85
- }
86
- interface DomainEvent<Name extends IntentName = IntentName, Payload = unknown> {
87
- intent: Name;
88
- payload: Payload;
89
- metadata: EventMetadata;
90
- }
91
-
92
- /**
93
- * Intent-specific types for the Ark kernel.
94
- *
95
- * Intents provide semantic naming for every important concept in the system
96
- * (domain events, application operations, adapters, workflows).
97
- */
98
-
99
- /**
100
- * An IntentCreator is a callable that creates a strongly-typed DomainEvent
101
- * when invoked with a payload.
102
- *
103
- * It also carries the semantic `name`.
104
- *
105
- * @example
106
- * const OrderPlaced = defineIntent<'Domain.Order.OrderPlaced', { orderId: string }>('Domain.Order.OrderPlaced');
107
- * const event = OrderPlaced({ orderId: 'o-1' });
108
- */
109
- interface IntentCreator<Name extends IntentName, Payload = unknown> {
110
- /**
111
- * Creates a DomainEvent for this intent.
112
- */
113
- (payload: Payload): DomainEvent<Name, Payload>;
114
- /**
115
- * The fully-qualified semantic name of the intent (e.g. "Domain.Order.OrderPlaced").
116
- */
117
- readonly name: Name;
118
- }
119
- /** Kind of relationship between two intents. */
120
- type IntentRelationshipKind = 'dependsOn' | 'produces';
121
- /**
122
- * Relationship declarations between intents.
123
- * Used for dependency analysis and graph generation.
124
- */
125
- interface IntentRelationship {
126
- from: string;
127
- to: string;
128
- kind: IntentRelationshipKind;
129
- }
130
-
131
- /**
132
- * Architecture layer profiles.
133
- *
134
- * A profile turns semantic names such as `Domain.Order.Placed` into governed
135
- * layer names and dependency rules.
136
- */
137
-
138
- interface ArchitectureLayer {
139
- name: string;
140
- prefixes: string[];
141
- /**
142
- * Custom matcher for teams whose intent names don't follow prefix conventions.
143
- * Checked before any prefix matching, in layer declaration order. A layer may
144
- * use `match` alone (with `prefixes: []`), prefixes alone, or both.
145
- */
146
- match?: (name: string) => boolean;
147
- description?: string;
148
- trustBoundary?: 'public' | 'auth' | 'admin' | 'internal';
149
- owners?: string[];
150
- order?: number;
151
- }
152
- type ArchitectureRule = ArkConfigRule;
153
- interface ArchitectureProfile {
154
- name: string;
155
- layers: ArchitectureLayer[];
156
- rules: ArchitectureRule[];
157
- resolveLayer(name: string): string | undefined;
158
- }
159
- interface CreateArchitectureProfileOptions {
160
- name: string;
161
- layers: ArchitectureLayer[];
162
- rules?: ArchitectureRule[];
163
- }
164
- interface CreateArchitectureProfileFromArkConfigOptions {
165
- /** Runtime profile name. Default: config.name or "ark.config.json". */
166
- name?: string;
167
- }
168
- type ArchitectureLayerConfig = ArkConfigLayer;
169
- type ArkCheckConfig = Omit<ArkConfig, '$schema' | 'schemaVersion' | 'rules'> & {
170
- $schema?: string;
171
- schemaVersion?: ArkConfig['schemaVersion'];
172
- rules?: ArchitectureRule[];
173
- };
174
- interface CreateElevenLayerArkConfigOptions {
175
- /** Source root used in generated file patterns. Default: "src". */
176
- rootDir?: string;
177
- /** Include entries for ark-check. Default: [rootDir]. */
178
- include?: string[];
179
- /** Mark generated layers optional. Default: true. */
180
- optionalLayers?: boolean;
181
- }
182
-
183
- export type { ArchitectureLayer as A, CreateArchitectureProfileFromArkConfigOptions as C, DomainEvent as D, EventMetadata as E, IntentName as I, PolicyViolation as P, ArchitectureLayerConfig as a, ArchitectureProfile as b, ArchitectureRule as c, ArkCheckConfig as d, CreateArchitectureProfileOptions as e, CreateElevenLayerArkConfigOptions as f, PolicySeverity as g, PolicyEnforcementMode as h, Policy as i, IntentCreator as j, IntentRelationship as k, CorrelationId as l, IntentRelationshipKind as m };