@nac3/forge-cli 1.21.3 → 1.23.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.
- package/dist/chat/bridge.d.ts +43 -1
- package/dist/chat/bridge.d.ts.map +1 -1
- package/dist/chat/bridge.js +176 -31
- package/dist/chat/bridge.js.map +1 -1
- package/dist/chat/bridge_inbox.d.ts +143 -0
- package/dist/chat/bridge_inbox.d.ts.map +1 -0
- package/dist/chat/bridge_inbox.js +219 -0
- package/dist/chat/bridge_inbox.js.map +1 -0
- package/dist/chat/claude.d.ts +10 -0
- package/dist/chat/claude.d.ts.map +1 -1
- package/dist/chat/claude.js.map +1 -1
- package/dist/chat/panel.d.ts.map +1 -1
- package/dist/chat/panel.js +148 -16
- package/dist/chat/panel.js.map +1 -1
- package/dist/chat/recent_sessions_recap.d.ts.map +1 -1
- package/dist/chat/recent_sessions_recap.js +18 -6
- package/dist/chat/recent_sessions_recap.js.map +1 -1
- package/dist/chat/server.d.ts +1 -1
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +346 -53
- package/dist/chat/server.js.map +1 -1
- package/dist/chat/tools/bridge_verbs.d.ts +10 -0
- package/dist/chat/tools/bridge_verbs.d.ts.map +1 -1
- package/dist/chat/tools/bridge_verbs.js +66 -3
- package/dist/chat/tools/bridge_verbs.js.map +1 -1
- package/dist/chat/tools/nac3_invoke.d.ts.map +1 -1
- package/dist/chat/tools/nac3_invoke.js +20 -3
- package/dist/chat/tools/nac3_invoke.js.map +1 -1
- package/dist/chat/tools/pending.d.ts.map +1 -1
- package/dist/chat/tools/pending.js +27 -4
- package/dist/chat/tools/pending.js.map +1 -1
- package/dist/chat/tools/urazuke.d.ts.map +1 -1
- package/dist/chat/tools/urazuke.js +7 -3
- package/dist/chat/tools/urazuke.js.map +1 -1
- package/dist/chat/tools.d.ts +6 -0
- package/dist/chat/tools.d.ts.map +1 -1
- package/dist/chat/tools.js +4 -0
- package/dist/chat/tools.js.map +1 -1
- package/dist/chat/turn_control.d.ts +2 -0
- package/dist/chat/turn_control.d.ts.map +1 -1
- package/dist/chat/turn_control.js +30 -1
- package/dist/chat/turn_control.js.map +1 -1
- package/dist/commands/pending.d.ts.map +1 -1
- package/dist/commands/pending.js +4 -2
- package/dist/commands/pending.js.map +1 -1
- package/dist/commands/urazuke.d.ts.map +1 -1
- package/dist/commands/urazuke.js +206 -16
- package/dist/commands/urazuke.js.map +1 -1
- package/dist/core/cost_router.d.ts +7 -0
- package/dist/core/cost_router.d.ts.map +1 -1
- package/dist/core/cost_router.js +8 -5
- package/dist/core/cost_router.js.map +1 -1
- package/dist/core/limits_config.d.ts +37 -6
- package/dist/core/limits_config.d.ts.map +1 -1
- package/dist/core/limits_config.js +74 -8
- package/dist/core/limits_config.js.map +1 -1
- package/dist/core/whats_new.d.ts.map +1 -1
- package/dist/core/whats_new.js +12 -0
- package/dist/core/whats_new.js.map +1 -1
- package/dist/nac3/danger_zone.d.ts +39 -0
- package/dist/nac3/danger_zone.d.ts.map +1 -0
- package/dist/nac3/danger_zone.js +31 -0
- package/dist/nac3/danger_zone.js.map +1 -0
- package/dist/nac3/internal_manifest.d.ts.map +1 -1
- package/dist/nac3/internal_manifest.js +33 -0
- package/dist/nac3/internal_manifest.js.map +1 -1
- package/dist/pending/store.d.ts +7 -0
- package/dist/pending/store.d.ts.map +1 -1
- package/dist/pending/store.js +41 -0
- package/dist/pending/store.js.map +1 -1
- package/dist/urazuke/catalog.d.ts +1 -1
- package/dist/urazuke/catalog.d.ts.map +1 -1
- package/dist/urazuke/catalog.js.map +1 -1
- package/dist/urazuke/current.d.ts +2 -2
- package/dist/urazuke/current.d.ts.map +1 -1
- package/dist/urazuke/current.js +32 -12
- package/dist/urazuke/current.js.map +1 -1
- package/dist/urazuke/gate.d.ts +45 -7
- package/dist/urazuke/gate.d.ts.map +1 -1
- package/dist/urazuke/gate.js +190 -20
- package/dist/urazuke/gate.js.map +1 -1
- package/dist/urazuke/gates_data.d.ts +170 -0
- package/dist/urazuke/gates_data.d.ts.map +1 -1
- package/dist/urazuke/gates_data.js +98 -5
- package/dist/urazuke/gates_data.js.map +1 -1
- package/dist/urazuke/gates_ledger.d.ts +75 -0
- package/dist/urazuke/gates_ledger.d.ts.map +1 -0
- package/dist/urazuke/gates_ledger.js +183 -0
- package/dist/urazuke/gates_ledger.js.map +1 -0
- package/dist/urazuke/gates_pull.d.ts +97 -0
- package/dist/urazuke/gates_pull.d.ts.map +1 -0
- package/dist/urazuke/gates_pull.js +303 -0
- package/dist/urazuke/gates_pull.js.map +1 -0
- package/dist/urazuke/heuristics.d.ts +108 -0
- package/dist/urazuke/heuristics.d.ts.map +1 -0
- package/dist/urazuke/heuristics.js +248 -0
- package/dist/urazuke/heuristics.js.map +1 -0
- package/dist/urazuke/manual_cases.d.ts +31 -0
- package/dist/urazuke/manual_cases.d.ts.map +1 -0
- package/dist/urazuke/manual_cases.js +87 -0
- package/dist/urazuke/manual_cases.js.map +1 -0
- package/dist/urazuke/project_config.d.ts +25 -0
- package/dist/urazuke/project_config.d.ts.map +1 -0
- package/dist/urazuke/project_config.js +65 -0
- package/dist/urazuke/project_config.js.map +1 -0
- package/dist/urazuke/quality.d.ts +0 -8
- package/dist/urazuke/quality.d.ts.map +1 -1
- package/dist/urazuke/quality.js +4 -29
- package/dist/urazuke/quality.js.map +1 -1
- package/dist/urazuke/retro.d.ts.map +1 -1
- package/dist/urazuke/retro.js +4 -1
- package/dist/urazuke/retro.js.map +1 -1
- package/dist/urazuke/scoreboard.d.ts +85 -0
- package/dist/urazuke/scoreboard.d.ts.map +1 -0
- package/dist/urazuke/scoreboard.js +260 -0
- package/dist/urazuke/scoreboard.js.map +1 -0
- package/dist/urazuke/section.d.ts +2 -2
- package/dist/urazuke/section.d.ts.map +1 -1
- package/dist/urazuke/section.js +31 -6
- package/dist/urazuke/section.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workflow/orchestrator.d.ts +9 -0
- package/dist/workflow/orchestrator.d.ts.map +1 -1
- package/dist/workflow/orchestrator.js +17 -16
- package/dist/workflow/orchestrator.js.map +1 -1
- package/package.json +1 -1
- package/src/i18n/catalogs/ar.json +558 -550
- package/src/i18n/catalogs/de.json +558 -550
- package/src/i18n/catalogs/en.json +558 -550
- package/src/i18n/catalogs/es.json +558 -550
- package/src/i18n/catalogs/fr.json +558 -550
- package/src/i18n/catalogs/hi.json +558 -550
- package/src/i18n/catalogs/it.json +558 -550
- package/src/i18n/catalogs/ja.json +558 -550
- package/src/i18n/catalogs/pt.json +558 -550
- package/src/i18n/catalogs/zh.json +558 -550
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BRINGING THE PUBLISHED DEFINITION -- the explicit act, with its number
|
|
3
|
+
* (PND-210, the double lock of PND-165 Pieza 4).
|
|
4
|
+
*
|
|
5
|
+
* `fetchPublishedGates` has been able to download, validate and recompute
|
|
6
|
+
* the seal since 2026-10-23, and until today nothing called it. That is the
|
|
7
|
+
* defect this module closes: a reader with no caller is a capability on
|
|
8
|
+
* paper, and meanwhile every project was measured by the catalogue compiled
|
|
9
|
+
* into Forge while `yf urazuke gates show` reported the frozen one.
|
|
10
|
+
*
|
|
11
|
+
* Two operations, and the asymmetry between them is the point:
|
|
12
|
+
*
|
|
13
|
+
* previewPublishedGates READ ONLY. Downloads, verifies the seal, contrasts
|
|
14
|
+
* the version against the append-only ledger, and
|
|
15
|
+
* MEASURES the cost: which steps that are green
|
|
16
|
+
* today would stop being green, and which required
|
|
17
|
+
* evaluators this installation cannot measure. It
|
|
18
|
+
* measures by evaluating both definitions over the
|
|
19
|
+
* real project; it does not estimate.
|
|
20
|
+
*
|
|
21
|
+
* adoptPublishedGates WRITES the freeze, and only with the owner's
|
|
22
|
+
* written reason. The reason is the second half of
|
|
23
|
+
* the double lock: a project starts and finishes on
|
|
24
|
+
* the same version of the method, so replacing that
|
|
25
|
+
* version is a decision with an author, not a
|
|
26
|
+
* refresh. A copy whose hash the ledger records
|
|
27
|
+
* with another value is NEVER adopted, reason or no
|
|
28
|
+
* reason -- it is not what the method published.
|
|
29
|
+
*
|
|
30
|
+
* Why adopting today is reported as not adoptable: the published catalogue
|
|
31
|
+
* declares twelve evaluators, this Forge implements eight, and the four
|
|
32
|
+
* missing ones are REQUIRED on the five anchors of the construction loop
|
|
33
|
+
* (steps 5, 8, 9, 10, 12). Adopting it before those exist freezes five
|
|
34
|
+
* permanently unmeasurable steps into the project -- correct by the
|
|
35
|
+
* compatibility clause, useless in practice. The preview says so with the
|
|
36
|
+
* numbers instead of refusing silently, and the owner can still press
|
|
37
|
+
* through with a written reason.
|
|
38
|
+
*
|
|
39
|
+
* ASCII-only.
|
|
40
|
+
*/
|
|
41
|
+
import fs from 'node:fs/promises';
|
|
42
|
+
import { fetchPublishedGates, publishedToResolved, resolveGates, writeFrozenGates, readFrozenGates, frozenGatesPath, verifyContentHash, } from './gates_data.js';
|
|
43
|
+
import { verifyAgainstLedger } from './gates_ledger.js';
|
|
44
|
+
import { evaluateLadder, implementsEvaluator, KNOWN_EVALUATORS, } from './gate.js';
|
|
45
|
+
function unmeasurableOf(steps, required) {
|
|
46
|
+
const out = [];
|
|
47
|
+
for (const s of steps) {
|
|
48
|
+
const names = s.evaluators
|
|
49
|
+
.filter((e) => e.required === required && !implementsEvaluator(e.name))
|
|
50
|
+
.map((e) => e.name);
|
|
51
|
+
if (names.length)
|
|
52
|
+
out.push({ step: s.num, id: s.id, title: s.title, evaluators: names });
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
/** The requirement-bearing key of one artifact rule: the path AND what the
|
|
57
|
+
* file has to say. Prose (label) is out: a wording fix is not a change of
|
|
58
|
+
* rule (D-051). */
|
|
59
|
+
function requirementKey(a) {
|
|
60
|
+
return a.path + '|' + (a.must_contain ? [...a.must_contain].join(',') : '');
|
|
61
|
+
}
|
|
62
|
+
function requirementKeys(g) {
|
|
63
|
+
const m = new Map();
|
|
64
|
+
for (const s of g.steps)
|
|
65
|
+
m.set(s.num, new Set(s.artifacts.map(requirementKey)));
|
|
66
|
+
return m;
|
|
67
|
+
}
|
|
68
|
+
/** What it would cost to adopt the published definition. Reads only. */
|
|
69
|
+
export async function previewPublishedGates(projectRoot, opts = {}) {
|
|
70
|
+
const current = await resolveGates(projectRoot);
|
|
71
|
+
const base = {
|
|
72
|
+
ok: false,
|
|
73
|
+
problems: [],
|
|
74
|
+
from: {
|
|
75
|
+
source: current.source,
|
|
76
|
+
version: current.version,
|
|
77
|
+
hash: current.hash,
|
|
78
|
+
method_declared: current.method_identity.declared,
|
|
79
|
+
},
|
|
80
|
+
unmeasurable_required: [],
|
|
81
|
+
unmeasurable_warning: [],
|
|
82
|
+
new_requirements: [],
|
|
83
|
+
would_turn: [],
|
|
84
|
+
adoptable: false,
|
|
85
|
+
why_not: [],
|
|
86
|
+
};
|
|
87
|
+
const v = await fetchPublishedGates({
|
|
88
|
+
...(opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
|
|
89
|
+
...(opts.url ? { url: opts.url } : {}),
|
|
90
|
+
...(opts.timeout_ms != null ? { timeout_ms: opts.timeout_ms } : {}),
|
|
91
|
+
});
|
|
92
|
+
if (!v.ok || !v.file || !v.hash) {
|
|
93
|
+
return { ...base, problems: v.problems, why_not: ['la definicion publicada no se pudo validar'] };
|
|
94
|
+
}
|
|
95
|
+
const file = v.file;
|
|
96
|
+
const candidate = publishedToResolved(file, 'portal', v.hash.recomputed);
|
|
97
|
+
const ledger = opts.skip_ledger ? undefined : await verifyAgainstLedger(file, {
|
|
98
|
+
...(opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
|
|
99
|
+
...(opts.timeout_ms != null ? { timeout_ms: opts.timeout_ms } : {}),
|
|
100
|
+
});
|
|
101
|
+
const unmeasurable_required = unmeasurableOf(candidate.steps, true);
|
|
102
|
+
const unmeasurable_warning = unmeasurableOf(candidate.steps, false);
|
|
103
|
+
const before = requirementKeys(current);
|
|
104
|
+
const new_requirements = [];
|
|
105
|
+
for (const s of candidate.steps) {
|
|
106
|
+
const had = before.get(s.num) ?? new Set();
|
|
107
|
+
for (const a of s.artifacts) {
|
|
108
|
+
if (had.has(requirementKey(a)))
|
|
109
|
+
continue;
|
|
110
|
+
new_requirements.push({
|
|
111
|
+
step: s.num, path: a.path,
|
|
112
|
+
...(a.must_contain?.length ? { must_contain: [...a.must_contain] } : {}),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/* The number, measured: evaluate the ladder twice over the same project,
|
|
117
|
+
* once with each definition. No estimating what can be run. */
|
|
118
|
+
const probes = opts.probes;
|
|
119
|
+
const nowLadder = await evaluateLadder({ projectRoot, ...(probes ? { probes } : {}), gates: current });
|
|
120
|
+
const thenLadder = await evaluateLadder({ projectRoot, ...(probes ? { probes } : {}), gates: candidate });
|
|
121
|
+
const byNum = new Map(nowLadder.map((r) => [r.num, r]));
|
|
122
|
+
const would_turn = [];
|
|
123
|
+
for (const after of thenLadder) {
|
|
124
|
+
const now = byNum.get(after.num);
|
|
125
|
+
if (!now)
|
|
126
|
+
continue;
|
|
127
|
+
if (now.status !== after.status) {
|
|
128
|
+
would_turn.push({ num: after.num, title: after.title, before: now.status, after: after.status });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const why_not = [];
|
|
132
|
+
if (unmeasurable_required.length) {
|
|
133
|
+
why_not.push(unmeasurable_required.length + ' peldano(s) quedarian con un evaluador requerido que esta'
|
|
134
|
+
+ ' instalacion no sabe medir (' + [...new Set(unmeasurable_required.flatMap((u) => u.evaluators))].join(', ')
|
|
135
|
+
+ '): declarados y no medidos, el peldano no avanza. Implementados hoy: ' + KNOWN_EVALUATORS.join(', ') + '.');
|
|
136
|
+
}
|
|
137
|
+
if (ledger && ledger.status === 'mismatch') {
|
|
138
|
+
why_not.push('el registro de versiones anota otra huella para ' + ledger.catalog_version
|
|
139
|
+
+ ': lo que bajo no es lo que el metodo publico con ese numero.');
|
|
140
|
+
}
|
|
141
|
+
if (ledger && ledger.status === 'could_not_verify') {
|
|
142
|
+
why_not.push('no pude contrastar la version contra el registro append-only: ' + ledger.detail);
|
|
143
|
+
}
|
|
144
|
+
if (ledger && ledger.status === 'absent') {
|
|
145
|
+
why_not.push('el registro de versiones no anota ' + ledger.catalog_version + '.');
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
...base,
|
|
149
|
+
ok: true,
|
|
150
|
+
to: { version: candidate.version, hash: candidate.hash, schema_version: candidate.schema_version },
|
|
151
|
+
...(ledger ? { ledger } : {}),
|
|
152
|
+
unmeasurable_required,
|
|
153
|
+
unmeasurable_warning,
|
|
154
|
+
new_requirements,
|
|
155
|
+
would_turn,
|
|
156
|
+
adoptable: why_not.length === 0,
|
|
157
|
+
why_not,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const MIN_REASON = 15;
|
|
161
|
+
/** Adopt the published definition into the project freeze. The double lock:
|
|
162
|
+
* a validated file, a ledger that does not contradict it, and the owner's
|
|
163
|
+
* written reason. */
|
|
164
|
+
export async function adoptPublishedGates(projectRoot, opts) {
|
|
165
|
+
const out = { written: false, problems: [], path: frozenGatesPath(projectRoot) };
|
|
166
|
+
const reason = (opts.reason ?? '').trim();
|
|
167
|
+
if (reason.length < MIN_REASON) {
|
|
168
|
+
out.problems.push('falta la razon escrita del dueno (minimo ' + MIN_REASON + ' caracteres).'
|
|
169
|
+
+ ' Un proyecto arranca y termina con la misma version del metodo: cambiarla es una decision'
|
|
170
|
+
+ ' con autor, y queda escrita en el congelado.');
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
173
|
+
const existing = await readFrozenGates(projectRoot);
|
|
174
|
+
if ((existing.gates || existing.refused?.length) && !opts.replace) {
|
|
175
|
+
out.problems.push('este proyecto ya tiene una version congelada'
|
|
176
|
+
+ (existing.gates ? ' (' + existing.gates.version + ')' : ' que NO verifica')
|
|
177
|
+
+ ' y no la piso sin que me lo pidas expresamente.');
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
const preview = await previewPublishedGates(projectRoot, opts);
|
|
181
|
+
out.preview = preview;
|
|
182
|
+
if (!preview.ok || !preview.to) {
|
|
183
|
+
out.problems.push(...preview.problems);
|
|
184
|
+
return out;
|
|
185
|
+
}
|
|
186
|
+
if (preview.ledger?.status === 'mismatch') {
|
|
187
|
+
out.problems.push('no adopto una copia que el registro de versiones contradice: ' + preview.ledger.detail);
|
|
188
|
+
return out;
|
|
189
|
+
}
|
|
190
|
+
const v = await fetchPublishedGates({
|
|
191
|
+
...(opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
|
|
192
|
+
...(opts.url ? { url: opts.url } : {}),
|
|
193
|
+
...(opts.timeout_ms != null ? { timeout_ms: opts.timeout_ms } : {}),
|
|
194
|
+
});
|
|
195
|
+
if (!v.ok || !v.file || !v.hash) {
|
|
196
|
+
out.problems.push(...v.problems);
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
/* The file is written VERBATIM: its seal is the method's hash over the
|
|
200
|
+
* method's covered keys, and re-serialising the payload would be the one
|
|
201
|
+
* way to turn a verified copy into an unverifiable one. The provenance of
|
|
202
|
+
* the freeze goes in keys the seal excludes -- they are not protected, and
|
|
203
|
+
* they do not need to be: what IS protected is the pair version + hash,
|
|
204
|
+
* and that is what the ledger audits. */
|
|
205
|
+
const file = v.file;
|
|
206
|
+
file['frozen_at'] = new Date().toISOString();
|
|
207
|
+
file['frozen_from'] = 'portal';
|
|
208
|
+
file['frozen_reason'] = reason;
|
|
209
|
+
if (preview.ledger) {
|
|
210
|
+
file['frozen_ledger'] = {
|
|
211
|
+
status: preview.ledger.status,
|
|
212
|
+
ledger_url: preview.ledger.ledger_url,
|
|
213
|
+
expected: preview.ledger.expected ?? null,
|
|
214
|
+
checked_at: new Date().toISOString(),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
file['method_identity'] = {
|
|
218
|
+
declared: true,
|
|
219
|
+
catalog_version: v.file.catalog_version,
|
|
220
|
+
content_hash: v.hash.recomputed,
|
|
221
|
+
...(preview.ledger ? { why: 'contrastada contra el registro de versiones: ' + preview.ledger.status } : {}),
|
|
222
|
+
};
|
|
223
|
+
for (const k of ['frozen_at', 'frozen_from', 'frozen_reason', 'frozen_ledger', 'method_identity']) {
|
|
224
|
+
if (!file.content_hash.covers.includes(k) && !file.content_hash.excludes.includes(k)) {
|
|
225
|
+
file.content_hash.excludes.push(k);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/* Last gate before writing: the copy about to be frozen has to verify by
|
|
229
|
+
* the same path that will read it back. */
|
|
230
|
+
const check = verifyContentHash(file);
|
|
231
|
+
if (!check.ok) {
|
|
232
|
+
out.problems.push('la copia que iba a congelar no verifica por el mismo camino que la lee:'
|
|
233
|
+
+ ' declarada ' + check.declared.slice(0, 16) + ', recalculada ' + check.recomputed.slice(0, 16)
|
|
234
|
+
+ (check.uncovered.length ? ', claves sin proteger ni excluir: ' + check.uncovered.join(', ') : ''));
|
|
235
|
+
return out;
|
|
236
|
+
}
|
|
237
|
+
await writeFrozenGates(projectRoot, file);
|
|
238
|
+
out.written = true;
|
|
239
|
+
out.version = v.file.catalog_version;
|
|
240
|
+
return out;
|
|
241
|
+
}
|
|
242
|
+
/** The preview as lines for the CLI and the panel. */
|
|
243
|
+
export function renderPullPreview(p) {
|
|
244
|
+
const lines = [];
|
|
245
|
+
if (!p.ok) {
|
|
246
|
+
lines.push('no pude traer la definicion publicada: ' + p.problems.join('; '));
|
|
247
|
+
return lines;
|
|
248
|
+
}
|
|
249
|
+
lines.push('en vigor: ' + p.from.version + ' [' + p.from.source + '] hash ' + p.from.hash.slice(0, 12)
|
|
250
|
+
+ (p.from.method_declared ? '' : ' -- NO declara una version del metodo'));
|
|
251
|
+
lines.push('publicada: ' + p.to.version + ' schema ' + p.to.schema_version + ' hash ' + p.to.hash.slice(0, 12));
|
|
252
|
+
if (p.ledger)
|
|
253
|
+
lines.push('registro de versiones: ' + p.ledger.status + ' -- ' + p.ledger.detail);
|
|
254
|
+
else
|
|
255
|
+
lines.push('registro de versiones: no consultado (--skip-ledger)');
|
|
256
|
+
for (const u of p.unmeasurable_required) {
|
|
257
|
+
lines.push('peldano ' + u.step + ' ' + u.title + ': requiere ' + u.evaluators.join(', ')
|
|
258
|
+
+ ' -- declarado y NO medido por esta instalacion');
|
|
259
|
+
}
|
|
260
|
+
if (p.new_requirements.length) {
|
|
261
|
+
lines.push('artefactos nuevos: ' + p.new_requirements.length + ' ('
|
|
262
|
+
+ p.new_requirements.slice(0, 6).map((r) => r.step + ':' + r.path).join(', ')
|
|
263
|
+
+ (p.new_requirements.length > 6 ? ', ...' : '') + ')');
|
|
264
|
+
}
|
|
265
|
+
lines.push(p.would_turn.length
|
|
266
|
+
? 'cambiarian de estado ' + p.would_turn.length + ' peldano(s): '
|
|
267
|
+
+ p.would_turn.map((w) => w.num + ' ' + w.before + '->' + w.after).join(', ')
|
|
268
|
+
: 'ningun peldano cambia de estado hoy (medido sobre este proyecto)');
|
|
269
|
+
lines.push(p.adoptable
|
|
270
|
+
? 'adoptable: si -- yf urazuke gates adopt --reason "..."'
|
|
271
|
+
: 'adoptable: NO -- ' + p.why_not.join(' | '));
|
|
272
|
+
return lines;
|
|
273
|
+
}
|
|
274
|
+
/** Does the project have a freeze on disk at all? Used by the CLI to tell
|
|
275
|
+
* "no freeze" apart from "a freeze that does not verify". */
|
|
276
|
+
export async function frozenExists(projectRoot) {
|
|
277
|
+
try {
|
|
278
|
+
await fs.stat(frozenGatesPath(projectRoot));
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/** The frozen copy as the PAYLOAD on disk, for an audit that needs the file
|
|
286
|
+
* and not the resolved shape (the ledger contrast recomputes the hash over
|
|
287
|
+
* the covered keys, so it needs them verbatim).
|
|
288
|
+
*
|
|
289
|
+
* Returned even when the seal does not recompute: in that case the ledger
|
|
290
|
+
* contrast is exactly what the owner needs to see, and refusing to hand the
|
|
291
|
+
* payload over would hide it. */
|
|
292
|
+
export async function readFrozenRaw(projectRoot) {
|
|
293
|
+
try {
|
|
294
|
+
const raw = JSON.parse(await fs.readFile(frozenGatesPath(projectRoot), 'utf8'));
|
|
295
|
+
if (typeof raw?.catalog_version !== 'string' || !Array.isArray(raw?.content_hash?.covers))
|
|
296
|
+
return undefined;
|
|
297
|
+
return raw;
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=gates_pull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gates_pull.js","sourceRoot":"","sources":["../../src/urazuke/gates_pull.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EACL,mBAAmB,EAAE,mBAAmB,EAAE,YAAY,EAAE,gBAAgB,EACxE,eAAe,EAAE,eAAe,EAAE,iBAAiB,GAEpD,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAsB,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,GAEtD,MAAM,WAAW,CAAC;AA6CnB,SAAS,cAAc,CAAC,KAAyB,EAAE,QAAiB;IAClE,MAAM,GAAG,GAAuB,EAAE,CAAC;IACnC,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,CAAC,CAAC,UAAU;aACvB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aACtE,GAAG,CAAC,CAAC,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QACpB,CAAC,CAAC,wDAAwD;QAC1D,CAAC,CAAC,mBAAmB,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;8DAC8D;AAC9D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,WAAmB;IACpD,IAAI,CAAC;QAAC,MAAM,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;AAC3F,CAAC;AAED;;;;;;kCAMkC;AAClC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAmB;IACrD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,CAAuB,CAAC;QACtG,IAAI,OAAO,GAAG,EAAE,eAAe,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC;YAAE,OAAO,SAAS,CAAC;QAC5G,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type ManualCaseLedger } from './manual_cases.js';
|
|
2
|
+
export * from './scoreboard.js';
|
|
3
|
+
export type Severity = 'blocks' | 'warns' | 'records';
|
|
4
|
+
export type RuleState = 'active' | 'switched_off' | 'group_off' | 'out_of_scope';
|
|
5
|
+
export type CheckerSource = 'adapter' | 'owner' | 'project' | 'not_published';
|
|
6
|
+
export interface SwitchOffRecord {
|
|
7
|
+
rule: string;
|
|
8
|
+
reason: string;
|
|
9
|
+
authorized_by: string;
|
|
10
|
+
review_date: string;
|
|
11
|
+
}
|
|
12
|
+
/** A group switch: `true`, or an off record without the `rule` field (the
|
|
13
|
+
* group name is the key). */
|
|
14
|
+
export type GroupSwitch = true | {
|
|
15
|
+
on: false;
|
|
16
|
+
reason?: string;
|
|
17
|
+
authorized_by?: string;
|
|
18
|
+
review_date?: string;
|
|
19
|
+
};
|
|
20
|
+
/** The per-project declarations, with the method's own field names. */
|
|
21
|
+
export interface ProjectSettings {
|
|
22
|
+
frontend?: string;
|
|
23
|
+
real_users?: boolean;
|
|
24
|
+
switches?: Record<string, GroupSwitch>;
|
|
25
|
+
switched_off?: unknown[];
|
|
26
|
+
thresholds?: Record<string, unknown>;
|
|
27
|
+
tools?: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
export interface ResolvedRule {
|
|
30
|
+
id: string;
|
|
31
|
+
group: string;
|
|
32
|
+
family: string;
|
|
33
|
+
instrument: string[];
|
|
34
|
+
severity: Severity;
|
|
35
|
+
/** Where the severity came from. `catalog` is the normal answer; the
|
|
36
|
+
* point of recording it is that a hardcoded one would have to say so. */
|
|
37
|
+
severity_source: 'catalog' | 'escalated';
|
|
38
|
+
state: RuleState;
|
|
39
|
+
human_red: boolean;
|
|
40
|
+
/** Counted in the compliance percentage. False for the rules the method
|
|
41
|
+
* puts outside it (`human_outside_the_percentage`) and for anything a
|
|
42
|
+
* person judges. */
|
|
43
|
+
in_percentage: boolean;
|
|
44
|
+
/** Measured green. `false` covers both "measured and failing" and "not
|
|
45
|
+
* measured", which `measured` tells apart. */
|
|
46
|
+
passing: boolean;
|
|
47
|
+
measured: boolean;
|
|
48
|
+
/** Who declares what measures this rule, and whether it is reachable. */
|
|
49
|
+
checker: CheckerSource;
|
|
50
|
+
record?: SwitchOffRecord;
|
|
51
|
+
/** Why it is not active, in one phrase, for the report. */
|
|
52
|
+
why?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ThresholdView {
|
|
55
|
+
id: string;
|
|
56
|
+
rule: string;
|
|
57
|
+
value: number | string | null;
|
|
58
|
+
declared: boolean;
|
|
59
|
+
source: 'annex' | 'project' | 'undeclared';
|
|
60
|
+
}
|
|
61
|
+
export interface RulesetValidity {
|
|
62
|
+
ok: boolean;
|
|
63
|
+
/** Everything worth saying about the declaration, invalidating or not. */
|
|
64
|
+
problems: string[];
|
|
65
|
+
/** The subset that makes the ruleset INVALID (a switch-off with no
|
|
66
|
+
* record). Carried as its own list because classifying it by matching
|
|
67
|
+
* the prose was a regex over a translatable string: the day the message
|
|
68
|
+
* changes language the gate silently stops emitting figures, or starts. */
|
|
69
|
+
invalidating: string[];
|
|
70
|
+
}
|
|
71
|
+
export interface Ruleset {
|
|
72
|
+
catalog_version: string;
|
|
73
|
+
adapter: string | null;
|
|
74
|
+
tools: Record<string, string>;
|
|
75
|
+
real_users: boolean;
|
|
76
|
+
rules: ResolvedRule[];
|
|
77
|
+
thresholds: ThresholdView[];
|
|
78
|
+
group_off: string[];
|
|
79
|
+
validity: RulesetValidity;
|
|
80
|
+
/** Things the gate has to say out loud rather than fold into a colour. */
|
|
81
|
+
could_not_verify: string[];
|
|
82
|
+
/** The human verdicts on record. Carried here so the scoreboard stays a
|
|
83
|
+
* pure function of the ruleset. */
|
|
84
|
+
manual_cases: ManualCaseLedger;
|
|
85
|
+
}
|
|
86
|
+
export interface ResolveRulesetOptions {
|
|
87
|
+
projectRoot: string;
|
|
88
|
+
/** The definition in force, as `resolveGates` returns it or as the
|
|
89
|
+
* published file. Both carry `heuristics` and `adapters`. */
|
|
90
|
+
gates: {
|
|
91
|
+
catalog_version?: string;
|
|
92
|
+
version?: string;
|
|
93
|
+
heuristics?: unknown;
|
|
94
|
+
adapters?: unknown;
|
|
95
|
+
};
|
|
96
|
+
settings?: ProjectSettings;
|
|
97
|
+
}
|
|
98
|
+
export declare function projectSettingsPath(root: string): string;
|
|
99
|
+
export declare function readProjectSettings(root: string): Promise<ProjectSettings | undefined>;
|
|
100
|
+
/** A switch-off record, or the list of what is missing from it. The method
|
|
101
|
+
* is explicit that an incomplete record is not a lenient switch-off: it is
|
|
102
|
+
* red, and it makes the whole ruleset invalid (D-046, D-047). */
|
|
103
|
+
export declare function switchOffProblems(entry: unknown, index: number): {
|
|
104
|
+
rule?: string;
|
|
105
|
+
problems: string[];
|
|
106
|
+
};
|
|
107
|
+
export declare function resolveRuleset(opts: ResolveRulesetOptions): Promise<Ruleset>;
|
|
108
|
+
//# sourceMappingURL=heuristics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heuristics.d.ts","sourceRoot":"","sources":["../../src/urazuke/heuristics.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,cAAc,iBAAiB,CAAC;AAEhC,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,cAAc,CAAC;AACjF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,eAAe,CAAC;AAE9E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;8BAC8B;AAC9B,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9G,uEAAuE;AACvE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,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