arkgate 4.8.14 → 4.8.16

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 (103) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/README.md +17 -7
  3. package/bin/ark-check-runtime.mjs +17 -49
  4. package/bin/ark-mcp-runtime.mjs +111 -2
  5. package/bin/ark-shared.mjs +142 -11
  6. package/bin/ark.mjs +24 -33
  7. package/bin/lib/adr-presence.mjs +97 -0
  8. package/bin/lib/agent-skills-package.mjs +179 -1
  9. package/bin/lib/analysis-completeness.mjs +38 -2
  10. package/bin/lib/analysis-engine.mjs +6 -6
  11. package/bin/lib/architecture-scan.mjs +43 -4
  12. package/bin/lib/ark-run-doctor.mjs +6 -0
  13. package/bin/lib/ark-run-report.mjs +6 -2
  14. package/bin/lib/arkrules-sensors.mjs +81 -0
  15. package/bin/lib/baseline-key.mjs +6 -1
  16. package/bin/lib/check-args.mjs +52 -2
  17. package/bin/lib/config-contract.mjs +65 -2
  18. package/bin/lib/diagnostic-catalog.mjs +5 -1
  19. package/bin/lib/doctor-advisories.mjs +120 -10
  20. package/bin/lib/doctor-green-cite.mjs +139 -0
  21. package/bin/lib/doctor-human.mjs +115 -67
  22. package/bin/lib/doctor-next-actions.mjs +23 -0
  23. package/bin/lib/doctor-plan.mjs +35 -2
  24. package/bin/lib/enforcement-honesty.mjs +47 -2
  25. package/bin/lib/field-install.mjs +47 -7
  26. package/bin/lib/first-run-help.mjs +9 -1
  27. package/bin/lib/host-support-matrix.mjs +9 -1
  28. package/bin/lib/html-report-depth.mjs +2 -0
  29. package/bin/lib/html-report.mjs +13 -2
  30. package/bin/lib/import-resolve.mjs +74 -13
  31. package/bin/lib/improvement-compass-doctor.mjs +8 -1
  32. package/bin/lib/improvement-compass-map.mjs +5 -1
  33. package/bin/lib/invariant-coverage.mjs +121 -0
  34. package/bin/lib/invariant-tests-path.mjs +212 -0
  35. package/bin/lib/layer-description.mjs +90 -8
  36. package/bin/lib/mcp-hook-payload.mjs +56 -0
  37. package/bin/lib/no-domain-frontend.mjs +91 -0
  38. package/bin/lib/package-manager.mjs +8 -0
  39. package/bin/lib/presets.mjs +3 -4
  40. package/bin/lib/product-copy.mjs +15 -0
  41. package/bin/lib/projected-governed-coverage.mjs +114 -0
  42. package/bin/lib/prototype-shortcuts.mjs +224 -0
  43. package/bin/lib/recommend-cli.mjs +54 -0
  44. package/bin/lib/remediation.mjs +15 -0
  45. package/bin/lib/resolved-candidate-facts.mjs +83 -66
  46. package/bin/lib/rules-under-contract.mjs +117 -2
  47. package/bin/lib/snippet-analysis.mjs +14 -8
  48. package/bin/lib/start-preview.mjs +24 -2
  49. package/bin/lib/states-transitions-presence.mjs +212 -0
  50. package/bin/lib/status-command.mjs +2 -0
  51. package/bin/lib/status-transition-catalog.mjs +410 -0
  52. package/bin/lib/team-parliament-io.mjs +10 -0
  53. package/bin/lib/violations.mjs +13 -1
  54. package/bin/lib/write-path-capabilities.mjs +20 -5
  55. package/bin/lib/write-path-detect.mjs +27 -2
  56. package/dist/{configTypes-j7so8B4O.d.ts → configTypes-VD0qcubY.d.ts} +21 -1
  57. package/dist/{diagnosticCatalog-DVx_2RmF.d.ts → diagnosticCatalog-KWvGLI1U.d.ts} +24 -3
  58. package/dist/eslint/index.cjs +4 -4
  59. package/dist/eslint/index.d.ts +1 -1
  60. package/dist/eslint/index.js +4 -4
  61. package/dist/index.cjs +34 -34
  62. package/dist/index.d.ts +71 -10
  63. package/dist/index.js +34 -34
  64. package/dist/nestjs/index.cjs +5 -5
  65. package/dist/nestjs/index.d.ts +3 -3
  66. package/dist/nestjs/index.js +5 -5
  67. package/dist/runtime/index.cjs +15 -15
  68. package/dist/runtime/index.d.ts +6 -6
  69. package/dist/runtime/index.js +15 -15
  70. package/dist/{types-tGhZUiGX.d.ts → types-BSzRy2X1.d.ts} +1 -1
  71. package/dist/{types-Djbs3KjE.d.ts → types-D5GT5ZT8.d.ts} +3 -1
  72. package/docs/README.md +1 -1
  73. package/docs/agent-guide.md +8 -4
  74. package/docs/ai-gates.md +10 -3
  75. package/docs/brownfield-adoption.md +4 -1
  76. package/docs/configuration.md +66 -10
  77. package/docs/develop.md +4 -1
  78. package/docs/diagnostics.md +48 -4
  79. package/docs/enthusiast/how-to-agent-gates.md +5 -0
  80. package/docs/enthusiast/how-to-pick-shape.md +1 -1
  81. package/docs/package-surface.md +7 -5
  82. package/docs/use.md +10 -3
  83. package/package.json +1 -1
  84. package/schemas/ark.config.schema.json +24 -3
  85. package/server.json +2 -2
  86. package/templates/agent-skills/README.md +1 -1
  87. package/templates/agent-skills/ark-adopt/SKILL.md +97 -1
  88. package/templates/agent-skills/ark-autopilot/SKILL.md +12 -3
  89. package/templates/agent-skills/ark-coverage/SKILL.md +2 -2
  90. package/templates/agent-skills/ark-explain/SKILL.md +6 -3
  91. package/templates/agent-skills/ark-explore/SKILL.md +33 -1
  92. package/templates/agent-skills/ark-place/SKILL.md +42 -3
  93. package/templates/agent-skills/ark-runtime/SKILL.md +4 -2
  94. package/templates/agent-skills/ark-upgrade/SKILL.md +1 -1
  95. package/templates/arkrules/DomainModel.json +14 -1
  96. package/templates/skills/ark-adopt.md +97 -1
  97. package/templates/skills/ark-autopilot.md +12 -3
  98. package/templates/skills/ark-coverage.md +2 -2
  99. package/templates/skills/ark-explain.md +6 -3
  100. package/templates/skills/ark-explore.md +33 -1
  101. package/templates/skills/ark-place.md +42 -3
  102. package/templates/skills/ark-runtime.md +4 -2
  103. package/templates/skills/ark-upgrade.md +1 -1
@@ -60,8 +60,15 @@ export const EMPTY_ANALYSIS_RULE_ID = 'ANALYSIS_COVERS_NO_FILES';
60
60
  * `countUngovernedSourceFiles` in scan-files.mjs. Feeding it a count that honours
61
61
  * `config.exclude` reopens the false green through `exclude: ["**"]`.
62
62
  *
63
+ * `classifiedFileCount` is optional. When omitted, included files are treated as
64
+ * classified (the historical meaning of `governedFileCount`). When provided and
65
+ * zero while include still matched files, this is the same vacuous green: import
66
+ * rules cannot run on unclassified source. Omit the count when `layers` is empty
67
+ * so `CONFIG_NO_LAYERS` stays the next step. Partial unclassified stays a warning.
68
+ *
63
69
  * @param {{
64
70
  * governedFileCount?: number,
71
+ * classifiedFileCount?: number,
65
72
  * ungovernedSourceCount?: number,
66
73
  * ungovernedSourceCap?: number,
67
74
  * root?: string,
@@ -72,8 +79,29 @@ export const EMPTY_ANALYSIS_RULE_ID = 'ANALYSIS_COVERS_NO_FILES';
72
79
  * @returns {{ ruleId: string, message: string, nextAction: string } | null}
73
80
  */
74
81
  export function emptyAnalysisRefusal(input = {}) {
75
- const count = Number(input.governedFileCount);
76
- if (!Number.isFinite(count) || count !== 0) return null;
82
+ const included = Number(input.governedFileCount);
83
+ if (!Number.isFinite(included)) return null;
84
+
85
+ const classifiedRaw = input.classifiedFileCount;
86
+ const classifiedProvided =
87
+ classifiedRaw !== undefined && classifiedRaw !== null && Number.isFinite(Number(classifiedRaw));
88
+ const classified = classifiedProvided ? Number(classifiedRaw) : included;
89
+
90
+ if (included > 0 && classified === 0) {
91
+ const root = String(input.root ?? '');
92
+ const configPath = String(input.configPath ?? '');
93
+ const message =
94
+ `Analysis covered 0 files: ${included} included file(s) exist under ${root} but none ` +
95
+ `matched a layer pattern in ${configPath}. Every rule is vacuously satisfied on an empty ` +
96
+ 'set, so a pass here would certify nothing.';
97
+ const nextAction =
98
+ `Extend layer patterns or narrow include in ${configPath} so every included file has a ` +
99
+ 'layer. `npx arkgate-check --root . --coverage` lists unclassified files, and `/ark-place` ' +
100
+ 'picks a folder. `--plan` and `--doctor` report this without refusing.';
101
+ return { ruleId: EMPTY_ANALYSIS_RULE_ID, message, nextAction };
102
+ }
103
+
104
+ if (included !== 0) return null;
77
105
 
78
106
  const ungoverned = Math.max(0, Number(input.ungovernedSourceCount) || 0);
79
107
  const cap = Math.max(0, Number(input.ungovernedSourceCap) || 0);
@@ -112,3 +140,11 @@ export function emptyAnalysisRefusal(input = {}) {
112
140
 
113
141
  return { ruleId: EMPTY_ANALYSIS_RULE_ID, message, nextAction };
114
142
  }
143
+
144
+ /** Path-only classified count. `undefined` when no layers — caller keeps the include-only meaning. */
145
+ export function classifiedCountFromFiles(files, layers, layerForFile, root) {
146
+ if (!Array.isArray(layers) || layers.length === 0 || typeof layerForFile !== 'function') {
147
+ return undefined;
148
+ }
149
+ return files.filter((abs) => layerForFile(root, abs, layers)).length;
150
+ }