arkgate 4.8.2 → 4.8.4
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 +257 -3
- package/README.md +47 -9
- package/bin/ark-check-runtime.mjs +340 -5
- package/bin/ark-layer-match.mjs +170 -13
- package/bin/ark-mcp-runtime.mjs +9 -2
- package/bin/lib/analysis-completeness.mjs +86 -0
- package/bin/lib/analysis-engine.mjs +6 -6
- package/bin/lib/architecture-scan.mjs +2 -0
- package/bin/lib/ark-order-facts.mjs +59 -0
- package/bin/lib/ark-order-sensors.mjs +31 -2
- package/bin/lib/arkrule-file-hints.mjs +6 -2
- package/bin/lib/arkrules-contract.mjs +9 -1
- package/bin/lib/arkrules-sensors.mjs +22 -2
- package/bin/lib/check-args.mjs +66 -0
- package/bin/lib/config-contract.mjs +26 -0
- package/bin/lib/config-extras.mjs +2 -0
- package/bin/lib/design-smells.mjs +85 -0
- package/bin/lib/diagnostic-catalog.mjs +8 -2
- package/bin/lib/first-run-help.mjs +12 -0
- package/bin/lib/invariant-coverage-io.mjs +175 -19
- package/bin/lib/invariant-coverage.mjs +110 -7
- package/bin/lib/literal-path-drift-io.mjs +569 -0
- package/bin/lib/literal-path-drift.mjs +761 -0
- package/bin/lib/policy-delta-io.mjs +5 -0
- package/bin/lib/remediation.mjs +24 -1
- package/bin/lib/resolved-candidate-facts.mjs +31 -0
- package/bin/lib/rules-under-contract.mjs +5 -0
- package/bin/lib/scan-files.mjs +54 -0
- package/bin/lib/sensor-promote-cli.mjs +372 -0
- package/bin/lib/sensor-promote-io.mjs +246 -0
- package/bin/lib/sensor-promotion.mjs +363 -0
- package/dist/{configTypes-BdCe_gvv.d.ts → configTypes-dy5PfTqS.d.ts} +36 -0
- package/dist/{diagnosticCatalog-CPzH-MLN.d.ts → diagnosticCatalog-DgTs0abp.d.ts} +169 -11
- package/dist/eslint/index.cjs +5 -5
- package/dist/eslint/index.d.ts +34 -1
- package/dist/eslint/index.js +5 -5
- package/dist/index.cjs +31 -31
- package/dist/index.d.ts +85 -7
- package/dist/index.js +31 -31
- package/dist/nestjs/index.cjs +5 -5
- package/dist/nestjs/index.d.ts +3 -3
- package/dist/nestjs/index.js +5 -5
- package/dist/runtime/index.cjs +13 -13
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.js +13 -13
- package/dist/{types-DCSlrRnV.d.ts → types-BuM8WNqe.d.ts} +1 -1
- package/dist/{types-C9KApBzX.d.ts → types-D95drJ3_.d.ts} +1 -1
- package/docs/README.md +4 -4
- package/docs/agent-guide.md +182 -0
- package/docs/configuration.md +89 -9
- package/docs/develop.md +24 -2
- package/docs/diagnostics.md +79 -1
- package/docs/enthusiast/README.md +6 -4
- package/docs/package-surface.md +36 -4
- package/docs/product-voice.md +15 -5
- package/docs/use.md +8 -5
- package/package.json +2 -2
- package/schemas/ark.arkrules.schema.json +1 -0
- package/schemas/ark.config.schema.json +72 -0
- package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
- package/server.json +3 -3
- package/templates/agent-skills/README.md +1 -1
- package/templates/agent-skills/ark-adopt/SKILL.md +13 -3
- package/templates/agent-skills/ark-autopilot/SKILL.md +1 -1
- package/templates/agent-skills/ark-contract/SKILL.md +4 -0
- package/templates/agent-skills/ark-coverage/SKILL.md +1 -0
- package/templates/agent-skills/ark-place/SKILL.md +6 -2
- package/templates/arkrules/ApplicationOrchestration.json +6 -0
- package/templates/skills/ark-adopt.md +13 -3
- package/templates/skills/ark-autopilot.md +1 -1
- package/templates/skills/ark-contract.md +4 -0
- package/templates/skills/ark-coverage.md +1 -0
- package/templates/skills/ark-place.md +6 -2
|
@@ -26,3 +26,89 @@ export function analysisIncompleteStatement(completeness) {
|
|
|
26
26
|
? 'Analysis incomplete: governed parse diagnostics prevent a complete architecture verdict.'
|
|
27
27
|
: 'Analysis unavailable: no API-compatible TypeScript host could produce architecture evidence.';
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
/** Public diagnostic id for a verdict asked to certify an empty file set. */
|
|
31
|
+
export const EMPTY_ANALYSIS_RULE_ID = 'ANALYSIS_COVERS_NO_FILES';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Refuse a verdict over zero governed files when the tree has source to govern.
|
|
35
|
+
*
|
|
36
|
+
* Every rule is vacuously satisfied on an empty set, so a green here certifies
|
|
37
|
+
* nothing while reading exactly like a green over a governed tree. That is a
|
|
38
|
+
* false green — the one failure mode CI trusts.
|
|
39
|
+
*
|
|
40
|
+
* The refusal separates ArkGate's own limitation from a fact about the repo, the
|
|
41
|
+
* same way the coverage budget does. Two states are a mismatch and refuse:
|
|
42
|
+
*
|
|
43
|
+
* - source exists under the analyzed root and the contract governs none of it —
|
|
44
|
+
* the contract does not describe this tree;
|
|
45
|
+
* - the analyzed root is not the root the caller asked for, because the contract
|
|
46
|
+
* was found outside it and its directory was adopted — ArkGate checked a
|
|
47
|
+
* different tree and found nothing in it.
|
|
48
|
+
*
|
|
49
|
+
* No governable source anywhere under the root, on the root the caller asked
|
|
50
|
+
* for, is a genuinely greenfield repo: `--init` is designed to land a contract
|
|
51
|
+
* before the code arrives, that is not a mismatch to refuse, and `--plan` /
|
|
52
|
+
* `--doctor` already carry the `empty-scope` adoption gap for it.
|
|
53
|
+
*
|
|
54
|
+
* Report modes (`--plan`, `--doctor`, `--coverage`) are how a user diagnoses and
|
|
55
|
+
* fixes an empty scope, so callers must not apply this refusal to them. It
|
|
56
|
+
* belongs to the verdict path. (`--adopt-contract` and `--suggest-include` never
|
|
57
|
+
* reach it: their handlers return earlier.)
|
|
58
|
+
*
|
|
59
|
+
* `ungovernedSourceCount` must come from a probe the contract cannot steer — see
|
|
60
|
+
* `countUngovernedSourceFiles` in scan-files.mjs. Feeding it a count that honours
|
|
61
|
+
* `config.exclude` reopens the false green through `exclude: ["**"]`.
|
|
62
|
+
*
|
|
63
|
+
* @param {{
|
|
64
|
+
* governedFileCount?: number,
|
|
65
|
+
* ungovernedSourceCount?: number,
|
|
66
|
+
* ungovernedSourceCap?: number,
|
|
67
|
+
* root?: string,
|
|
68
|
+
* requestedRoot?: string,
|
|
69
|
+
* configPath?: string,
|
|
70
|
+
* configWalkedUp?: boolean,
|
|
71
|
+
* }} [input]
|
|
72
|
+
* @returns {{ ruleId: string, message: string, nextAction: string } | null}
|
|
73
|
+
*/
|
|
74
|
+
export function emptyAnalysisRefusal(input = {}) {
|
|
75
|
+
const count = Number(input.governedFileCount);
|
|
76
|
+
if (!Number.isFinite(count) || count !== 0) return null;
|
|
77
|
+
|
|
78
|
+
const ungoverned = Math.max(0, Number(input.ungovernedSourceCount) || 0);
|
|
79
|
+
const cap = Math.max(0, Number(input.ungovernedSourceCap) || 0);
|
|
80
|
+
const root = String(input.root ?? '');
|
|
81
|
+
const configPath = String(input.configPath ?? '');
|
|
82
|
+
const requestedRoot = String(input.requestedRoot ?? '');
|
|
83
|
+
const movedRoot =
|
|
84
|
+
input.configWalkedUp === true && requestedRoot.length > 0 && requestedRoot !== root;
|
|
85
|
+
|
|
86
|
+
// Greenfield on the root the caller asked for: nothing to govern, nothing to mistake.
|
|
87
|
+
if (ungoverned === 0 && !movedRoot) return null;
|
|
88
|
+
|
|
89
|
+
// The probe stops at a cap, so say "at least N" rather than claim a census it never took.
|
|
90
|
+
const counted = cap > 0 && ungoverned >= cap ? `at least ${ungoverned}` : `${ungoverned}`;
|
|
91
|
+
|
|
92
|
+
const evidence = movedRoot
|
|
93
|
+
? `${counted} source file(s) exist under ${root}, which is not the ${requestedRoot} this ` +
|
|
94
|
+
`run was asked for — the contract at ${configPath} lives outside it`
|
|
95
|
+
: `${counted} source file(s) exist under ${root} and none of them matched the include and ` +
|
|
96
|
+
`layer patterns in ${configPath}`;
|
|
97
|
+
|
|
98
|
+
const message =
|
|
99
|
+
`Analysis covered 0 files: ${evidence}. Every rule is vacuously satisfied on an empty set, ` +
|
|
100
|
+
'so a pass here would certify nothing.';
|
|
101
|
+
|
|
102
|
+
const scopeHint = movedRoot
|
|
103
|
+
? `This run analyzed ${root}, not the ${requestedRoot} you asked for: the contract at ` +
|
|
104
|
+
`${configPath} lives outside ${requestedRoot}, and ark-check adopted the directory holding ` +
|
|
105
|
+
'it as the project root. Pass a contract inside the tree you want checked.'
|
|
106
|
+
: `Point --root at the tree the contract describes (this run analyzed ${root}), or fix the ` +
|
|
107
|
+
`include / exclude / layer patterns in ${configPath} so they match real files.`;
|
|
108
|
+
|
|
109
|
+
const nextAction =
|
|
110
|
+
`${scopeHint} \`npx arkgate-check --root . --plan\` and \`--coverage\` report the empty scope ` +
|
|
111
|
+
'without refusing, and `--adopt-contract --write` proposes an include that matches this tree.';
|
|
112
|
+
|
|
113
|
+
return { ruleId: EMPTY_ANALYSIS_RULE_ID, message, nextAction };
|
|
114
|
+
}
|