kibi-cli 2.22.1 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-operation-metadata.d.ts +1 -1
- package/dist/cli-operation-metadata.js +1 -1
- package/dist/cli-register-foundation.d.ts.map +1 -1
- package/dist/cli-register-foundation.js +1 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +51 -3
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +28 -0
- package/dist/commands/migrate.d.ts +10 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +81 -9
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +15 -1
- package/dist/decision-firmness.d.ts +16 -4
- package/dist/decision-firmness.d.ts.map +1 -1
- package/dist/decision-firmness.js +29 -6
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +39 -36
- package/dist/intent-search.d.ts +2 -0
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +43 -4
- package/dist/operations/bootstrap/activation.d.ts +7 -1
- package/dist/operations/bootstrap/activation.d.ts.map +1 -1
- package/dist/operations/bootstrap/activation.js +27 -2
- package/dist/operations/bootstrap/candidate-helpers.d.ts +6 -0
- package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidate-helpers.js +19 -0
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +56 -16
- package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance-actions.js +14 -2
- package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance.js +6 -2
- package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
- package/dist/operations/bootstrap/intent-claims.js +2 -2
- package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/markdown-candidates.js +2 -2
- package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
- package/dist/operations/bootstrap/presentation.js +75 -9
- package/dist/operations/bootstrap/types.d.ts +6 -0
- package/dist/operations/bootstrap/types.d.ts.map +1 -1
- package/dist/operations/migration/firm-supersede.d.ts +19 -0
- package/dist/operations/migration/firm-supersede.d.ts.map +1 -0
- package/dist/operations/migration/firm-supersede.js +60 -0
- package/dist/operations/migration/kb-sources.d.ts +8 -5
- package/dist/operations/migration/kb-sources.d.ts.map +1 -1
- package/dist/operations/migration/kb-sources.js +50 -14
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +52 -2
- package/dist/operations/migration/source-paths.d.ts +18 -1
- package/dist/operations/migration/source-paths.d.ts.map +1 -1
- package/dist/operations/migration/source-paths.js +111 -16
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +22 -7
- package/dist/operations/mutation/requirement-semantics.d.ts +19 -1
- package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -1
- package/dist/operations/mutation/requirement-semantics.js +63 -2
- package/dist/operations/mutation/strict-fact.js +1 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +2 -1
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +22 -2
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +49 -17
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +7 -1
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +16 -3
- package/dist/public/impact/types.d.ts +2 -0
- package/dist/public/impact/types.d.ts.map +1 -1
- package/dist/public/operations/catalog.d.ts +8 -3
- 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 +10 -3
- package/dist/public/operations/check-helpers.d.ts +10 -0
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +54 -0
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +1 -0
- package/dist/public/operations/decision-firmness.d.ts +14 -0
- package/dist/public/operations/decision-firmness.d.ts.map +1 -1
- package/dist/public/operations/decision-firmness.js +60 -7
- package/dist/public/operations/discovery-executors.d.ts +18 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +80 -8
- package/dist/public/operations/schema6-check-actions.d.ts +4 -0
- package/dist/public/operations/schema6-check-actions.d.ts.map +1 -1
- package/dist/public/operations/schema6-check-actions.js +39 -2
- package/dist/public/operations/source-path-dangling.d.ts +1 -1
- package/dist/public/operations/source-path-dangling.d.ts.map +1 -1
- package/dist/public/operations/source-path-dangling.js +11 -2
- package/dist/public/operations/specs/composite.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +5 -0
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +5 -0
- package/dist/public/operations/specs/planning.d.ts +1 -1
- package/dist/public/operations/specs/planning.js +1 -1
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +6 -4
- package/dist/public/operations/specs/semantic.d.ts +1 -1
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +4 -2
- package/dist/public/operations/specs/upsert.d.ts +1 -1
- package/dist/public/operations/specs/upsert.js +1 -1
- package/dist/public/schemas/entity.js +1 -1
- package/dist/public/skills/kibi-bootstrap/SKILL.md +5 -4
- package/dist/public/skills/kibi-usage/SKILL.md +36 -16
- package/dist/public/skills/kibi-usage/resources/workflows.md +3 -1
- package/dist/schemas/entity.schema.json +1 -1
- package/dist/search-answer.d.ts +14 -0
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +51 -5
- package/dist/traceability/git-change-snapshot.d.ts +46 -0
- package/dist/traceability/git-change-snapshot.d.ts.map +1 -1
- package/dist/traceability/git-change-snapshot.js +187 -3
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +5 -6
- package/dist/traceability/staged-inventory-drift.d.ts +24 -0
- package/dist/traceability/staged-inventory-drift.d.ts.map +1 -0
- package/dist/traceability/staged-inventory-drift.js +84 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +1 -2
- package/dist/types/entities.d.ts +2 -2
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/content-freshness.d.ts +9 -0
- package/dist/utils/content-freshness.d.ts.map +1 -1
- package/dist/utils/content-freshness.js +33 -0
- package/dist/utils/kb-manifest.d.ts +7 -0
- package/dist/utils/kb-manifest.d.ts.map +1 -1
- package/dist/utils/kb-manifest.js +6 -0
- package/dist/utils/merge-driver-setup.d.ts +10 -0
- package/dist/utils/merge-driver-setup.d.ts.map +1 -0
- package/dist/utils/merge-driver-setup.js +69 -0
- package/dist/utils/rule-registry.generated.d.ts +1 -1
- package/dist/utils/rule-registry.generated.js +1 -1
- 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/src/public/impact/analyzer.ts +13 -1
- package/src/public/impact/diagnostics.ts +20 -3
- package/src/public/impact/types.ts +2 -0
- package/src/public/operations/check-executor.ts +16 -4
- package/src/public/operations/check-helpers.ts +65 -0
- package/src/public/operations/contracts.ts +1 -0
- package/src/public/operations/decision-firmness.ts +83 -10
- package/src/public/operations/discovery-executors.ts +124 -7
- package/src/public/operations/schema6-check-actions.ts +43 -2
- package/src/public/operations/source-path-dangling.ts +12 -2
- package/src/public/operations/specs/discovery.ts +6 -0
- package/src/public/operations/specs/planning.ts +1 -1
- package/src/public/operations/specs/reporting.ts +6 -4
- package/src/public/operations/specs/semantic.ts +4 -2
- package/src/public/operations/specs/upsert.ts +1 -1
- package/src/public/schemas/entity.ts +1 -1
- package/src/public/skills/kibi-bootstrap/SKILL.md +5 -4
- package/src/public/skills/kibi-usage/SKILL.md +36 -16
- package/src/public/skills/kibi-usage/resources/workflows.md +3 -1
- package/src/schemas/entity.schema.json +1 -1
|
@@ -4,6 +4,7 @@ import { analyzeSourceChanges, assertSourceAnalysisGate, } from "../../plugins/s
|
|
|
4
4
|
import { captureStagedSnapshot } from "../../traceability/git-change-snapshot.js";
|
|
5
5
|
import { readSnapshotKnowledge } from "../../traceability/snapshot-knowledge.js";
|
|
6
6
|
import { extractSymbolsFromStagedFileAsync } from "../../traceability/symbol-extract.js";
|
|
7
|
+
import { isTraceabilityRelationshipType } from "../symbol-granularity.js";
|
|
7
8
|
import { createSemanticReviewDiagnostics, createSymbolGranularityDiagnostics, } from "./diagnostics.js";
|
|
8
9
|
import { createImpactManifestLookup, readImpactManifestResults, } from "./manifest.js";
|
|
9
10
|
import { normalizeSourceFile } from "./source-changes.js";
|
|
@@ -90,7 +91,12 @@ export async function analyzeChangedFileImpact(options) {
|
|
|
90
91
|
manifestResults: activeManifestResults,
|
|
91
92
|
symbolsByFile,
|
|
92
93
|
}),
|
|
93
|
-
...createSemanticReviewDiagnostics({
|
|
94
|
+
...createSemanticReviewDiagnostics({
|
|
95
|
+
symbolsByFile,
|
|
96
|
+
linkedSourceFiles: new Set(activeManifestResults
|
|
97
|
+
.filter((result) => result.relationships.some((relationship) => isTraceabilityRelationshipType(relationship.type)))
|
|
98
|
+
.map((result) => result.sourceFile)),
|
|
99
|
+
}),
|
|
94
100
|
];
|
|
95
101
|
const maxDiagnostics = options.maxDiagnostics;
|
|
96
102
|
const cappedDiagnostics = maxDiagnostics !== undefined && maxDiagnostics >= 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../src/public/impact/diagnostics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAarF,OAAO,KAAK,EACV,iBAAiB,EACjB,gCAAgC,EAChC,mCAAmC,EACpC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../src/public/impact/diagnostics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAarF,OAAO,KAAK,EACV,iBAAiB,EACjB,gCAAgC,EAChC,mCAAmC,EACpC,MAAM,YAAY,CAAC;AA0FpB,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,mCAAmC,GAC3C,oBAAoB,EAAE,CAmExB;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,gCAAgC,GACxC,oBAAoB,EAAE,CAiCxB;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,SAAS,oBAAoB,EAAE,GAC3C,OAAO,CAET;AAED,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,SAAS,iBAAiB,EAAE,GACxC,OAAO,CAIT"}
|
|
@@ -40,6 +40,9 @@ function getGranularSymbolsForSourceFile(sourceFile, options) {
|
|
|
40
40
|
sourceSymbols: sourceSymbols.length > 0 ? sourceSymbols : (changedSymbols ?? []),
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
+
function hasTraceabilityLinks(symbol) {
|
|
44
|
+
return (symbol.relationships ?? []).some((relationship) => isTraceabilityRelationshipType(relationship.type));
|
|
45
|
+
}
|
|
43
46
|
function formatRelationshipTargets(symbol) {
|
|
44
47
|
const targets = [
|
|
45
48
|
...new Set((symbol.relationships ?? [])
|
|
@@ -116,15 +119,25 @@ export function createSemanticReviewDiagnostics(options) {
|
|
|
116
119
|
if (!isChangedBehavioralReviewCandidate(symbol))
|
|
117
120
|
continue;
|
|
118
121
|
const linkedTargets = formatRelationshipTargets(symbol);
|
|
122
|
+
const file = symbol.location.file;
|
|
123
|
+
// In a file no requirement owns at all, the changed behavior has no
|
|
124
|
+
// recorded intent, so the review is "record it", not "compare it with
|
|
125
|
+
// its links". Elsewhere a coarser symbol of the file may still own it.
|
|
126
|
+
const unlinked = !hasTraceabilityLinks(symbol) &&
|
|
127
|
+
!(options.linkedSourceFiles?.has(file) ?? false);
|
|
119
128
|
diagnostics.push({
|
|
120
129
|
id: "symbol_semantic_review_needed",
|
|
121
130
|
severity: "warning",
|
|
122
131
|
blocking: false,
|
|
123
132
|
category: "symbol",
|
|
124
|
-
files: [
|
|
133
|
+
files: [file],
|
|
125
134
|
docs: ["docs/symbol-traceability-taxonomy.md"],
|
|
126
|
-
message:
|
|
127
|
-
|
|
135
|
+
message: unlinked
|
|
136
|
+
? `Changed behavioral symbol ${symbol.name} is in a file no requirement owns, so no recorded intent covers the behavior it has after this change`
|
|
137
|
+
: `Changed behavioral symbol ${symbol.name} needs semantic review against linked Kibi coverage: ${linkedTargets}`,
|
|
138
|
+
suggestion: unlinked
|
|
139
|
+
? `If the change adds or alters behavior, record it with the change: kb_search({query:"<the behavior>", sourceLocations:[{path:"${file}"}]}) for a requirement that already describes it and link ${symbol.name} to it; if none does, kb_upsert a requirement with a scenario and link the symbol with implements. If behavior is unchanged (a refactor, renaming), say so in the final report instead.`
|
|
140
|
+
: `Use kb_search and kb_query for ${file}, then verify that ${linkedTargets} actually describe and test the changed behavior or UI copy. Update Kibi links or requirements/tests while the edit context is fresh.`,
|
|
128
141
|
});
|
|
129
142
|
}
|
|
130
143
|
}
|
|
@@ -32,6 +32,8 @@ export type SymbolGranularityDiagnosticsOptions = {
|
|
|
32
32
|
};
|
|
33
33
|
export type SemanticReviewDiagnosticsOptions = {
|
|
34
34
|
readonly symbolsByFile: SymbolsByFile;
|
|
35
|
+
/** Source files where some manifest symbol carries a traceability link. */
|
|
36
|
+
readonly linkedSourceFiles?: ReadonlySet<string>;
|
|
35
37
|
};
|
|
36
38
|
export type SymbolQualityDiagnosticsOptions = {
|
|
37
39
|
readonly manifestResults: readonly ExtractionResult[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/public/impact/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EACb,QAAQ,GACR,aAAa,GACb,UAAU,GACV,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,eAAe,GACf,MAAM,CAAC;IACX,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,G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C;IAC/C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC5D,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC5D,QAAQ,CAAC,cAAc,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -162,6 +162,11 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
162
162
|
readonly default: 0;
|
|
163
163
|
readonly description: "Optional zero-based pagination offset. Default: 0. Example: 50 to skip first 50 rows.";
|
|
164
164
|
};
|
|
165
|
+
readonly includeBody: {
|
|
166
|
+
readonly type: "boolean";
|
|
167
|
+
readonly default: false;
|
|
168
|
+
readonly description: "With id only: also return the entity's authored Markdown body (the prose after its front matter) as body {id, path, text}, so a stale statement in it can be corrected; kb_upsert document.body replaces it. Default: false.";
|
|
169
|
+
};
|
|
165
170
|
};
|
|
166
171
|
};
|
|
167
172
|
readonly requiresProlog: true;
|
|
@@ -503,7 +508,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
503
508
|
readonly items: {
|
|
504
509
|
readonly type: "string";
|
|
505
510
|
};
|
|
506
|
-
readonly description: "Optional complete list of atomic requirement clauses supplied by the caller. Use this for compound prose so every normative clause receives a stable claim key and independent grounding review.";
|
|
511
|
+
readonly description: "Optional complete list of atomic requirement clauses supplied by the caller. Each clause must be a verbatim fragment of text (whitespace may differ); a clause that does not occur in text fails the call with VALIDATION_FAILED naming it. Use this for compound prose so every normative clause receives a stable claim key and independent grounding review.";
|
|
507
512
|
};
|
|
508
513
|
readonly interpretations: {
|
|
509
514
|
readonly type: "array";
|
|
@@ -984,7 +989,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
984
989
|
}, {
|
|
985
990
|
readonly name: "kb_upsert";
|
|
986
991
|
readonly cliName: "upsert";
|
|
987
|
-
readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Pass a sectioned `document.body` when creating a requirement (the statement, then `## Context` stating why it exists, who asked and the source, then `## Source` with the verbatim excerpt) and a prose body for scenarios, tests, ADRs and observation facts; a result warning reports an entity whose body lacks context, and kb_check blocks it under entity-context-missing. Never invent a reason the requester did not give: write 'Reason not stated'. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.";
|
|
992
|
+
readonly description: "Create or update one entity and optional relationships. Use for KB mutations after validating intent; prefer a dryRun:true call first because it validates without writing and returns semantic advisor receipts for prose-heavy requirements. Use kb_model (mode requirement) before hand-writing strict property facts from prose, and kb_model (mode predicates) before hand-writing ontology predicate facts. Use the `relationships` array for batch creation of multiple links in a single call (e.g., linking a requirement to multiple tests or facts). An update keeps the properties and relationships it leaves out: send the fields that change (with title and status) and only the links to add. Prefer modeling requirements as reusable fact links (`constrains`, `requires_property`, or `requires_predicate`) so consistency and contradiction checks remain queryable. Relationship endpoints must already exist in KB. For requirements, the write will be rejected if it contradicts existing current requirements that constrain the same subject with incompatible properties. To replace a conflicting requirement, include a `supersedes` relationship from the new requirement to the old one in the same request, then upsert the old requirement with status closed (kb_check blocks a superseded requirement that is not closed). Successful writes may return non-blocking semantic advisor warnings; inspect and repair those warnings before treating prose as contradiction-checkable. Pass a sectioned `document.body` when creating a requirement (the statement, then `## Context` stating why it exists, who asked and the source, then `## Source` with the verbatim excerpt) and a prose body for scenarios, tests, ADRs and observation facts; a result warning reports an entity whose body lacks context, and kb_check blocks it under entity-context-missing. Never invent a reason the requester did not give: write 'Reason not stated'. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.";
|
|
988
993
|
readonly businessInputSchema: {
|
|
989
994
|
readonly type: "object";
|
|
990
995
|
readonly required: readonly ["type", "id", "properties"];
|
|
@@ -1992,7 +1997,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1992
1997
|
readonly minLength: 1;
|
|
1993
1998
|
};
|
|
1994
1999
|
readonly maxItems: 64;
|
|
1995
|
-
readonly description: "Optional complete atomic clause decomposition. Each assertive clause receives independent proposition accounting.";
|
|
2000
|
+
readonly description: "Optional complete atomic clause decomposition. Each clause must be a verbatim fragment of intent (whitespace may differ); a clause that does not occur in intent fails the call with VALIDATION_FAILED naming it. Each assertive clause receives independent proposition accounting.";
|
|
1996
2001
|
};
|
|
1997
2002
|
readonly semanticFacets: {
|
|
1998
2003
|
readonly type: "object";
|
|
@@ -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,EACtB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB
|
|
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,EACtB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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a,GAClB,qBAAqB,CAKvB;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,qBAAqB,CAElE;AAGD,wBAAgB,SAAS,IAAI,SAAS,qBAAqB,EAAE,CAE5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-executor.d.ts","sourceRoot":"","sources":["../../../src/public/operations/check-executor.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,sBAAsB,EACtB,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"check-executor.d.ts","sourceRoot":"","sources":["../../../src/public/operations/check-executor.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,sBAAsB,EACtB,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIL,iBAAiB,EAGjB,iBAAiB,EAGlB,MAAM,oBAAoB,CAAC;AAY5B,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,oBAAoB,CAAC;AAOvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAC1C,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,EAAE,CAAC;AACxE,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,GAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,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+PxC"}
|
|
@@ -3,7 +3,7 @@ import { resolveBranchAttachment } from "../../utils/branch-resolver.js";
|
|
|
3
3
|
import { BRANCH_STORE_NOT_COMPILED_RULE, inspectBranchStore, uncompiledBranchStoreReason, } from "../../utils/branch-store.js";
|
|
4
4
|
import { collectFullKbQualityDiagnostics } from "../impact-diagnostics.js";
|
|
5
5
|
import { buildStructuredContent, buildSummary, } from "./check-format-shared.js";
|
|
6
|
-
import { analyzeKbCheckImpact, collectQueryPlanSafetyViolations, getEffectiveRules, partitionCheckFindings, qualityDiagnosticsFromImpact, resolveCheckRules, stagedEntityIdStyleDiagnostics, } from "./check-helpers.js";
|
|
6
|
+
import { SCOPED_CHECK_OMITTED_ID, analyzeKbCheckImpact, collectQueryPlanSafetyViolations, getEffectiveRules, partitionCheckFindings, qualityDiagnosticsFromImpact, resolveCheckRules, scopeQualityDiagnosticsToImpact, stagedEntityIdStyleDiagnostics, } from "./check-helpers.js";
|
|
7
7
|
import { collectCheckPolicyViolations } from "./check-policy-rules.js";
|
|
8
8
|
import { collectDecisionFirmnessViolations } from "./decision-firmness.js";
|
|
9
9
|
import { executeStatus } from "./discovery-executors.js";
|
|
@@ -278,12 +278,19 @@ export async function executeCheck(args, context, options = {}) {
|
|
|
278
278
|
now: context.clock(),
|
|
279
279
|
...maxDiagnosticsOption,
|
|
280
280
|
});
|
|
281
|
+
// A check scoped to sourceFiles answers about those files; the KB-wide
|
|
282
|
+
// advisory scan only lists what concerns them.
|
|
283
|
+
const advisoryQualityDiagnostics = impactResult && args.sourceFiles !== undefined && !hasExplicitRules
|
|
284
|
+
? scopeQualityDiagnosticsToImpact(partitioned.qualityDiagnostics, impactResult)
|
|
285
|
+
: partitioned.qualityDiagnostics;
|
|
281
286
|
const qualityDiagnostics = [
|
|
282
|
-
...
|
|
287
|
+
...advisoryQualityDiagnostics,
|
|
283
288
|
...extraQualityDiagnostics,
|
|
284
289
|
];
|
|
285
290
|
const statusPlan = await readStatusMigrationPlan(context);
|
|
286
|
-
const migrationPlan = await migrationPlanForCheck(context, violations,
|
|
291
|
+
const migrationPlan = await migrationPlanForCheck(context, violations,
|
|
292
|
+
// The omitted-findings count is a pointer, not a repair to plan.
|
|
293
|
+
qualityDiagnostics.filter((diagnostic) => diagnostic.id !== SCOPED_CHECK_OMITTED_ID), statusPlan);
|
|
287
294
|
return {
|
|
288
295
|
content: [
|
|
289
296
|
{
|
|
@@ -14,6 +14,16 @@ export declare function partitionCheckFindings(findings: readonly Violation[]):
|
|
|
14
14
|
violations: Violation[];
|
|
15
15
|
qualityDiagnostics: QualityDiagnostic[];
|
|
16
16
|
};
|
|
17
|
+
export declare const SCOPED_CHECK_OMITTED_ID = "scoped_check_omitted_quality";
|
|
18
|
+
/**
|
|
19
|
+
* Advisory rule findings of a check scoped to `sourceFiles` that concern
|
|
20
|
+
* those files: findings on an entity a changed file's symbols link to (or on
|
|
21
|
+
* those symbols) and findings whose source is one of the files. The KB-wide rest (unapproved requirements elsewhere,
|
|
22
|
+
* unrelated scenarios) is reduced to one info diagnostic with per-rule counts,
|
|
23
|
+
* so a check after a small edit answers about that edit; kb_check without
|
|
24
|
+
* sourceFiles still lists every finding.
|
|
25
|
+
*/
|
|
26
|
+
export declare function scopeQualityDiagnosticsToImpact(diagnostics: readonly QualityDiagnostic[], impactResult: ChangedFileImpactResult): QualityDiagnostic[];
|
|
17
27
|
export declare function collectQueryPlanSafetyViolations(): Violation[];
|
|
18
28
|
/**
|
|
19
29
|
* Resolve the rules for one check invocation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-helpers.d.ts","sourceRoot":"","sources":["../../../src/public/operations/check-helpers.ts"],"names":[],"mappings":"AA0BA,OAAO,EACL,UAAU,EACV,KAAK,SAAS,EACd,iBAAiB,EAGlB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC;AAEzC;;;;;;;GAOG;AAEH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,GAAG;IACtE,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CACzC,CA0BA;AAQD,wBAAgB,gCAAgC,IAAI,SAAS,EAAE,CAU9D;AAED;;;;;;GAMG;AAEH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GAC9B,GAAG,CAAC,MAAM,CAAC,CAQb;AAED;;;;GAIG;AAEH,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GA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;;;;;GAMG;AAEH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GAC9B,GAAG,CAAC,MAAM,CAAC,CAQb;AAED;;;;GAIG;AAEH,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQxB;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAO1D;AAGD,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAoB9C;AAED;;;;GAIG;AAEH,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,GAC/B,SAAS,iBAAiB,EAAE,CAY9B;AAGD,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,uBAAuB,GAAG,SAAS,GAChD,SAAS,iBAAiB,EAAE,CAK9B"}
|
|
@@ -60,6 +60,60 @@ export function partitionCheckFindings(findings) {
|
|
|
60
60
|
}
|
|
61
61
|
return { violations, qualityDiagnostics };
|
|
62
62
|
}
|
|
63
|
+
export const SCOPED_CHECK_OMITTED_ID = "scoped_check_omitted_quality";
|
|
64
|
+
const OMITTED_RULES_SHOWN = 5;
|
|
65
|
+
/**
|
|
66
|
+
* Advisory rule findings of a check scoped to `sourceFiles` that concern
|
|
67
|
+
* those files: findings on an entity a changed file's symbols link to (or on
|
|
68
|
+
* those symbols) and findings whose source is one of the files. The KB-wide rest (unapproved requirements elsewhere,
|
|
69
|
+
* unrelated scenarios) is reduced to one info diagnostic with per-rule counts,
|
|
70
|
+
* so a check after a small edit answers about that edit; kb_check without
|
|
71
|
+
* sourceFiles still lists every finding.
|
|
72
|
+
*/
|
|
73
|
+
// implements REQ-cli-check
|
|
74
|
+
export function scopeQualityDiagnosticsToImpact(diagnostics, impactResult) {
|
|
75
|
+
const normalizePath = (value) => value.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
76
|
+
const files = new Set(impactResult.sourceFiles.map(normalizePath));
|
|
77
|
+
const entityIds = new Set();
|
|
78
|
+
for (const linked of impactResult.linkedEntities) {
|
|
79
|
+
entityIds.add(linked.id);
|
|
80
|
+
entityIds.add(linked.sourceSymbolId);
|
|
81
|
+
}
|
|
82
|
+
const inScope = (diagnostic) => (diagnostic.entityId !== undefined && entityIds.has(diagnostic.entityId)) ||
|
|
83
|
+
(diagnostic.source !== undefined &&
|
|
84
|
+
files.has(normalizePath(diagnostic.source))) ||
|
|
85
|
+
(diagnostic.files ?? []).some((file) => files.has(normalizePath(file)));
|
|
86
|
+
const kept = [];
|
|
87
|
+
const omittedByRule = new Map();
|
|
88
|
+
for (const diagnostic of diagnostics) {
|
|
89
|
+
if (inScope(diagnostic)) {
|
|
90
|
+
kept.push(diagnostic);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const rule = diagnostic.id.replace(/^rule\./, "");
|
|
94
|
+
omittedByRule.set(rule, (omittedByRule.get(rule) ?? 0) + 1);
|
|
95
|
+
}
|
|
96
|
+
if (omittedByRule.size === 0)
|
|
97
|
+
return kept;
|
|
98
|
+
const omitted = [...omittedByRule.values()].reduce((a, b) => a + b, 0);
|
|
99
|
+
const rules = [...omittedByRule.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
|
100
|
+
const shown = rules
|
|
101
|
+
.slice(0, OMITTED_RULES_SHOWN)
|
|
102
|
+
.map(([rule, count]) => `${rule} ×${count}`);
|
|
103
|
+
if (rules.length > OMITTED_RULES_SHOWN) {
|
|
104
|
+
shown.push(`${rules.length - OMITTED_RULES_SHOWN} more rules`);
|
|
105
|
+
}
|
|
106
|
+
kept.push({
|
|
107
|
+
id: SCOPED_CHECK_OMITTED_ID,
|
|
108
|
+
severity: "info",
|
|
109
|
+
blocking: false,
|
|
110
|
+
category: "integrity",
|
|
111
|
+
message: `This check is scoped to ${files.size} source ${files.size === 1 ? "file" : "files"}; ${omitted} advisory ${omitted === 1 ? "finding" : "findings"} elsewhere in the KB ${omitted === 1 ? "is" : "are"} not listed (${shown.join(", ")}). None of them concerns the checked files.`,
|
|
112
|
+
suggestion: "Run kb_check without sourceFiles for the full KB audit when it matters to the task.",
|
|
113
|
+
evidence: { omitted, byRule: Object.fromEntries(rules) },
|
|
114
|
+
});
|
|
115
|
+
return kept;
|
|
116
|
+
}
|
|
63
117
|
function resolveChecksPlPath() {
|
|
64
118
|
const override = getKbPlPathOverride();
|
|
65
119
|
return path.join(path.dirname(override ?? resolveKbPlPath()), "checks.pl");
|
|
@@ -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;
|
|
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;AAqaD,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"}
|
|
@@ -9,6 +9,11 @@ export declare const SUPERSEDES_REASON_MISSING_RULE = "supersedes-reason-missing
|
|
|
9
9
|
/** How many legacy supersedes the schema 9 migration acknowledged (info). */
|
|
10
10
|
export declare const SUPERSEDES_REASON_ACKNOWLEDGED_RULE = "supersedes-reason-acknowledged";
|
|
11
11
|
export declare const DECISION_FIRMNESS_RULES: readonly ["decision-firm-unreferenced", "decision-firm-superseded", "supersedes-reason-missing", "supersedes-reason-acknowledged"];
|
|
12
|
+
/**
|
|
13
|
+
* The schema version from which a decision without `firmness` reads its
|
|
14
|
+
* firmness from its origin, so a person's or imported rule is firm.
|
|
15
|
+
*/
|
|
16
|
+
export declare const FIRMNESS_FROM_ORIGIN_SCHEMA_VERSION = 10;
|
|
12
17
|
/** Every authored requirement and ADR. */
|
|
13
18
|
export declare function listDecisionEntities(workspaceRoot: string): AuthoredEntity[];
|
|
14
19
|
/**
|
|
@@ -27,9 +32,18 @@ export declare function authoredSupersedes(workspaceRoot: string, entities: read
|
|
|
27
32
|
export declare function unexplainedSupersedes(entities: readonly AuthoredEntity[], edges: ReadonlyMap<string, Set<string>>): AuthoredEntity[];
|
|
28
33
|
/** The supersede edges of an entity, as the manifest acknowledges them. */
|
|
29
34
|
export declare function supersedeAcknowledgements(id: string, edges: ReadonlyMap<string, Set<string>>): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Supersede edges (`FROM -> TO`) whose target reads as firm only because
|
|
37
|
+
* firmness follows origin (it has no `firmness` and an agent did not write
|
|
38
|
+
* it) and whose superseder is not firm, retired entities included. These
|
|
39
|
+
* were allowed before schema 10; the migration acknowledges them once.
|
|
40
|
+
*/
|
|
41
|
+
export declare function implicitFirmSupersedes(entities: readonly AuthoredEntity[], edges: ReadonlyMap<string, Set<string>>): string[];
|
|
30
42
|
/** Evaluate the firmness rules over authored requirements and ADRs. */
|
|
31
43
|
export declare function evaluateDecisionFirmness(entities: readonly AuthoredEntity[], edges: ReadonlyMap<string, Set<string>>, rules?: ReadonlySet<string>, acknowledged?: ReadonlySet<string>, options?: Readonly<{
|
|
32
44
|
schemaVersion?: number | null;
|
|
45
|
+
/** Edges the schema 10 migration recorded (`FROM -> TO`). */
|
|
46
|
+
firmSupersedeAcknowledged?: ReadonlySet<string>;
|
|
33
47
|
}>): Violation[];
|
|
34
48
|
/** Read the authored decisions once and evaluate the selected rules. */
|
|
35
49
|
export declare function collectDecisionFirmnessViolations(rules: ReadonlySet<string>, workspaceRoot: string): Violation[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-firmness.d.ts","sourceRoot":"","sources":["../../../src/public/operations/decision-firmness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decision-firmness.d.ts","sourceRoot":"","sources":["../../../src/public/operations/decision-firmness.ts"],"names":[],"mappings":"AAmCA,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;AAOX;;;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AED,wEAAwE;AAExE,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,aAAa,EAAE,MAAM,GACpB,SAAS,EAAE,CAgBb"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
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";
|
|
19
|
+
import { MIN_WHY_CHANGED_WORDS, WHY_THIS_CHANGED_HEADING, carriesFirmness, effectiveFirmness, firmnessIsImplicit, firmnessRef, supersedeAcknowledgement, whyThisChangedWords, } from "../../decision-firmness.js";
|
|
20
20
|
import { listLaneMarkdownFiles, readText, } from "../../operations/migration/kb-sources.js";
|
|
21
21
|
import { readAllShards } from "../../relationships/shards.js";
|
|
22
22
|
import { readKbManifest } from "../../utils/kb-manifest.js";
|
|
@@ -43,6 +43,18 @@ export const DECISION_FIRMNESS_RULES = [
|
|
|
43
43
|
const DECISION_LANES = ["requirements", "adr"];
|
|
44
44
|
/** The schema version from which a supersede must explain itself. */
|
|
45
45
|
const SUPERSEDES_REASON_SCHEMA_VERSION = 9;
|
|
46
|
+
/**
|
|
47
|
+
* The schema version from which a decision without `firmness` reads its
|
|
48
|
+
* firmness from its origin, so a person's or imported rule is firm.
|
|
49
|
+
*/
|
|
50
|
+
// implements REQ-kb-decision-firmness-from-origin
|
|
51
|
+
export const FIRMNESS_FROM_ORIGIN_SCHEMA_VERSION = 10;
|
|
52
|
+
/**
|
|
53
|
+
* Told on a KB older than schema 10: the pending schema upgrade acknowledges
|
|
54
|
+
* supersedes of decisions that only became firm when firmness started to
|
|
55
|
+
* follow origin.
|
|
56
|
+
*/
|
|
57
|
+
const PRE_SCHEMA10_FIRM_NOTE = " This decision has no firmness and was not written by an agent, so it reads as firm from schema 10; supersedes recorded before schema 10 are acknowledged by the plan's schema-config-upgrade (kibi migrate --yes).";
|
|
46
58
|
/**
|
|
47
59
|
* Told on a KB older than schema 9: the pending schema upgrade acknowledges
|
|
48
60
|
* supersedes recorded before the rule existed, so no edit is required now.
|
|
@@ -128,21 +140,51 @@ export function supersedeAcknowledgements(id, edges) {
|
|
|
128
140
|
.sort()
|
|
129
141
|
.map((target) => supersedeAcknowledgement(id, target));
|
|
130
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Supersede edges (`FROM -> TO`) whose target reads as firm only because
|
|
145
|
+
* firmness follows origin (it has no `firmness` and an agent did not write
|
|
146
|
+
* it) and whose superseder is not firm, retired entities included. These
|
|
147
|
+
* were allowed before schema 10; the migration acknowledges them once.
|
|
148
|
+
*/
|
|
149
|
+
// implements REQ-kb-decision-firmness-from-origin
|
|
150
|
+
export function implicitFirmSupersedes(entities, edges) {
|
|
151
|
+
const byId = new Map(entities.map((entity) => [entity.id, entity]));
|
|
152
|
+
const found = [];
|
|
153
|
+
for (const [from, targets] of edges) {
|
|
154
|
+
const source = byId.get(from);
|
|
155
|
+
if (source === undefined ||
|
|
156
|
+
effectiveFirmness(source.type, source.data.firmness, source.data.origin) === "firm")
|
|
157
|
+
continue;
|
|
158
|
+
for (const to of targets) {
|
|
159
|
+
const target = byId.get(to);
|
|
160
|
+
if (target !== undefined &&
|
|
161
|
+
firmnessIsImplicit(target.type, target.data.firmness) &&
|
|
162
|
+
effectiveFirmness(target.type, undefined, target.data.origin) === "firm")
|
|
163
|
+
found.push(supersedeAcknowledgement(from, to));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return found.sort();
|
|
167
|
+
}
|
|
131
168
|
/** Evaluate the firmness rules over authored requirements and ADRs. */
|
|
132
169
|
// implements REQ-kb-decision-firmness
|
|
133
170
|
export function evaluateDecisionFirmness(entities, edges, rules = new Set(DECISION_FIRMNESS_RULES), acknowledged = new Set(), options = {}) {
|
|
134
171
|
const preSchema9 = typeof options.schemaVersion === "number" &&
|
|
135
172
|
options.schemaVersion < SUPERSEDES_REASON_SCHEMA_VERSION;
|
|
173
|
+
const preSchema10 = typeof options.schemaVersion === "number" &&
|
|
174
|
+
options.schemaVersion < FIRMNESS_FROM_ORIGIN_SCHEMA_VERSION;
|
|
175
|
+
const firmAcknowledged = options.firmSupersedeAcknowledged ?? new Set();
|
|
136
176
|
const findings = [];
|
|
137
177
|
const superseded = supersededIds(edges);
|
|
138
178
|
const byId = new Map(entities.map((entity) => [entity.id, entity]));
|
|
139
179
|
const current = entities
|
|
140
180
|
.filter((entity) => isCurrentAuthoredEntity(entity, superseded))
|
|
141
181
|
.sort((left, right) => left.id.localeCompare(right.id));
|
|
142
|
-
const firmnessOf = (entity) => effectiveFirmness(entity.type, entity.data.firmness);
|
|
182
|
+
const firmnessOf = (entity) => effectiveFirmness(entity.type, entity.data.firmness, entity.data.origin);
|
|
183
|
+
// Only an authored `firmness: firm` must cite the person's words: a
|
|
184
|
+
// decision that reads as firm from its origin already names its author.
|
|
143
185
|
if (rules.has(DECISION_FIRM_UNREFERENCED_RULE)) {
|
|
144
186
|
for (const entity of current) {
|
|
145
|
-
if (
|
|
187
|
+
if (entity.data.firmness !== "firm")
|
|
146
188
|
continue;
|
|
147
189
|
if (firmnessRef({ type: entity.type, ...entity.data }) !== undefined)
|
|
148
190
|
continue;
|
|
@@ -162,11 +204,19 @@ export function evaluateDecisionFirmness(entities, edges, rules = new Set(DECISI
|
|
|
162
204
|
for (const entity of [...entities].sort((left, right) => left.id.localeCompare(right.id))) {
|
|
163
205
|
if (firmnessOf(entity) === "firm")
|
|
164
206
|
continue;
|
|
207
|
+
const implicit = new Set();
|
|
165
208
|
const firmTargets = [...(edges.get(entity.id) ?? [])]
|
|
166
209
|
.filter((id) => {
|
|
167
210
|
const target = byId.get(id);
|
|
168
|
-
|
|
169
|
-
|
|
211
|
+
if (target === undefined || firmnessOf(target) !== "firm")
|
|
212
|
+
return false;
|
|
213
|
+
if (!firmnessIsImplicit(target.type, target.data.firmness))
|
|
214
|
+
return true;
|
|
215
|
+
// Recorded before firmness followed origin: acknowledged once.
|
|
216
|
+
if (firmAcknowledged.has(supersedeAcknowledgement(entity.id, id)))
|
|
217
|
+
return false;
|
|
218
|
+
implicit.add(id);
|
|
219
|
+
return true;
|
|
170
220
|
})
|
|
171
221
|
.sort();
|
|
172
222
|
if (firmTargets.length === 0)
|
|
@@ -175,7 +225,7 @@ export function evaluateDecisionFirmness(entities, edges, rules = new Set(DECISI
|
|
|
175
225
|
rule: DECISION_FIRM_SUPERSEDED_RULE,
|
|
176
226
|
entityId: entity.id,
|
|
177
227
|
description: `${entity.id} (firmness: ${firmnessOf(entity)}) supersedes the firm decision${firmTargets.length === 1 ? "" : "s"} ${firmTargets.join(", ")}; only a human may change a firm decision`,
|
|
178
|
-
suggestion:
|
|
228
|
+
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${preSchema10 && implicit.size > 0 ? `.${PRE_SCHEMA10_FIRM_NOTE}` : ""}`,
|
|
179
229
|
source: entity.path,
|
|
180
230
|
evidence: { firmness: firmnessOf(entity), firmTargets },
|
|
181
231
|
});
|
|
@@ -222,5 +272,8 @@ export function collectDecisionFirmnessViolations(rules, workspaceRoot) {
|
|
|
222
272
|
return [];
|
|
223
273
|
const entities = listDecisionEntities(workspaceRoot);
|
|
224
274
|
const manifest = readKbManifest(workspaceRoot);
|
|
225
|
-
return evaluateDecisionFirmness(entities, authoredSupersedes(workspaceRoot, entities), rules, new Set(manifest?.supersedesReasonAcknowledged ?? []), {
|
|
275
|
+
return evaluateDecisionFirmness(entities, authoredSupersedes(workspaceRoot, entities), rules, new Set(manifest?.supersedesReasonAcknowledged ?? []), {
|
|
276
|
+
schemaVersion: manifest?.schemaVersion ?? null,
|
|
277
|
+
firmSupersedeAcknowledged: new Set(manifest?.firmSupersedeAcknowledged ?? []),
|
|
278
|
+
});
|
|
226
279
|
}
|
|
@@ -23,6 +23,8 @@ export type QueryInput = {
|
|
|
23
23
|
readonly distinct?: string;
|
|
24
24
|
readonly subjectKey?: string;
|
|
25
25
|
readonly propertyKey?: string;
|
|
26
|
+
/** With `id`: also return the entity's authored Markdown body. */
|
|
27
|
+
readonly includeBody?: boolean;
|
|
26
28
|
};
|
|
27
29
|
/** A ready-to-run follow-up call the query suggests. */
|
|
28
30
|
export type QueryNextCall = Readonly<{
|
|
@@ -53,7 +55,23 @@ export type QueryPayload = {
|
|
|
53
55
|
readonly factQuery?: FactQueryPayload;
|
|
54
56
|
/** Present when an empty answer came from a store never compiled for this branch. */
|
|
55
57
|
readonly branchStore?: SearchBranchStoreNotice;
|
|
58
|
+
/** Present when `includeBody` was requested for an `id`. */
|
|
59
|
+
readonly body?: QueryBody;
|
|
56
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* The authored Markdown body of the entity a kb_query `id` names: the text
|
|
63
|
+
* after its front matter, which kb_upsert `document.body` replaces. `text` is
|
|
64
|
+
* null when the entity has no readable authored document (a symbol, or a
|
|
65
|
+
* source that is not a workspace Markdown file).
|
|
66
|
+
*/
|
|
67
|
+
export type QueryBody = Readonly<{
|
|
68
|
+
id: string;
|
|
69
|
+
path: string | null;
|
|
70
|
+
text: string | null;
|
|
71
|
+
truncated?: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
/** Bodies longer than this are cut; the file itself stays the full record. */
|
|
74
|
+
export declare const QUERY_BODY_MAX_CHARS = 32000;
|
|
57
75
|
export declare const FACT_KINDS: readonly ["subject", "property_value", "predicate", "predicate_schema", "observation", "meta", "rule", "rule_schema"];
|
|
58
76
|
export type SearchInput = {
|
|
59
77
|
readonly query: string;
|
|
@@ -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":["../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