kibi-cli 0.12.8 → 0.14.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.js +1 -0
- package/dist/commands/check.d.ts +1 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +117 -82
- package/dist/commands/discovery-shared.d.ts +1 -0
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +2 -191
- package/dist/commands/discovery-table.d.ts +3 -0
- package/dist/commands/discovery-table.d.ts.map +1 -0
- package/dist/commands/discovery-table.js +204 -0
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +8 -1
- package/dist/commands/sync/extraction.d.ts +6 -1
- package/dist/commands/sync/extraction.d.ts.map +1 -1
- package/dist/commands/sync/extraction.js +7 -3
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +29 -1
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +18 -0
- package/dist/extractors/markdown.d.ts +6 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.d.ts +1 -1
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +62 -0
- package/dist/public/impact/analyzer.d.ts +3 -0
- package/dist/public/impact/analyzer.d.ts.map +1 -0
- package/dist/public/impact/analyzer.js +54 -0
- package/dist/public/impact/coverage-depth-quality.d.ts +4 -0
- package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -0
- package/dist/public/impact/coverage-depth-quality.js +179 -0
- package/dist/public/impact/diagnostics.d.ts +7 -0
- package/dist/public/impact/diagnostics.d.ts.map +1 -0
- package/dist/public/impact/diagnostics.js +122 -0
- package/dist/public/impact/diff-meaning.d.ts +2 -0
- package/dist/public/impact/diff-meaning.d.ts.map +1 -0
- package/dist/public/impact/diff-meaning.js +101 -0
- package/dist/public/impact/full-kb-quality.d.ts +10 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -0
- package/dist/public/impact/full-kb-quality.js +158 -0
- package/dist/public/impact/manifest.d.ts +5 -0
- package/dist/public/impact/manifest.d.ts.map +1 -0
- package/dist/public/impact/manifest.js +43 -0
- package/dist/public/impact/requirement-quality.d.ts +4 -0
- package/dist/public/impact/requirement-quality.d.ts.map +1 -0
- package/dist/public/impact/requirement-quality.js +216 -0
- package/dist/public/impact/source-changes.d.ts +5 -0
- package/dist/public/impact/source-changes.d.ts.map +1 -0
- package/dist/public/impact/source-changes.js +129 -0
- package/dist/public/impact/summaries.d.ts +6 -0
- package/dist/public/impact/summaries.d.ts.map +1 -0
- package/dist/public/impact/summaries.js +68 -0
- package/dist/public/impact/symbol-quality-model.d.ts +21 -0
- package/dist/public/impact/symbol-quality-model.d.ts.map +1 -0
- package/dist/public/impact/symbol-quality-model.js +116 -0
- package/dist/public/impact/symbol-quality.d.ts +4 -0
- package/dist/public/impact/symbol-quality.d.ts.map +1 -0
- package/dist/public/impact/symbol-quality.js +159 -0
- package/dist/public/impact/types.d.ts +79 -0
- package/dist/public/impact/types.d.ts.map +1 -0
- package/dist/public/impact/types.js +1 -0
- package/dist/public/impact-diagnostics.d.ts +7 -0
- package/dist/public/impact-diagnostics.d.ts.map +1 -0
- package/dist/public/impact-diagnostics.js +5 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +21 -0
- package/dist/public/skills/kibi-usage/SKILL.md +13 -5
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
- package/dist/public/skills/kibi-usage/resources/relationship-directions.md +30 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +14 -0
- package/dist/public/symbol-granularity.d.ts +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.js +2 -0
- package/dist/traceability/evidence-model.d.ts +1 -1
- package/dist/traceability/evidence-model.d.ts.map +1 -1
- package/dist/traceability/evidence-model.js +1 -1
- package/dist/traceability/staged-diagnostics.d.ts +6 -6
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +12 -6
- package/dist/traceability/staged-impact-contract.js +1 -1
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +23 -1
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +41 -0
- package/dist/types/entities.d.ts +5 -1
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/prolog-query-plan-safety.d.ts +8 -0
- package/dist/utils/prolog-query-plan-safety.d.ts.map +1 -0
- package/dist/utils/prolog-query-plan-safety.js +47 -0
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.js +12 -0
- package/package.json +6 -2
- package/schema/entities.pl +4 -0
- package/src/public/impact/analyzer.ts +90 -0
- package/src/public/impact/coverage-depth-quality.ts +268 -0
- package/src/public/impact/diagnostics.ts +192 -0
- package/src/public/impact/diff-meaning.ts +121 -0
- package/src/public/impact/full-kb-quality.ts +203 -0
- package/src/public/impact/manifest.ts +57 -0
- package/src/public/impact/requirement-quality.ts +282 -0
- package/src/public/impact/source-changes.ts +180 -0
- package/src/public/impact/summaries.ts +100 -0
- package/src/public/impact/symbol-quality-model.ts +171 -0
- package/src/public/impact/symbol-quality.ts +207 -0
- package/src/public/impact/types.ts +99 -0
- package/src/public/impact-diagnostics.ts +22 -0
- package/src/public/schemas/entity.ts +23 -0
- package/src/public/skills/kibi-usage/SKILL.md +13 -5
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
- package/src/public/skills/kibi-usage/resources/relationship-directions.md +30 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +14 -0
- package/src/public/symbol-granularity.ts +4 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { isAllowedGranularityReason } from "../symbol-granularity.js";
|
|
2
|
+
import { AGGREGATE_KINDS, collectSymbols, isModuleOrConfig, narrowerExtractedSymbols, narrowerManifestSymbols, } from "./symbol-quality-model.js";
|
|
3
|
+
function thresholdFor(symbol) {
|
|
4
|
+
return AGGREGATE_KINDS.has(symbol.kind) ? 4 : 2;
|
|
5
|
+
}
|
|
6
|
+
function isMultiRequirementCandidate(symbol) {
|
|
7
|
+
if (isModuleOrConfig(symbol)) {
|
|
8
|
+
return !isAllowedGranularityReason(symbol.result.entity.granularity_reason);
|
|
9
|
+
}
|
|
10
|
+
return symbol.role === "behavioral";
|
|
11
|
+
}
|
|
12
|
+
function createMultiRequirementDiagnostics(symbols) {
|
|
13
|
+
return symbols.flatMap((symbol) => {
|
|
14
|
+
if (!isMultiRequirementCandidate(symbol))
|
|
15
|
+
return [];
|
|
16
|
+
const threshold = thresholdFor(symbol);
|
|
17
|
+
if (symbol.requirementTargetIds.length <= threshold)
|
|
18
|
+
return [];
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
id: "multi_requirement_symbol_review",
|
|
22
|
+
severity: "review",
|
|
23
|
+
blocking: false,
|
|
24
|
+
category: "symbol",
|
|
25
|
+
entityId: symbol.id,
|
|
26
|
+
source: symbol.source,
|
|
27
|
+
files: [symbol.source, symbol.sourceFile],
|
|
28
|
+
docs: ["docs/symbol-traceability-taxonomy.md"],
|
|
29
|
+
message: `Symbol ${symbol.id} implements ${symbol.requirementTargetIds.length} requirements, above the ${threshold} target review threshold.`,
|
|
30
|
+
suggestion: "Review whether this symbol owns multiple unrelated behaviors; move relationships to narrower behavioral symbols or add a valid granularity_reason when broad ownership is intentional.",
|
|
31
|
+
evidence: {
|
|
32
|
+
targetIds: symbol.requirementTargetIds,
|
|
33
|
+
targetCount: symbol.requirementTargetIds.length,
|
|
34
|
+
threshold,
|
|
35
|
+
symbolKind: symbol.kind,
|
|
36
|
+
symbolRole: symbol.role,
|
|
37
|
+
sourceFile: symbol.sourceFile,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function hasDistinctCoordinates(symbols) {
|
|
44
|
+
const coordinateKeys = symbols.map((symbol) => symbol.coordinateKey);
|
|
45
|
+
if (coordinateKeys.some((key) => key === null))
|
|
46
|
+
return false;
|
|
47
|
+
return new Set(coordinateKeys).size === coordinateKeys.length;
|
|
48
|
+
}
|
|
49
|
+
function createDuplicateCoordinateDiagnostics(symbols) {
|
|
50
|
+
const groups = Map.groupBy(symbols, (symbol) => `${symbol.sourceFile}\u0000${symbol.title}`);
|
|
51
|
+
return [...groups.values()].flatMap((group) => {
|
|
52
|
+
if (group.length < 2)
|
|
53
|
+
return [];
|
|
54
|
+
if (hasDistinctCoordinates(group))
|
|
55
|
+
return [];
|
|
56
|
+
const first = group[0];
|
|
57
|
+
if (first === undefined)
|
|
58
|
+
return [];
|
|
59
|
+
const candidateIds = group.map((symbol) => symbol.id).sort();
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
id: "duplicate_symbol_coordinate_review",
|
|
63
|
+
severity: "review",
|
|
64
|
+
blocking: false,
|
|
65
|
+
category: "coordinate",
|
|
66
|
+
entityId: first.id,
|
|
67
|
+
source: first.source,
|
|
68
|
+
files: [first.source, first.sourceFile],
|
|
69
|
+
docs: ["docs/symbol-traceability-taxonomy.md"],
|
|
70
|
+
message: `Symbols ${candidateIds.join(", ")} share title ${first.title} and source ${first.sourceFile} without distinct coordinate evidence.`,
|
|
71
|
+
suggestion: "Refresh symbol coordinates or rename member-level manifest entries so duplicate modeled symbols are distinguishable after parsing.",
|
|
72
|
+
evidence: {
|
|
73
|
+
candidateIds,
|
|
74
|
+
title: first.title,
|
|
75
|
+
sourceFile: first.sourceFile,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function requirementTagsById(results) {
|
|
82
|
+
const tagsById = new Map();
|
|
83
|
+
for (const result of results) {
|
|
84
|
+
if (result.entity.type !== "req")
|
|
85
|
+
continue;
|
|
86
|
+
tagsById.set(result.entity.id, [...(result.entity.tags ?? [])].sort());
|
|
87
|
+
}
|
|
88
|
+
return tagsById;
|
|
89
|
+
}
|
|
90
|
+
function tagsForTargets(targetIds, tagsByRequirementId) {
|
|
91
|
+
return [
|
|
92
|
+
...new Set(targetIds.flatMap((targetId) => tagsByRequirementId.get(targetId) ?? [])),
|
|
93
|
+
].sort();
|
|
94
|
+
}
|
|
95
|
+
function hasSharedRequirementTag(targetIds, tagsByRequirementId) {
|
|
96
|
+
const tagSets = targetIds
|
|
97
|
+
.map((targetId) => new Set(tagsByRequirementId.get(targetId) ?? []))
|
|
98
|
+
.filter((tagSet) => tagSet.size > 0);
|
|
99
|
+
const first = tagSets[0];
|
|
100
|
+
if (first === undefined || tagSets.length !== targetIds.length)
|
|
101
|
+
return false;
|
|
102
|
+
return [...first].some((tag) => tagSets.every((tagSet) => tagSet.has(tag)));
|
|
103
|
+
}
|
|
104
|
+
function isMixedPurposeCandidate(symbol) {
|
|
105
|
+
return AGGREGATE_KINDS.has(symbol.kind) || isModuleOrConfig(symbol);
|
|
106
|
+
}
|
|
107
|
+
function createMixedPurposeDiagnostics(symbols, options) {
|
|
108
|
+
const tagsByRequirementId = requirementTagsById(options.manifestResults);
|
|
109
|
+
return symbols.flatMap((symbol) => {
|
|
110
|
+
if (!isMixedPurposeCandidate(symbol))
|
|
111
|
+
return [];
|
|
112
|
+
const manifestChildren = narrowerManifestSymbols(symbol, symbols);
|
|
113
|
+
const extractedChildren = narrowerExtractedSymbols(symbol, options.symbolsByFile);
|
|
114
|
+
if (manifestChildren.length === 0 && extractedChildren.length === 0)
|
|
115
|
+
return [];
|
|
116
|
+
const requirementTags = tagsForTargets(symbol.requirementTargetIds, tagsByRequirementId);
|
|
117
|
+
if (requirementTags.length < 3)
|
|
118
|
+
return [];
|
|
119
|
+
if (hasSharedRequirementTag(symbol.requirementTargetIds, tagsByRequirementId)) {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
const narrowerSymbolIds = [
|
|
123
|
+
...new Set([
|
|
124
|
+
...manifestChildren.map((child) => child.id),
|
|
125
|
+
...extractedChildren.map((child) => child.id),
|
|
126
|
+
]),
|
|
127
|
+
].sort();
|
|
128
|
+
return [
|
|
129
|
+
{
|
|
130
|
+
id: "component_mixed_purpose_review",
|
|
131
|
+
severity: "review",
|
|
132
|
+
blocking: false,
|
|
133
|
+
category: "mixed-purpose",
|
|
134
|
+
entityId: symbol.id,
|
|
135
|
+
source: symbol.source,
|
|
136
|
+
files: [symbol.source, symbol.sourceFile],
|
|
137
|
+
docs: ["docs/symbol-traceability-taxonomy.md"],
|
|
138
|
+
message: `Symbol ${symbol.id} spans unrelated requirement tag clusters while narrower same-file symbols exist.`,
|
|
139
|
+
suggestion: "Move unrelated requirement ownership to narrower class members/components/services or split the coarse symbol into cohesive behavioral anchors.",
|
|
140
|
+
evidence: {
|
|
141
|
+
targetIds: symbol.requirementTargetIds,
|
|
142
|
+
requirementTags,
|
|
143
|
+
narrowerSymbolIds,
|
|
144
|
+
sourceFile: symbol.sourceFile,
|
|
145
|
+
symbolKind: symbol.kind,
|
|
146
|
+
symbolRole: symbol.role,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
export function createSymbolQualityDiagnostics(options) {
|
|
153
|
+
const symbols = collectSymbols(options);
|
|
154
|
+
return [
|
|
155
|
+
...createMultiRequirementDiagnostics(symbols),
|
|
156
|
+
...createDuplicateCoordinateDiagnostics(symbols),
|
|
157
|
+
...createMixedPurposeDiagnostics(symbols, options),
|
|
158
|
+
];
|
|
159
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ExtractionResult } from "../../extractors/markdown.js";
|
|
2
|
+
import type { HunkRange, StagedFile } from "../../traceability/git-staged.js";
|
|
3
|
+
import type { KibiImpactDiagnostic } from "../../traceability/staged-diagnostics.js";
|
|
4
|
+
import type { ExtractedSymbol } from "../../traceability/symbol-extract.js";
|
|
5
|
+
export type QualityDiagnosticSeverity = "error" | "warning" | "review" | "info";
|
|
6
|
+
export type QualityDiagnostic = {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly severity: QualityDiagnosticSeverity;
|
|
9
|
+
readonly blocking: boolean;
|
|
10
|
+
readonly category: "symbol" | "requirement" | "coverage" | "fact" | "status" | "coordinate" | "mixed-purpose" | string;
|
|
11
|
+
readonly entityId?: string;
|
|
12
|
+
readonly source?: string;
|
|
13
|
+
readonly files?: readonly string[];
|
|
14
|
+
readonly docs?: readonly string[];
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly suggestion: string;
|
|
17
|
+
readonly evidence?: Readonly<Record<string, unknown>>;
|
|
18
|
+
};
|
|
19
|
+
export type SymbolsByFile = Map<string, readonly ExtractedSymbol[]>;
|
|
20
|
+
export type TraceabilityRelationship = {
|
|
21
|
+
readonly type: string;
|
|
22
|
+
readonly to: string;
|
|
23
|
+
};
|
|
24
|
+
export type SymbolGranularityDiagnosticsOptions = {
|
|
25
|
+
readonly manifestResults: readonly ExtractionResult[];
|
|
26
|
+
readonly activeEntityIds?: ReadonlySet<string>;
|
|
27
|
+
readonly symbolsByFile: SymbolsByFile;
|
|
28
|
+
readonly sourceContentByFile?: ReadonlyMap<string, string>;
|
|
29
|
+
readonly workspaceRoot?: string;
|
|
30
|
+
};
|
|
31
|
+
export type SemanticReviewDiagnosticsOptions = {
|
|
32
|
+
readonly symbolsByFile: SymbolsByFile;
|
|
33
|
+
};
|
|
34
|
+
export type SymbolQualityDiagnosticsOptions = {
|
|
35
|
+
readonly manifestResults: readonly ExtractionResult[];
|
|
36
|
+
readonly activeEntityIds?: ReadonlySet<string>;
|
|
37
|
+
readonly symbolsByFile: SymbolsByFile;
|
|
38
|
+
};
|
|
39
|
+
export type RequirementQualityDiagnosticsOptions = {
|
|
40
|
+
readonly manifestResults: readonly ExtractionResult[];
|
|
41
|
+
readonly hardViolationEntityIds?: ReadonlySet<string>;
|
|
42
|
+
};
|
|
43
|
+
export type ChangedFileImpactOptions = {
|
|
44
|
+
readonly workspaceRoot: string;
|
|
45
|
+
readonly sourceFiles?: readonly string[];
|
|
46
|
+
readonly staged?: boolean;
|
|
47
|
+
readonly includeWorkingTreeDiff?: boolean;
|
|
48
|
+
readonly includeImpactDiagnostics?: boolean;
|
|
49
|
+
readonly maxDiagnostics?: number;
|
|
50
|
+
};
|
|
51
|
+
export type ImpactExtractedSymbol = {
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly kind: string;
|
|
55
|
+
readonly role: string;
|
|
56
|
+
readonly location: ExtractedSymbol["location"];
|
|
57
|
+
readonly hunkRanges: readonly HunkRange[];
|
|
58
|
+
readonly linkedEntityIds: readonly string[];
|
|
59
|
+
};
|
|
60
|
+
export type ImpactLinkedEntity = {
|
|
61
|
+
readonly id: string;
|
|
62
|
+
readonly relationshipType: string;
|
|
63
|
+
readonly sourceSymbolId: string;
|
|
64
|
+
readonly sourceSymbolName: string;
|
|
65
|
+
};
|
|
66
|
+
export type ChangedFileImpactResult = {
|
|
67
|
+
readonly impactDiagnostics: readonly KibiImpactDiagnostic[];
|
|
68
|
+
readonly sourceFiles: readonly string[];
|
|
69
|
+
readonly extractedSymbols: readonly ImpactExtractedSymbol[];
|
|
70
|
+
readonly linkedEntities: readonly ImpactLinkedEntity[];
|
|
71
|
+
readonly nextActions: readonly string[];
|
|
72
|
+
};
|
|
73
|
+
export type SourceChange = {
|
|
74
|
+
readonly file: string;
|
|
75
|
+
readonly status: StagedFile["status"];
|
|
76
|
+
readonly hunkRanges: readonly HunkRange[];
|
|
77
|
+
readonly content: string;
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/public/impact/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,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yzeChangedFileImpact } from "./impact/analyzer.js";
|
|
2
|
+
export { collectFullKbQualityDiagnostics } from "./impact/full-kb-quality.js";
|
|
3
|
+
export { createSemanticReviewDiagnostics, createSymbolGranularityDiagnostics, hasBlockingImpactDiagnostics, hasBlockingQualityDiagnostics, } from "./impact/diagnostics.js";
|
|
4
|
+
export { createRequirementQualityDiagnostics } from "./impact/requirement-quality.js";
|
|
5
|
+
export { createSymbolQualityDiagnostics } from "./impact/symbol-quality.js";
|
|
6
|
+
export type { ChangedFileImpactOptions, ChangedFileImpactResult, ImpactExtractedSymbol, ImpactLinkedEntity, QualityDiagnostic, QualityDiagnosticSeverity, RequirementQualityDiagnosticsOptions, SemanticReviewDiagnosticsOptions, SymbolGranularityDiagnosticsOptions, SymbolQualityDiagnosticsOptions, } from "./impact/types.js";
|
|
7
|
+
//# sourceMappingURL=impact-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact-diagnostics.d.ts","sourceRoot":"","sources":["../../src/public/impact-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mCAAmC,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,oCAAoC,EACpC,gCAAgC,EAChC,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { analyzeChangedFileImpact } from "./impact/analyzer.js";
|
|
2
|
+
export { collectFullKbQualityDiagnostics } from "./impact/full-kb-quality.js";
|
|
3
|
+
export { createSemanticReviewDiagnostics, createSymbolGranularityDiagnostics, hasBlockingImpactDiagnostics, hasBlockingQualityDiagnostics, } from "./impact/diagnostics.js";
|
|
4
|
+
export { createRequirementQualityDiagnostics } from "./impact/requirement-quality.js";
|
|
5
|
+
export { createSymbolQualityDiagnostics } from "./impact/symbol-quality.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AAmFA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAoLzC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -119,6 +119,14 @@ const entitySchema = {
|
|
|
119
119
|
type: "string",
|
|
120
120
|
enum: [...SYMBOL_ROLES],
|
|
121
121
|
},
|
|
122
|
+
verification_scope: {
|
|
123
|
+
type: "string",
|
|
124
|
+
enum: ["unit", "integration", "end_to_end"],
|
|
125
|
+
},
|
|
126
|
+
verification_perspective: {
|
|
127
|
+
type: "string",
|
|
128
|
+
enum: ["internal", "consumer"],
|
|
129
|
+
},
|
|
122
130
|
type: {
|
|
123
131
|
type: "string",
|
|
124
132
|
enum: [
|
|
@@ -221,6 +229,19 @@ const entitySchema = {
|
|
|
221
229
|
},
|
|
222
230
|
},
|
|
223
231
|
},
|
|
232
|
+
{
|
|
233
|
+
if: {
|
|
234
|
+
properties: { type: { const: "test" } },
|
|
235
|
+
},
|
|
236
|
+
else: {
|
|
237
|
+
not: {
|
|
238
|
+
anyOf: [
|
|
239
|
+
{ required: ["verification_scope"] },
|
|
240
|
+
{ required: ["verification_perspective"] },
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
},
|
|
224
245
|
...factConditionals,
|
|
225
246
|
],
|
|
226
247
|
additionalProperties: false,
|
|
@@ -101,7 +101,7 @@ See `resources/fact-lanes.md` for the full strict vs observation lane comparison
|
|
|
101
101
|
|
|
102
102
|
Model one semantic claim per strict `property_value` fact. Reusing the same `subject_key` and `property_key` lets `domain-contradictions` compare requirements mechanically.
|
|
103
103
|
|
|
104
|
-
Incoherent role-set example: `REQ-ROLE-SET-2` says the allowed user roles are exactly `
|
|
104
|
+
Incoherent role-set example: `REQ-ROLE-SET-2` says the allowed user roles are exactly `user,admin`, while `REQ-ROLE-SET-3` says the same property is exactly `user,admin,superadmin`. Both constrain `FACT-USER-ROLES` and require different values for `user.roles.allowed_set`, so they cannot both be current.
|
|
105
105
|
|
|
106
106
|
```yaml
|
|
107
107
|
subject:
|
|
@@ -115,15 +115,15 @@ property_values:
|
|
|
115
115
|
subject_key: user.roles
|
|
116
116
|
property_key: user.roles.allowed_set
|
|
117
117
|
operator: eq
|
|
118
|
-
value_type:
|
|
119
|
-
|
|
118
|
+
value_type: string
|
|
119
|
+
value_string: user,admin
|
|
120
120
|
- id: FACT-USER-ROLES-ALLOWED-3
|
|
121
121
|
fact_kind: property_value
|
|
122
122
|
subject_key: user.roles
|
|
123
123
|
property_key: user.roles.allowed_set
|
|
124
124
|
operator: eq
|
|
125
|
-
value_type:
|
|
126
|
-
|
|
125
|
+
value_type: string
|
|
126
|
+
value_string: user,admin,superadmin
|
|
127
127
|
|
|
128
128
|
requirements:
|
|
129
129
|
- id: REQ-ROLE-SET-2
|
|
@@ -176,6 +176,14 @@ Keep symbol payloads minimal: include only the fields needed to identify the sym
|
|
|
176
176
|
|
|
177
177
|
When a generic `Query failed` appears, do not keep retrying the same payload. First call `kb_validate_upsert`, query or create the missing endpoints, reduce the payload to the minimum required fields, and retry once. If it still fails, report the blocker instead of looping.
|
|
178
178
|
|
|
179
|
+
## Small Behavior Fix Impact Evidence
|
|
180
|
+
|
|
181
|
+
For a behavior-changing source edit with no existing requirement, create a requirement for the corrected behavior. If no requirement exists, create one for the corrected behavior, then model strict facts from that requirement when the invariant is contradiction-sensitive.
|
|
182
|
+
|
|
183
|
+
Do not link facts directly to tests. Facts describe the invariant; requirements or scenarios are verified by executable tests. Use `REQ -> TEST` with `verified_by` or `TEST -> REQ` with `validates`, then link the requirement to facts with `constrains` and `requires_property`. Link the touched production symbol to the requirement with `implements` and to the test with `covered_by` when coverage evidence is needed.
|
|
184
|
+
|
|
185
|
+
MCP writes do not automatically stage markdown evidence. When a staged hook requires impact evidence, ensure the repo's tracked documentation artifacts for the requirement, fact, test, symbol metadata, or coordinate refresh are authored and staged alongside the source change.
|
|
186
|
+
|
|
179
187
|
## Sequential Upserts
|
|
180
188
|
|
|
181
189
|
Never fire `kb_upsert` calls in parallel. Execute them sequentially to avoid lock contention and ensure deterministic ordering. This is especially important when creating chains of related entities.
|
|
@@ -30,7 +30,7 @@ Granular strict facts work best when each `property_value` represents one semant
|
|
|
30
30
|
|
|
31
31
|
### Role set conflict
|
|
32
32
|
|
|
33
|
-
`REQ-ROLE-SET-2` and `REQ-ROLE-SET-3` are incoherent if both are current: they each define the exact allowed role set, but one allows two roles and the other allows three.
|
|
33
|
+
`REQ-ROLE-SET-2` and `REQ-ROLE-SET-3` are incoherent if both are current: they each define the exact allowed role set, but one allows two roles and the other allows three. Encode compact set values as canonical strings because the strict property schema supports string, int, number, and bool values.
|
|
34
34
|
|
|
35
35
|
```yaml
|
|
36
36
|
subject:
|
|
@@ -48,8 +48,8 @@ property_values:
|
|
|
48
48
|
subject_key: user.roles
|
|
49
49
|
property_key: user.roles.allowed_set
|
|
50
50
|
operator: eq
|
|
51
|
-
value_type:
|
|
52
|
-
|
|
51
|
+
value_type: string
|
|
52
|
+
value_string: user,admin
|
|
53
53
|
- id: FACT-USER-ROLES-ALLOWED-3
|
|
54
54
|
title: User, admin, and superadmin roles
|
|
55
55
|
status: active
|
|
@@ -57,8 +57,8 @@ property_values:
|
|
|
57
57
|
subject_key: user.roles
|
|
58
58
|
property_key: user.roles.allowed_set
|
|
59
59
|
operator: eq
|
|
60
|
-
value_type:
|
|
61
|
-
|
|
60
|
+
value_type: string
|
|
61
|
+
value_string: user,admin,superadmin
|
|
62
62
|
|
|
63
63
|
relationships:
|
|
64
64
|
- { type: constrains, from: REQ-ROLE-SET-2, to: FACT-USER-ROLES }
|
|
@@ -87,3 +87,33 @@ relationships:
|
|
|
87
87
|
from: SYM-handler
|
|
88
88
|
to: TEST-005
|
|
89
89
|
```
|
|
90
|
+
|
|
91
|
+
## Invalid Test-Fact Shortcuts
|
|
92
|
+
|
|
93
|
+
Do not model small behavior fixes as direct test-fact pairs. Facts describe invariants; requirements or scenarios are verified by tests.
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
# WRONG: fact -> test is not a valid verified_by shape
|
|
97
|
+
relationships:
|
|
98
|
+
- type: verified_by
|
|
99
|
+
from: FACT-HEADER-AVATAR-INITIAL-UPPERCASE
|
|
100
|
+
to: TEST-AVATAR-HEADER-FALLBACK
|
|
101
|
+
|
|
102
|
+
# WRONG: test -> fact is not a valid validates shape
|
|
103
|
+
relationships:
|
|
104
|
+
- type: validates
|
|
105
|
+
from: TEST-AVATAR-HEADER-FALLBACK
|
|
106
|
+
to: FACT-HEADER-AVATAR-INITIAL-UPPERCASE
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Use a requirement as the verification target/source, then link that requirement to strict facts:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
relationships:
|
|
113
|
+
- type: verified_by
|
|
114
|
+
from: REQ-HEADER-AVATAR-INITIAL-UPPERCASE
|
|
115
|
+
to: TEST-AVATAR-HEADER-FALLBACK
|
|
116
|
+
- type: requires_property
|
|
117
|
+
from: REQ-HEADER-AVATAR-INITIAL-UPPERCASE
|
|
118
|
+
to: FACT-HEADER-AVATAR-INITIAL-UPPERCASE
|
|
119
|
+
```
|
|
@@ -19,6 +19,20 @@ The canonical workflow for any KB operation follows this pattern:
|
|
|
19
19
|
4. kb_check with targeted rules
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
## Small Behavior Fix With No Existing Requirement
|
|
23
|
+
```
|
|
24
|
+
1. kb_search and kb_query by the changed source file and test file.
|
|
25
|
+
2. If no requirement exists, create a REQ for the corrected behavior.
|
|
26
|
+
3. Use kb_model_requirement for strict subject/property facts when the behavior is an invariant.
|
|
27
|
+
4. Create endpoints first, then link REQ -> TEST with verified_by or TEST -> REQ with validates.
|
|
28
|
+
5. Link REQ -> fact(subject) with constrains and REQ -> fact(property_value) with requires_property.
|
|
29
|
+
6. Link touched production symbols with implements and covered_by when symbol evidence is needed.
|
|
30
|
+
7. Author and stage tracked markdown/symbol evidence; MCP writes do not stage those files automatically.
|
|
31
|
+
8. Run kb_check with targeted rules, then a final full check.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Do not create a test-fact pair. Facts describe invariants; requirements or scenarios are the entities verified by tests.
|
|
35
|
+
|
|
22
36
|
## Fixing a Traceability Gap
|
|
23
37
|
```
|
|
24
38
|
1. kb_query --sourceFile <code-file> to find linked entities
|
|
@@ -4,7 +4,7 @@ export declare const TRACEABILITY_RELATIONSHIP_TYPES: readonly ["implements", "c
|
|
|
4
4
|
export type TraceabilityRelationshipType = (typeof TRACEABILITY_RELATIONSHIP_TYPES)[number];
|
|
5
5
|
export declare const ALLOWED_GRANULARITY_REASONS: readonly ["config-artifact", "module-level-behavior", "extractor-miss", "legacy-link"];
|
|
6
6
|
export type GranularityReason = (typeof ALLOWED_GRANULARITY_REASONS)[number];
|
|
7
|
-
export type SymbolKind = "function" | "class" | "method" | "interface" | "type" | "variable" | "enum" | "unknown";
|
|
7
|
+
export type SymbolKind = "function" | "class" | "method" | "property" | "accessor" | "interface" | "type" | "variable" | "enum" | "unknown";
|
|
8
8
|
export type SourceSymbolKind = SymbolKind;
|
|
9
9
|
export interface GranularSymbolCandidate {
|
|
10
10
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-granularity.d.ts","sourceRoot":"","sources":["../../src/public/symbol-granularity.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,oFAOf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,+BAA+B,yDAIlC,CAAC;AAEX,MAAM,MAAM,4BAA4B,GACtC,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,eAAO,MAAM,2BAA2B,wFAK9B,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,OAAO,GACP,QAAQ,GACR,WAAW,GACX,MAAM,GACN,UAAU,GACV,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAE1C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AASD,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"symbol-granularity.d.ts","sourceRoot":"","sources":["../../src/public/symbol-granularity.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,oFAOf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,+BAA+B,yDAIlC,CAAC;AAEX,MAAM,MAAM,4BAA4B,GACtC,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,eAAO,MAAM,2BAA2B,wFAK9B,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,WAAW,GACX,MAAM,GACN,UAAU,GACV,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAE1C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AASD,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAgB5D;AAED,eAAO,MAAM,uBAAuB,wBAAkB,CAAC;AAEvD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAIhE;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,4BAA4B,CAIvC;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,iBAAiB,CAE5B;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,uBAAuB,GAAG,UAAU,CAI5E;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,uBAAuB,GACjC,OAAO,CAET;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,uBAAuB,EAAE,GACpC,MAAM,EAAE,CAMV;AAED,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,uBAAuB,EAAE,GACpC,MAAM,EAAE,CAQV"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* analysis decides whether a source edit is behavior-changing; this contract only
|
|
6
6
|
* records that decision and the staged KB artifacts that cover it.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
export declare const KIBI_STAGED_IMPACT_EVIDENCE_DOC = "docs/cli-reference.md#staged-impact-evidence";
|
|
9
9
|
export declare const KIBI_ENTITY_SCHEMA_DOC = "docs/entity-schema.md";
|
|
10
10
|
/** Canonical symbols manifest path used by staged traceability enforcement. */
|
|
11
11
|
export declare const KIBI_SYMBOLS_MANIFEST_PATH = "documentation/symbols.yaml";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evidence-model.d.ts","sourceRoot":"","sources":["../../src/traceability/evidence-model.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,
|
|
1
|
+
{"version":3,"file":"evidence-model.d.ts","sourceRoot":"","sources":["../../src/traceability/evidence-model.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,+BAA+B,iDACI,CAAC;AAEjD,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAE9D,+EAA+E;AAC/E,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE,qFAAqF;AACrF,eAAO,MAAM,4BAA4B,0CACA,CAAC;AAE1C,mEAAmE;AACnE,eAAO,MAAM,0BAA0B,sBAAsB,CAAC;AAE9D,oEAAoE;AACpE,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,UAAU,GACV,MAAM,GACN,KAAK,GACL,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACxB,sBAAsB,GACtB,0BAA0B,CAAC;AAE/B,sEAAsE;AACtE,MAAM,WAAW,sBAAsB;IACrC,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;IAC7C,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,2DAA2D;IAC3D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,sEAAsE;IACtE,W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E,cAAc,CAAC;CACtB;AAMD,0DAA0D;AAC1D,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAK7E;AAED,oEAAoE;AACpE,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,kBAAkB,GAC3B,MAAM,EAAE,CAQV;AAED,gFAAgF;AAChF,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,kBAAkB,GAC3B,MAAM,EAAE,CAMV;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAYzE;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAK1E;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,kBAAkB,GAC3B,MAAM,EAAE,CAQV"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* analysis decides whether a source edit is behavior-changing; this contract only
|
|
6
6
|
* records that decision and the staged KB artifacts that cover it.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
export const KIBI_STAGED_IMPACT_EVIDENCE_DOC = "docs/cli-reference.md#staged-impact-evidence";
|
|
9
9
|
export const KIBI_ENTITY_SCHEMA_DOC = "docs/entity-schema.md";
|
|
10
10
|
/** Canonical symbols manifest path used by staged traceability enforcement. */
|
|
11
11
|
export const KIBI_SYMBOLS_MANIFEST_PATH = "documentation/symbols.yaml";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import type { QualityDiagnostic } from "../public/impact/types.js";
|
|
1
2
|
import { type KibiImpactEvidence } from "./evidence-model.js";
|
|
2
|
-
export type KibiImpactDiagnosticId = "kibi_impact_evidence_missing" | "symbols_manifest_stale" | "symbol_granularity_violation" | "kibi_impact_override_missing_rationale";
|
|
3
|
-
export interface KibiImpactDiagnostic {
|
|
3
|
+
export type KibiImpactDiagnosticId = "kibi_impact_evidence_missing" | "symbols_manifest_stale" | "symbol_granularity_violation" | "symbol_semantic_review_needed" | "multi_requirement_symbol_review" | "duplicate_symbol_coordinate_review" | "component_mixed_purpose_review" | "broad_requirement_review" | "requirement_status_review" | "strict_fact_modeling_review" | "kibi_impact_override_missing_rationale";
|
|
4
|
+
export interface KibiImpactDiagnostic extends QualityDiagnostic {
|
|
4
5
|
/** Stable staged-enforcement diagnostic identifier. */
|
|
5
6
|
id: KibiImpactDiagnosticId;
|
|
6
|
-
|
|
7
|
-
severity: "error";
|
|
7
|
+
category: QualityDiagnostic["category"];
|
|
8
8
|
/** Repo-relative files that explain why the diagnostic fired. */
|
|
9
|
-
files: string[];
|
|
9
|
+
files: readonly string[];
|
|
10
10
|
/** User-facing docs that explain the policy. */
|
|
11
|
-
docs: string[];
|
|
11
|
+
docs: readonly string[];
|
|
12
12
|
/** Exact CLI-facing diagnostic message. */
|
|
13
13
|
message: string;
|
|
14
14
|
/** Deterministic remediation guidance. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staged-diagnostics.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,kBAAkB,EAIxB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,sBAAsB,GAC9B,8BAA8B,GAC9B,wBAAwB,GACxB,8BAA8B,GAC9B,wCAAwC,CAAC;AAE7C,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"staged-diagnostics.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAIL,KAAK,kBAAkB,EAIxB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,sBAAsB,GAC9B,8BAA8B,GAC9B,wBAAwB,GACxB,8BAA8B,GAC9B,+BAA+B,GAC/B,iCAAiC,GACjC,oCAAoC,GACpC,gCAAgC,GAChC,0BAA0B,GAC1B,2BAA2B,GAC3B,6BAA6B,GAC7B,wCAAwC,CAAC;AAE7C,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,uDAAuD;IACvD,EAAE,EAAE,sBAAsB,CAAC;IAC3B,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,iEAAiE;IACjE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,gDAAgD;IAChD,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;CACpB;AA4DD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,GAC3B,oBAAoB,EAAE,CAoCxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KIBI_STAGED_IMPACT_EVIDENCE_DOC, KIBI_SYMBOLS_MANIFEST_PATH, KIBI_SYMBOL_COORDINATES_PATH, getBehaviorSourcePaths, getMissingBehaviorSourcePaths, hasOverrideRationale, } from "./evidence-model.js";
|
|
2
2
|
function formatFileList(paths) {
|
|
3
3
|
return paths.join(", ");
|
|
4
4
|
}
|
|
@@ -6,18 +6,22 @@ function createMissingEvidenceDiagnostic(paths) {
|
|
|
6
6
|
return {
|
|
7
7
|
id: "kibi_impact_evidence_missing",
|
|
8
8
|
severity: "error",
|
|
9
|
+
blocking: true,
|
|
10
|
+
category: "fact",
|
|
9
11
|
files: [...paths],
|
|
10
|
-
docs: [
|
|
11
|
-
message: `Behavior-changing staged files are missing Kibi impact evidence (see ${
|
|
12
|
-
suggestion: `Query Kibi via MCP before deciding
|
|
12
|
+
docs: [KIBI_STAGED_IMPACT_EVIDENCE_DOC],
|
|
13
|
+
message: `Behavior-changing staged files are missing staged Kibi impact evidence (see ${KIBI_STAGED_IMPACT_EVIDENCE_DOC}): ${formatFileList(paths)}`,
|
|
14
|
+
suggestion: `Query Kibi via MCP before deciding. MCP writes update KB state but do not stage tracked evidence; also stage requirement/scenario/test/fact/symbol markdown, authored ${KIBI_SYMBOLS_MANIFEST_PATH} metadata, or refreshed ${KIBI_SYMBOL_COORDINATES_PATH}. Re-run kibi check --staged after staging tracked evidence.`,
|
|
13
15
|
};
|
|
14
16
|
}
|
|
15
17
|
function createSymbolsManifestStaleDiagnostic(paths) {
|
|
16
18
|
return {
|
|
17
19
|
id: "symbols_manifest_stale",
|
|
18
20
|
severity: "error",
|
|
21
|
+
blocking: true,
|
|
22
|
+
category: "symbol",
|
|
19
23
|
files: [KIBI_SYMBOL_COORDINATES_PATH, ...paths],
|
|
20
|
-
docs: [
|
|
24
|
+
docs: [KIBI_STAGED_IMPACT_EVIDENCE_DOC],
|
|
21
25
|
message: `${KIBI_SYMBOL_COORDINATES_PATH} is stale or missing for staged source files: ${formatFileList(paths)}`,
|
|
22
26
|
suggestion: `Run kibi sync --refresh-symbol-coordinates && git add ${KIBI_SYMBOL_COORDINATES_PATH} ${KIBI_SYMBOLS_MANIFEST_PATH}, then re-run kibi check --staged.`,
|
|
23
27
|
};
|
|
@@ -30,8 +34,10 @@ function createMissingOverrideRationaleDiagnostic(evidence) {
|
|
|
30
34
|
return {
|
|
31
35
|
id: "kibi_impact_override_missing_rationale",
|
|
32
36
|
severity: "error",
|
|
37
|
+
blocking: true,
|
|
38
|
+
category: "fact",
|
|
33
39
|
files: [evidence.mode.override.path, ...paths],
|
|
34
|
-
docs: [
|
|
40
|
+
docs: [KIBI_STAGED_IMPACT_EVIDENCE_DOC],
|
|
35
41
|
message: `Kibi-Impact: none override is missing rationale for staged source files: ${formatFileList(paths)}`,
|
|
36
42
|
suggestion: "Add a non-empty rationale in the same staged override record, keep overrides limited to false positives or non-behavioral source edits, and re-run kibi check --staged.",
|
|
37
43
|
};
|
|
@@ -49,7 +49,7 @@ export const KIBI_IMPACT_DIAGNOSTICS = {
|
|
|
49
49
|
title: "Behavior edit requires staged Kibi impact evidence",
|
|
50
50
|
resolution: [
|
|
51
51
|
"Query Kibi via MCP first: use kb_search for discovery, then kb_query for exact follow-up.",
|
|
52
|
-
"
|
|
52
|
+
"MCP writes update KB state but do not stage tracked evidence; also stage related KB entity markdown, authored documentation/symbols.yaml metadata, or refreshed documentation/symbol-coordinates.yaml.",
|
|
53
53
|
"Re-run or let the hook run kibi check --staged.",
|
|
54
54
|
],
|
|
55
55
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staged-symbols-manifest.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-symbols-manifest.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"staged-symbols-manifest.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-symbols-manifest.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA+BlD,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,cAAc,CAAC;IACtD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qCAAqC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAC7D;AA+SD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE;IACnD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,GAAG,+BAA+B,CA8ElC;AAoBD,wBAAgB,4CAA4C,CAAC,OAAO,EAAE;IACpE,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,GAAG,qCAAqC,CAgDxC"}
|