kibi-cli 2.5.2 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-operation-metadata.d.ts +1 -1
- package/dist/cli-operation-metadata.js +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +15 -0
- package/dist/commands/init-helpers.js +1 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +43 -0
- package/dist/entity-body-context.d.ts +132 -0
- package/dist/entity-body-context.d.ts.map +1 -0
- package/dist/entity-body-context.js +382 -0
- package/dist/extractors/markdown.d.ts +13 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +19 -2
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +4 -4
- package/dist/operations/bootstrap/candidate-helpers.d.ts +18 -0
- package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidate-helpers.js +35 -0
- package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidates.js +4 -2
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +24 -15
- package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -1
- package/dist/operations/bootstrap/intent-claims.js +210 -5
- package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
- package/dist/operations/bootstrap/markdown-candidates.js +7 -3
- package/dist/operations/bootstrap/presentation.d.ts +8 -0
- package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
- package/dist/operations/bootstrap/presentation.js +66 -8
- package/dist/operations/bootstrap/types.d.ts +21 -0
- package/dist/operations/bootstrap/types.d.ts.map +1 -1
- package/dist/operations/bootstrap/types.js +10 -0
- package/dist/operations/migration/entity-body-context.d.ts +57 -0
- package/dist/operations/migration/entity-body-context.d.ts.map +1 -0
- package/dist/operations/migration/entity-body-context.js +261 -0
- package/dist/operations/migration/polarity-values.d.ts.map +1 -1
- package/dist/operations/migration/polarity-values.js +5 -2
- 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 +69 -0
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
- package/dist/operations/modeling/logic-modeling.js +3 -1
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +7 -9
- package/dist/operations/mutation/context-warning.d.ts +13 -0
- package/dist/operations/mutation/context-warning.d.ts.map +1 -0
- package/dist/operations/mutation/context-warning.js +59 -0
- package/dist/operations/mutation/origin.d.ts +2 -1
- package/dist/operations/mutation/origin.d.ts.map +1 -1
- package/dist/operations/mutation/origin.js +7 -18
- package/dist/operations/mutation/requirement-semantics.d.ts +16 -0
- package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -0
- package/dist/operations/mutation/requirement-semantics.js +64 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +10 -0
- package/dist/operations/mutation/stored-entity.d.ts +20 -0
- package/dist/operations/mutation/stored-entity.d.ts.map +1 -0
- package/dist/operations/mutation/stored-entity.js +51 -0
- package/dist/operations/mutation/upsert.d.ts +3 -2
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +19 -10
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +6 -1
- package/dist/operations/planning/compile-intent.d.ts +9 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +49 -2
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +3 -2
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +3 -41
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.js +10 -1
- package/dist/operations/semantic-advisor/proposition-role.d.ts +6 -0
- package/dist/operations/semantic-advisor/proposition-role.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/proposition-role.js +76 -0
- package/dist/public/operations/catalog.d.ts +78 -9
- 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/entity-context.d.ts +51 -0
- package/dist/public/operations/entity-context.d.ts.map +1 -0
- package/dist/public/operations/entity-context.js +235 -0
- package/dist/public/operations/origin-review.d.ts +1 -1
- package/dist/public/operations/origin-review.js +2 -2
- package/dist/public/operations/specs/bootstrap.d.ts +59 -5
- package/dist/public/operations/specs/bootstrap.d.ts.map +1 -1
- package/dist/public/operations/specs/bootstrap.js +48 -6
- 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 +3 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +10 -2
- package/dist/public/operations/specs/planning.d.ts +15 -0
- package/dist/public/operations/specs/planning.d.ts.map +1 -1
- package/dist/public/operations/specs/planning.js +15 -0
- package/dist/public/operations/specs/upsert.d.ts +3 -3
- package/dist/public/operations/specs/upsert.js +2 -2
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +7 -1
- package/dist/public/skills/kibi-bootstrap/SKILL.md +13 -7
- package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +9 -2
- package/dist/public/skills/kibi-usage/SKILL.md +56 -3
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +5 -1
- package/dist/schemas/entity.schema.json +14 -1
- package/dist/search-ranking.d.ts.map +1 -1
- package/dist/search-ranking.js +7 -4
- package/dist/traceability/staged-consistency.d.ts +25 -0
- package/dist/traceability/staged-consistency.d.ts.map +1 -0
- package/dist/traceability/staged-consistency.js +92 -0
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +5 -0
- package/dist/utils/kb-manifest.d.ts +5 -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 +11 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +13 -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 -2
- package/package.json +2 -2
- package/schema/manifest.json +5 -0
- package/schema/validation.pl +14 -2
- package/src/public/operations/check-executor.ts +6 -0
- package/src/public/operations/entity-context.ts +304 -0
- package/src/public/operations/origin-review.ts +2 -2
- package/src/public/operations/specs/bootstrap.ts +52 -5
- package/src/public/operations/specs/check-rules.generated.ts +3 -1
- package/src/public/operations/specs/mutation-schemas.ts +10 -2
- package/src/public/operations/specs/planning.ts +18 -0
- package/src/public/operations/specs/upsert.ts +2 -2
- package/src/public/schemas/entity.ts +7 -1
- package/src/public/skills/kibi-bootstrap/SKILL.md +13 -7
- package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +9 -2
- package/src/public/skills/kibi-usage/SKILL.md +56 -3
- package/src/public/skills/kibi-usage/resources/source-authoring.md +5 -1
- package/src/schemas/entity.schema.json +14 -1
|
@@ -0,0 +1,235 @@
|
|
|
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 { load as loadYaml } from "js-yaml";
|
|
20
|
+
import { CONTEXT_MISSING_TAG, CONTEXT_REQUIRED_TYPES, RESERVED_TAG_HINT, assessContext, contextFinding, isContextAcknowledged, } from "../../entity-body-context.js";
|
|
21
|
+
import { inferTypeFromPath, legacyRequirementSemanticText, } from "../../extractors/markdown.js";
|
|
22
|
+
import { requirementSemanticText } from "../../extractors/markdown.js";
|
|
23
|
+
import { listLaneMarkdownFiles, readText, sliceFrontmatter, } from "../../operations/migration/kb-sources.js";
|
|
24
|
+
import { readAllShards } from "../../relationships/shards.js";
|
|
25
|
+
import { readKbManifest } from "../../utils/kb-manifest.js";
|
|
26
|
+
/** A current entity must carry body context (blocking). */
|
|
27
|
+
// implements REQ-kb-entity-body-context
|
|
28
|
+
export const ENTITY_CONTEXT_MISSING_RULE = "entity-context-missing";
|
|
29
|
+
/** How many legacy entities carry the review:context-missing tag (advisory). */
|
|
30
|
+
// implements REQ-kb-entity-body-context
|
|
31
|
+
export const ENTITY_CONTEXT_ACKNOWLEDGED_RULE = "entity-context-acknowledged";
|
|
32
|
+
// implements REQ-kb-entity-body-context
|
|
33
|
+
export const ENTITY_CONTEXT_RULES = [
|
|
34
|
+
ENTITY_CONTEXT_MISSING_RULE,
|
|
35
|
+
ENTITY_CONTEXT_ACKNOWLEDGED_RULE,
|
|
36
|
+
];
|
|
37
|
+
/** Statuses of entities that are no longer current. */
|
|
38
|
+
const RETIRED_STATUSES = new Set([
|
|
39
|
+
"deprecated",
|
|
40
|
+
"superseded",
|
|
41
|
+
"archived",
|
|
42
|
+
"removed",
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* Split an authored Markdown document into its front matter record and its
|
|
46
|
+
* body. Returns null when the front matter is absent or does not parse.
|
|
47
|
+
*/
|
|
48
|
+
// implements REQ-kb-entity-body-context
|
|
49
|
+
export function readAuthoredEntity(content, relativePath) {
|
|
50
|
+
const slice = sliceFrontmatter(content);
|
|
51
|
+
if (slice === null)
|
|
52
|
+
return null;
|
|
53
|
+
let data;
|
|
54
|
+
try {
|
|
55
|
+
data = loadYaml(slice.text);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const record = data;
|
|
64
|
+
const type = typeof record.type === "string"
|
|
65
|
+
? record.type
|
|
66
|
+
: (inferTypeFromPath(relativePath) ?? "");
|
|
67
|
+
const id = typeof record.id === "string" && record.id.trim() !== ""
|
|
68
|
+
? record.id.trim()
|
|
69
|
+
: path.basename(relativePath, ".md");
|
|
70
|
+
const newline = slice.suffix.indexOf("\n");
|
|
71
|
+
return {
|
|
72
|
+
id,
|
|
73
|
+
type,
|
|
74
|
+
path: relativePath,
|
|
75
|
+
data: record,
|
|
76
|
+
body: newline < 0 ? "" : slice.suffix.slice(newline + 1),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The checked meaning a requirement's context is compared against. A
|
|
81
|
+
* `semantic_text` that schema 8 pinned from the old derivation (statement plus
|
|
82
|
+
* context sections) is the body's derivation, not a statement of its own, so
|
|
83
|
+
* it is replaced by the statement-only derivation; an authored value stands.
|
|
84
|
+
*/
|
|
85
|
+
// implements REQ-kb-entity-body-context
|
|
86
|
+
export function contextStatementOf(entity) {
|
|
87
|
+
if (entity.type !== "req")
|
|
88
|
+
return undefined;
|
|
89
|
+
const pinned = entity.data.semantic_text;
|
|
90
|
+
if (typeof pinned === "string" &&
|
|
91
|
+
pinned.trim() !== "" &&
|
|
92
|
+
pinned.trim() !== legacyRequirementSemanticText(entity.body)) {
|
|
93
|
+
return pinned;
|
|
94
|
+
}
|
|
95
|
+
return requirementSemanticText(entity.body);
|
|
96
|
+
}
|
|
97
|
+
/** The entity fields the context rules read, with the derived meaning. */
|
|
98
|
+
// implements REQ-kb-entity-body-context
|
|
99
|
+
export function contextEntityOf(entity) {
|
|
100
|
+
return {
|
|
101
|
+
title: entity.data.title,
|
|
102
|
+
semantic_text: contextStatementOf(entity),
|
|
103
|
+
fact_kind: entity.data.fact_kind,
|
|
104
|
+
tags: entity.data.tags,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Whether an authored entity is current: not retired, not superseded. */
|
|
108
|
+
// implements REQ-kb-entity-body-context
|
|
109
|
+
export function isCurrentAuthoredEntity(entity, superseded) {
|
|
110
|
+
const status = entity.data.status;
|
|
111
|
+
return (!(typeof status === "string" && RETIRED_STATUSES.has(status)) &&
|
|
112
|
+
!superseded.has(entity.id));
|
|
113
|
+
}
|
|
114
|
+
const CONTEXT_LANES = [
|
|
115
|
+
"requirements",
|
|
116
|
+
"scenarios",
|
|
117
|
+
"tests",
|
|
118
|
+
"adr",
|
|
119
|
+
"facts",
|
|
120
|
+
];
|
|
121
|
+
/** Every authored entity of a type the context rules apply to. */
|
|
122
|
+
// implements REQ-kb-entity-body-context
|
|
123
|
+
export function listContextAuthoredEntities(workspaceRoot) {
|
|
124
|
+
const entities = [];
|
|
125
|
+
for (const file of listLaneMarkdownFiles(workspaceRoot, CONTEXT_LANES)) {
|
|
126
|
+
const content = readText(file.absolutePath);
|
|
127
|
+
if (content === null)
|
|
128
|
+
continue;
|
|
129
|
+
const entity = readAuthoredEntity(content, file.relativePath);
|
|
130
|
+
if (entity !== null &&
|
|
131
|
+
CONTEXT_REQUIRED_TYPES.includes(entity.type)) {
|
|
132
|
+
entities.push(entity);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return entities;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Ids some other entity supersedes, read from authored `links` and the
|
|
139
|
+
* relationship shards so the check and the migration agree before a sync.
|
|
140
|
+
*/
|
|
141
|
+
// implements REQ-kb-entity-body-context
|
|
142
|
+
export function authoredSupersededIds(workspaceRoot, entities) {
|
|
143
|
+
const superseded = new Set();
|
|
144
|
+
for (const entity of entities) {
|
|
145
|
+
const links = entity.data.links;
|
|
146
|
+
if (!Array.isArray(links))
|
|
147
|
+
continue;
|
|
148
|
+
for (const link of links) {
|
|
149
|
+
if (link !== null &&
|
|
150
|
+
typeof link === "object" &&
|
|
151
|
+
link.type === "supersedes" &&
|
|
152
|
+
typeof link.target === "string") {
|
|
153
|
+
superseded.add(link.target);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
for (const relationship of readAllShards(path.join(workspaceRoot, ".kb"))) {
|
|
159
|
+
if (relationship.type === "supersedes")
|
|
160
|
+
superseded.add(relationship.to);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// Malformed shards fail sync with their own diagnostic.
|
|
165
|
+
}
|
|
166
|
+
return superseded;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Evaluate the context rules over authored entities. Entities tagged
|
|
170
|
+
* review:context-missing are acknowledged legacy: they never violate, and one
|
|
171
|
+
* advisory finding counts them.
|
|
172
|
+
*/
|
|
173
|
+
// implements REQ-kb-entity-body-context
|
|
174
|
+
export function evaluateEntityContext(entities, superseded, rules = new Set(ENTITY_CONTEXT_RULES), acknowledgedIds = new Set()) {
|
|
175
|
+
const findings = [];
|
|
176
|
+
const acknowledged = [];
|
|
177
|
+
const current = entities
|
|
178
|
+
.filter((entity) => isCurrentAuthoredEntity(entity, superseded))
|
|
179
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
180
|
+
for (const entity of current) {
|
|
181
|
+
const view = contextEntityOf(entity);
|
|
182
|
+
const assessment = assessContext(entity.type, entity.body, view);
|
|
183
|
+
if (assessment.ok)
|
|
184
|
+
continue;
|
|
185
|
+
if (acknowledgedIds.has(entity.id)) {
|
|
186
|
+
acknowledged.push({ id: entity.id, type: entity.type });
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (!rules.has(ENTITY_CONTEXT_MISSING_RULE))
|
|
190
|
+
continue;
|
|
191
|
+
const finding = contextFinding(entity.type, entity.id, entity.body, view);
|
|
192
|
+
if (finding === null)
|
|
193
|
+
continue;
|
|
194
|
+
const selfTagged = isContextAcknowledged(view.tags);
|
|
195
|
+
findings.push({
|
|
196
|
+
rule: ENTITY_CONTEXT_MISSING_RULE,
|
|
197
|
+
entityId: entity.id,
|
|
198
|
+
description: selfTagged
|
|
199
|
+
? `${finding.description}; ${CONTEXT_MISSING_TAG} is not honored here because the schema 8 migration did not acknowledge this entity`
|
|
200
|
+
: finding.description,
|
|
201
|
+
suggestion: selfTagged ? RESERVED_TAG_HINT : finding.suggestion,
|
|
202
|
+
source: entity.path,
|
|
203
|
+
evidence: {
|
|
204
|
+
type: entity.type,
|
|
205
|
+
reason: finding.reason,
|
|
206
|
+
contextWords: finding.words,
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
if (rules.has(ENTITY_CONTEXT_ACKNOWLEDGED_RULE) && acknowledged.length > 0) {
|
|
211
|
+
const byType = {};
|
|
212
|
+
for (const row of acknowledged) {
|
|
213
|
+
byType[row.type] = (byType[row.type] ?? 0) + 1;
|
|
214
|
+
}
|
|
215
|
+
findings.push({
|
|
216
|
+
rule: ENTITY_CONTEXT_ACKNOWLEDGED_RULE,
|
|
217
|
+
entityId: "workspace",
|
|
218
|
+
description: `${acknowledged.length} current entit${acknowledged.length === 1 ? "y is" : "ies are"} tagged review:context-missing and still lack body context (${Object.entries(byType)
|
|
219
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
220
|
+
.map(([type, count]) => `${count} ${type}`)
|
|
221
|
+
.join(", ")})`,
|
|
222
|
+
suggestion: "Ask the person who knows why each entity exists and record the answer in its body; never invent a reason",
|
|
223
|
+
evidence: { total: acknowledged.length, byType },
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return findings;
|
|
227
|
+
}
|
|
228
|
+
/** Read the authored entities once and evaluate the selected rules. */
|
|
229
|
+
// implements REQ-kb-entity-body-context
|
|
230
|
+
export function collectEntityContextViolations(rules, workspaceRoot) {
|
|
231
|
+
if (!ENTITY_CONTEXT_RULES.some((rule) => rules.has(rule)))
|
|
232
|
+
return [];
|
|
233
|
+
const entities = listContextAuthoredEntities(workspaceRoot);
|
|
234
|
+
return evaluateEntityContext(entities, authoredSupersededIds(workspaceRoot, entities), rules, new Set(readKbManifest(workspaceRoot)?.contextAcknowledged ?? []));
|
|
235
|
+
}
|
|
@@ -34,7 +34,7 @@ export type OriginReviewInput = Readonly<{
|
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
36
|
* True when a Markdown document (frontmatter ignored) has a heading that
|
|
37
|
-
* starts with "Rationale" or "
|
|
37
|
+
* starts with "Rationale", "Why" or "Context", at any level.
|
|
38
38
|
*/
|
|
39
39
|
export declare function markdownHasRationaleSection(content: string): boolean;
|
|
40
40
|
/**
|
|
@@ -64,10 +64,10 @@ const CURRENT_REQUIREMENT_STATUSES = new Set([
|
|
|
64
64
|
"active",
|
|
65
65
|
"approved",
|
|
66
66
|
]);
|
|
67
|
-
const RATIONALE_HEADING = /^#{1,6}[ \t]+(?:rationale|why)\b/im;
|
|
67
|
+
const RATIONALE_HEADING = /^#{1,6}[ \t]+(?:rationale|why|context)\b/im;
|
|
68
68
|
/**
|
|
69
69
|
* True when a Markdown document (frontmatter ignored) has a heading that
|
|
70
|
-
* starts with "Rationale" or "
|
|
70
|
+
* starts with "Rationale", "Why" or "Context", at any level.
|
|
71
71
|
*/
|
|
72
72
|
// implements REQ-kibi-entity-origin
|
|
73
73
|
export function markdownHasRationaleSection(content) {
|
|
@@ -10,8 +10,7 @@ export declare const planBootstrapSpec: {
|
|
|
10
10
|
readonly properties: {
|
|
11
11
|
readonly includeGenericMarkdown: {
|
|
12
12
|
readonly type: "boolean";
|
|
13
|
-
readonly
|
|
14
|
-
readonly description: "Whether to include generic markdown file content as candidate facts. Default: true.";
|
|
13
|
+
readonly description: "Whether to include generic markdown file content as candidate facts. Default: true, or false when bootstrapContext declares intentClaims (the declared sources already carry the intent); set it explicitly to override.";
|
|
15
14
|
};
|
|
16
15
|
readonly minConfidence: {
|
|
17
16
|
readonly type: "number";
|
|
@@ -25,7 +24,7 @@ export declare const planBootstrapSpec: {
|
|
|
25
24
|
readonly default: 50;
|
|
26
25
|
readonly minimum: 1;
|
|
27
26
|
readonly maximum: 200;
|
|
28
|
-
readonly description: "
|
|
27
|
+
readonly description: "Budget for candidates Kibi discovers itself (symbols, tests, repository documents). Declared intentClaims sit outside it: they are never capped and never use its slots. Clamped to [1, 200]. Default: 50.";
|
|
29
28
|
};
|
|
30
29
|
readonly entityTypes: {
|
|
31
30
|
readonly type: "array";
|
|
@@ -116,11 +115,22 @@ export declare const planBootstrapSpec: {
|
|
|
116
115
|
readonly intentClaims: {
|
|
117
116
|
readonly type: "array";
|
|
118
117
|
readonly maxItems: 200;
|
|
119
|
-
readonly description: "Statements
|
|
118
|
+
readonly description: "Statements the agent harvested from knowledgeSources, each citing its source. Intent claims (the default kind) that the strict modeler can ground become cited req candidates; the rest become explicit authoring follow-ups. Observation and open_question claims never become requirements: they become cited fact candidates with fact_kind observation, open questions tagged review:open-question. Every intent and observation claim needs an excerpt: the created entity's body keeps the statement, then a '## Source' section with the blockquoted excerpt, the source title and the reference. Bound into the plan hash.";
|
|
120
119
|
readonly items: {
|
|
121
120
|
readonly type: "object";
|
|
122
121
|
readonly required: readonly ["statement", "sourceId", "reference"];
|
|
123
122
|
readonly additionalProperties: false;
|
|
123
|
+
readonly if: {
|
|
124
|
+
readonly properties: {
|
|
125
|
+
readonly kind: {
|
|
126
|
+
readonly const: "open_question";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
readonly required: readonly ["kind"];
|
|
130
|
+
};
|
|
131
|
+
readonly else: {
|
|
132
|
+
readonly required: readonly ["excerpt"];
|
|
133
|
+
};
|
|
124
134
|
readonly properties: {
|
|
125
135
|
readonly statement: {
|
|
126
136
|
readonly type: "string";
|
|
@@ -138,7 +148,51 @@ export declare const planBootstrapSpec: {
|
|
|
138
148
|
};
|
|
139
149
|
readonly excerpt: {
|
|
140
150
|
readonly type: "string";
|
|
141
|
-
readonly
|
|
151
|
+
readonly minLength: 1;
|
|
152
|
+
readonly description: "Verbatim passage from the source the claim came from. Required for intent and observation claims (optional for open_question): Kibi persists it with the knowledge source title and reference in the created entity's '## Source' section, because the ticket or page may be gone by the next migration.";
|
|
153
|
+
};
|
|
154
|
+
readonly kind: {
|
|
155
|
+
readonly type: "string";
|
|
156
|
+
readonly enum: readonly ["intent", "observation", "open_question"];
|
|
157
|
+
readonly default: "intent";
|
|
158
|
+
readonly description: "intent: intended behavior (may become a req). observation: how things are today, without stating intent. open_question: something the sources leave undecided. Default: intent.";
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
readonly conflicts: {
|
|
164
|
+
readonly type: "array";
|
|
165
|
+
readonly maxItems: 50;
|
|
166
|
+
readonly description: "Contradictions the agent found between declared intentClaims and leaves for the human to resolve. Each becomes a cited fact candidate with fact_kind observation tagged review:conflict. Every claimReference must match a declared claim's sourceId and reference. Bound into the plan hash.";
|
|
167
|
+
readonly items: {
|
|
168
|
+
readonly type: "object";
|
|
169
|
+
readonly required: readonly ["claimReferences", "note"];
|
|
170
|
+
readonly additionalProperties: false;
|
|
171
|
+
readonly properties: {
|
|
172
|
+
readonly claimReferences: {
|
|
173
|
+
readonly type: "array";
|
|
174
|
+
readonly minItems: 2;
|
|
175
|
+
readonly maxItems: 10;
|
|
176
|
+
readonly items: {
|
|
177
|
+
readonly type: "object";
|
|
178
|
+
readonly required: readonly ["sourceId", "reference"];
|
|
179
|
+
readonly additionalProperties: false;
|
|
180
|
+
readonly properties: {
|
|
181
|
+
readonly sourceId: {
|
|
182
|
+
readonly type: "string";
|
|
183
|
+
readonly minLength: 1;
|
|
184
|
+
};
|
|
185
|
+
readonly reference: {
|
|
186
|
+
readonly type: "string";
|
|
187
|
+
readonly minLength: 1;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
readonly note: {
|
|
193
|
+
readonly type: "string";
|
|
194
|
+
readonly minLength: 1;
|
|
195
|
+
readonly description: "What disagrees, in one sentence, without resolving it.";
|
|
142
196
|
};
|
|
143
197
|
};
|
|
144
198
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAUjF,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyM7B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { executePlanBootstrap } from "../../../operations/bootstrap/generate.js";
|
|
2
|
-
import { KNOWLEDGE_SOURCE_AUTHORITIES, KNOWLEDGE_SOURCE_KINDS, } from "../../../operations/bootstrap/types.js";
|
|
2
|
+
import { INTENT_CLAIM_KINDS, KNOWLEDGE_SOURCE_AUTHORITIES, KNOWLEDGE_SOURCE_KINDS, } from "../../../operations/bootstrap/types.js";
|
|
3
3
|
export { executePlanBootstrap } from "../../../operations/bootstrap/generate.js";
|
|
4
4
|
// implements REQ-KIBI-BOOTSTRAP-PLAN
|
|
5
5
|
export const planBootstrapSpec = {
|
|
@@ -11,8 +11,7 @@ export const planBootstrapSpec = {
|
|
|
11
11
|
properties: {
|
|
12
12
|
includeGenericMarkdown: {
|
|
13
13
|
type: "boolean",
|
|
14
|
-
|
|
15
|
-
description: "Whether to include generic markdown file content as candidate facts. Default: true.",
|
|
14
|
+
description: "Whether to include generic markdown file content as candidate facts. Default: true, or false when bootstrapContext declares intentClaims (the declared sources already carry the intent); set it explicitly to override.",
|
|
16
15
|
},
|
|
17
16
|
minConfidence: {
|
|
18
17
|
type: "number",
|
|
@@ -26,7 +25,7 @@ export const planBootstrapSpec = {
|
|
|
26
25
|
default: 50,
|
|
27
26
|
minimum: 1,
|
|
28
27
|
maximum: 200,
|
|
29
|
-
description: "
|
|
28
|
+
description: "Budget for candidates Kibi discovers itself (symbols, tests, repository documents). Declared intentClaims sit outside it: they are never capped and never use its slots. Clamped to [1, 200]. Default: 50.",
|
|
30
29
|
},
|
|
31
30
|
entityTypes: {
|
|
32
31
|
type: "array",
|
|
@@ -101,11 +100,16 @@ export const planBootstrapSpec = {
|
|
|
101
100
|
intentClaims: {
|
|
102
101
|
type: "array",
|
|
103
102
|
maxItems: 200,
|
|
104
|
-
description: "Statements
|
|
103
|
+
description: "Statements the agent harvested from knowledgeSources, each citing its source. Intent claims (the default kind) that the strict modeler can ground become cited req candidates; the rest become explicit authoring follow-ups. Observation and open_question claims never become requirements: they become cited fact candidates with fact_kind observation, open questions tagged review:open-question. Every intent and observation claim needs an excerpt: the created entity's body keeps the statement, then a '## Source' section with the blockquoted excerpt, the source title and the reference. Bound into the plan hash.",
|
|
105
104
|
items: {
|
|
106
105
|
type: "object",
|
|
107
106
|
required: ["statement", "sourceId", "reference"],
|
|
108
107
|
additionalProperties: false,
|
|
108
|
+
if: {
|
|
109
|
+
properties: { kind: { const: "open_question" } },
|
|
110
|
+
required: ["kind"],
|
|
111
|
+
},
|
|
112
|
+
else: { required: ["excerpt"] },
|
|
109
113
|
properties: {
|
|
110
114
|
statement: {
|
|
111
115
|
type: "string",
|
|
@@ -123,7 +127,45 @@ export const planBootstrapSpec = {
|
|
|
123
127
|
},
|
|
124
128
|
excerpt: {
|
|
125
129
|
type: "string",
|
|
126
|
-
|
|
130
|
+
minLength: 1,
|
|
131
|
+
description: "Verbatim passage from the source the claim came from. Required for intent and observation claims (optional for open_question): Kibi persists it with the knowledge source title and reference in the created entity's '## Source' section, because the ticket or page may be gone by the next migration.",
|
|
132
|
+
},
|
|
133
|
+
kind: {
|
|
134
|
+
type: "string",
|
|
135
|
+
enum: [...INTENT_CLAIM_KINDS],
|
|
136
|
+
default: "intent",
|
|
137
|
+
description: "intent: intended behavior (may become a req). observation: how things are today, without stating intent. open_question: something the sources leave undecided. Default: intent.",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
conflicts: {
|
|
143
|
+
type: "array",
|
|
144
|
+
maxItems: 50,
|
|
145
|
+
description: "Contradictions the agent found between declared intentClaims and leaves for the human to resolve. Each becomes a cited fact candidate with fact_kind observation tagged review:conflict. Every claimReference must match a declared claim's sourceId and reference. Bound into the plan hash.",
|
|
146
|
+
items: {
|
|
147
|
+
type: "object",
|
|
148
|
+
required: ["claimReferences", "note"],
|
|
149
|
+
additionalProperties: false,
|
|
150
|
+
properties: {
|
|
151
|
+
claimReferences: {
|
|
152
|
+
type: "array",
|
|
153
|
+
minItems: 2,
|
|
154
|
+
maxItems: 10,
|
|
155
|
+
items: {
|
|
156
|
+
type: "object",
|
|
157
|
+
required: ["sourceId", "reference"],
|
|
158
|
+
additionalProperties: false,
|
|
159
|
+
properties: {
|
|
160
|
+
sourceId: { type: "string", minLength: 1 },
|
|
161
|
+
reference: { type: "string", minLength: 1 },
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
note: {
|
|
166
|
+
type: "string",
|
|
167
|
+
minLength: 1,
|
|
168
|
+
description: "What disagrees, in one sentence, without resolving it.",
|
|
127
169
|
},
|
|
128
170
|
},
|
|
129
171
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Every selectable kb_check rule name, registry order. */
|
|
2
2
|
export declare const SELECTABLE_RULE_NAMES: readonly string[];
|
|
3
3
|
/** Comma-separated "Allowed:" fragment for the kb_check rules description. */
|
|
4
|
-
export declare const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, 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, 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";
|
|
4
|
+
export declare const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, 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, 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";
|
|
5
5
|
//# sourceMappingURL=check-rules.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-rules.generated.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/check-rules.generated.ts"],"names":[],"mappings":"AAUA,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"check-rules.generated.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/check-rules.generated.ts"],"names":[],"mappings":"AAUA,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EA4ClD,CAAC;AAGF,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,+7BACy5B,CAAC"}
|
|
@@ -50,7 +50,9 @@ export const SELECTABLE_RULE_NAMES = [
|
|
|
50
50
|
"adr-unlinked",
|
|
51
51
|
"adr-proposed",
|
|
52
52
|
"predicate-schema-conformance",
|
|
53
|
+
"entity-context-missing",
|
|
54
|
+
"entity-context-acknowledged",
|
|
53
55
|
];
|
|
54
56
|
// implements REQ-006
|
|
55
57
|
/** Comma-separated "Allowed:" fragment for the kb_check rules description. */
|
|
56
|
-
export const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, 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, 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";
|
|
58
|
+
export const SELECTABLE_RULES_ALLOWED = "must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, 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, 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";
|
|
@@ -12,7 +12,7 @@ export declare const checkSpec: {
|
|
|
12
12
|
readonly type: "string";
|
|
13
13
|
readonly enum: readonly string[];
|
|
14
14
|
};
|
|
15
|
-
readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, 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, 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. 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.";
|
|
15
|
+
readonly description: "Optional rule subset. Allowed: must-priority-coverage, symbol-coverage, symbol-traceability, no-dangling-refs, source-relationship-parity, 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, 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. 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.";
|
|
16
16
|
};
|
|
17
17
|
readonly sourceFiles: {
|
|
18
18
|
readonly type: "array";
|
|
@@ -526,7 +526,7 @@ export declare const ENTITY_PROPERTIES_SCHEMA: {
|
|
|
526
526
|
};
|
|
527
527
|
readonly claim_text: {
|
|
528
528
|
readonly type: "string";
|
|
529
|
-
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit.";
|
|
529
|
+
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. Requires claim_key, except on an observation or meta fact, which may quote the clause it is about without claim_key.";
|
|
530
530
|
};
|
|
531
531
|
readonly predicate_name: {
|
|
532
532
|
readonly type: "string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-schemas.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation-schemas.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,gFASf,CAAC;
|
|
1
|
+
{"version":3,"file":"mutation-schemas.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation-schemas.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,gFASf,CAAC;AAoBX,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoX3B,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;CA8CvB,CAAC"}
|
|
@@ -11,11 +11,19 @@ export const ENTITY_TYPES = [
|
|
|
11
11
|
"symbol",
|
|
12
12
|
"fact",
|
|
13
13
|
];
|
|
14
|
+
// An observation or meta fact may quote a claim in claim_text alone: it is a
|
|
15
|
+
// non-grounding review note, so it does not claim the clause's key.
|
|
14
16
|
const CLAIM_PROVENANCE_CONDITIONAL = JSON.parse(`{
|
|
15
17
|
"if": {
|
|
16
18
|
"anyOf": [
|
|
17
19
|
{ "required": ["claim_key"] },
|
|
18
|
-
{
|
|
20
|
+
{
|
|
21
|
+
"required": ["claim_text"],
|
|
22
|
+
"not": {
|
|
23
|
+
"properties": { "fact_kind": { "enum": ["observation", "meta"] } },
|
|
24
|
+
"required": ["fact_kind"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
]
|
|
20
28
|
},
|
|
21
29
|
"then": { "required": ["claim_key", "claim_text"] }
|
|
@@ -247,7 +255,7 @@ export const ENTITY_PROPERTIES_SCHEMA = {
|
|
|
247
255
|
},
|
|
248
256
|
claim_text: {
|
|
249
257
|
type: "string",
|
|
250
|
-
description: "Exact atomic requirement clause represented by this fact, retained for human audit.",
|
|
258
|
+
description: "Exact atomic requirement clause represented by this fact, retained for human audit. Requires claim_key, except on an observation or meta fact, which may quote the clause it is about without claim_key.",
|
|
251
259
|
},
|
|
252
260
|
predicate_name: {
|
|
253
261
|
type: "string",
|
|
@@ -24,6 +24,21 @@ export declare const compileIntentSpec: {
|
|
|
24
24
|
readonly enum: readonly ["create", "update"];
|
|
25
25
|
readonly description: "Create a new requirement or update an existing one. Update auto-selection is allowed only with a high-confidence, well-separated candidate.";
|
|
26
26
|
};
|
|
27
|
+
readonly context: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly maxLength: 10000;
|
|
30
|
+
readonly description: "Why the requirement exists, who asked and anything that does not fit its checked meaning. Required when mode is create (validation error naming this field otherwise); rendered as a '## Context' section of the requirement document, never as part of the checked meaning. Never invent a reason: write 'Reason not stated' when the requester gave none. An update keeps the existing document body unless context is supplied.";
|
|
31
|
+
};
|
|
32
|
+
readonly sourceExcerpt: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly maxLength: 10000;
|
|
35
|
+
readonly description: "Optional verbatim text the intent came from (a ticket, a message, a document passage). Rendered as a blockquote in the requirement's '## Source' section; requires context.";
|
|
36
|
+
};
|
|
37
|
+
readonly sourceReference: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly maxLength: 2000;
|
|
40
|
+
readonly description: "Optional locator of the source text (ticket id, URL, path). Rendered in the requirement's '## Source' section; requires context.";
|
|
41
|
+
};
|
|
27
42
|
readonly requirementId: {
|
|
28
43
|
readonly type: "string";
|
|
29
44
|
readonly description: "Optional exact requirement ID. Required for an update when automatic selection is below the confidence and margin gates.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,gBAAgB,EACjB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAGL,oBAAoB,EACrB,MAAM,gDAAgD,CAAC;AAGxD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,oBAAoB,GACrB,MAAM,gDAAgD,CAAC;AACxD,YAAY,EACV,aAAa,EACb,eAAe,GAChB,MAAM,4CAA4C,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAGtF,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,gBAAgB,EACjB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAGL,oBAAoB,EACrB,MAAM,gDAAgD,CAAC;AAGxD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,oBAAoB,GACrB,MAAM,gDAAgD,CAAC;AACxD,YAAY,EACV,aAAa,EACb,eAAe,GAChB,MAAM,4CAA4C,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAGtF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4KsC,CAAC;AAGrE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDwC,CAAC"}
|
|
@@ -22,6 +22,21 @@ export const compileIntentSpec = {
|
|
|
22
22
|
enum: ["create", "update"],
|
|
23
23
|
description: "Create a new requirement or update an existing one. Update auto-selection is allowed only with a high-confidence, well-separated candidate.",
|
|
24
24
|
},
|
|
25
|
+
context: {
|
|
26
|
+
type: "string",
|
|
27
|
+
maxLength: 10000,
|
|
28
|
+
description: "Why the requirement exists, who asked and anything that does not fit its checked meaning. Required when mode is create (validation error naming this field otherwise); rendered as a '## Context' section of the requirement document, never as part of the checked meaning. Never invent a reason: write 'Reason not stated' when the requester gave none. An update keeps the existing document body unless context is supplied.",
|
|
29
|
+
},
|
|
30
|
+
sourceExcerpt: {
|
|
31
|
+
type: "string",
|
|
32
|
+
maxLength: 10000,
|
|
33
|
+
description: "Optional verbatim text the intent came from (a ticket, a message, a document passage). Rendered as a blockquote in the requirement's '## Source' section; requires context.",
|
|
34
|
+
},
|
|
35
|
+
sourceReference: {
|
|
36
|
+
type: "string",
|
|
37
|
+
maxLength: 2000,
|
|
38
|
+
description: "Optional locator of the source text (ticket id, URL, path). Rendered in the requirement's '## Source' section; requires context.",
|
|
39
|
+
},
|
|
25
40
|
requirementId: {
|
|
26
41
|
type: "string",
|
|
27
42
|
description: "Optional exact requirement ID. Required for an update when automatic selection is below the confidence and margin gates.",
|
|
@@ -2,7 +2,7 @@ import { executeUpsert } from "../../../operations/mutation/upsert.js";
|
|
|
2
2
|
export declare const upsertSpec: {
|
|
3
3
|
readonly name: "kb_upsert";
|
|
4
4
|
readonly cliName: "upsert";
|
|
5
|
-
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. Do not use for read-only inspection. Side effects: writes KB, may refresh symbol coordinates; dryRun:true writes nothing.";
|
|
5
|
+
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.";
|
|
6
6
|
readonly businessInputSchema: {
|
|
7
7
|
readonly type: "object";
|
|
8
8
|
readonly required: readonly ["type", "id", "properties"];
|
|
@@ -543,7 +543,7 @@ export declare const upsertSpec: {
|
|
|
543
543
|
};
|
|
544
544
|
readonly claim_text: {
|
|
545
545
|
readonly type: "string";
|
|
546
|
-
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit.";
|
|
546
|
+
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. Requires claim_key, except on an observation or meta fact, which may quote the clause it is about without claim_key.";
|
|
547
547
|
};
|
|
548
548
|
readonly predicate_name: {
|
|
549
549
|
readonly type: "string";
|
|
@@ -710,7 +710,7 @@ export declare const upsertSpec: {
|
|
|
710
710
|
readonly document: {
|
|
711
711
|
readonly type: "object";
|
|
712
712
|
readonly additionalProperties: false;
|
|
713
|
-
readonly description: "Optional source-first document write. Paths are workspace-relative; omit body when updating to preserve the existing body bytes.";
|
|
713
|
+
readonly description: "Optional source-first document write. Paths are workspace-relative; omit body when updating to preserve the existing body bytes. For a new requirement pass a sectioned body: statement, '## Context' (why, who asked, constraints), '## Source' (blockquoted excerpt and reference); context never changes the checked meaning, which stays in semantic_text.";
|
|
714
714
|
readonly properties: {
|
|
715
715
|
readonly path: {
|
|
716
716
|
readonly type: "string";
|