@radicaltools/mcp 0.5.0 → 0.6.1
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/{chunk-ULUOEM3X.js → chunk-CKZSHFE5.js} +1 -1
- package/dist/{chunk-DSR2PAMW.js → chunk-H2EUPF2D.js} +1 -1
- package/dist/{dist-4NNGZXOU.js → dist-3IBN4PU7.js} +2 -2
- package/dist/{elkLayout-YXJWF5QP.js → elkLayout-7MVDIEFO.js} +2 -2
- package/dist/hub-catalogue/concern/concern-accessibility.radical +871 -0
- package/dist/hub-catalogue/concern/concern-ci-cd-pipeline.radical +975 -0
- package/dist/hub-catalogue/concern/concern-frontend-stack.radical +84 -311
- package/dist/hub-catalogue/concern/concern-mobile-performance.radical +710 -0
- package/dist/hub-catalogue/concern/concern-release-versioning.radical +294 -57
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +1 -1
- package/dist/hub-catalogue/concern/concern-usability.radical +1266 -0
- package/dist/index.js +335 -161
- package/dist/{pdfjs-7X3VKNRD.js → pdfjs-DDCLOUBH.js} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -83,13 +83,13 @@ import {
|
|
|
83
83
|
viewShowsEveryNode,
|
|
84
84
|
wikiDepthOf,
|
|
85
85
|
withCanvasPositions
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-H2EUPF2D.js";
|
|
87
87
|
import {
|
|
88
88
|
__commonJS,
|
|
89
89
|
__toESM,
|
|
90
90
|
define_RADICAL_BUILD_default,
|
|
91
91
|
init_define_RADICAL_BUILD
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-CKZSHFE5.js";
|
|
93
93
|
|
|
94
94
|
// ../../node_modules/webcola/dist/src/powergraph.js
|
|
95
95
|
var require_powergraph = __commonJS({
|
|
@@ -6848,8 +6848,8 @@ function buildAlignmentToolHandlers() {
|
|
|
6848
6848
|
if (input.nodeIds !== void 0 && (!Array.isArray(input.nodeIds) || input.nodeIds.some((id) => typeof id !== "string"))) return fail("remove_alignment: nodeIds must be an array of node ids");
|
|
6849
6849
|
const canvas2 = canvasFor(ctx, "remove_alignment", input.viewId, true);
|
|
6850
6850
|
if ("error" in canvas2) return fail(canvas2.error);
|
|
6851
|
-
const
|
|
6852
|
-
const matches = ctx.diagram.getLayoutConstraints(canvas2.viewId).filter((c) => (input.id === void 0 ? c.type !== "pin" : c.id === input.id) && (!
|
|
6851
|
+
const among2 = input.nodeIds ? new Set(input.nodeIds.map((id) => ctx.resolveId(id))) : null;
|
|
6852
|
+
const matches = ctx.diagram.getLayoutConstraints(canvas2.viewId).filter((c) => (input.id === void 0 ? c.type !== "pin" : c.id === input.id) && (!among2 || c.nodeIds.every((id) => among2.has(id))));
|
|
6853
6853
|
if (!matches.length) {
|
|
6854
6854
|
const existing = ctx.diagram.getLayoutConstraints(canvas2.viewId);
|
|
6855
6855
|
return fail(`remove_alignment: no such alignment on this canvas.${existing.length ? ` It has: ${existing.map(describeConstraint).join("; ")}.` : " It has none."}`);
|
|
@@ -11846,7 +11846,7 @@ init_define_RADICAL_BUILD();
|
|
|
11846
11846
|
|
|
11847
11847
|
// ../../packages/common/src/check/sensors.ts
|
|
11848
11848
|
init_define_RADICAL_BUILD();
|
|
11849
|
-
var SENSOR_NAMES = ["command", "json", "playwright"];
|
|
11849
|
+
var SENSOR_NAMES = ["command", "github-actions", "json", "lighthouse", "machine", "playwright"];
|
|
11850
11850
|
function commandWords(line) {
|
|
11851
11851
|
const words2 = [];
|
|
11852
11852
|
let word = "";
|
|
@@ -12640,6 +12640,7 @@ function parseMeasurementStore(text3) {
|
|
|
12640
12640
|
var TEST_LINE = /^test\((.+)\)(?:\s+passed)?$/;
|
|
12641
12641
|
var REVIEW_LINE = /^review\((.+)\)\s+passed$/i;
|
|
12642
12642
|
var REVIEW_METRIC = "review";
|
|
12643
|
+
var SCALED = /\s+scaled$/i;
|
|
12643
12644
|
var METRIC_LINE = /^([A-Za-z_][\w.:/-]*)\s*(?:\{([^}]*)\})?\s*(<=|>=|==|!=|=|<|>)\s*(-?\d+(?:\.\d+)?(?:e-?\d+)?)\s*(\S+)?$/i;
|
|
12644
12645
|
var BASELINE_LINE = /^([A-Za-z_][\w.:/-]*)\s*(?:\{([^}]*)\})?\s*(<=|>=|==|!=|=|<|>)\s*baseline(?:\s*([+-])\s*(\d+(?:\.\d+)?(?:e-?\d+)?)\s*(%|[^\s%]+)?)?$/i;
|
|
12645
12646
|
function parseLabels(text3) {
|
|
@@ -12668,11 +12669,14 @@ function parseCondition(line) {
|
|
|
12668
12669
|
const baseline = b[4] ? { sign: b[4] === "-" ? -1 : 1, by: Number(b[5]), percent: b[6] === "%", ...b[6] !== "%" ? { unit: b[6] } : {} } : { sign: 1, by: 0, percent: true };
|
|
12669
12670
|
return { kind: "metric", raw, metric: b[1], labels: labels2, op: b[3] === "=" ? "==" : b[3], value: Number.NaN, baseline };
|
|
12670
12671
|
}
|
|
12671
|
-
const
|
|
12672
|
-
|
|
12672
|
+
const scaled = SCALED.test(raw);
|
|
12673
|
+
const m = METRIC_LINE.exec(scaled ? raw.replace(SCALED, "") : raw);
|
|
12674
|
+
if (!m) return { kind: "invalid", raw, problem: "it is neither `test(<file> \u203A <title>) passed`, `review(<name>) passed`, `<metric>{<labels>} <op> <number> [unit] [scaled]` nor `<metric>{<labels>} <op> baseline [+|- <number> %|unit]`" };
|
|
12673
12675
|
const labels = m[2] === void 0 ? {} : parseLabels(m[2]);
|
|
12674
12676
|
if (typeof labels === "string") return { kind: "invalid", raw, problem: labels };
|
|
12675
|
-
|
|
12677
|
+
const op = m[3] === "=" ? "==" : m[3];
|
|
12678
|
+
if (scaled && (op === "==" || op === "!=")) return { kind: "invalid", raw, problem: "scaled stretches a limit: it takes <, <=, > or >=, not == or !=" };
|
|
12679
|
+
return { kind: "metric", raw, metric: m[1], labels, op, value: Number(m[4]), ...m[5] ? { unit: m[5] } : {}, ...scaled ? { scaled: true } : {} };
|
|
12676
12680
|
}
|
|
12677
12681
|
function parseConditions(text3) {
|
|
12678
12682
|
if (typeof text3 !== "string") return [];
|
|
@@ -12731,6 +12735,24 @@ function baselineOf(condition2, baseline, unit) {
|
|
|
12731
12735
|
return { median: values.length % 2 ? values[mid] : (values[mid - 1] + values[mid]) / 2, runs: values.length };
|
|
12732
12736
|
}
|
|
12733
12737
|
var round = (n) => Math.round(n * 100) / 100;
|
|
12738
|
+
var MACHINE_SPEED_METRIC = "machine.speed";
|
|
12739
|
+
function machineSpeedAt(measurements, at) {
|
|
12740
|
+
const t = Date.parse(at);
|
|
12741
|
+
let best;
|
|
12742
|
+
for (const m of measurements) {
|
|
12743
|
+
if (m.metric !== MACHINE_SPEED_METRIC || !Number.isFinite(m.value) || m.value <= 0) continue;
|
|
12744
|
+
if (!best || Math.abs(Date.parse(m.at) - t) < Math.abs(Date.parse(best.at) - t)) best = m;
|
|
12745
|
+
}
|
|
12746
|
+
return best;
|
|
12747
|
+
}
|
|
12748
|
+
function scaledLimit(condition2, speed) {
|
|
12749
|
+
const factor = Math.max(1, round(speed));
|
|
12750
|
+
const upper = condition2.op === "<" || condition2.op === "<=";
|
|
12751
|
+
const limit = upper ? condition2.value * factor : condition2.value / factor;
|
|
12752
|
+
const unit = condition2.unit ? ` ${condition2.unit}` : "";
|
|
12753
|
+
const text3 = `${condition2.value}${unit} ${upper ? "\xD7" : "\xF7"} ${factor} = ${round(limit)}${unit}${speed < 1 ? ` (machine.speed ${round(speed)}, never below \xD71)` : ""}`;
|
|
12754
|
+
return { limit, factor, text: text3 };
|
|
12755
|
+
}
|
|
12734
12756
|
function evaluateMetric(condition2, measurements, maxAge, now4, baseline = []) {
|
|
12735
12757
|
const measurement = latestMeasurement(condition2, measurements);
|
|
12736
12758
|
if (!measurement) return { outcome: "not-run" };
|
|
@@ -12758,6 +12780,12 @@ function evaluateMetric(condition2, measurements, maxAge, now4, baseline = []) {
|
|
|
12758
12780
|
value = converted;
|
|
12759
12781
|
}
|
|
12760
12782
|
if (maxAge !== void 0 && age > maxAge) return { outcome: "stale", measurement, detail: `measured ${formatAge(age)} ago` };
|
|
12783
|
+
if (condition2.scaled) {
|
|
12784
|
+
const machine = machineSpeedAt(measurements, measurement.at);
|
|
12785
|
+
if (!machine) return { outcome: "not-run", measurement, detail: `scaled to the machine, and no ${MACHINE_SPEED_METRIC} was measured: run radical sense machine where the value is measured` };
|
|
12786
|
+
const scaled = scaledLimit(condition2, machine.value);
|
|
12787
|
+
return { outcome: COMPARE[condition2.op](value, scaled.limit) ? "passed" : "failed", measurement, detail: `limit ${scaled.text}` };
|
|
12788
|
+
}
|
|
12761
12789
|
return { outcome: COMPARE[condition2.op](value, condition2.value) ? "passed" : "failed", measurement };
|
|
12762
12790
|
}
|
|
12763
12791
|
|
|
@@ -13217,6 +13245,10 @@ function concernStatuses(packs, nodes, relations) {
|
|
|
13217
13245
|
}
|
|
13218
13246
|
return out;
|
|
13219
13247
|
}
|
|
13248
|
+
function openConcerns(packs, nodes, relations, metamodel) {
|
|
13249
|
+
if (!holdsConcerns(metamodel)) return [];
|
|
13250
|
+
return concernStatuses(packs, nodes, relations).filter((s) => s.open.length);
|
|
13251
|
+
}
|
|
13220
13252
|
var prop = (node, key) => {
|
|
13221
13253
|
const value = node[key];
|
|
13222
13254
|
return typeof value === "string" ? value.trim() : "";
|
|
@@ -13809,7 +13841,8 @@ function testRule(outcome, message) {
|
|
|
13809
13841
|
if (!model.tests) return [];
|
|
13810
13842
|
return Object.values(model.nodes).filter((n) => TESTED_TYPES.includes(n.type)).flatMap((node) => testOutcomes(node, model).filter((o) => o.outcome === outcome).map((o) => {
|
|
13811
13843
|
const related = failing ? affectedBy(model, node).map((n) => n.id) : [];
|
|
13812
|
-
|
|
13844
|
+
const reason = outcome === "failed" ? findTests(o.id, model.tests ?? []).matches.find((c) => c.status === "failed" && c.message)?.message : void 0;
|
|
13845
|
+
return { nodeId: node.id, test: o.id.raw, message: message(node, o.id.raw, model), ...reason ? { reason } : {}, ...related.length ? { relatedIds: related } : {} };
|
|
13813
13846
|
}));
|
|
13814
13847
|
};
|
|
13815
13848
|
}
|
|
@@ -13832,6 +13865,9 @@ function metricRule(outcome, message) {
|
|
|
13832
13865
|
const origin = originOf(node);
|
|
13833
13866
|
return elements.flatMap((element) => elementConditions(node, model, element).filter((r) => r.outcome === outcome).map((r) => ({
|
|
13834
13867
|
nodeId: origin ? element.id : node.id,
|
|
13868
|
+
condition: r.condition,
|
|
13869
|
+
...r.measurement ? { measured: r.measurement } : {},
|
|
13870
|
+
...r.detail ? { why: r.detail } : {},
|
|
13835
13871
|
message: `${message(node, r.condition, seen(r), r.detail).replace(/\.$/, "")} for ${TYPE_NAME[element.type] ?? element.type} ${quote(element)}${origin ? ` (a fitness function of ${origin})` : ""}.`,
|
|
13836
13872
|
...origin ? { relatedIds: [node.id] } : outcome === "failed" ? { relatedIds: [element.id] } : {}
|
|
13837
13873
|
})));
|
|
@@ -13839,7 +13875,14 @@ function metricRule(outcome, message) {
|
|
|
13839
13875
|
const metricLines = new Set(conditionsOf(node).filter((c) => c.kind === "metric").map((c) => c.raw));
|
|
13840
13876
|
return conditionResults(node, model).filter((r) => r.outcome === outcome && metricLines.has(r.condition)).map((r) => {
|
|
13841
13877
|
const related = outcome === "failed" ? affectedBy(model, node).map((n) => n.id) : [];
|
|
13842
|
-
return {
|
|
13878
|
+
return {
|
|
13879
|
+
nodeId: node.id,
|
|
13880
|
+
condition: r.condition,
|
|
13881
|
+
...r.measurement ? { measured: r.measurement } : {},
|
|
13882
|
+
...r.detail ? { why: r.detail } : {},
|
|
13883
|
+
message: message(node, r.condition, seen(r), r.detail),
|
|
13884
|
+
...related.length ? { relatedIds: related } : {}
|
|
13885
|
+
};
|
|
13843
13886
|
});
|
|
13844
13887
|
});
|
|
13845
13888
|
};
|
|
@@ -14050,7 +14093,7 @@ var sourceReading = (text3) => reading(text3.replace(/(\d)_(?=\d)/g, "$1").repla
|
|
|
14050
14093
|
var CHECK_RULES = [
|
|
14051
14094
|
{
|
|
14052
14095
|
id: "metamodel",
|
|
14053
|
-
description: 'The model follows its metamodel
|
|
14096
|
+
description: '**The model follows its metamodel**: types, parents, relation pairs, required properties, references and the state machine rules. The Validation list in Studio and get_issues over MCP, with their severities: an unknown type or a relation to no element is an error, a relation pair the metamodel does not allow a warning (`"metamodel": "error"` makes every issue one).',
|
|
14054
14097
|
severity: "error",
|
|
14055
14098
|
dimension: "consistency",
|
|
14056
14099
|
run: (model) => validateModel(model.nodes, model.relations, model.metamodel).map((issue) => ({
|
|
@@ -14063,42 +14106,42 @@ var CHECK_RULES = [
|
|
|
14063
14106
|
},
|
|
14064
14107
|
{
|
|
14065
14108
|
id: "requirement-incomplete",
|
|
14066
|
-
description: "A requirement has an action and every field its EARS type reads (an event-driven one a trigger, a state-driven one a precondition, \u2026).",
|
|
14109
|
+
description: "**A requirement has an action and every field its EARS type reads** (an event-driven one a trigger, a state-driven one a precondition, \u2026).",
|
|
14067
14110
|
severity: "warning",
|
|
14068
14111
|
dimension: "completeness",
|
|
14069
14112
|
run: (model) => nodesOf(model, "requirement").filter((n) => !composeEarsSentence(n, void 0, requirementStatePhrase(n, model.nodes, model.relations)).complete).map((n) => ({ nodeId: n.id, message: `Requirement ${quote(n)} (${prop2(n, "ears_type") || "ubiquitous"}) misses the action or a field its EARS type needs.` }))
|
|
14070
14113
|
},
|
|
14071
14114
|
{
|
|
14072
14115
|
id: "requirement-without-scenario",
|
|
14073
|
-
description: "Every requirement is verified by at least one scenario
|
|
14116
|
+
description: "**Every requirement is verified by at least one scenario**.",
|
|
14074
14117
|
severity: "warning",
|
|
14075
14118
|
dimension: "traceability",
|
|
14076
14119
|
run: (model) => model.metamodel.nodeTypes.scenario ? unlinked(model, "requirement", "verifies", "in", ["scenario"]).map((n) => ({ nodeId: n.id, message: `No scenario verifies requirement ${quote(n)}.` })) : []
|
|
14077
14120
|
},
|
|
14078
14121
|
{
|
|
14079
14122
|
id: "requirement-unsatisfied",
|
|
14080
|
-
description: "Every requirement is satisfied by an element of the architecture
|
|
14123
|
+
description: "**Every requirement is satisfied by an element of the architecture**.",
|
|
14081
14124
|
severity: "warning",
|
|
14082
14125
|
dimension: "traceability",
|
|
14083
14126
|
run: (model) => unlinked(model, "requirement", "satisfies", "in").map((n) => ({ nodeId: n.id, message: `Nothing satisfies requirement ${quote(n)}.` }))
|
|
14084
14127
|
},
|
|
14085
14128
|
{
|
|
14086
14129
|
id: "requirement-without-origin",
|
|
14087
|
-
description: "Every requirement derives from a need or from another requirement
|
|
14130
|
+
description: "**Every requirement derives from a need or from another requirement**.",
|
|
14088
14131
|
severity: "warning",
|
|
14089
14132
|
dimension: "traceability",
|
|
14090
14133
|
run: (model) => unlinked(model, "requirement", "derives", "out", ["need", "requirement"]).map((n) => ({ nodeId: n.id, message: `Requirement ${quote(n)} derives from no need and no other requirement.` }))
|
|
14091
14134
|
},
|
|
14092
14135
|
{
|
|
14093
14136
|
id: "need-without-requirement",
|
|
14094
|
-
description: "Every need has at least one requirement derived from it
|
|
14137
|
+
description: "**Every need has at least one requirement derived from it**, or from a need inside it (a need that derives from it, Part of).",
|
|
14095
14138
|
severity: "warning",
|
|
14096
14139
|
dimension: "traceability",
|
|
14097
14140
|
run: (model) => unlinked(model, "need", "derives", "in", ["requirement"]).filter((n) => !requirementsOfNeed(model, n.id).length).map((n) => ({ nodeId: n.id, message: `No requirement derives from need ${quote(n)}.` }))
|
|
14098
14141
|
},
|
|
14099
14142
|
{
|
|
14100
14143
|
id: "derives-quote-missing",
|
|
14101
|
-
description: "A requirement's derives relation to a need quotes the words of the need it rests on (property quote, one verbatim fragment per line). Off unless check.json turns it on; the goal requirements-quoting-need follows it in percent.",
|
|
14144
|
+
description: "A requirement's derives relation to a need **quotes the words of the need it rests on** (property quote, one verbatim fragment per line). Off unless check.json turns it on; the goal requirements-quoting-need follows it in percent.",
|
|
14102
14145
|
severity: "warning",
|
|
14103
14146
|
off: true,
|
|
14104
14147
|
dimension: "traceability",
|
|
@@ -14106,7 +14149,7 @@ var CHECK_RULES = [
|
|
|
14106
14149
|
},
|
|
14107
14150
|
{
|
|
14108
14151
|
id: "derives-quote-not-in-need",
|
|
14109
|
-
description: "Every fragment a derives relation quotes is in the need's text outside its superseded answers, as whole words (case, white space, Markdown marks, dashes and quotation marks aside; an ellipsis joins pieces that must be there in that order, within one question, answer or the text before the questions), and holds at least two words; only a relation to a need quotes.",
|
|
14152
|
+
description: "**Every fragment a derives relation quotes is in the need's text** outside its superseded answers, as whole words (case, white space, Markdown marks, dashes and quotation marks aside; an ellipsis joins pieces that must be there in that order, within one question, answer or the text before the questions), and holds at least two words; only a relation to a need quotes.",
|
|
14110
14153
|
severity: "error",
|
|
14111
14154
|
dimension: "traceability",
|
|
14112
14155
|
run: (model) => Object.values(model.relations).filter((r) => r.relationType === "derives" && relationQuote(r).trim() && model.nodes[r.sourceId]?.type === "requirement" && !originOf(model.nodes[r.sourceId])).flatMap((r) => {
|
|
@@ -14121,7 +14164,7 @@ var CHECK_RULES = [
|
|
|
14121
14164
|
},
|
|
14122
14165
|
{
|
|
14123
14166
|
id: "quote-value-missing",
|
|
14124
|
-
description: "Every hard value a derives relation quotes (a number, null, true or false, a date or time, an identifier in backticks or quotation marks) is in the requirement's sentence
|
|
14167
|
+
description: "**Every hard value a derives relation quotes** (a number, null, true or false, a date or time, an identifier in backticks or quotation marks) **is in the requirement's sentence**, in that form or another (20 percent as 20%, 15 minutes as 900 seconds, 12.30 \u20AC as 1230 cents).",
|
|
14125
14168
|
severity: "warning",
|
|
14126
14169
|
dimension: "traceability",
|
|
14127
14170
|
run: (model) => nodesOf(model, "requirement").filter((n) => !originOf(n)).flatMap((req) => {
|
|
@@ -14132,14 +14175,14 @@ var CHECK_RULES = [
|
|
|
14132
14175
|
},
|
|
14133
14176
|
{
|
|
14134
14177
|
id: "quote-value-differs",
|
|
14135
|
-
description: "A requirement keeps the sense the words it quotes give a value
|
|
14178
|
+
description: "**A requirement keeps the sense the words it quotes give a value**: the same side of a limit (at most, more than, from \u2026 to; a refusal speaks of the other side), the same unit, the same order of a list, the same rounding.",
|
|
14136
14179
|
severity: "warning",
|
|
14137
14180
|
dimension: "traceability",
|
|
14138
14181
|
run: (model) => nodesOf(model, "requirement").filter((n) => !originOf(n)).flatMap((req) => quoteSenseGaps(model, req))
|
|
14139
14182
|
},
|
|
14140
14183
|
{
|
|
14141
14184
|
id: "requirement-value-unquoted",
|
|
14142
|
-
description: "Every hard value a requirement states that quotes its need is in those quotes (or in those of the requirements it derives from), in that form or another, or its rationale names it as a decision of the model.",
|
|
14185
|
+
description: "**Every hard value a requirement states that quotes its need is in those quotes** (or in those of the requirements it derives from), in that form or another, or its rationale names it as a decision of the model.",
|
|
14143
14186
|
severity: "warning",
|
|
14144
14187
|
dimension: "traceability",
|
|
14145
14188
|
run: (model) => nodesOf(model, "requirement").filter((n) => !originOf(n)).flatMap((req) => {
|
|
@@ -14149,7 +14192,7 @@ var CHECK_RULES = [
|
|
|
14149
14192
|
},
|
|
14150
14193
|
{
|
|
14151
14194
|
id: "scenario-value-missing",
|
|
14152
|
-
description: "Every hard value a requirement takes from the words it quotes is in a scenario that verifies it (its given, when, then or Gherkin text): what the person said reaches a check.",
|
|
14195
|
+
description: "**Every hard value a requirement takes from the words it quotes is in a scenario that verifies it** (its given, when, then or Gherkin text): what the person said reaches a check.",
|
|
14153
14196
|
severity: "warning",
|
|
14154
14197
|
dimension: "traceability",
|
|
14155
14198
|
run: (model) => nodesOf(model, "requirement").filter((n) => !originOf(n)).flatMap((req) => {
|
|
@@ -14166,7 +14209,7 @@ var CHECK_RULES = [
|
|
|
14166
14209
|
},
|
|
14167
14210
|
{
|
|
14168
14211
|
id: "example-not-in-scenario",
|
|
14169
|
-
description:
|
|
14212
|
+
description: `**Every example a need gives with values** ("for example", "e.g.", "Example:") **is whole in one scenario** of the requirements derived from the need: the person's own case checks what they meant.`,
|
|
14170
14213
|
severity: "warning",
|
|
14171
14214
|
dimension: "traceability",
|
|
14172
14215
|
run: (model) => nodesOf(model, "need").filter((n) => !originOf(n)).flatMap((need) => {
|
|
@@ -14184,7 +14227,7 @@ var CHECK_RULES = [
|
|
|
14184
14227
|
},
|
|
14185
14228
|
{
|
|
14186
14229
|
id: "scenario-value-untested",
|
|
14187
|
-
description: "With the test sources (radical check reads the files of the tests .radical/radical.json binds): every hard value a scenario names that tells a case apart (not a count below 10) is in the file of a test bound to it
|
|
14230
|
+
description: "With the test sources (radical check reads the files of the tests .radical/radical.json binds): **every hard value a scenario names that tells a case apart** (not a count below 10) **is in the file of a test bound to it**.",
|
|
14188
14231
|
severity: "warning",
|
|
14189
14232
|
dimension: "traceability",
|
|
14190
14233
|
run: (model) => {
|
|
@@ -14204,7 +14247,7 @@ var CHECK_RULES = [
|
|
|
14204
14247
|
},
|
|
14205
14248
|
{
|
|
14206
14249
|
id: "need-answer-unquoted",
|
|
14207
|
-
description: "Every paragraph and list item of an answer of a person in a need (from a line that starts with A:, Answer: or A1:, or an answer on its question's line; lead-ins and lines of fewer than four words aside) is quoted by a requirement that derives from the need
|
|
14250
|
+
description: "**Every paragraph and list item of an answer of a person in a need** (from a line that starts with A:, Answer: or A1:, or an answer on its question's line; lead-ins and lines of fewer than four words aside) **is quoted by a requirement that derives from the need**, or the answer is marked (no requirement) or (superseded).",
|
|
14208
14251
|
severity: "warning",
|
|
14209
14252
|
dimension: "traceability",
|
|
14210
14253
|
run: (model) => {
|
|
@@ -14222,7 +14265,7 @@ var CHECK_RULES = [
|
|
|
14222
14265
|
},
|
|
14223
14266
|
{
|
|
14224
14267
|
id: "need-answer-changed",
|
|
14225
|
-
description: "With the model at the base (radical check in git, the Inspector with the branch's base): every answer of a person a need held there it still holds, word for word
|
|
14268
|
+
description: "With the model at the base (radical check in git, the Inspector with the branch's base): **every answer of a person a need held there it still holds, word for word**; a person's words are only added to, and an answer a later one replaces is marked (superseded).",
|
|
14226
14269
|
severity: "error",
|
|
14227
14270
|
dimension: "traceability",
|
|
14228
14271
|
run: (model) => {
|
|
@@ -14236,21 +14279,21 @@ var CHECK_RULES = [
|
|
|
14236
14279
|
},
|
|
14237
14280
|
{
|
|
14238
14281
|
id: "scenario-verifies-nothing",
|
|
14239
|
-
description: "Every scenario verifies a requirement or a state machine
|
|
14282
|
+
description: "**Every scenario verifies a requirement or a state machine**.",
|
|
14240
14283
|
severity: "warning",
|
|
14241
14284
|
dimension: "traceability",
|
|
14242
14285
|
run: (model) => unlinked(model, "scenario", "verifies", "out").map((n) => ({ nodeId: n.id, message: `Scenario ${quote(n)} verifies no requirement and no state machine.` }))
|
|
14243
14286
|
},
|
|
14244
14287
|
{
|
|
14245
14288
|
id: "adr-without-fitness-fn",
|
|
14246
|
-
description: "Every accepted ADR is implemented by a fitness function that checks it.",
|
|
14289
|
+
description: "**Every accepted ADR is implemented by a fitness function** that checks it.",
|
|
14247
14290
|
severity: "warning",
|
|
14248
14291
|
dimension: "decisions",
|
|
14249
14292
|
run: (model) => model.metamodel.nodeTypes["fitness-fn"] ? unlinked(model, "adr", "implements", "in", ["fitness-fn"]).filter((n) => prop2(n, "status") === "accepted").filter((n) => !relationsOf(model, "waives").from.has(n.id)).map((n) => ({ nodeId: n.id, message: `No fitness function implements accepted ADR ${quote(n)}.` })) : []
|
|
14250
14293
|
},
|
|
14251
14294
|
{
|
|
14252
14295
|
id: "inherited-adr-unapplied",
|
|
14253
|
-
description: "Every accepted ADR of a model this one depends on (deps.json) binds it
|
|
14296
|
+
description: "**Every accepted ADR of a model this one depends on** (deps.json) **binds it**: it constrains at least one of this model's elements, or an accepted ADR of this model waives it and says why.",
|
|
14254
14297
|
severity: "error",
|
|
14255
14298
|
dimension: "decisions",
|
|
14256
14299
|
run: (model) => inheritedDecisions(model).filter((d) => !d.elements.length).map(({ adr, origin }) => ({
|
|
@@ -14260,7 +14303,7 @@ var CHECK_RULES = [
|
|
|
14260
14303
|
},
|
|
14261
14304
|
{
|
|
14262
14305
|
id: "inherited-adr-unchecked",
|
|
14263
|
-
description: "Every element an accepted ADR of a model this one depends on constrains is checked
|
|
14306
|
+
description: "**Every element an accepted ADR of a model this one depends on constrains is checked**: a fitness function implements the ADR (this model's or the other's) and names its check (metric conditions, or tests .radical/radical.json binds to it).",
|
|
14264
14307
|
severity: "error",
|
|
14265
14308
|
dimension: "decisions",
|
|
14266
14309
|
run: (model) => inheritedDecisions(model).flatMap(({ adr, origin, elements }) => {
|
|
@@ -14274,7 +14317,7 @@ var CHECK_RULES = [
|
|
|
14274
14317
|
},
|
|
14275
14318
|
{
|
|
14276
14319
|
id: "adr-incomplete",
|
|
14277
|
-
description: "An accepted ADR records its date, context, decision and consequences
|
|
14320
|
+
description: "**An accepted ADR records its date, context, decision and consequences**.",
|
|
14278
14321
|
severity: "warning",
|
|
14279
14322
|
dimension: "completeness",
|
|
14280
14323
|
run: (model) => nodesOf(model, "adr").filter((n) => prop2(n, "status") === "accepted").flatMap((n) => {
|
|
@@ -14284,7 +14327,7 @@ var CHECK_RULES = [
|
|
|
14284
14327
|
},
|
|
14285
14328
|
{
|
|
14286
14329
|
id: "adr-superseded-unlinked",
|
|
14287
|
-
description: "An ADR is superseded exactly when a newer ADR supersedes it
|
|
14330
|
+
description: "**An ADR is superseded exactly when a newer ADR supersedes it**.",
|
|
14288
14331
|
severity: "warning",
|
|
14289
14332
|
dimension: "consistency",
|
|
14290
14333
|
run: (model) => {
|
|
@@ -14301,7 +14344,7 @@ var CHECK_RULES = [
|
|
|
14301
14344
|
},
|
|
14302
14345
|
{
|
|
14303
14346
|
id: "fitness-fn-unlinked",
|
|
14304
|
-
description: "Every fitness function implements an ADR or constrains an element
|
|
14347
|
+
description: "**Every fitness function implements an ADR or constrains an element**.",
|
|
14305
14348
|
severity: "warning",
|
|
14306
14349
|
dimension: "decisions",
|
|
14307
14350
|
run: (model) => {
|
|
@@ -14312,10 +14355,10 @@ var CHECK_RULES = [
|
|
|
14312
14355
|
},
|
|
14313
14356
|
{
|
|
14314
14357
|
id: "concern-unaddressed",
|
|
14315
|
-
description: "Every concern a Hub concern pack finds in the model is settled by an accepted ADR marked with it (property `concern`) that constrains the elements it applies to, or what contains them.",
|
|
14358
|
+
description: "**Every concern a Hub concern pack finds in the model is settled by an accepted ADR marked with it** (property `concern`) that constrains the elements it applies to, or what contains them.",
|
|
14316
14359
|
severity: "warning",
|
|
14317
14360
|
dimension: "decisions",
|
|
14318
|
-
run: (model) =>
|
|
14361
|
+
run: (model) => openConcerns(model.concerns ?? [], model.nodes, model.relations, model.metamodel).map(({ pack, open, pending }) => {
|
|
14319
14362
|
const names = open.map((id) => quote(model.nodes[id])).join(", ");
|
|
14320
14363
|
const being = pending.length ? ` ${pending.map(quote).join(", ")} ${pending.length === 1 ? "is" : "are"} proposed: the decision is being made.` : "";
|
|
14321
14364
|
return {
|
|
@@ -14325,11 +14368,11 @@ var CHECK_RULES = [
|
|
|
14325
14368
|
message: `${pack.name}: ${pack.concern.why} No accepted ADR marked "${pack.concern.id}" settles it for ${names}.${being}`,
|
|
14326
14369
|
details: (pack.templateParams ?? []).map(questionLine)
|
|
14327
14370
|
};
|
|
14328
|
-
})
|
|
14371
|
+
})
|
|
14329
14372
|
},
|
|
14330
14373
|
{
|
|
14331
14374
|
id: "concern-unbound",
|
|
14332
|
-
description: "Every accepted ADR marked with a concern (property `concern`, set by a Hub concern pack) constrains the elements it settles the concern for
|
|
14375
|
+
description: "**Every accepted ADR marked with a concern** (property `concern`, set by a Hub concern pack) **constrains the elements it settles the concern for**.",
|
|
14333
14376
|
severity: "warning",
|
|
14334
14377
|
dimension: "decisions",
|
|
14335
14378
|
run: (model) => unboundDecisions(model.concerns ?? [], model.nodes, model.relations, model.metamodel).map(({ adr, concern, checks, bindTo }) => ({
|
|
@@ -14341,21 +14384,21 @@ var CHECK_RULES = [
|
|
|
14341
14384
|
},
|
|
14342
14385
|
{
|
|
14343
14386
|
id: "scenario-without-metrics",
|
|
14344
|
-
description: "Every scenario has what checks it
|
|
14387
|
+
description: "**Every scenario has what checks it**: tests the repository's .radical/radical.json binds to it, or metric conditions (property `metrics`, one per line: `<metric>{<labels>} <op> <number> [unit]`). One the repository must verify is scenario-not-verified-here's.",
|
|
14345
14388
|
severity: "warning",
|
|
14346
14389
|
dimension: "traceability",
|
|
14347
14390
|
run: (model) => nodesOf(model, "scenario").filter((n) => !conditionsOf(n).length && !verifiedHere(model, n)).map((n) => ({ nodeId: n.id, message: `Scenario ${quote(n)} names no check.` }))
|
|
14348
14391
|
},
|
|
14349
14392
|
{
|
|
14350
14393
|
id: "scenario-not-verified-here",
|
|
14351
|
-
description: "With the repository's .radical/radical.json (the CLI): every scenario of a requirement an element the repository builds satisfies has tests the file binds to it, or metric conditions
|
|
14394
|
+
description: "With the repository's .radical/radical.json (the CLI): **every scenario of a requirement an element the repository builds satisfies has tests the file binds to it, or metric conditions**.",
|
|
14352
14395
|
severity: "warning",
|
|
14353
14396
|
dimension: "traceability",
|
|
14354
14397
|
run: (model) => nodesOf(model, "scenario").filter((n) => !conditionsOf(n).length && verifiedHere(model, n)).map((n) => ({ nodeId: n.id, message: `Scenario ${quote(n)} is this repository's to verify (an element it builds satisfies its requirement), and ${model.repository.file} binds no test to it: radical verify ${n.id} --test "<file> \u203A <title>".` }))
|
|
14355
14398
|
},
|
|
14356
14399
|
{
|
|
14357
14400
|
id: "model-names-tests",
|
|
14358
|
-
description: "A scenario or fitness function names no test in its Metrics
|
|
14401
|
+
description: "**A scenario or fitness function names no test in its Metrics**: the repository binds its tests in .radical/radical.json (radical setup moves them there). A test named in Metrics still counts.",
|
|
14359
14402
|
severity: "warning",
|
|
14360
14403
|
dimension: "traceability",
|
|
14361
14404
|
run: (model) => Object.values(model.nodes).filter((n) => TESTED_TYPES.includes(n.type) && !originOf(n)).flatMap((n) => {
|
|
@@ -14365,14 +14408,14 @@ var CHECK_RULES = [
|
|
|
14365
14408
|
},
|
|
14366
14409
|
{
|
|
14367
14410
|
id: "fitness-fn-without-metrics",
|
|
14368
|
-
description: "Every fitness function states what checks it and when it passes (property `metrics`, one condition per line).",
|
|
14411
|
+
description: "**Every fitness function states what checks it and when it passes** (property `metrics`, one condition per line).",
|
|
14369
14412
|
severity: "warning",
|
|
14370
14413
|
dimension: "decisions",
|
|
14371
14414
|
run: (model) => nodesOf(model, "fitness-fn").filter((n) => !conditionsOf(n).length).map((n) => ({ nodeId: n.id, message: `Fitness function ${quote(n)} names no check.` }))
|
|
14372
14415
|
},
|
|
14373
14416
|
{
|
|
14374
14417
|
id: "fitness-fn-unclassified",
|
|
14375
|
-
description: "Every fitness function states its characteristic (ISO/IEC 25010), scope, cadence (with the event it is triggered on, or how often a temporal one falls due) and invocation.",
|
|
14418
|
+
description: "**Every fitness function states its characteristic** (ISO/IEC 25010), scope, cadence (with the event it is triggered on, or how often a temporal one falls due) and invocation.",
|
|
14376
14419
|
severity: "warning",
|
|
14377
14420
|
dimension: "decisions",
|
|
14378
14421
|
run: (model) => nodesOf(model, "fitness-fn").flatMap((n) => {
|
|
@@ -14385,7 +14428,7 @@ var CHECK_RULES = [
|
|
|
14385
14428
|
},
|
|
14386
14429
|
{
|
|
14387
14430
|
id: "fitness-fn-measure-invalid",
|
|
14388
|
-
description:
|
|
14431
|
+
description: `**Every line of a fitness function's \`measure\` names a sensor** of radical sense (${SENSOR_NAMES.join(", ")}) or, run by the CLI, one of the repository's .radical/sensors/sensors.json.`,
|
|
14389
14432
|
severity: "error",
|
|
14390
14433
|
dimension: "completeness",
|
|
14391
14434
|
run: (model) => model.sensors === void 0 ? [] : nodesOf(model, "fitness-fn").flatMap((n) => parseMeasure(n.measure).filter((line) => !isSensorName(line.sensor) && !model.sensors?.names.includes(line.sensor)).map((line) => ({
|
|
@@ -14395,14 +14438,14 @@ var CHECK_RULES = [
|
|
|
14395
14438
|
},
|
|
14396
14439
|
{
|
|
14397
14440
|
id: "repository-mapping",
|
|
14398
|
-
description: "With the repository's .radical/radical.json (the CLI): each entry names an element of the model
|
|
14441
|
+
description: "With the repository's .radical/radical.json (the CLI): **each entry names an element of the model**, its own or another model's of the federation, under the element's name, with paths the repository has; tests are bound to scenarios and fitness functions.",
|
|
14399
14442
|
severity: "warning",
|
|
14400
14443
|
dimension: "traceability",
|
|
14401
14444
|
run: repositoryMapping
|
|
14402
14445
|
},
|
|
14403
14446
|
{
|
|
14404
14447
|
id: "repository-settings-in-model",
|
|
14405
|
-
description: `The model's check.json holds the model's rules and goals; the repository's test files (test-unbound's include and exclude) and CI's artifacts belong in .radical/radical.json ("tests", "ci"). Those in check.json are still read.`,
|
|
14448
|
+
description: `The model's check.json holds the model's rules and goals; **the repository's test files** (test-unbound's include and exclude) and CI's artifacts **belong in .radical/radical.json** ("tests", "ci"). Those in check.json are still read.`,
|
|
14406
14449
|
severity: "warning",
|
|
14407
14450
|
dimension: "completeness",
|
|
14408
14451
|
run: (model) => (model.settingsInModel ?? []).map((what) => ({
|
|
@@ -14412,7 +14455,7 @@ var CHECK_RULES = [
|
|
|
14412
14455
|
},
|
|
14413
14456
|
{
|
|
14414
14457
|
id: "description-path-missing",
|
|
14415
|
-
description: "With the repository (the CLI): a path from the repository's root an element's description names (apps/cli/src/sense.ts) is in the repository
|
|
14458
|
+
description: "With the repository (the CLI): **a path from the repository's root an element's description names** (apps/cli/src/sense.ts) **is in the repository**; one that is gone tells of code that moved.",
|
|
14416
14459
|
severity: "warning",
|
|
14417
14460
|
dimension: "consistency",
|
|
14418
14461
|
run: (model) => Object.entries(model.missingPaths ?? {}).flatMap(([id, paths]) => {
|
|
@@ -14422,21 +14465,21 @@ var CHECK_RULES = [
|
|
|
14422
14465
|
},
|
|
14423
14466
|
{
|
|
14424
14467
|
id: "measure-with-arguments",
|
|
14425
|
-
description:
|
|
14468
|
+
description: `**A fitness function's measure lines name sensors only**: an adapter's arguments (files, options of the repository) belong to a sensor of .radical/sensors/sensors.json ({ "adapter": "playwright", "args": [...] }). A line with arguments still runs.`,
|
|
14426
14469
|
severity: "warning",
|
|
14427
14470
|
dimension: "completeness",
|
|
14428
14471
|
run: (model) => nodesOf(model, "fitness-fn").flatMap((n) => parseMeasure(n.measure).filter((line) => line.args.length > 0).map((line) => ({ nodeId: n.id, message: `Fitness function ${quote(n)}: measure "${line.raw}" has the repository's arguments; name a sensor of .radical/sensors/sensors.json that holds them ({ "adapter": "${line.sensor}", "args": [...] }).` })))
|
|
14429
14472
|
},
|
|
14430
14473
|
{
|
|
14431
14474
|
id: "metric-invalid",
|
|
14432
|
-
description: "Every line of a scenario's or fitness function's `metrics` reads as a condition
|
|
14475
|
+
description: "**Every line of a scenario's or fitness function's `metrics` reads as a condition**, its unit converts to the unit of the measurement it matches, and `combine` and `max_age` read.",
|
|
14433
14476
|
severity: "error",
|
|
14434
14477
|
dimension: "completeness",
|
|
14435
14478
|
run: invalidChecks
|
|
14436
14479
|
},
|
|
14437
14480
|
{
|
|
14438
14481
|
id: "test-failed",
|
|
14439
|
-
description: "With --report: every test a scenario or fitness function names passed
|
|
14482
|
+
description: "With --report: **every test a scenario or fitness function names passed**.",
|
|
14440
14483
|
severity: "error",
|
|
14441
14484
|
dimension: "tests",
|
|
14442
14485
|
readsReports: true,
|
|
@@ -14444,7 +14487,7 @@ var CHECK_RULES = [
|
|
|
14444
14487
|
},
|
|
14445
14488
|
{
|
|
14446
14489
|
id: "test-not-found",
|
|
14447
|
-
description: "With --report: every test a scenario or fitness function names is in the report of its file (a renamed or deleted test is not).",
|
|
14490
|
+
description: "With --report: **every test a scenario or fitness function names is in the report of its file** (a renamed or deleted test is not).",
|
|
14448
14491
|
severity: "error",
|
|
14449
14492
|
dimension: "tests",
|
|
14450
14493
|
readsReports: true,
|
|
@@ -14452,7 +14495,7 @@ var CHECK_RULES = [
|
|
|
14452
14495
|
},
|
|
14453
14496
|
{
|
|
14454
14497
|
id: "test-skipped",
|
|
14455
|
-
description: "With --report: no test a scenario or fitness function names was skipped
|
|
14498
|
+
description: "With --report: **no test a scenario or fitness function names was skipped**.",
|
|
14456
14499
|
severity: "warning",
|
|
14457
14500
|
dimension: "tests",
|
|
14458
14501
|
readsReports: true,
|
|
@@ -14460,15 +14503,15 @@ var CHECK_RULES = [
|
|
|
14460
14503
|
},
|
|
14461
14504
|
{
|
|
14462
14505
|
id: "test-not-run",
|
|
14463
|
-
description: "With --report: every file a scenario or fitness function names a test in is in the reports
|
|
14506
|
+
description: "With --report: **every file a scenario or fitness function names a test in is in the reports**.",
|
|
14464
14507
|
severity: "warning",
|
|
14465
14508
|
dimension: "tests",
|
|
14466
14509
|
readsReports: true,
|
|
14467
|
-
run: testRule("not-run", (node, id) => `${testedName(node)}: no report has
|
|
14510
|
+
run: testRule("not-run", (node, id) => `${testedName(node)}: test ${id} did not run: no report has its file.`)
|
|
14468
14511
|
},
|
|
14469
14512
|
{
|
|
14470
14513
|
id: "metric-failed",
|
|
14471
|
-
description: "With measurements: every metric condition a scenario or fitness function states holds for the latest measurement it matches.",
|
|
14514
|
+
description: "With measurements: **every metric condition a scenario or fitness function states holds** for the latest measurement it matches.",
|
|
14472
14515
|
severity: "error",
|
|
14473
14516
|
dimension: "tests",
|
|
14474
14517
|
readsMeasurements: true,
|
|
@@ -14476,7 +14519,7 @@ var CHECK_RULES = [
|
|
|
14476
14519
|
},
|
|
14477
14520
|
{
|
|
14478
14521
|
id: "metric-stale",
|
|
14479
|
-
description: "With measurements: the latest measurement each metric condition matches is no older than the element's max_age (a stale one never passes).",
|
|
14522
|
+
description: "With measurements: **the latest measurement each metric condition matches is no older than the element's max_age** (a stale one never passes).",
|
|
14480
14523
|
severity: "warning",
|
|
14481
14524
|
dimension: "tests",
|
|
14482
14525
|
readsMeasurements: true,
|
|
@@ -14484,7 +14527,7 @@ var CHECK_RULES = [
|
|
|
14484
14527
|
},
|
|
14485
14528
|
{
|
|
14486
14529
|
id: "metric-not-measured",
|
|
14487
|
-
description: "With measurements: a measurement matches every metric condition a scenario or fitness function states
|
|
14530
|
+
description: "With measurements: **a measurement matches every metric condition a scenario or fitness function states**.",
|
|
14488
14531
|
severity: "warning",
|
|
14489
14532
|
dimension: "tests",
|
|
14490
14533
|
readsMeasurements: true,
|
|
@@ -14492,7 +14535,7 @@ var CHECK_RULES = [
|
|
|
14492
14535
|
},
|
|
14493
14536
|
{
|
|
14494
14537
|
id: "test-unbound",
|
|
14495
|
-
description: "With --report and an include in check.json: every test in the files it includes is named by a scenario or a fitness function
|
|
14538
|
+
description: "With --report and an include in check.json: **every test in the files it includes is named by a scenario or a fitness function**, by its title or its describe block (a whole file or directory does not count). One finding per test file.",
|
|
14496
14539
|
severity: "warning",
|
|
14497
14540
|
dimension: "tests",
|
|
14498
14541
|
readsReports: true,
|
|
@@ -14532,11 +14575,32 @@ function wordFindings(model, off = /* @__PURE__ */ new Set()) {
|
|
|
14532
14575
|
return CHECK_RULES.filter((r) => WORD_RULES.has(r.id) && !off.has(r.id)).flatMap((rule) => rule.run(model).map((f) => ({ rule: rule.id, severity: f.severity ?? rule.severity, message: f.message, ...f.nodeId ? { nodeId: f.nodeId } : {}, ...f.relationId ? { relationId: f.relationId } : {}, ...f.about ? { about: f.about } : {} })));
|
|
14533
14576
|
}
|
|
14534
14577
|
|
|
14578
|
+
// ../../packages/common/src/check/profiles.ts
|
|
14579
|
+
init_define_RADICAL_BUILD();
|
|
14580
|
+
var ADOPT_RULE = {
|
|
14581
|
+
id: "baselines-pending",
|
|
14582
|
+
description: '**check.json does not wait for the baselines of its first run** ("adopt": true); radical check --adopt takes them once.',
|
|
14583
|
+
severity: "error",
|
|
14584
|
+
dimension: "consistency"
|
|
14585
|
+
};
|
|
14586
|
+
function strictCheckConfig(ruleIds, metricIds) {
|
|
14587
|
+
return {
|
|
14588
|
+
rules: Object.fromEntries(ruleIds.filter((id) => id !== ADOPT_RULE.id).map((id) => [id, "error"])),
|
|
14589
|
+
goals: Object.fromEntries(metricIds.map((id) => [id, { min: 100 }]))
|
|
14590
|
+
};
|
|
14591
|
+
}
|
|
14592
|
+
function existingCodeCheckConfig(ruleIds) {
|
|
14593
|
+
return {
|
|
14594
|
+
adopt: true,
|
|
14595
|
+
rules: Object.fromEntries(ruleIds.filter((id) => id !== ADOPT_RULE.id).map((id) => [id, "error"]))
|
|
14596
|
+
};
|
|
14597
|
+
}
|
|
14598
|
+
|
|
14535
14599
|
// ../../packages/common/src/check/goals.ts
|
|
14536
14600
|
init_define_RADICAL_BUILD();
|
|
14537
14601
|
var GOAL_RULE = {
|
|
14538
14602
|
id: "goal-unmet",
|
|
14539
|
-
description: 'Every metric check.json sets a goal for ("goals": { "<metric>": { "min": <percent> } }) reaches it
|
|
14603
|
+
description: '**Every metric check.json sets a goal for** ("goals": { "<metric>": { "min": <percent> } }) **reaches it**. One finding per goal, with the metric as its code.',
|
|
14540
14604
|
severity: "error"
|
|
14541
14605
|
};
|
|
14542
14606
|
var without = (rule) => (population) => (ctx) => {
|
|
@@ -14640,6 +14704,70 @@ var CHECK_METRICS = [
|
|
|
14640
14704
|
];
|
|
14641
14705
|
var METRIC_IDS = new Set(CHECK_METRICS.map((m) => m.id));
|
|
14642
14706
|
|
|
14707
|
+
// ../../packages/common/src/check/files.ts
|
|
14708
|
+
init_define_RADICAL_BUILD();
|
|
14709
|
+
var CHECK_CONFIG_FILE = "check.json";
|
|
14710
|
+
var TEST_RESULTS_FILE = `${STATE_DIR}/test-results.json`;
|
|
14711
|
+
var MEASUREMENTS_FILE = `${STATE_DIR}/measurements.json`;
|
|
14712
|
+
var CI_FETCH_FILE = `${STATE_DIR}/ci-fetch.json`;
|
|
14713
|
+
function testsRanAt(results) {
|
|
14714
|
+
const runs = results.ci?.runs.map((r) => r.ranAt).filter((at) => !Number.isNaN(Date.parse(at))).sort() ?? [];
|
|
14715
|
+
return runs.length ? runs[runs.length - 1] : results.readAt;
|
|
14716
|
+
}
|
|
14717
|
+
function ciSourceOf(value) {
|
|
14718
|
+
const ci = value;
|
|
14719
|
+
if (!ci || ci.provider !== "github" || typeof ci.commit !== "string" || typeof ci.behind !== "number" || !Array.isArray(ci.runs)) return void 0;
|
|
14720
|
+
const runs = ci.runs.filter((r) => !!r && typeof r.id === "number" && typeof r.url === "string" && typeof r.sha === "string" && typeof r.ranAt === "string" && typeof r.workflow === "string" && Array.isArray(r.artifacts));
|
|
14721
|
+
return { provider: "github", commit: ci.commit, behind: ci.behind, runs, ...typeof ci.measurements === "number" ? { measurements: ci.measurements } : {} };
|
|
14722
|
+
}
|
|
14723
|
+
var STATUSES = /* @__PURE__ */ new Set(["passed", "failed", "skipped"]);
|
|
14724
|
+
function parseTestResults(text3) {
|
|
14725
|
+
let data;
|
|
14726
|
+
try {
|
|
14727
|
+
data = JSON.parse(text3);
|
|
14728
|
+
} catch {
|
|
14729
|
+
return null;
|
|
14730
|
+
}
|
|
14731
|
+
const r = data;
|
|
14732
|
+
if (r?.version !== 1 || typeof r.readAt !== "string" || !Array.isArray(r.cases)) return null;
|
|
14733
|
+
const cases = r.cases.filter((c) => !!c && typeof c.file === "string" && Array.isArray(c.title) && c.title.every((t) => typeof t === "string") && STATUSES.has(c.status));
|
|
14734
|
+
const ci = ciSourceOf(r.ci);
|
|
14735
|
+
const k = r.kept;
|
|
14736
|
+
const kept2 = k && typeof k.since === "string" && typeof k.cases === "number" && typeof k.files === "number" ? { since: k.since, cases: k.cases, files: k.files } : void 0;
|
|
14737
|
+
return {
|
|
14738
|
+
version: 1,
|
|
14739
|
+
readAt: r.readAt,
|
|
14740
|
+
reports: Array.isArray(r.reports) ? r.reports.filter((x) => typeof x === "string") : [],
|
|
14741
|
+
cases,
|
|
14742
|
+
...typeof r.commit === "string" ? { commit: r.commit } : {},
|
|
14743
|
+
...ci ? { ci } : {},
|
|
14744
|
+
...kept2 ? { kept: kept2 } : {}
|
|
14745
|
+
};
|
|
14746
|
+
}
|
|
14747
|
+
function parseCheckConfig(text3) {
|
|
14748
|
+
const data = JSON.parse(stripBom(text3));
|
|
14749
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) throw new Error("a config is a JSON object");
|
|
14750
|
+
const rules = data.rules;
|
|
14751
|
+
if (rules !== void 0 && (typeof rules !== "object" || rules === null || Array.isArray(rules))) throw new Error('"rules" is an object of rule settings');
|
|
14752
|
+
const goals = data.goals;
|
|
14753
|
+
if (goals !== void 0) {
|
|
14754
|
+
if (typeof goals !== "object" || goals === null || Array.isArray(goals)) throw new Error('"goals" is an object of goals by metric');
|
|
14755
|
+
for (const [id, goal] of Object.entries(goals)) {
|
|
14756
|
+
const min = goal?.min;
|
|
14757
|
+
if (typeof min !== "number" || !(min >= 0 && min <= 100)) throw new Error(`goal "${id}" needs a "min" from 0 to 100 (percent)`);
|
|
14758
|
+
}
|
|
14759
|
+
}
|
|
14760
|
+
const adopt = data.adopt;
|
|
14761
|
+
if (adopt !== void 0 && typeof adopt !== "boolean") throw new Error('"adopt" is true while check.json waits for the baselines of its first run (radical check --adopt), else left out');
|
|
14762
|
+
const ci = data.ci;
|
|
14763
|
+
if (ci !== void 0) {
|
|
14764
|
+
const artifacts = ci?.artifacts;
|
|
14765
|
+
if (typeof ci !== "object" || ci === null || Array.isArray(ci) || artifacts !== void 0 && !(Array.isArray(artifacts) && artifacts.every((a) => typeof a === "string" && a)))
|
|
14766
|
+
throw new Error('"ci" is an object whose "artifacts" lists the names of the CI artifacts that hold test reports');
|
|
14767
|
+
}
|
|
14768
|
+
return data;
|
|
14769
|
+
}
|
|
14770
|
+
|
|
14643
14771
|
// ../../packages/common/src/check/testSource.ts
|
|
14644
14772
|
init_define_RADICAL_BUILD();
|
|
14645
14773
|
|
|
@@ -14800,88 +14928,36 @@ function formatTrace(trace, nodes, now4 = Date.now()) {
|
|
|
14800
14928
|
return out.join("\n");
|
|
14801
14929
|
}
|
|
14802
14930
|
|
|
14803
|
-
// ../../packages/common/src/check/files.ts
|
|
14804
|
-
init_define_RADICAL_BUILD();
|
|
14805
|
-
var CHECK_CONFIG_FILE = "check.json";
|
|
14806
|
-
var TEST_RESULTS_FILE = `${STATE_DIR}/test-results.json`;
|
|
14807
|
-
var MEASUREMENTS_FILE = `${STATE_DIR}/measurements.json`;
|
|
14808
|
-
function testsRanAt(results) {
|
|
14809
|
-
const runs = results.ci?.runs.map((r) => r.ranAt).filter((at) => !Number.isNaN(Date.parse(at))).sort() ?? [];
|
|
14810
|
-
return runs.length ? runs[runs.length - 1] : results.readAt;
|
|
14811
|
-
}
|
|
14812
|
-
function ciSourceOf(value) {
|
|
14813
|
-
const ci = value;
|
|
14814
|
-
if (!ci || ci.provider !== "github" || typeof ci.commit !== "string" || typeof ci.behind !== "number" || !Array.isArray(ci.runs)) return void 0;
|
|
14815
|
-
const runs = ci.runs.filter((r) => !!r && typeof r.id === "number" && typeof r.url === "string" && typeof r.sha === "string" && typeof r.ranAt === "string" && typeof r.workflow === "string" && Array.isArray(r.artifacts));
|
|
14816
|
-
return { provider: "github", commit: ci.commit, behind: ci.behind, runs };
|
|
14817
|
-
}
|
|
14818
|
-
var STATUSES = /* @__PURE__ */ new Set(["passed", "failed", "skipped"]);
|
|
14819
|
-
function parseTestResults(text3) {
|
|
14820
|
-
let data;
|
|
14821
|
-
try {
|
|
14822
|
-
data = JSON.parse(text3);
|
|
14823
|
-
} catch {
|
|
14824
|
-
return null;
|
|
14825
|
-
}
|
|
14826
|
-
const r = data;
|
|
14827
|
-
if (r?.version !== 1 || typeof r.readAt !== "string" || !Array.isArray(r.cases)) return null;
|
|
14828
|
-
const cases = r.cases.filter((c) => !!c && typeof c.file === "string" && Array.isArray(c.title) && c.title.every((t) => typeof t === "string") && STATUSES.has(c.status));
|
|
14829
|
-
const ci = ciSourceOf(r.ci);
|
|
14830
|
-
return {
|
|
14831
|
-
version: 1,
|
|
14832
|
-
readAt: r.readAt,
|
|
14833
|
-
reports: Array.isArray(r.reports) ? r.reports.filter((x) => typeof x === "string") : [],
|
|
14834
|
-
cases,
|
|
14835
|
-
...typeof r.commit === "string" ? { commit: r.commit } : {},
|
|
14836
|
-
...ci ? { ci } : {}
|
|
14837
|
-
};
|
|
14838
|
-
}
|
|
14839
|
-
function parseCheckConfig(text3) {
|
|
14840
|
-
const data = JSON.parse(stripBom(text3));
|
|
14841
|
-
if (!data || typeof data !== "object" || Array.isArray(data)) throw new Error("a config is a JSON object");
|
|
14842
|
-
const rules = data.rules;
|
|
14843
|
-
if (rules !== void 0 && (typeof rules !== "object" || rules === null || Array.isArray(rules))) throw new Error('"rules" is an object of rule settings');
|
|
14844
|
-
const goals = data.goals;
|
|
14845
|
-
if (goals !== void 0) {
|
|
14846
|
-
if (typeof goals !== "object" || goals === null || Array.isArray(goals)) throw new Error('"goals" is an object of goals by metric');
|
|
14847
|
-
for (const [id, goal] of Object.entries(goals)) {
|
|
14848
|
-
const min = goal?.min;
|
|
14849
|
-
if (typeof min !== "number" || !(min >= 0 && min <= 100)) throw new Error(`goal "${id}" needs a "min" from 0 to 100 (percent)`);
|
|
14850
|
-
}
|
|
14851
|
-
}
|
|
14852
|
-
const ci = data.ci;
|
|
14853
|
-
if (ci !== void 0) {
|
|
14854
|
-
const artifacts = ci?.artifacts;
|
|
14855
|
-
if (typeof ci !== "object" || ci === null || Array.isArray(ci) || artifacts !== void 0 && !(Array.isArray(artifacts) && artifacts.every((a) => typeof a === "string" && a)))
|
|
14856
|
-
throw new Error('"ci" is an object whose "artifacts" lists the names of the CI artifacts that hold test reports');
|
|
14857
|
-
}
|
|
14858
|
-
return data;
|
|
14859
|
-
}
|
|
14860
|
-
|
|
14861
14931
|
// ../../packages/common/src/check/reviews.ts
|
|
14862
14932
|
init_define_RADICAL_BUILD();
|
|
14863
14933
|
|
|
14864
14934
|
// ../../packages/common/src/check/format.ts
|
|
14865
14935
|
init_define_RADICAL_BUILD();
|
|
14866
14936
|
|
|
14937
|
+
// ../../packages/common/src/check/findingWords.ts
|
|
14938
|
+
init_define_RADICAL_BUILD();
|
|
14939
|
+
|
|
14867
14940
|
// ../../packages/common/src/check/configChanges.ts
|
|
14868
14941
|
init_define_RADICAL_BUILD();
|
|
14869
14942
|
|
|
14870
14943
|
// ../../packages/common/src/check/index.ts
|
|
14871
14944
|
var FOLDER_RULES = [
|
|
14872
|
-
{ id: "folder-manifest", description: "The folder has a radical.md manifest of the Markdown-folder format, version 1.", severity: "error", dimension: "consistency" },
|
|
14873
|
-
{ id: "folder-json", description: "Every JSON sidecar (relations.json, views.json, \u2026) parses
|
|
14874
|
-
{ id: "folder-conflict", description: "No node file holds git conflict markers
|
|
14875
|
-
{ id: "folder-not-a-node", description: "A node file with frontmatter has an id and a type (one without them is skipped on loading, and its element is gone).", severity: "error", dimension: "consistency" },
|
|
14876
|
-
{ id: "folder-duplicate-id", description: "No two node files hold the same id
|
|
14877
|
-
{ id: "stale-reference", description: "Views, sequences and slides point only at elements, relations and views the model has
|
|
14945
|
+
{ id: "folder-manifest", description: "**The folder has a radical.md manifest** of the Markdown-folder format, version 1.", severity: "error", dimension: "consistency" },
|
|
14946
|
+
{ id: "folder-json", description: "**Every JSON sidecar** (relations.json, views.json, \u2026) **parses**.", severity: "error", dimension: "consistency" },
|
|
14947
|
+
{ id: "folder-conflict", description: "**No node file holds git conflict markers**.", severity: "error", dimension: "consistency" },
|
|
14948
|
+
{ id: "folder-not-a-node", description: "**A node file with frontmatter has an id and a type** (one without them is skipped on loading, and its element is gone).", severity: "error", dimension: "consistency" },
|
|
14949
|
+
{ id: "folder-duplicate-id", description: "**No two node files hold the same id**.", severity: "error", dimension: "consistency" },
|
|
14950
|
+
{ id: "stale-reference", description: "**Views, sequences and slides point only at elements, relations and views the model has**.", severity: "warning", dimension: "consistency" }
|
|
14878
14951
|
];
|
|
14879
14952
|
var STALE_REFERENCE = "stale-reference";
|
|
14880
|
-
var MODEL_RULE_IDS = /* @__PURE__ */ new Set([STALE_REFERENCE, ...CHECK_RULES.map((r) => r.id), GOAL_RULE.id]);
|
|
14881
|
-
var ALL_RULES = [...FOLDER_RULES, ...CHECK_RULES, GOAL_RULE];
|
|
14953
|
+
var MODEL_RULE_IDS = /* @__PURE__ */ new Set([STALE_REFERENCE, ...CHECK_RULES.map((r) => r.id), GOAL_RULE.id, ADOPT_RULE.id]);
|
|
14954
|
+
var ALL_RULES = [...FOLDER_RULES, ...CHECK_RULES, GOAL_RULE, ADOPT_RULE];
|
|
14882
14955
|
var RULE_IDS = new Set(ALL_RULES.map((r) => r.id));
|
|
14883
14956
|
var DEFAULT_SEVERITY = new Map(ALL_RULES.map((r) => [r.id, r.severity]));
|
|
14884
14957
|
var DEFAULT_OFF = new Set(ALL_RULES.filter((r) => r.off).map((r) => r.id));
|
|
14958
|
+
var strictCheckConfig2 = () => strictCheckConfig(ALL_RULES.map((r) => r.id), CHECK_METRICS.map((m) => m.id));
|
|
14959
|
+
var existingCodeCheckConfig2 = () => existingCodeCheckConfig(ALL_RULES.map((r) => r.id));
|
|
14960
|
+
var serializeCheckConfig = (config) => JSON.stringify(config, null, 2) + "\n";
|
|
14885
14961
|
|
|
14886
14962
|
// ../../packages/common/src/federation.ts
|
|
14887
14963
|
init_define_RADICAL_BUILD();
|
|
@@ -22583,7 +22659,7 @@ function unchangedResult(nodes, relations, style = "curved") {
|
|
|
22583
22659
|
}
|
|
22584
22660
|
async function runSmartLayoutELKPhase(inputNodes, inputRelations, metamodel, onProgress) {
|
|
22585
22661
|
const { nodes, relations } = projectToVisibleGraph(inputNodes, inputRelations);
|
|
22586
|
-
const { applyElkLayout } = await import("./elkLayout-
|
|
22662
|
+
const { applyElkLayout } = await import("./elkLayout-7MVDIEFO.js");
|
|
22587
22663
|
const depth2 = maxContainmentDepth(metamodel);
|
|
22588
22664
|
const mmDirection = depth2 >= 2 ? "RIGHT" : "DOWN";
|
|
22589
22665
|
const engines = [
|
|
@@ -25291,39 +25367,91 @@ init_define_RADICAL_BUILD();
|
|
|
25291
25367
|
init_define_RADICAL_BUILD();
|
|
25292
25368
|
var CONCERNS_QUESTION_ID = "concerns";
|
|
25293
25369
|
var CONCERN_QUESTION_PREFIX = "concern:";
|
|
25294
|
-
var
|
|
25295
|
-
|
|
25370
|
+
var BASELINE_PACK_IDS = ["concern-ci-cd-pipeline", "concern-test-strategy", "concern-release-versioning", "concern-code-quality-gate"];
|
|
25371
|
+
var SCREEN_PACK_IDS = ["concern-usability", "concern-accessibility", "concern-mobile-performance"];
|
|
25372
|
+
var concernsStageOf = (stage) => stage === "requirements" || stage === "review" ? stage : void 0;
|
|
25373
|
+
var packLine = (p, appliesTo) => `- ${p.id} | ${p.name}: ${p.description}${appliesTo?.length ? ` Open for: ${appliesTo.map((l) => `"${l}"`).join(", ")}.` : ""}`;
|
|
25374
|
+
var among = (packs, ids) => ids.map((id) => packs.find((p) => p.id === id)).filter((p) => !!p);
|
|
25375
|
+
function concernsClarifyLines(packs, mode, options = {}) {
|
|
25296
25376
|
if (!packs.length) return [];
|
|
25377
|
+
if (options.stage === "review") return reviewClarifyLines(packs, mode, options.appliesTo ?? {});
|
|
25378
|
+
const baseline = among(packs, BASELINE_PACK_IDS);
|
|
25379
|
+
const screens = among(packs, SCREEN_PACK_IDS);
|
|
25380
|
+
const names = (list) => list.map((p) => p.name).join(", ");
|
|
25297
25381
|
const lines = [
|
|
25298
25382
|
"",
|
|
25299
25383
|
"Concern packs of the Hub (id | name: what it settles). Each brings the requirements, the decision, its",
|
|
25300
25384
|
"fitness functions and scenarios for one concern, as the user's answers to its questions pick them:",
|
|
25301
|
-
...packs.map(packLine),
|
|
25385
|
+
...packs.map((p) => packLine(p)),
|
|
25302
25386
|
"",
|
|
25303
25387
|
"Pick the packs whose concern this system clearly has, from the description in whatever language it is",
|
|
25304
|
-
"written (people sign in, data about people is kept, other systems are called, \u2026)
|
|
25388
|
+
"written (people sign in, data about people is kept, other systems are called, \u2026)."
|
|
25305
25389
|
];
|
|
25390
|
+
if (baseline.length) {
|
|
25391
|
+
lines.push(
|
|
25392
|
+
`Always include the baseline packs: ${names(baseline)}. They are the good practices every system needs`,
|
|
25393
|
+
"(how a change is built, tested, released and held to a quality gate); the user unchecks what does not apply."
|
|
25394
|
+
);
|
|
25395
|
+
}
|
|
25396
|
+
if (screens.length) {
|
|
25397
|
+
lines.push(
|
|
25398
|
+
`When people use the system through screens (a web, mobile or desktop app), also include ${names(screens)}:`,
|
|
25399
|
+
"the good practices of what people see and use. Leave them out for a system nobody uses through a screen."
|
|
25400
|
+
);
|
|
25401
|
+
}
|
|
25402
|
+
if (!baseline.length) lines.push("None if none fits.");
|
|
25306
25403
|
if (mode === "ask") {
|
|
25307
25404
|
lines.push(
|
|
25308
|
-
"
|
|
25405
|
+
"Present your picks to the user as proposed, each checked, the baseline packs among them, and let the user",
|
|
25406
|
+
"drop any that does not apply. Where the description clearly settles one of a kept pack's",
|
|
25309
25407
|
"questions (listed below), propose the answer, quoting the words of the description it rests on, and ask",
|
|
25310
25408
|
"the user to accept or change those answers; ask the other questions with their options. Answer only what",
|
|
25311
|
-
"the description says, not what is usual. Pass the packs with the answers the user accepted
|
|
25312
|
-
"forge_generate as concerns."
|
|
25409
|
+
"the description says, not what is usual. Pass the packs the user kept, with the answers the user accepted",
|
|
25410
|
+
"or gave, to forge_generate as concerns; a pack the user dropped is left out."
|
|
25411
|
+
);
|
|
25412
|
+
} else {
|
|
25413
|
+
lines.push(
|
|
25414
|
+
`Include one question with id "${CONCERNS_QUESTION_ID}", kind "select", multiSelect true, whose options are the`,
|
|
25415
|
+
`names of your picks exactly as written above, asking which of them to settle now.${baseline.length ? "" : " Leave it out if none fits."}`,
|
|
25416
|
+
...jsonAnswerLines()
|
|
25417
|
+
);
|
|
25418
|
+
}
|
|
25419
|
+
return lines;
|
|
25420
|
+
}
|
|
25421
|
+
function reviewClarifyLines(packs, mode, appliesTo) {
|
|
25422
|
+
const lines = [
|
|
25423
|
+
"",
|
|
25424
|
+
"These concerns the model raises are still open: Hub concern packs whose concern applies to elements of the",
|
|
25425
|
+
"model that no accepted decision settles (id | name: what it settles, and where it is open). Settle them",
|
|
25426
|
+
"before Forge ends. Each brings the requirements, the decision, its fitness functions and scenarios for its",
|
|
25427
|
+
"concern, as the user's answers to its questions pick them, bound to the elements it is open for:",
|
|
25428
|
+
...packs.map((p) => packLine(p, appliesTo[p.id])),
|
|
25429
|
+
""
|
|
25430
|
+
];
|
|
25431
|
+
if (mode === "ask") {
|
|
25432
|
+
lines.push(
|
|
25433
|
+
"Present all of them to the user as proposed, each checked, and let the user drop any that does not apply.",
|
|
25434
|
+
"Where the description or the earlier answers clearly settle one of a kept pack's questions (listed below),",
|
|
25435
|
+
"propose the answer, quoting the words it rests on, and ask the user to accept or change those answers; ask",
|
|
25436
|
+
"the other questions with their options. Pass the packs the user kept, with the answers the user accepted or",
|
|
25437
|
+
"gave, to forge_generate as concerns: each comes into the model bound at once where its concern applies."
|
|
25313
25438
|
);
|
|
25314
25439
|
} else {
|
|
25315
25440
|
lines.push(
|
|
25316
25441
|
`Include one question with id "${CONCERNS_QUESTION_ID}", kind "select", multiSelect true, whose options are the`,
|
|
25317
|
-
"names of
|
|
25318
|
-
|
|
25319
|
-
`clearly settles one of a pick's questions, add to the "${CONCERNS_QUESTION_ID}" question an "answers" array of`,
|
|
25320
|
-
'{"pack": pack id, "key": question key, "answer": option value, "because": the words of the description it',
|
|
25321
|
-
"rests on, quoted as written}. Answer only what the description says, not what is usual: the user sees",
|
|
25322
|
-
"each answer with its words and accepts or changes it."
|
|
25442
|
+
"names of all of them exactly as written above, asking which of them to settle now.",
|
|
25443
|
+
...jsonAnswerLines()
|
|
25323
25444
|
);
|
|
25324
25445
|
}
|
|
25325
25446
|
return lines;
|
|
25326
25447
|
}
|
|
25448
|
+
var jsonAnswerLines = () => [
|
|
25449
|
+
"Do not ask the packs' own questions (listed below): they are added for the picks. Where the description",
|
|
25450
|
+
`clearly settles one of a pick's questions, add to the "${CONCERNS_QUESTION_ID}" question an "answers" array of`,
|
|
25451
|
+
'{"pack": pack id, "key": question key, "answer": option value, "because": the words of the description it',
|
|
25452
|
+
"rests on, quoted as written}. Answer only what the description says, not what is usual: the user sees",
|
|
25453
|
+
"each answer with its words and accepts or changes it."
|
|
25454
|
+
];
|
|
25327
25455
|
function concernQuestionLines(packs) {
|
|
25328
25456
|
if (!packs.length) return [];
|
|
25329
25457
|
return [
|
|
@@ -25335,6 +25463,20 @@ function concernQuestionLines(packs) {
|
|
|
25335
25463
|
])
|
|
25336
25464
|
];
|
|
25337
25465
|
}
|
|
25466
|
+
function openConcernsForReview(packs, nodes, relations, metamodel) {
|
|
25467
|
+
const open = openConcerns(packs, nodes, relations, metamodel);
|
|
25468
|
+
return {
|
|
25469
|
+
packs: open.map((s) => s.pack),
|
|
25470
|
+
appliesTo: Object.fromEntries(open.map((s) => [s.pack.id, s.open.map((id) => nodes[id].label)]))
|
|
25471
|
+
};
|
|
25472
|
+
}
|
|
25473
|
+
function concernBindTargets(pack, nodes, relations, metamodel) {
|
|
25474
|
+
return suggestedCover(bindSuggestions(pack, nodes, relations, metamodel));
|
|
25475
|
+
}
|
|
25476
|
+
function reviewConcernLine(settled, nodes) {
|
|
25477
|
+
if (!settled.length) return "";
|
|
25478
|
+
return `Settled the open concerns the user confirmed, each bound where its concern applies: ${settled.map((s) => `${s.name} (${s.boundTo.length ? s.boundTo.map((id) => `"${nodes[id]?.label ?? id}"`).join(", ") : "unbound: nothing it applies to"})`).join(", ")}.`;
|
|
25479
|
+
}
|
|
25338
25480
|
function decidedConcern(pack, insert) {
|
|
25339
25481
|
const ids = (type2) => Object.values(insert.nodes).filter((n) => n.type === type2).map((n) => n.id);
|
|
25340
25482
|
return { packId: pack.id, name: pack.name, concern: pack.concern.id, adrIds: ids("adr"), fitnessIds: ids("fitness-fn"), requirementIds: ids("requirement") };
|
|
@@ -25369,7 +25511,7 @@ function bindUnboundConcerns(decided, packs, nodes, relations, metamodel) {
|
|
|
25369
25511
|
const adrs = d.adrIds.filter((id) => nodes[id] && nodes[id][CONCERN_KEY]);
|
|
25370
25512
|
if (!adrs.length || adrs.some((id) => constrains.has(id))) continue;
|
|
25371
25513
|
const pack = packs.find((p) => p.id === d.packId);
|
|
25372
|
-
const where = pack ?
|
|
25514
|
+
const where = pack ? concernBindTargets(pack, nodes, relations, metamodel) : [];
|
|
25373
25515
|
if (!where.length) {
|
|
25374
25516
|
lines.push(`${d.name}: nothing it applies to yet, so its decision is left unbound (concern-unbound reports it).`);
|
|
25375
25517
|
continue;
|
|
@@ -25384,7 +25526,7 @@ function bindUnboundConcerns(decided, packs, nodes, relations, metamodel) {
|
|
|
25384
25526
|
}
|
|
25385
25527
|
|
|
25386
25528
|
// ../../packages/common/src/ai/forge/clarify.ts
|
|
25387
|
-
function buildClarifyPrompt(stageTitle2, description, concernPacks2, priorQA, mode = "json") {
|
|
25529
|
+
function buildClarifyPrompt(stageTitle2, description, concernPacks2, priorQA, mode = "json", concerns = {}) {
|
|
25388
25530
|
const lines = [
|
|
25389
25531
|
`You are about to generate the "${stageTitle2}" stage of a Radical Forge run for the system described below.`,
|
|
25390
25532
|
"",
|
|
@@ -25411,7 +25553,7 @@ function buildClarifyPrompt(stageTitle2, description, concernPacks2, priorQA, mo
|
|
|
25411
25553
|
lines.push(
|
|
25412
25554
|
"Ask the user those questions and wait for the answers; offer options where",
|
|
25413
25555
|
"an answer is a choice. If nothing needs clarifying, ask nothing.",
|
|
25414
|
-
...concernsClarifyLines(concernPacks2 ?? [], "ask"),
|
|
25556
|
+
...concernsClarifyLines(concernPacks2 ?? [], "ask", concerns),
|
|
25415
25557
|
...concernQuestionLines(concernPacks2 ?? [])
|
|
25416
25558
|
);
|
|
25417
25559
|
return lines.join("\n");
|
|
@@ -25421,7 +25563,7 @@ function buildClarifyPrompt(stageTitle2, description, concernPacks2, priorQA, mo
|
|
|
25421
25563
|
'{"id": string, "question": string, "kind": "text" | "select", "options"?: string[], "multiSelect"?: boolean}',
|
|
25422
25564
|
"If nothing needs clarifying, respond with exactly: []"
|
|
25423
25565
|
);
|
|
25424
|
-
lines.push(...concernsClarifyLines(concernPacks2 ?? [], "json"), ...concernQuestionLines(concernPacks2 ?? []));
|
|
25566
|
+
lines.push(...concernsClarifyLines(concernPacks2 ?? [], "json", concerns), ...concernQuestionLines(concernPacks2 ?? []));
|
|
25425
25567
|
return lines.join("\n");
|
|
25426
25568
|
}
|
|
25427
25569
|
function formatClarificationAnswers(questions, answers) {
|
|
@@ -26367,10 +26509,13 @@ var FORGE_PROCEDURE = [
|
|
|
26367
26509
|
" and write the model in the other.",
|
|
26368
26510
|
"2. For each stage, in order:",
|
|
26369
26511
|
" a. forge_clarify: read it and ask the user the clarifying questions it calls for, if any. In the",
|
|
26370
|
-
" Requirements stage it also lists the Hub's concern packs: pick those the description calls for,
|
|
26371
|
-
"
|
|
26372
|
-
"
|
|
26373
|
-
"
|
|
26512
|
+
" Requirements stage it also lists the Hub's concern packs: pick those the description calls for, the",
|
|
26513
|
+
" baseline packs every system needs always among them, present them to the user as proposed, let the user",
|
|
26514
|
+
" drop any and ask the questions of the packs kept. In the Review stage it lists the concerns the model",
|
|
26515
|
+
" raises that are still open, to settle the same way. Wait for the answers.",
|
|
26516
|
+
" b. forge_generate with those answers (in Requirements and Review, the packs the user kept with their",
|
|
26517
|
+
" answers as concerns: in Requirements they come into the model whole, unbound, before the stage; in",
|
|
26518
|
+
" Review bound at once where their concern applies). It returns the stage task:",
|
|
26374
26519
|
" carry it out with the model tools (add_node, add_relation, update_node, search_model, \u2026).",
|
|
26375
26520
|
" A stage may also close gaps in earlier stages within the description (a requirement or scenario a",
|
|
26376
26521
|
" process shows is missing, a wrong name), but only by proposing it: forge_propose_refinement returns",
|
|
@@ -26422,7 +26567,7 @@ var FORGE_TOOL_DEFS = [
|
|
|
26422
26567
|
},
|
|
26423
26568
|
{
|
|
26424
26569
|
name: "forge_clarify",
|
|
26425
|
-
description: "Before generating a Forge stage: returns what to clarify with the user first
|
|
26570
|
+
description: "Before generating a Forge stage: returns what to clarify with the user first; in the Requirements stage the Hub's concern packs to pick from with their questions (the baseline packs every system needs always proposed), and in the Review stage the concerns the model raises that are still open. Ask the user, then call forge_generate with the answers.",
|
|
26426
26571
|
inputSchema: {
|
|
26427
26572
|
type: "object",
|
|
26428
26573
|
properties: { stage: { ...stageEnum, description: "The next stage of the run, or one already generated (to regenerate it with new answers)." } },
|
|
@@ -26449,7 +26594,7 @@ var FORGE_TOOL_DEFS = [
|
|
|
26449
26594
|
},
|
|
26450
26595
|
concerns: {
|
|
26451
26596
|
type: "array",
|
|
26452
|
-
description: "Requirements
|
|
26597
|
+
description: "Requirements and Review stages only: the concern packs (from forge_clarify) the user kept, each with the user's answers by question key (option values); leave out those the user dropped. In Requirements they come into the model whole and unbound before the stage, and the C4 stage binds them; in Review each comes in bound at once where its concern applies. Omit to keep the last run's; [] imports none.",
|
|
26453
26598
|
items: {
|
|
26454
26599
|
type: "object",
|
|
26455
26600
|
properties: { id: { type: "string" }, answers: { type: "object", additionalProperties: { type: "string" } } },
|
|
@@ -26670,7 +26815,7 @@ var Forge = class {
|
|
|
26670
26815
|
case "forge_start":
|
|
26671
26816
|
return this.start(args, ctx, facade);
|
|
26672
26817
|
case "forge_clarify":
|
|
26673
|
-
return this.clarify(args);
|
|
26818
|
+
return this.clarify(args, facade);
|
|
26674
26819
|
case "forge_generate":
|
|
26675
26820
|
return this.generate(args, facade);
|
|
26676
26821
|
case "forge_complete_stage":
|
|
@@ -26810,7 +26955,7 @@ var Forge = class {
|
|
|
26810
26955
|
}
|
|
26811
26956
|
} });
|
|
26812
26957
|
}
|
|
26813
|
-
clarify(args) {
|
|
26958
|
+
clarify(args, facade) {
|
|
26814
26959
|
const run = this.run;
|
|
26815
26960
|
if (!run) return fail2("forge_clarify: no Forge run; call forge_start first");
|
|
26816
26961
|
const stage = this.stageArg(args, "forge_clarify");
|
|
@@ -26818,9 +26963,11 @@ var Forge = class {
|
|
|
26818
26963
|
const id = stage;
|
|
26819
26964
|
const blocked = this.blocked(run, id);
|
|
26820
26965
|
if (blocked) return fail2(`forge_clarify: ${blocked}`);
|
|
26821
|
-
const
|
|
26966
|
+
const concernsStage = concernsStageOf(id);
|
|
26967
|
+
const offered = concernsStage === "review" ? openConcernsForReview(this.concernPacks(), facade.getNodes(), facade.getRelations(), facade.getMetamodel?.()) : { packs: concernsStage ? this.concernPacks() : [], appliesTo: {} };
|
|
26968
|
+
const packs = offered.packs;
|
|
26822
26969
|
const priorQA = STAGE_IDS3.slice(0, STAGE_IDS3.indexOf(id)).map((prior) => run.stages[prior]?.clarifications ?? "").filter(Boolean).join("\n\n");
|
|
26823
|
-
const lines = [buildClarifyPrompt(stageTitle(id), run.description, packs, priorQA, "ask"), "", ...forgeLanguageRules(run.languages)];
|
|
26970
|
+
const lines = [buildClarifyPrompt(stageTitle(id), run.description, packs, priorQA, "ask", { stage: concernsStage, appliesTo: offered.appliesTo }), "", ...forgeLanguageRules(run.languages)];
|
|
26824
26971
|
lines.push("", `Then call forge_generate with stage "${id}"${packs.length ? ", the answers and the concerns" : " and the answers"}.`);
|
|
26825
26972
|
return ok(lines.join("\n"), { readOnly: true, commit: () => {
|
|
26826
26973
|
run.clarified.add(id);
|
|
@@ -26855,7 +27002,7 @@ var Forge = class {
|
|
|
26855
27002
|
}
|
|
26856
27003
|
let concernPicks = previous?.concernPicks;
|
|
26857
27004
|
if (args.concerns !== void 0) {
|
|
26858
|
-
if (id
|
|
27005
|
+
if (!concernsStageOf(id)) return fail2("forge_generate: concerns are settled in the Requirements and Review stages");
|
|
26859
27006
|
if (!Array.isArray(args.concerns)) return fail2("forge_generate: concerns must be an array of { id, answers }");
|
|
26860
27007
|
const picks = [];
|
|
26861
27008
|
for (const raw of args.concerns) {
|
|
@@ -26894,18 +27041,25 @@ var Forge = class {
|
|
|
26894
27041
|
const openedNames = opened.map((v) => views[v]?.name).filter(Boolean);
|
|
26895
27042
|
let data;
|
|
26896
27043
|
let decided = run.concerns;
|
|
26897
|
-
|
|
26898
|
-
|
|
27044
|
+
const stageDecided = [];
|
|
27045
|
+
const settled = [];
|
|
27046
|
+
if (concernsStageOf(id)) {
|
|
27047
|
+
if (id === "requirements") decided = [];
|
|
26899
27048
|
if (concernPicks?.length) {
|
|
26900
27049
|
data = facade.toDiagramData();
|
|
26901
27050
|
const roots = data.nodes.filter((n) => !n.parentId);
|
|
26902
27051
|
let top = roots.length ? Math.max(...roots.map((n) => n.y + n.height)) + IMPORT_GAP : 0;
|
|
27052
|
+
const metamodel = facade.getMetamodel?.();
|
|
27053
|
+
const modelNodes = facade.getNodes();
|
|
26903
27054
|
for (const pick of concernPicks) {
|
|
27055
|
+
const pack = this.concernPacks().find((p) => p.id === pick.id);
|
|
26904
27056
|
const concept = docToConcept(this.hub().docs.get(pick.id));
|
|
27057
|
+
const bindTo = id === "review" ? concernBindTargets(pack, modelNodes, facade.getRelations(), metamodel) : [];
|
|
26905
27058
|
const insert = buildConcernInsert(concept, {
|
|
26906
27059
|
answers: pick.answers,
|
|
26907
|
-
elements: [],
|
|
26908
|
-
|
|
27060
|
+
elements: bindTo.map((el) => modelNodes[el]),
|
|
27061
|
+
nodes: modelNodes,
|
|
27062
|
+
metamodel,
|
|
26909
27063
|
today: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
26910
27064
|
newId: () => crypto.randomUUID(),
|
|
26911
27065
|
place: ({ height }) => {
|
|
@@ -26918,7 +27072,8 @@ var Forge = class {
|
|
|
26918
27072
|
data.nodes.push(...Object.values(insert.nodes));
|
|
26919
27073
|
data.relations.push(...Object.values(insert.relations));
|
|
26920
27074
|
data.views = [...data.views ?? [], ...insert.views];
|
|
26921
|
-
decided.push(decidedConcern(
|
|
27075
|
+
(id === "requirements" ? decided : stageDecided).push(decidedConcern(pack, insert));
|
|
27076
|
+
settled.push({ name: pack.name, boundTo: bindTo });
|
|
26922
27077
|
}
|
|
26923
27078
|
readOnly = false;
|
|
26924
27079
|
}
|
|
@@ -26934,7 +27089,7 @@ var Forge = class {
|
|
|
26934
27089
|
const prompt = buildForgeStagePrompt(
|
|
26935
27090
|
id,
|
|
26936
27091
|
run.description,
|
|
26937
|
-
buildConcernsBlock(id, decided, nodes),
|
|
27092
|
+
buildConcernsBlock(id, [...decided, ...stageDecided], nodes),
|
|
26938
27093
|
clarifications,
|
|
26939
27094
|
priorSummaries,
|
|
26940
27095
|
needNode ? { id: needNode.id, label: needNode.label } : void 0,
|
|
@@ -26951,6 +27106,7 @@ var Forge = class {
|
|
|
26951
27106
|
FORGE_STAGES[stageIdx].blurb,
|
|
26952
27107
|
...openedNames.length ? [`Made the stage's views before it begins: ${openedNames.join(", ")}. What you add shows up in them as you add it.`] : [],
|
|
26953
27108
|
...id === "requirements" && decided.length ? [`Imported the concern packs the user confirmed, whole and unbound: ${decided.map((d) => d.name).join(", ")}. The C4 stage links them.`] : [],
|
|
27109
|
+
...id === "review" && settled.length ? [reviewConcernLine(settled, nodes)] : [],
|
|
26954
27110
|
"",
|
|
26955
27111
|
"Carry out the task at the end with the model tools (add_node, add_relation, update_node, move_node, search_model, \u2026).",
|
|
26956
27112
|
"A Forge stage only builds the model: do not change the metamodel, presentations or milestones.",
|
|
@@ -30513,7 +30669,7 @@ function htmlToMarkdown(html) {
|
|
|
30513
30669
|
`;
|
|
30514
30670
|
}
|
|
30515
30671
|
async function pdfText(bytes) {
|
|
30516
|
-
const { extractText, getDocumentProxy } = await import("./dist-
|
|
30672
|
+
const { extractText, getDocumentProxy } = await import("./dist-3IBN4PU7.js");
|
|
30517
30673
|
let timer2;
|
|
30518
30674
|
const late = new Promise((_, fail3) => {
|
|
30519
30675
|
timer2 = setTimeout(() => fail3(new Error(`not read within ${PDF_TIMEOUT / 1e3} s`)), PDF_TIMEOUT);
|
|
@@ -41973,6 +42129,23 @@ var FolderModel = class _FolderModel {
|
|
|
41973
42129
|
/** Saves `content` (the model before a Forge run) as the folder's base
|
|
41974
42130
|
* unless git saved one; a line for the answer when it did. A failed write
|
|
41975
42131
|
* never fails the call. */
|
|
42132
|
+
/** The gate a model made by Forge or Assay starts with, written into a
|
|
42133
|
+
* folder that has no check.json (ADR Strict gate for new models): Forge's
|
|
42134
|
+
* model starts with its code, so every rule is an error and every goal
|
|
42135
|
+
* 100%; Assay's describes code that was there, so every rule is an error
|
|
42136
|
+
* waiting for the baselines of its first run. */
|
|
42137
|
+
async writeGate(name) {
|
|
42138
|
+
if (name !== "forge_start" && name !== "assay_finish") return "";
|
|
42139
|
+
const file = join17(this.folder, CHECK_CONFIG_FILE);
|
|
42140
|
+
if (await stat4(file).then(() => true, () => false)) return "";
|
|
42141
|
+
const forge = name === "forge_start";
|
|
42142
|
+
await writeFile5(file, serializeCheckConfig(forge ? strictCheckConfig2() : existingCodeCheckConfig2()));
|
|
42143
|
+
return forge ? `
|
|
42144
|
+
|
|
42145
|
+
Wrote ${CHECK_CONFIG_FILE}, the gate the new model starts with: every rule an error and every goal at 100% (radical check and Studio's Inspector read it).` : `
|
|
42146
|
+
|
|
42147
|
+
Wrote ${CHECK_CONFIG_FILE} for existing code: every rule an error, waiting for the baselines of its first run. Once the model is complete, run radical check --adopt (with the test reports) and commit check.json.`;
|
|
42148
|
+
}
|
|
41976
42149
|
async saveForgeBase(content) {
|
|
41977
42150
|
try {
|
|
41978
42151
|
if (!mayReplaceWithForgeBase(await readEditorStateFile(this.folder, MODEL_BASE_FILE))) return "";
|
|
@@ -42438,7 +42611,7 @@ ${buildMetamodelBrief(metamodel2)}` };
|
|
|
42438
42611
|
result.commit?.();
|
|
42439
42612
|
if (FORGE_TOOLS.has(name)) await this.writeForgeStatus();
|
|
42440
42613
|
if (ASSAY_TOOLS.has(name)) await this.writeAssayStatus();
|
|
42441
|
-
return { ok: true, text: result.resultText + (forgeBase ? await this.saveForgeBase(forgeBase) : "") + (result.afterWrite ? await result.afterWrite() : "") };
|
|
42614
|
+
return { ok: true, text: result.resultText + (forgeBase ? await this.saveForgeBase(forgeBase) : "") + (result.afterWrite ? await result.afterWrite() : "") + await this.writeGate(name) };
|
|
42442
42615
|
}
|
|
42443
42616
|
let changed = result.data ?? facade.toDiagramData();
|
|
42444
42617
|
settleGeometry(data, changed);
|
|
@@ -42467,6 +42640,7 @@ ${buildMetamodelBrief(metamodel2)}` };
|
|
|
42467
42640
|
if (FORGE_TOOLS.has(name)) await this.writeForgeStatus();
|
|
42468
42641
|
if (ASSAY_TOOLS.has(name)) await this.writeAssayStatus();
|
|
42469
42642
|
if (forgeBase) outcome.text += await this.saveForgeBase(forgeBase);
|
|
42643
|
+
outcome.text += await this.writeGate(name);
|
|
42470
42644
|
if (this.refreshTools(metamodel)) return { ...outcome, toolsChanged: true };
|
|
42471
42645
|
return outcome;
|
|
42472
42646
|
} catch (error) {
|