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.
Files changed (77) hide show
  1. package/CHANGELOG.md +76 -1145
  2. package/README.md +59 -19
  3. package/bin/ark-check-runtime.mjs +1598 -0
  4. package/bin/ark-check.mjs +32 -1565
  5. package/bin/ark-mcp-runtime.mjs +1976 -0
  6. package/bin/ark-mcp.mjs +84 -1495
  7. package/bin/ark-shared.mjs +34 -38
  8. package/bin/ark.mjs +33 -66
  9. package/bin/lib/adapter-contract.mjs +161 -9
  10. package/bin/lib/agent-gates.mjs +1 -0
  11. package/bin/lib/analysis-completeness.mjs +28 -0
  12. package/bin/lib/analysis-engine.mjs +8 -8
  13. package/bin/lib/analysis-policy.mjs +27 -0
  14. package/bin/lib/architecture-scan.mjs +70 -357
  15. package/bin/lib/auto-patch.mjs +76 -8
  16. package/bin/lib/ci-and-commands.mjs +1 -1
  17. package/bin/lib/codex-home.mjs +43 -16
  18. package/bin/lib/design-delta.mjs +4 -0
  19. package/bin/lib/doctor-advisories.mjs +4 -3
  20. package/bin/lib/doctor-plan.mjs +40 -41
  21. package/bin/lib/enforcement-state.mjs +2 -0
  22. package/bin/lib/github-enforcement.mjs +443 -0
  23. package/bin/lib/hook-templates.mjs +12 -148
  24. package/bin/lib/html-report-advisories.mjs +1 -1
  25. package/bin/lib/html-report-depth.mjs +9 -0
  26. package/bin/lib/html-report.mjs +5 -5
  27. package/bin/lib/install-migrate.mjs +83 -79
  28. package/bin/lib/managed-upgrade.mjs +622 -0
  29. package/bin/lib/mcp-adoption.mjs +3 -1
  30. package/bin/lib/parse-health.mjs +6 -5
  31. package/bin/lib/port-proof.mjs +2 -2
  32. package/bin/lib/prepare-change.mjs +68 -38
  33. package/bin/lib/prepare-write.mjs +7 -1
  34. package/bin/lib/resident-doctor-client.mjs +55 -0
  35. package/bin/lib/resident-hook.mjs +247 -0
  36. package/bin/lib/resolved-candidate-facts.mjs +1160 -0
  37. package/bin/lib/scan-files.mjs +19 -6
  38. package/bin/lib/snippet-analysis.mjs +119 -0
  39. package/bin/lib/source-policy.mjs +24 -0
  40. package/bin/lib/typescript-host.mjs +15 -18
  41. package/bin/lib/unavailable-analysis.mjs +76 -0
  42. package/bin/lib/upgrade-command.mjs +115 -0
  43. package/bin/lib/weakest-link.mjs +21 -179
  44. package/bin/lib/write-path-capabilities.mjs +167 -16
  45. package/bin/lib/write-path-detect.mjs +3 -2
  46. package/dist/eslint/index.cjs +3 -3
  47. package/dist/eslint/index.d.ts +3 -0
  48. package/dist/eslint/index.js +3 -3
  49. package/dist/index.cjs +7 -7
  50. package/dist/index.d.ts +1073 -141
  51. package/dist/index.js +7 -7
  52. package/docs/agent-guide.md +103 -59
  53. package/docs/ai-gates.md +97 -16
  54. package/docs/demos/01-write-gate-self-correction.md +2 -2
  55. package/docs/enthusiast/README.md +10 -10
  56. package/docs/enthusiast/how-to-gallery-starter.md +2 -2
  57. package/docs/enthusiast/reference-commands.md +18 -1
  58. package/docs/enthusiast/tutorial-first-project.md +2 -2
  59. package/docs/package-surface.md +98 -12
  60. package/docs/typescript-support.md +109 -37
  61. package/package.json +32 -4
  62. package/schemas/ark.analysis-result.schema.json +159 -2
  63. package/schemas/ark.design-delta.schema.json +1 -0
  64. package/schemas/ark.enforcement-state.schema.json +84 -0
  65. package/schemas/ark.resolved-candidate-facts.schema.json +1 -0
  66. package/server.json +2 -2
  67. package/templates/skills/ark-explore.md +5 -5
  68. package/templates/skills/ark-fix.md +1 -1
  69. package/templates/skills/ark-runtime.md +15 -8
  70. package/templates/skills/ark-upgrade.md +122 -182
  71. package/bin/lib/ai-velocity.mjs +0 -293
  72. package/bin/lib/graph-cycles.mjs +0 -6
  73. package/bin/lib/safety-diagnostics.mjs +0 -284
  74. package/bin/lib/ts-resolve.mjs +0 -228
  75. package/dist/configTypes-DAPvBqK6.d.cts +0 -61
  76. package/dist/eslint/index.d.cts +0 -146
  77. package/dist/index.d.cts +0 -986
@@ -1,146 +0,0 @@
1
- import { A as ArkConfig } from '../configTypes-DAPvBqK6.cjs';
2
-
3
- /**
4
- * Pure layer-glob matching for ark.config.json.
5
- *
6
- * **Canonical algorithm** for CLI, ESLint, and library consumers.
7
- * The CLI load path uses the generated `bin/ark-layer-match.mjs`
8
- * (`npm run generate:layer-match` / `npm run check:layer-match`).
9
- * Behavioral parity tests remain a safety net.
10
- */
11
- type LayerConfig = {
12
- name: string;
13
- patterns?: string[];
14
- exclude?: string[];
15
- forbiddenGlobals?: string[];
16
- };
17
- /**
18
- * Layer-to-layer dependency rule from ark.config.json.
19
- *
20
- * - Classic: `{ from, to, allowed: false }` denies **cross-layer** edges only.
21
- * Same-layer is always allowed without peerIsolation (historical short-circuit).
22
- * - `peerIsolation: true` + `allowed: false`: deny only when slice ids differ
23
- * (same **or** cross layer). Same-slice → allow. Needs fromPath/toPath; missing
24
- * paths/slices → fail-open.
25
- */
26
- type EdgeRule = {
27
- from: string;
28
- to: string;
29
- allowed?: boolean;
30
- /**
31
- * When true with `allowed: false`: deny only when importer and importee resolve
32
- * to different slice ids (parent/name, e.g. features/auth). Works same-layer
33
- * and cross-layer. See findDeniedEdgeRule.
34
- */
35
- peerIsolation?: boolean;
36
- /**
37
- * Path segment names that own the slice id as the *next* segment
38
- * (e.g. `["features"]` → `src/features/auth/...` has slice `auth`).
39
- * When omitted, inferred from the layer's glob patterns (segment before `**`/`*`).
40
- */
41
- sliceFolders?: string[];
42
- /** Optional override message for scanners / write-gate. */
43
- message?: string;
44
- };
45
- /** Options for path-aware edge checks (peer isolation). */
46
- type EdgeCheckOptions = {
47
- /** Repo-relative path of the importing file. */
48
- fromPath?: string;
49
- /** Repo-relative path of the imported module. */
50
- toPath?: string;
51
- /** Layer configs — used to infer sliceFolders when the rule omits them. */
52
- layers?: LayerConfig[];
53
- };
54
- declare function globToRegExp(pattern: string): RegExp;
55
- declare function patternSpecificity(pattern: string): number;
56
- declare function layerForRelativePath(relPath: string, layers: LayerConfig[] | undefined): string | undefined;
57
- declare function isEdgeDenied(rules: EdgeRule[] | undefined, from: string, to: string, options?: EdgeCheckOptions): boolean;
58
-
59
- type RuleContext = {
60
- report(descriptor: Record<string, unknown>): void;
61
- /** ESLint 9+ / 10: preferred path on the context object. */
62
- filename?: string;
63
- /** ESLint 8-style physical path when linting with processors / virtual files. */
64
- physicalFilename?: string;
65
- /** ESLint ≤8 API — still present on some hosts; removed in ESLint 10. */
66
- getFilename?: () => string;
67
- /** ESLint 9+ source/scope API. */
68
- sourceCode?: SourceCode;
69
- /** ESLint ≤8 source/scope API. */
70
- getSourceCode?: () => SourceCode;
71
- options?: unknown[];
72
- };
73
- type ScopeVariable = {
74
- defs?: unknown[];
75
- };
76
- type ScopeReference = {
77
- identifier?: AstNode;
78
- resolved?: ScopeVariable | null;
79
- isValueReference?: boolean;
80
- };
81
- type Scope = {
82
- set?: Map<string, ScopeVariable>;
83
- references?: ScopeReference[];
84
- upper?: Scope | null;
85
- };
86
- type SourceCode = {
87
- getScope?: (node: AstNode) => Scope;
88
- };
89
- type RuleListener = Record<string, (node: AstNode) => void>;
90
- type AstNode = {
91
- type?: string;
92
- name?: string;
93
- value?: unknown;
94
- source?: AstNode;
95
- callee?: AstNode;
96
- object?: AstNode;
97
- property?: AstNode;
98
- key?: AstNode;
99
- arguments?: AstNode[];
100
- properties?: AstNode[];
101
- importKind?: string;
102
- specifiers?: AstNode[];
103
- parent?: AstNode;
104
- init?: AstNode;
105
- computed?: boolean;
106
- loc?: {
107
- start?: {
108
- line?: number;
109
- column?: number;
110
- };
111
- };
112
- };
113
- type ArkRule = {
114
- meta: {
115
- type: 'problem';
116
- docs: {
117
- description: string;
118
- };
119
- messages: Record<string, string>;
120
- schema: unknown[];
121
- };
122
- create(context: RuleContext): RuleListener;
123
- };
124
- type ArkEslintPlugin = {
125
- rules: Record<string, ArkRule>;
126
- configs?: Record<string, unknown>;
127
- };
128
- declare function findConfigPath(startFile: string): string | null;
129
- declare function loadArkConfig(configPath: string): ArkConfig | null;
130
- /** Resolve relative import specifier to an absolute path candidate (TS-oriented). */
131
- declare function resolveRelativeImport(fromFile: string, specifier: string): string | null;
132
- /**
133
- * Config-driven layer import boundary (primary editor gate).
134
- * Replaces path-token domain/infra heuristics when ark.config.json is present.
135
- * Rule id kept as `no-domain-infra-imports` for recommended-config / upgrade stability.
136
- */
137
- declare const noDomainInfraImports: ArkRule;
138
- declare const noRawEventPublish: ArkRule;
139
- declare const requirePublishSource: ArkRule;
140
- declare const noForbiddenGlobals: ArkRule;
141
- declare const noDeniedCapabilities: ArkRule;
142
- declare const plugin: ArkEslintPlugin;
143
-
144
- // @ts-ignore
145
- export = plugin;
146
- export { findConfigPath, globToRegExp, isEdgeDenied, layerForRelativePath, loadArkConfig, noDeniedCapabilities, noDomainInfraImports, noForbiddenGlobals, noRawEventPublish, patternSpecificity, plugin, requirePublishSource, resolveRelativeImport };