kibi-cli 2.20.0 → 2.21.2
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/cli-operation-metadata.d.ts +1 -1
- package/dist/cli-operation-metadata.js +1 -1
- package/dist/commands/doctor.js +13 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +15 -3
- package/dist/commands/legacy-storage-migration.d.ts.map +1 -1
- package/dist/commands/legacy-storage-migration.js +26 -1
- package/dist/commands/migrate.d.ts +2 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +155 -11
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +14 -2
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +4 -0
- package/dist/decision-firmness.d.ts +39 -0
- package/dist/decision-firmness.d.ts.map +1 -0
- package/dist/decision-firmness.js +115 -0
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +16 -1
- package/dist/operations/migration/kb-sources.d.ts +5 -1
- package/dist/operations/migration/kb-sources.d.ts.map +1 -1
- package/dist/operations/migration/kb-sources.js +28 -1
- package/dist/operations/migration/schema6.d.ts +2 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +44 -1
- package/dist/operations/migration/supersedes-reason.d.ts +26 -0
- package/dist/operations/migration/supersedes-reason.d.ts.map +1 -0
- package/dist/operations/migration/supersedes-reason.js +69 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +10 -2
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +11 -0
- package/dist/operations/modeling/predicate-types.d.ts +32 -1
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +175 -35
- package/dist/operations/mutation/delete.d.ts +5 -1
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +223 -17
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +1 -0
- package/dist/operations/mutation/source-authoring.d.ts +8 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +33 -0
- package/dist/operations/mutation/types.d.ts +37 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +54 -2
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +2 -1
- package/dist/operations/planning/apply-plan.d.ts +6 -1
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +8 -2
- package/dist/operations/semantic-advisor/clauses.d.ts +9 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +24 -0
- package/dist/public/operations/catalog.d.ts +14 -5
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +3 -0
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +29 -1
- package/dist/public/operations/decision-firmness.d.ts +34 -0
- package/dist/public/operations/decision-firmness.d.ts.map +1 -0
- package/dist/public/operations/decision-firmness.js +216 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +16 -2
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +37 -7
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +5 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +7 -2
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +13 -17
- package/dist/public/operations/specs/mutation.d.ts +6 -2
- package/dist/public/operations/specs/mutation.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation.js +6 -2
- package/dist/public/operations/specs/upsert.d.ts +7 -2
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +13 -13
- package/dist/public/skills/kibi-traceability/SKILL.md +6 -4
- package/dist/public/skills/kibi-usage/SKILL.md +52 -10
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +4 -2
- package/dist/public/skills/kibi-usage/resources/ui-requirements.md +2 -2
- package/dist/public/skills/kibi-usage/resources/workflows.md +1 -1
- package/dist/relationships/shards.d.ts +10 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +27 -11
- package/dist/schemas/entity.schema.json +30 -25
- package/dist/search-answer.d.ts +31 -2
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +115 -17
- package/dist/types/entities.d.ts +4 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/kb-manifest.d.ts +6 -0
- package/dist/utils/kb-manifest.d.ts.map +1 -1
- package/dist/utils/kb-manifest.js +6 -0
- package/dist/utils/rule-registry.generated.d.ts +21 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +25 -0
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.d.ts.map +1 -1
- package/dist/utils/schema-version.js +3 -1
- package/package.json +2 -2
- package/schema/entities.pl +6 -0
- package/src/public/operations/check-executor.ts +6 -0
- package/src/public/operations/contracts.ts +33 -1
- package/src/public/operations/decision-firmness.ts +280 -0
- package/src/public/operations/discovery-executors.ts +17 -2
- package/src/public/operations/migration-plan.ts +41 -9
- package/src/public/operations/specs/check-rules.generated.ts +5 -1
- package/src/public/operations/specs/mutation-schemas.ts +14 -17
- package/src/public/operations/specs/mutation.ts +7 -2
- package/src/public/schemas/entity.ts +14 -13
- package/src/public/skills/kibi-traceability/SKILL.md +6 -4
- package/src/public/skills/kibi-usage/SKILL.md +52 -10
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
- package/src/public/skills/kibi-usage/resources/source-authoring.md +4 -2
- package/src/public/skills/kibi-usage/resources/ui-requirements.md +2 -2
- package/src/public/skills/kibi-usage/resources/workflows.md +1 -1
- package/src/schemas/entity.schema.json +30 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/apply-plan.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAEV,gBAAgB,EAGjB,MAAM,0CAA0C,CAAC;AASlD,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,uBAAuB,CAAC;AAgE/B,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAGhB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,yBAAyB,EAAG,2BAAoC,CAAC;AA6G9E,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,IAAI,CAMN;AAED,wBAAgB,mCAAmC,CACjD,SAAS,EAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,EACnE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,IAAI,CAaN;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,e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sB,gBAAgB,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB;AACzB;;;GAGG;AACH,WAAW,GAAE,MAAM,IAAsB,GACxC,OAAO,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,eAAe,CAAC;CACpC,CAAC,CAmDD"}
|
|
@@ -2052,11 +2052,16 @@ async function recordBootstrapLockReclaims(context, journalPath, reclaimed) {
|
|
|
2052
2052
|
}, null, 2)}\n`);
|
|
2053
2053
|
}
|
|
2054
2054
|
// implements REQ-agent-guided-migration-orchestration, REQ-cli-canonical-runtime, REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-change-to-proof-plan-compiler-v2, REQ-kibi-predicate-vocabulary-migration
|
|
2055
|
-
export async function executeApplyPlan(args, context
|
|
2055
|
+
export async function executeApplyPlan(args, context,
|
|
2056
|
+
/**
|
|
2057
|
+
* Called once the plan's commit is authoritative, for a caller that holds
|
|
2058
|
+
* the workspace lock and must classify a later failure as committed.
|
|
2059
|
+
*/
|
|
2060
|
+
onCommitted = () => undefined) {
|
|
2056
2061
|
if (isBootstrapApplyArgs(args))
|
|
2057
2062
|
preflightBootstrapActions(validateBootstrapPlanShape(args), context);
|
|
2058
2063
|
if (!context.fs || context.sourceMutationLockHeld === true)
|
|
2059
|
-
return executeApplyPlanUnlocked(args, context);
|
|
2064
|
+
return executeApplyPlanUnlocked(args, context, onCommitted);
|
|
2060
2065
|
const applyingJournal = await applyingBootstrapJournal(args, context);
|
|
2061
2066
|
const lock = await acquireWorkspaceMutationLock(context.workspaceRoot, applyingJournal === undefined
|
|
2062
2067
|
? {}
|
|
@@ -2083,6 +2088,7 @@ export async function executeApplyPlan(args, context) {
|
|
|
2083
2088
|
sourceMutationLockHeld: true,
|
|
2084
2089
|
}, () => {
|
|
2085
2090
|
committed = true;
|
|
2091
|
+
onCommitted();
|
|
2086
2092
|
});
|
|
2087
2093
|
committed = true;
|
|
2088
2094
|
return result;
|
|
@@ -9,5 +9,14 @@ export declare function hasNormativeAssertion(text: string): boolean;
|
|
|
9
9
|
export declare function modeledClaimRole(text: string, modality?: string): "normative" | "descriptive";
|
|
10
10
|
export declare function normalizeSemanticClause(value: string): string;
|
|
11
11
|
export declare function semanticClaimKey(text: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Fill `claim_key` from `claim_text` on a fact that may ground a claim.
|
|
14
|
+
*
|
|
15
|
+
* The key is a pure function of the text, so a caller that sends the text
|
|
16
|
+
* alone has given Kibi everything it needs; a supplied key is still checked
|
|
17
|
+
* against the derived one by the entity validators. Observation and meta
|
|
18
|
+
* facts quote a claim without owning it, so they stay keyless.
|
|
19
|
+
*/
|
|
20
|
+
export declare function deriveFactClaimKey(entity: Record<string, unknown>): void;
|
|
12
21
|
export declare function extractSemanticClauses(text: string, suppliedClauses?: readonly string[]): readonly SemanticClause[];
|
|
13
22
|
//# sourceMappingURL=clauses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clauses.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/clauses.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACjC,CAAC,CAAC;AAmBH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3D;AAQD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,GAChB,WAAW,GAAG,aAAa,CAG7B;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AA4BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,SAAS,cAAc,EAAE,CA4B3B"}
|
|
1
|
+
{"version":3,"file":"clauses.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/clauses.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACjC,CAAC,CAAC;AAmBH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3D;AAQD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,GAChB,WAAW,GAAG,aAAa,CAG7B;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AAKD;;;;;;;GAOG;AAEH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAWxE;AA4BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,SAAS,cAAc,EAAE,CA4B3B"}
|
|
@@ -38,6 +38,30 @@ export function semanticClaimKey(text) {
|
|
|
38
38
|
const digest = createHash("sha256").update(normalized).digest("hex");
|
|
39
39
|
return `CLAIM-${digest.slice(0, 16).toUpperCase()}`;
|
|
40
40
|
}
|
|
41
|
+
/** Fact kinds that quote a claim as a review note and never ground it. */
|
|
42
|
+
const NON_GROUNDING_FACT_KINDS = new Set(["observation", "meta"]);
|
|
43
|
+
/**
|
|
44
|
+
* Fill `claim_key` from `claim_text` on a fact that may ground a claim.
|
|
45
|
+
*
|
|
46
|
+
* The key is a pure function of the text, so a caller that sends the text
|
|
47
|
+
* alone has given Kibi everything it needs; a supplied key is still checked
|
|
48
|
+
* against the derived one by the entity validators. Observation and meta
|
|
49
|
+
* facts quote a claim without owning it, so they stay keyless.
|
|
50
|
+
*/
|
|
51
|
+
// implements REQ-kibi-review-observation-claim-text-v2
|
|
52
|
+
export function deriveFactClaimKey(entity) {
|
|
53
|
+
if (entity.type !== "fact")
|
|
54
|
+
return;
|
|
55
|
+
if (entity.claim_key !== undefined)
|
|
56
|
+
return;
|
|
57
|
+
if (typeof entity.claim_text !== "string")
|
|
58
|
+
return;
|
|
59
|
+
if (typeof entity.fact_kind === "string" &&
|
|
60
|
+
NON_GROUNDING_FACT_KINDS.has(entity.fact_kind)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
entity.claim_key = semanticClaimKey(entity.claim_text);
|
|
64
|
+
}
|
|
41
65
|
function detectedClauses(text) {
|
|
42
66
|
return text
|
|
43
67
|
.split(/(?:\r?\n)+|;|(?<=[.!?])\s+(?=[A-Z0-9])/)
|
|
@@ -1117,6 +1117,11 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1117
1117
|
readonly minLength: 1;
|
|
1118
1118
|
readonly description: "Requirement-only. Optional reference to the exception's approval decision record.";
|
|
1119
1119
|
};
|
|
1120
|
+
readonly firmness: {
|
|
1121
|
+
readonly type: "string";
|
|
1122
|
+
readonly enum: readonly ["firm", "default", "exploratory"];
|
|
1123
|
+
readonly description: "req/adr only. firm = a human stated it as a rule (needs origin.ref to their words); default (when absent) = delegated or agent choice; exploratory = flagged guess.";
|
|
1124
|
+
};
|
|
1120
1125
|
readonly rationale: {
|
|
1121
1126
|
readonly type: "string";
|
|
1122
1127
|
readonly minLength: 1;
|
|
@@ -1521,11 +1526,11 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1521
1526
|
readonly claim_key: {
|
|
1522
1527
|
readonly type: "string";
|
|
1523
1528
|
readonly pattern: "^CLAIM-[A-F0-9]{16}$";
|
|
1524
|
-
readonly description: "Stable
|
|
1529
|
+
readonly description: "Stable key of the atomic prose clause grounded by this fact, derived from claim_text. Optional: when omitted, Kibi derives it; when sent, it must equal the derived key.";
|
|
1525
1530
|
};
|
|
1526
1531
|
readonly claim_text: {
|
|
1527
1532
|
readonly type: "string";
|
|
1528
|
-
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit.
|
|
1533
|
+
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. On a grounding fact Kibi derives claim_key from it; an observation or meta fact quotes the clause it is about without a key.";
|
|
1529
1534
|
};
|
|
1530
1535
|
readonly predicate_name: {
|
|
1531
1536
|
readonly type: "string";
|
|
@@ -1755,7 +1760,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1755
1760
|
}, {
|
|
1756
1761
|
readonly name: "kb_delete";
|
|
1757
1762
|
readonly cliName: "delete";
|
|
1758
|
-
readonly description: "Delete entities by ID. Use only for intentional removals after dependency checks. Do not use as a bulk cleanup shortcut. Side effects: mutates and saves KB; skips entities with dependents.";
|
|
1763
|
+
readonly description: "Delete entities by ID, or exact relationship triples. Use only for intentional removals after dependency checks. Do not use as a bulk cleanup shortcut. An entity authored in a Markdown or YAML source is not deleted directly: the call writes nothing and returns outcome plan_returned with a hash-bound deletionPlan and a nextActions entry holding the exact kb_apply_plan input ({plan, approvedPlanHash}); apply that unmodified, or repeat this call with approvedPlanHash = deletionPlan.planHash to apply the freshly computed plan in one step (a stale or different hash fails with DELETE_PLAN_HASH_MISMATCH and writes nothing). Authored requirements are never deleted: outcome supersession_required points to kb_upsert with a supersedes relationship. dryRun:true previews any delete and writes nothing. Side effects: mutates and saves KB and authored sources; skips entities with dependents; dryRun and plan_returned write nothing.";
|
|
1759
1764
|
readonly businessInputSchema: {
|
|
1760
1765
|
readonly type: "object";
|
|
1761
1766
|
readonly oneOf: readonly [{
|
|
@@ -1805,7 +1810,11 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1805
1810
|
readonly approvedPlanHash: {
|
|
1806
1811
|
readonly type: "string";
|
|
1807
1812
|
readonly pattern: "^[a-fA-F0-9]{64}$";
|
|
1808
|
-
readonly description: "
|
|
1813
|
+
readonly description: "With ids only: the deletionPlan.planHash a prior call for the same ids returned. The plan is recomputed and applied through kb_apply_plan when its hash still matches; a mismatch fails with DELETE_PLAN_HASH_MISMATCH and writes nothing. Not allowed with relationships or dryRun.";
|
|
1814
|
+
};
|
|
1815
|
+
readonly dryRun: {
|
|
1816
|
+
readonly type: "boolean";
|
|
1817
|
+
readonly description: "Preview without writing. Relationship and direct entity deletes run their preflight and return outcome dry_run with wouldDelete counts, the sourceWrites (paths and hashes) a commit would make, and skippedEffects. Authored ids return the same deletion plan as without dryRun.";
|
|
1809
1818
|
};
|
|
1810
1819
|
};
|
|
1811
1820
|
};
|
|
@@ -1825,7 +1834,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1825
1834
|
readonly type: "string";
|
|
1826
1835
|
readonly enum: readonly string[];
|
|
1827
1836
|
};
|
|
1828
|
-
readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, policy-ownership, policy-markers. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
|
|
1837
|
+
readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, branch-store-not-compiled, source-path-dangling, no-cycles, required-fields, deprecated-adr-no-successor, superseded-requirement-open, scenario-feasibility, scenario-feasibility-unknown, exception-claim-keys, numeric-string-value, rule-key-arguments-missing, domain-contradictions, logic-coverage, rule-safety, rule-verifiability, query-plan-safety, req-status-vocabulary, strict-fact-shape, strict-req-fact-pairing, predicate-verifiability, strict-readiness, semantic-completeness, related-requirement-unmodeled, proof-contract-symbols, entity-id-style, domain-redundancy, domain-implication, subject-key-identity, subject-key-shape, ontology-quality, exception-unapproved, exception-approval-self-attested, agent-requirement-unapproved, requirement-rationale-missing, symbol-owner-superseded, adr-unlinked, adr-proposed, predicate-schema-conformance, entity-context-missing, entity-context-acknowledged, decision-firm-unreferenced, decision-firm-superseded, supersedes-reason-missing, supersedes-reason-acknowledged, policy-ownership, policy-markers. If omitted, server runs canonical and advisory rules plus the full-KB qualityDiagnostics audit scan, including usage telemetry acceptance when evidence exists; migration rules run only when explicitly selected. Advisory and migration findings are non-blocking qualityDiagnostics. If supplied, server preserves scoped validation and skips the full-KB advisory scan.";
|
|
1829
1838
|
};
|
|
1830
1839
|
readonly sourceFiles: {
|
|
1831
1840
|
readonly type: "array";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/public/operations/catalog.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,qBAAqB,EACt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B,GAAG;IAClC,QAAQ,CAAC,6CAA6C,CAAC,EAAE,OAAO,CAAC;IACjE;;;;;;OAMG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAoFF;;;;;GAKG;AAEH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,gBAAgB,EACzB,aAAa,EAAE,MAAM,GACpB,SAAS,GAAG,IAAI,CAgClB;AAGD,wBAAsB,YAAY,CAChC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CA+OxC"}
|
|
@@ -5,6 +5,7 @@ import { collectFullKbQualityDiagnostics } from "../impact-diagnostics.js";
|
|
|
5
5
|
import { buildStructuredContent, buildSummary, } from "./check-format-shared.js";
|
|
6
6
|
import { analyzeKbCheckImpact, collectQueryPlanSafetyViolations, getEffectiveRules, partitionCheckFindings, qualityDiagnosticsFromImpact, resolveCheckRules, stagedEntityIdStyleDiagnostics, } from "./check-helpers.js";
|
|
7
7
|
import { collectCheckPolicyViolations } from "./check-policy-rules.js";
|
|
8
|
+
import { collectDecisionFirmnessViolations } from "./decision-firmness.js";
|
|
8
9
|
import { executeStatus } from "./discovery-executors.js";
|
|
9
10
|
import { collectEntityContextViolations } from "./entity-context.js";
|
|
10
11
|
import { buildActionsFromCheck, buildMigrationPlan, mergeMigrationPlans, } from "./migration-plan.js";
|
|
@@ -237,6 +238,7 @@ export async function executeCheck(args, context, options = {}) {
|
|
|
237
238
|
: [];
|
|
238
239
|
const originReviewFindings = await collectOriginReviewViolations(prolog, rulesAllowlist, workspaceRoot);
|
|
239
240
|
const entityContextFindings = collectEntityContextViolations(rulesAllowlist, workspaceRoot);
|
|
241
|
+
const decisionFirmnessFindings = collectDecisionFirmnessViolations(rulesAllowlist, workspaceRoot);
|
|
240
242
|
const checkPolicyFindings = await collectCheckPolicyViolations(prolog, rulesAllowlist, workspaceRoot);
|
|
241
243
|
const partitioned = partitionCheckFindings([
|
|
242
244
|
...aggregatedFindings,
|
|
@@ -246,6 +248,7 @@ export async function executeCheck(args, context, options = {}) {
|
|
|
246
248
|
...predicateConformanceFindings,
|
|
247
249
|
...originReviewFindings,
|
|
248
250
|
...entityContextFindings,
|
|
251
|
+
...decisionFirmnessFindings,
|
|
249
252
|
...checkPolicyFindings,
|
|
250
253
|
]);
|
|
251
254
|
const violations = partitioned.violations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/public/operations/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAsZpE;;uEAEuE;AACvE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAMrB;AA+
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/public/operations/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAsZpE;;uEAEuE;AACvE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAMrB;AA+ZD,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAC3C,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAa3C,CAAC;AAmDF,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAClD,YAAY,EAAE,MAAM,GACnB,IAAI,CAIN;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,SAAS,eAAe,EAAE,GAClC,SAAS,0BAA0B,EAAE,CAoBvC"}
|
|
@@ -464,6 +464,8 @@ const BASE_DATA_SCHEMAS = {
|
|
|
464
464
|
"record_ontology_gap",
|
|
465
465
|
"review_nonlogical",
|
|
466
466
|
"replace_grounding",
|
|
467
|
+
"extend_requirement",
|
|
468
|
+
"keep_existing_grounding",
|
|
467
469
|
],
|
|
468
470
|
},
|
|
469
471
|
recommendedPredicateSchema: { type: ["object", "null"] },
|
|
@@ -477,7 +479,14 @@ const BASE_DATA_SCHEMAS = {
|
|
|
477
479
|
type: ["string", "null"],
|
|
478
480
|
description: "The planned predicate fact id (FACT-PRED-...) that a requires_predicate link must target. Candidate ids (SUGGEST-...) are never relationship targets.",
|
|
479
481
|
},
|
|
480
|
-
existingGrounding:
|
|
482
|
+
existingGrounding: {
|
|
483
|
+
...recordArray,
|
|
484
|
+
description: "The grounding links requirementId already has for this claim: matched by claim_key (the same proposition text) or, for a predicate fact, by the recommended candidate's canonical_key (the same predicate tuple in other words; matchedBy says which).",
|
|
485
|
+
},
|
|
486
|
+
decisionConflicts: {
|
|
487
|
+
...recordArray,
|
|
488
|
+
description: "When no hash-bound plan ran the contradiction analysis: stored decision facts of current requirements that agree with the complete candidate on its key arguments and decide the opposite (requirementId, factId, effect, proposedEffect, canonicalKey). A warning repeats each one.",
|
|
489
|
+
},
|
|
481
490
|
replacementPlan: { type: ["object", "null"] },
|
|
482
491
|
bindingHints: {
|
|
483
492
|
...recordArray,
|
|
@@ -535,6 +544,10 @@ const BASE_DATA_SCHEMAS = {
|
|
|
535
544
|
relationships_created: integerValue,
|
|
536
545
|
warnings: valueArray,
|
|
537
546
|
semanticAdvisor: recordValue,
|
|
547
|
+
claimKey: {
|
|
548
|
+
...stringValue,
|
|
549
|
+
description: "For a fact with claim_text: the stored claim_key, derived from claim_text when the payload did not supply it.",
|
|
550
|
+
},
|
|
538
551
|
status: stringValue,
|
|
539
552
|
effectFailures: recordArray,
|
|
540
553
|
nextActions: recordArray,
|
|
@@ -569,6 +582,21 @@ const BASE_DATA_SCHEMAS = {
|
|
|
569
582
|
status: stringValue,
|
|
570
583
|
effectFailures: recordArray,
|
|
571
584
|
nextActions: recordArray,
|
|
585
|
+
outcome: {
|
|
586
|
+
type: "string",
|
|
587
|
+
enum: [
|
|
588
|
+
"plan_returned",
|
|
589
|
+
"supersession_required",
|
|
590
|
+
"plan_applied",
|
|
591
|
+
"dry_run",
|
|
592
|
+
],
|
|
593
|
+
description: "Absent on a direct delete. plan_returned: deletionPlan was returned and nothing was written; nextActions[0].input is the exact kb_apply_plan input. supersession_required: an authored requirement must be superseded with kb_upsert instead. plan_applied: approvedPlanHash matched and the plan was applied. dry_run: dryRun:true previewed the delete and nothing was written.",
|
|
594
|
+
},
|
|
595
|
+
dryRun: { const: true },
|
|
596
|
+
wouldDelete: recordValue,
|
|
597
|
+
planHash: stringValue,
|
|
598
|
+
sourcePaths: stringArray,
|
|
599
|
+
recoveryJournalId: stringValue,
|
|
572
600
|
}),
|
|
573
601
|
kb_check: {
|
|
574
602
|
description: "Synchronous check payload, or a kibi.job.v1 receipt when async:true detached the check into a background job (poll kb_job_status with the jobId).",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Violation } from "../../utils/rule-registry.js";
|
|
2
|
+
import { type AuthoredEntity } from "./entity-context.js";
|
|
3
|
+
/** A firm decision must cite the human words it rests on (blocking). */
|
|
4
|
+
export declare const DECISION_FIRM_UNREFERENCED_RULE = "decision-firm-unreferenced";
|
|
5
|
+
/** Only a firm decision may supersede a firm decision (blocking). */
|
|
6
|
+
export declare const DECISION_FIRM_SUPERSEDED_RULE = "decision-firm-superseded";
|
|
7
|
+
/** A supersede must say why under "Why this changed" (blocking). */
|
|
8
|
+
export declare const SUPERSEDES_REASON_MISSING_RULE = "supersedes-reason-missing";
|
|
9
|
+
/** How many legacy supersedes the schema 9 migration acknowledged (info). */
|
|
10
|
+
export declare const SUPERSEDES_REASON_ACKNOWLEDGED_RULE = "supersedes-reason-acknowledged";
|
|
11
|
+
export declare const DECISION_FIRMNESS_RULES: readonly ["decision-firm-unreferenced", "decision-firm-superseded", "supersedes-reason-missing", "supersedes-reason-acknowledged"];
|
|
12
|
+
/** Every authored requirement and ADR. */
|
|
13
|
+
export declare function listDecisionEntities(workspaceRoot: string): AuthoredEntity[];
|
|
14
|
+
/**
|
|
15
|
+
* Supersedes edges from requirements and ADRs, keyed by the superseding id,
|
|
16
|
+
* read from authored `links` and the relationship shards so the check and the
|
|
17
|
+
* migration agree before a sync. A shard edge whose source entity no longer
|
|
18
|
+
* exists is ignored: it must not make its target look replaced.
|
|
19
|
+
*/
|
|
20
|
+
export declare function authoredSupersedes(workspaceRoot: string, entities: readonly AuthoredEntity[]): Map<string, Set<string>>;
|
|
21
|
+
/**
|
|
22
|
+
* Superseding requirements and ADRs, whatever their status, without a "Why
|
|
23
|
+
* this changed" explanation. The schema 9 migration acknowledges their edges
|
|
24
|
+
* once, retired ones included, so one that becomes current again does not
|
|
25
|
+
* start blocking; read-only.
|
|
26
|
+
*/
|
|
27
|
+
export declare function unexplainedSupersedes(entities: readonly AuthoredEntity[], edges: ReadonlyMap<string, Set<string>>): AuthoredEntity[];
|
|
28
|
+
/** The supersede edges of an entity, as the manifest acknowledges them. */
|
|
29
|
+
export declare function supersedeAcknowledgements(id: string, edges: ReadonlyMap<string, Set<string>>): string[];
|
|
30
|
+
/** Evaluate the firmness rules over authored requirements and ADRs. */
|
|
31
|
+
export declare function evaluateDecisionFirmness(entities: readonly AuthoredEntity[], edges: ReadonlyMap<string, Set<string>>, rules?: ReadonlySet<string>, acknowledged?: ReadonlySet<string>): Violation[];
|
|
32
|
+
/** Read the authored decisions once and evaluate the selected rules. */
|
|
33
|
+
export declare function collectDecisionFirmnessViolations(rules: ReadonlySet<string>, workspaceRoot: string): Violation[];
|
|
34
|
+
//# sourceMappingURL=decision-firmness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-firmness.d.ts","sourceRoot":"","sources":["../../../src/public/operations/decision-firmness.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,qBAAqB,CAAC;AAE7B,wEAAwE;AAExE,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAC5E,qEAAqE;AAErE,eAAO,MAAM,6BAA6B,6BAA6B,CAAC;AACxE,oEAAoE;AAEpE,eAAO,MAAM,8BAA8B,8BAA8B,CAAC;AAC1E,6EAA6E;AAE7E,eAAO,MAAM,mCAAmC,mCACd,CAAC;AAGnC,eAAO,MAAM,uBAAuB,oIAK1B,CAAC;AAIX,0CAA0C;AAE1C,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc,EAAE,CAS5E;AAED;;;;;GAKG;AAEH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,SAAS,cAAc,EAAE,GAClC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CA+B1B;AASD;;;;;GAKG;AAEH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GACtC,cAAc,EAAE,CAQlB;AAED,2EAA2E;AAE3E,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GACtC,MAAM,EAAE,CAIV;AAED,uEAAuE;AAEvE,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EACvC,KAAK,GAAE,WAAW,CAAC,MAAM,CAAoC,EAC7D,YAAY,GAAE,WAAW,CAAC,MAAM,CAAa,GAC5C,SAAS,EAAE,CAiGb;AAED,wEAAwE;AAExE,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,aAAa,EAAE,MAAM,GACpB,SAAS,EAAE,CASb"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
import { MIN_WHY_CHANGED_WORDS, WHY_THIS_CHANGED_HEADING, carriesFirmness, effectiveFirmness, firmnessRef, supersedeAcknowledgement, whyThisChangedWords, } from "../../decision-firmness.js";
|
|
20
|
+
import { listLaneMarkdownFiles, readText, } from "../../operations/migration/kb-sources.js";
|
|
21
|
+
import { readAllShards } from "../../relationships/shards.js";
|
|
22
|
+
import { readKbManifest } from "../../utils/kb-manifest.js";
|
|
23
|
+
import { isCurrentAuthoredEntity, readAuthoredEntity, } from "./entity-context.js";
|
|
24
|
+
/** A firm decision must cite the human words it rests on (blocking). */
|
|
25
|
+
// implements REQ-kb-decision-firmness
|
|
26
|
+
export const DECISION_FIRM_UNREFERENCED_RULE = "decision-firm-unreferenced";
|
|
27
|
+
/** Only a firm decision may supersede a firm decision (blocking). */
|
|
28
|
+
// implements REQ-kb-decision-firmness
|
|
29
|
+
export const DECISION_FIRM_SUPERSEDED_RULE = "decision-firm-superseded";
|
|
30
|
+
/** A supersede must say why under "Why this changed" (blocking). */
|
|
31
|
+
// implements REQ-kb-decision-firmness
|
|
32
|
+
export const SUPERSEDES_REASON_MISSING_RULE = "supersedes-reason-missing";
|
|
33
|
+
/** How many legacy supersedes the schema 9 migration acknowledged (info). */
|
|
34
|
+
// implements REQ-kb-decision-firmness
|
|
35
|
+
export const SUPERSEDES_REASON_ACKNOWLEDGED_RULE = "supersedes-reason-acknowledged";
|
|
36
|
+
// implements REQ-kb-decision-firmness
|
|
37
|
+
export const DECISION_FIRMNESS_RULES = [
|
|
38
|
+
DECISION_FIRM_UNREFERENCED_RULE,
|
|
39
|
+
DECISION_FIRM_SUPERSEDED_RULE,
|
|
40
|
+
SUPERSEDES_REASON_MISSING_RULE,
|
|
41
|
+
SUPERSEDES_REASON_ACKNOWLEDGED_RULE,
|
|
42
|
+
];
|
|
43
|
+
const DECISION_LANES = ["requirements", "adr"];
|
|
44
|
+
/** Every authored requirement and ADR. */
|
|
45
|
+
// implements REQ-kb-decision-firmness
|
|
46
|
+
export function listDecisionEntities(workspaceRoot) {
|
|
47
|
+
const entities = [];
|
|
48
|
+
for (const file of listLaneMarkdownFiles(workspaceRoot, DECISION_LANES)) {
|
|
49
|
+
const content = readText(file.absolutePath);
|
|
50
|
+
if (content === null)
|
|
51
|
+
continue;
|
|
52
|
+
const entity = readAuthoredEntity(content, file.relativePath);
|
|
53
|
+
if (entity !== null && carriesFirmness(entity.type))
|
|
54
|
+
entities.push(entity);
|
|
55
|
+
}
|
|
56
|
+
return entities;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Supersedes edges from requirements and ADRs, keyed by the superseding id,
|
|
60
|
+
* read from authored `links` and the relationship shards so the check and the
|
|
61
|
+
* migration agree before a sync. A shard edge whose source entity no longer
|
|
62
|
+
* exists is ignored: it must not make its target look replaced.
|
|
63
|
+
*/
|
|
64
|
+
// implements REQ-kb-decision-firmness
|
|
65
|
+
export function authoredSupersedes(workspaceRoot, entities) {
|
|
66
|
+
const edges = new Map();
|
|
67
|
+
const known = new Set(entities.map((entity) => entity.id));
|
|
68
|
+
const add = (from, to) => {
|
|
69
|
+
const targets = edges.get(from) ?? new Set();
|
|
70
|
+
targets.add(to);
|
|
71
|
+
edges.set(from, targets);
|
|
72
|
+
};
|
|
73
|
+
for (const entity of entities) {
|
|
74
|
+
const links = entity.data.links;
|
|
75
|
+
if (!Array.isArray(links))
|
|
76
|
+
continue;
|
|
77
|
+
for (const link of links) {
|
|
78
|
+
if (link !== null &&
|
|
79
|
+
typeof link === "object" &&
|
|
80
|
+
link.type === "supersedes" &&
|
|
81
|
+
typeof link.target === "string") {
|
|
82
|
+
add(entity.id, link.target);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
for (const relationship of readAllShards(path.join(workspaceRoot, ".kb"))) {
|
|
88
|
+
if (relationship.type === "supersedes" && known.has(relationship.from))
|
|
89
|
+
add(relationship.from, relationship.to);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Malformed shards fail sync with their own diagnostic.
|
|
94
|
+
}
|
|
95
|
+
return edges;
|
|
96
|
+
}
|
|
97
|
+
function supersededIds(edges) {
|
|
98
|
+
const superseded = new Set();
|
|
99
|
+
for (const targets of edges.values())
|
|
100
|
+
for (const target of targets)
|
|
101
|
+
superseded.add(target);
|
|
102
|
+
return superseded;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Superseding requirements and ADRs, whatever their status, without a "Why
|
|
106
|
+
* this changed" explanation. The schema 9 migration acknowledges their edges
|
|
107
|
+
* once, retired ones included, so one that becomes current again does not
|
|
108
|
+
* start blocking; read-only.
|
|
109
|
+
*/
|
|
110
|
+
// implements REQ-kb-decision-firmness
|
|
111
|
+
export function unexplainedSupersedes(entities, edges) {
|
|
112
|
+
return entities
|
|
113
|
+
.filter((entity) => edges.has(entity.id) &&
|
|
114
|
+
whyThisChangedWords(entity.body) < MIN_WHY_CHANGED_WORDS)
|
|
115
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
116
|
+
}
|
|
117
|
+
/** The supersede edges of an entity, as the manifest acknowledges them. */
|
|
118
|
+
// implements REQ-kb-decision-firmness
|
|
119
|
+
export function supersedeAcknowledgements(id, edges) {
|
|
120
|
+
return [...(edges.get(id) ?? [])]
|
|
121
|
+
.sort()
|
|
122
|
+
.map((target) => supersedeAcknowledgement(id, target));
|
|
123
|
+
}
|
|
124
|
+
/** Evaluate the firmness rules over authored requirements and ADRs. */
|
|
125
|
+
// implements REQ-kb-decision-firmness
|
|
126
|
+
export function evaluateDecisionFirmness(entities, edges, rules = new Set(DECISION_FIRMNESS_RULES), acknowledged = new Set()) {
|
|
127
|
+
const findings = [];
|
|
128
|
+
const superseded = supersededIds(edges);
|
|
129
|
+
const byId = new Map(entities.map((entity) => [entity.id, entity]));
|
|
130
|
+
const current = entities
|
|
131
|
+
.filter((entity) => isCurrentAuthoredEntity(entity, superseded))
|
|
132
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
133
|
+
const firmnessOf = (entity) => effectiveFirmness(entity.type, entity.data.firmness);
|
|
134
|
+
if (rules.has(DECISION_FIRM_UNREFERENCED_RULE)) {
|
|
135
|
+
for (const entity of current) {
|
|
136
|
+
if (firmnessOf(entity) !== "firm")
|
|
137
|
+
continue;
|
|
138
|
+
if (firmnessRef({ type: entity.type, ...entity.data }) !== undefined)
|
|
139
|
+
continue;
|
|
140
|
+
findings.push({
|
|
141
|
+
rule: DECISION_FIRM_UNREFERENCED_RULE,
|
|
142
|
+
entityId: entity.id,
|
|
143
|
+
description: `${entity.id} is marked firmness: firm but names no human words it rests on (origin.ref${entity.type === "req" ? " or approval_ref" : ""} is missing)`,
|
|
144
|
+
suggestion: "Set origin.ref to the message, review or ticket where a human stated this rule; if no human stated it, use firmness: default (or exploratory for a guess)",
|
|
145
|
+
source: entity.path,
|
|
146
|
+
evidence: { type: entity.type, firmness: "firm" },
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Every superseder counts, retired ones too: replacing a non-firm
|
|
151
|
+
// superseder must not launder the overruled firm decision.
|
|
152
|
+
if (rules.has(DECISION_FIRM_SUPERSEDED_RULE)) {
|
|
153
|
+
for (const entity of [...entities].sort((left, right) => left.id.localeCompare(right.id))) {
|
|
154
|
+
if (firmnessOf(entity) === "firm")
|
|
155
|
+
continue;
|
|
156
|
+
const firmTargets = [...(edges.get(entity.id) ?? [])]
|
|
157
|
+
.filter((id) => {
|
|
158
|
+
const target = byId.get(id);
|
|
159
|
+
return (target !== undefined &&
|
|
160
|
+
effectiveFirmness(target.type, target.data.firmness) === "firm");
|
|
161
|
+
})
|
|
162
|
+
.sort();
|
|
163
|
+
if (firmTargets.length === 0)
|
|
164
|
+
continue;
|
|
165
|
+
findings.push({
|
|
166
|
+
rule: DECISION_FIRM_SUPERSEDED_RULE,
|
|
167
|
+
entityId: entity.id,
|
|
168
|
+
description: `${entity.id} (firmness: ${firmnessOf(entity)}) supersedes the firm decision${firmTargets.length === 1 ? "" : "s"} ${firmTargets.join(", ")}; only a human may change a firm decision`,
|
|
169
|
+
suggestion: "Ask the person who stated the firm decision; if they agree, mark the replacement firmness: firm with origin.ref to their words, otherwise remove the supersedes link and propose the change instead",
|
|
170
|
+
source: entity.path,
|
|
171
|
+
evidence: { firmness: firmnessOf(entity), firmTargets },
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const currentIds = new Set(current.map((entity) => entity.id));
|
|
176
|
+
const unexplained = unexplainedSupersedes(entities, edges).filter((entity) => currentIds.has(entity.id));
|
|
177
|
+
const isAcknowledged = (entity) => supersedeAcknowledgements(entity.id, edges).every((edge) => acknowledged.has(edge));
|
|
178
|
+
const exempt = unexplained.filter(isAcknowledged);
|
|
179
|
+
if (rules.has(SUPERSEDES_REASON_MISSING_RULE)) {
|
|
180
|
+
for (const entity of unexplained) {
|
|
181
|
+
if (isAcknowledged(entity))
|
|
182
|
+
continue;
|
|
183
|
+
const targets = [...(edges.get(entity.id) ?? [])].sort();
|
|
184
|
+
const unacknowledged = targets.filter((target) => !acknowledged.has(supersedeAcknowledgement(entity.id, target)));
|
|
185
|
+
findings.push({
|
|
186
|
+
rule: SUPERSEDES_REASON_MISSING_RULE,
|
|
187
|
+
entityId: entity.id,
|
|
188
|
+
description: `${entity.id} supersedes ${unacknowledged.join(", ")} without a '## ${WHY_THIS_CHANGED_HEADING}' section of at least ${MIN_WHY_CHANGED_WORDS} words`,
|
|
189
|
+
suggestion: `Add '## ${WHY_THIS_CHANGED_HEADING}' to the body: name the evidence (a failing test, a measured cost, a constraint the old decision missed, a new requirement) and answer the superseded decision's reasoning. A preference is not evidence; propose it instead of superseding.`,
|
|
190
|
+
source: entity.path,
|
|
191
|
+
evidence: { type: entity.type, supersedes: unacknowledged },
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (rules.has(SUPERSEDES_REASON_ACKNOWLEDGED_RULE) && exempt.length) {
|
|
196
|
+
findings.push({
|
|
197
|
+
rule: SUPERSEDES_REASON_ACKNOWLEDGED_RULE,
|
|
198
|
+
entityId: "workspace",
|
|
199
|
+
description: `${exempt.length} current superseding requirement${exempt.length === 1 ? " or ADR was" : "s and ADRs were"} recorded before schema 9 without a '${WHY_THIS_CHANGED_HEADING}' section`,
|
|
200
|
+
suggestion: "When you next touch one, add the reason if the history or a person states it; never invent one",
|
|
201
|
+
evidence: {
|
|
202
|
+
total: exempt.length,
|
|
203
|
+
ids: exempt.slice(0, 25).map((entity) => entity.id),
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return findings;
|
|
208
|
+
}
|
|
209
|
+
/** Read the authored decisions once and evaluate the selected rules. */
|
|
210
|
+
// implements REQ-kb-decision-firmness
|
|
211
|
+
export function collectDecisionFirmnessViolations(rules, workspaceRoot) {
|
|
212
|
+
if (!DECISION_FIRMNESS_RULES.some((rule) => rules.has(rule)))
|
|
213
|
+
return [];
|
|
214
|
+
const entities = listDecisionEntities(workspaceRoot);
|
|
215
|
+
return evaluateDecisionFirmness(entities, authoredSupersedes(workspaceRoot, entities), rules, new Set(readKbManifest(workspaceRoot)?.supersedesReasonAcknowledged ?? []));
|
|
216
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-executors.d.ts","sourceRoot":"","sources":["../../../src/public/operations/discovery-executors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery-executors.d.ts","sourceRoot":"","sources":["../../../src/public/operations/discovery-executors.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,wBAAwB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EACL,yBAAyB,EACzB,KAAK,qBAAqB,EAM3B,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAGnB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,MAAM,UAAU,GAAG;IACvB,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,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAmUzC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { compilerFingerprintReason } from "../../commands/sync/cache.js";
|
|
3
|
+
import { effectiveFirmness } from "../../decision-firmness.js";
|
|
3
4
|
import { EngineClient } from "../../engine.js";
|
|
4
5
|
import { executeIntentSearch, validateIntentSearchInput, } from "../../intent-search.js";
|
|
5
6
|
import { classifyActivation } from "../../operations/bootstrap/activation.js";
|
|
@@ -288,7 +289,12 @@ function factRowSummary(row) {
|
|
|
288
289
|
const names = Array.isArray(row.argumentNames)
|
|
289
290
|
? row.argumentNames.map(String).join(", ")
|
|
290
291
|
: "";
|
|
291
|
-
|
|
292
|
+
// A built-in schema is no stored entity: its id is for kb_model's
|
|
293
|
+
// schemaId, not for a kb_query by id.
|
|
294
|
+
const builtin = row.builtin === true
|
|
295
|
+
? ` [builtin${id ? ` ${id}` : ""}, not a stored entity]`
|
|
296
|
+
: "";
|
|
297
|
+
return `${row.name}(${names})${builtin}`;
|
|
292
298
|
}
|
|
293
299
|
return `${id} (${String(row.title ?? "")})`;
|
|
294
300
|
}
|
|
@@ -433,7 +439,15 @@ export async function executeQuery(input, context) {
|
|
|
433
439
|
const indexedPage = prolog.queryEntities
|
|
434
440
|
? await prolog.queryEntities(pageInput, signal)
|
|
435
441
|
: await queryEntitiesViaQuery(prolog, pageInput, signal);
|
|
436
|
-
|
|
442
|
+
// A requirement or ADR without authored firmness reads as `default`;
|
|
443
|
+
// the row says so, so a reader never has to know the default.
|
|
444
|
+
// implements REQ-kb-decision-firmness
|
|
445
|
+
const paginated = indexedPage.entities.map((entity) => {
|
|
446
|
+
const firmness = effectiveFirmness(entity.type, entity.firmness);
|
|
447
|
+
return firmness === undefined || entity.firmness === firmness
|
|
448
|
+
? entity
|
|
449
|
+
: { ...entity, firmness };
|
|
450
|
+
});
|
|
437
451
|
const text = indexedPage.count === 0
|
|
438
452
|
? `No entities found${type ? ` of type '${type}'` : ""}.`
|
|
439
453
|
: `Found ${indexedPage.count} entities${type ? ` of type '${type}'` : ""}. Showing ${paginated.length} (offset ${offset}, limit ${limit}): ${paginated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-plan.d.ts","sourceRoot":"","sources":["../../../src/public/operations/migration-plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migration-plan.d.ts","sourceRoot":"","sources":["../../../src/public/operations/migration-plan.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,sBAAsB,EAAG,wBAAiC,CAAC;AAExE,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAChF,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,CAAC;IACP,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC1C,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,KAAK,CAAC;IACZ,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEP,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EACJ,SAAS,GACT,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,WAAW,GACX,cAAc,GACd,QAAQ,GACR,UAAU,GACV,OAAO,GACP,SA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