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
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { propositionRole } from "./proposition-role.js";
|
|
2
|
+
import type { SemanticAdvisorAnalysisResult, SemanticAdvisorInput } from "./types.js";
|
|
2
3
|
export declare const SEMANTIC_ADVISOR_VERSION = "semantic-advisor-v2";
|
|
3
4
|
export { semanticClaimKey } from "./clauses.js";
|
|
4
5
|
export declare function stringLogicClaims(value: unknown): string[];
|
|
5
|
-
export
|
|
6
|
+
export { propositionRole };
|
|
6
7
|
export declare function analyzeSemanticAdvisorInput(input: SemanticAdvisorInput): SemanticAdvisorAnalysisResult;
|
|
7
8
|
//# sourceMappingURL=analyze-prose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAiBxD,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EAWrB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI1D;AAugBD,OAAO,EAAE,eAAe,EAAE,CAAC;AA4V3B,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,oBAAoB,GAC1B,6BAA6B,CA+D/B"}
|
|
@@ -2,9 +2,10 @@ import { createBuiltinOntologyPack, detectSignals as detectBuiltinSignals, } fro
|
|
|
2
2
|
import { utf8Span, validateLogicIr, } from "../../logic/ir.js";
|
|
3
3
|
import { logicRuleFactId } from "../modeling/logic-modeling.js";
|
|
4
4
|
import { buildAdvisorResult } from "./analysis-receipt.js";
|
|
5
|
-
import { extractSemanticClauses,
|
|
5
|
+
import { extractSemanticClauses, semanticClaimKey, } from "./clauses.js";
|
|
6
6
|
import { detectConditionalRule, } from "./conditional-rules.js";
|
|
7
7
|
import { observationPlan } from "./observation-plan.js";
|
|
8
|
+
import { propositionRole } from "./proposition-role.js";
|
|
8
9
|
import { predicateSuggestion as buildPredicateSuggestion, isRecord, payloadHash, propertiesOf, relationship, semanticClausesOf, semanticSourceHash, semanticSourceOf, sourceOf, statementOf, stringValue, } from "./shared.js";
|
|
9
10
|
import { detectStrictSuggestion } from "./strict-rules.js";
|
|
10
11
|
export const SEMANTIC_ADVISOR_VERSION = "semantic-advisor-v2";
|
|
@@ -415,46 +416,7 @@ function unmatchedClauseSuggestion(payload, clause, clauses, expectedClaimKeys)
|
|
|
415
416
|
]),
|
|
416
417
|
}, clause, clauses, expectedClaimKeys, statementOf(payload), semanticSourceOf(payload).field);
|
|
417
418
|
}
|
|
418
|
-
|
|
419
|
-
export function propositionRole(statement, normative) {
|
|
420
|
-
// Explicit context labels may quote obligations. Incidental explanatory
|
|
421
|
-
// words within an asserted obligation must not exempt it from grounding.
|
|
422
|
-
const assertedNormative = normative && hasNormativeAssertion(statement);
|
|
423
|
-
// A bare desired impression is subjective, even when phrased with should.
|
|
424
|
-
// Keep concrete actions, quantitative conditions and any independent
|
|
425
|
-
// obligation assertive instead of exempting them through subjective words.
|
|
426
|
-
const impression = /\bshould\s+(?:feel\s+(?:welcoming|comfortable|energetic)(?:\s+and\s+(?:welcoming|comfortable|energetic))*|(?:look|seem)\s+complete)\b/i.exec(statement);
|
|
427
|
-
const impressionTail = impression
|
|
428
|
-
? statement.slice(impression.index + impression[0].length).trim()
|
|
429
|
-
: "";
|
|
430
|
-
const subjectiveAspiration = impression !== null &&
|
|
431
|
-
(impressionTail.length === 0 ||
|
|
432
|
-
/^(?:to|for)\s+[^,;.!?]+$/i.test(impressionTail)) &&
|
|
433
|
-
!/\b(?:and|or)\b/i.test(impressionTail) &&
|
|
434
|
-
!/\d|\b(?:at least|at most|exactly|within|no more than)\b/i.test(statement) &&
|
|
435
|
-
!hasNormativeAssertion(statement.replace(impression[0], ""));
|
|
436
|
-
if (/^\s*(?:for example\b|e\.g\.|(?:example|illustrative(?: example)?)\s*:)/i.test(statement) ||
|
|
437
|
-
(!assertedNormative &&
|
|
438
|
-
/\b(?:for example|e\.g\.|such as|illustrative)\b/i.test(statement)))
|
|
439
|
-
return "example";
|
|
440
|
-
if (/^\s*rationale\s*:/i.test(statement) ||
|
|
441
|
-
(!assertedNormative &&
|
|
442
|
-
/\b(?:because|so that|in order to| rationale|therefore)\b/i.test(statement)))
|
|
443
|
-
return "rationale";
|
|
444
|
-
if (subjectiveAspiration ||
|
|
445
|
-
(!assertedNormative &&
|
|
446
|
-
/\b(?:feel|comfortable|looks complete|seems complete|subjective|prefer)\b/i.test(statement)))
|
|
447
|
-
return "subjective";
|
|
448
|
-
if (/\b(?:means|defined as|refers to|is called)\b/i.test(statement))
|
|
449
|
-
return "definition";
|
|
450
|
-
if (/^\s*(?:if|when|whenever|provided that|only if)\b/i.test(statement))
|
|
451
|
-
return "condition";
|
|
452
|
-
if (/\b(?:unless|except|exempt|apart from)\b/i.test(statement))
|
|
453
|
-
return "exception";
|
|
454
|
-
if (normative)
|
|
455
|
-
return "normative";
|
|
456
|
-
return "descriptive";
|
|
457
|
-
}
|
|
419
|
+
export { propositionRole };
|
|
458
420
|
function shadowAnalysis(text, interpretations) {
|
|
459
421
|
const valid = interpretations.filter((interpretation) => interpretation.valid);
|
|
460
422
|
const models = valid.flatMap(({ normalized_ir: ir }) => (ir ? [ir] : []));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestion-boundary.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/ingestion-boundary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"ingestion-boundary.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/ingestion-boundary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAG3E,OAAO,EACL,KAAK,OAAO,EAOb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,sBAAsB,EAAuB,MAAM,YAAY,CAAC;AAgB9E,MAAM,WAAW,+BAA+B;IAC9C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.js";
|
|
3
|
+
import { legacyPropositionRoles } from "./proposition-role.js";
|
|
3
4
|
import { SEMANTIC_INVENTORY_VERSION, isRecord, propertiesOf, semanticSourceHash, semanticSourceOf, stringValue, } from "./shared.js";
|
|
4
5
|
const CURRENT_REQUIREMENT_STATUSES = new Set([
|
|
5
6
|
"open",
|
|
@@ -14,6 +15,14 @@ const LOGICAL_RELATIONSHIPS = new Set([
|
|
|
14
15
|
"requires_predicate",
|
|
15
16
|
"requires_rule",
|
|
16
17
|
]);
|
|
18
|
+
// A stored role matches when it is the advisor's current role or, for an
|
|
19
|
+
// assertive proposition, a role an earlier advisor assigned to the same text.
|
|
20
|
+
function roleMatchesAdvisor(role, expected) {
|
|
21
|
+
if (role === expected.role)
|
|
22
|
+
return true;
|
|
23
|
+
return (!CONTEXT_ROLES.has(expected.role) &&
|
|
24
|
+
legacyPropositionRoles(expected.claim_text).includes(role));
|
|
25
|
+
}
|
|
17
26
|
function inventoryOf(payload) {
|
|
18
27
|
const raw = propertiesOf(payload).semantic_inventory;
|
|
19
28
|
return Array.isArray(raw) ? raw.filter(isRecord) : [];
|
|
@@ -96,7 +105,7 @@ export function validateSemanticInventoryBoundary(payload, relationships, receip
|
|
|
96
105
|
if (expected &&
|
|
97
106
|
(claimKey !== expected.claim_key ||
|
|
98
107
|
claimText !== expected.claim_text ||
|
|
99
|
-
role
|
|
108
|
+
!roleMatchesAdvisor(role, expected) ||
|
|
100
109
|
start !== expected.span.start ||
|
|
101
110
|
end !== expected.span.end)) {
|
|
102
111
|
errors.push(`semantic_inventory[${index}] does not match advisor proposition '${expected.claim_key}'`);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SemanticPropositionRole } from "./types.js";
|
|
2
|
+
export declare function isDefinitionShape(statement: string): boolean;
|
|
3
|
+
export declare function legacyPropositionRoles(statement: string): readonly SemanticPropositionRole[];
|
|
4
|
+
export declare function propositionRole(statement: string, normative: boolean): SemanticPropositionRole;
|
|
5
|
+
export declare function advisorPropositionRole(semanticText: string, claimKey: string, suppliedClauses?: readonly string[]): SemanticPropositionRole | null;
|
|
6
|
+
//# sourceMappingURL=proposition-role.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposition-role.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/proposition-role.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAU1D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAQ5D;AAOD,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAChB,SAAS,uBAAuB,EAAE,CAEpC;AAGD,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,GACjB,uBAAuB,CAqDzB;AAOD,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,uBAAuB,GAAG,IAAI,CAKhC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { extractSemanticClauses, hasNormativeAssertion } from "./clauses.js";
|
|
2
|
+
const DEFINITION_VERB = /\b(?:means|defined as|refers to|is called)\b/i;
|
|
3
|
+
const CONDITION_OPENER = /^\s*(?:if|when|whenever|provided that|only if)\b/i;
|
|
4
|
+
// implements REQ-kibi-conditional-requirement-authoring
|
|
5
|
+
// A definition is "<subject> means|is defined as|refers to|is called <...>" as
|
|
6
|
+
// the main predicate of a sentence that asserts no obligation. A definition
|
|
7
|
+
// verb that opens a relative clause ("every note that refers to the clip") or
|
|
8
|
+
// follows a condition does not make the sentence a definition.
|
|
9
|
+
export function isDefinitionShape(statement) {
|
|
10
|
+
if (hasNormativeAssertion(statement))
|
|
11
|
+
return false;
|
|
12
|
+
const match = DEFINITION_VERB.exec(statement);
|
|
13
|
+
if (match === null)
|
|
14
|
+
return false;
|
|
15
|
+
const subject = statement.slice(0, match.index);
|
|
16
|
+
if (subject.trim().length === 0 || CONDITION_OPENER.test(subject))
|
|
17
|
+
return false;
|
|
18
|
+
return !/\b(?:that|which|who)\s*$/i.test(subject);
|
|
19
|
+
}
|
|
20
|
+
// implements REQ-kibi-proposition-complete-ingestion
|
|
21
|
+
// Inventories persisted before definitions required the main-predicate shape
|
|
22
|
+
// recorded any clause containing a definition verb as a definition. Accept that
|
|
23
|
+
// stored role so existing knowledge keeps validating; new writes use the
|
|
24
|
+
// advisor's current role.
|
|
25
|
+
export function legacyPropositionRoles(statement) {
|
|
26
|
+
return DEFINITION_VERB.test(statement) ? ["definition"] : [];
|
|
27
|
+
}
|
|
28
|
+
// implements REQ-kibi-conditional-requirement-authoring
|
|
29
|
+
export function propositionRole(statement, normative) {
|
|
30
|
+
// Explicit context labels may quote obligations. Incidental explanatory
|
|
31
|
+
// words within an asserted obligation must not exempt it from grounding.
|
|
32
|
+
const assertedNormative = normative && hasNormativeAssertion(statement);
|
|
33
|
+
// A bare desired impression is subjective, even when phrased with should.
|
|
34
|
+
// Keep concrete actions, quantitative conditions and any independent
|
|
35
|
+
// obligation assertive instead of exempting them through subjective words.
|
|
36
|
+
const impression = /\bshould\s+(?:feel\s+(?:welcoming|comfortable|energetic)(?:\s+and\s+(?:welcoming|comfortable|energetic))*|(?:look|seem)\s+complete)\b/i.exec(statement);
|
|
37
|
+
const impressionTail = impression
|
|
38
|
+
? statement.slice(impression.index + impression[0].length).trim()
|
|
39
|
+
: "";
|
|
40
|
+
const subjectiveAspiration = impression !== null &&
|
|
41
|
+
(impressionTail.length === 0 ||
|
|
42
|
+
/^(?:to|for)\s+[^,;.!?]+$/i.test(impressionTail)) &&
|
|
43
|
+
!/\b(?:and|or)\b/i.test(impressionTail) &&
|
|
44
|
+
!/\d|\b(?:at least|at most|exactly|within|no more than)\b/i.test(statement) &&
|
|
45
|
+
!hasNormativeAssertion(statement.replace(impression[0], ""));
|
|
46
|
+
if (/^\s*(?:for example\b|e\.g\.|(?:example|illustrative(?: example)?)\s*:)/i.test(statement) ||
|
|
47
|
+
(!assertedNormative &&
|
|
48
|
+
/\b(?:for example|e\.g\.|such as|illustrative)\b/i.test(statement)))
|
|
49
|
+
return "example";
|
|
50
|
+
if (/^\s*rationale\s*:/i.test(statement) ||
|
|
51
|
+
(!assertedNormative &&
|
|
52
|
+
/\b(?:because|so that|in order to| rationale|therefore)\b/i.test(statement)))
|
|
53
|
+
return "rationale";
|
|
54
|
+
if (subjectiveAspiration ||
|
|
55
|
+
(!assertedNormative &&
|
|
56
|
+
/\b(?:feel|comfortable|looks complete|seems complete|subjective|prefer)\b/i.test(statement)))
|
|
57
|
+
return "subjective";
|
|
58
|
+
if (isDefinitionShape(statement))
|
|
59
|
+
return "definition";
|
|
60
|
+
if (CONDITION_OPENER.test(statement))
|
|
61
|
+
return "condition";
|
|
62
|
+
if (/\b(?:unless|except|exempt|apart from)\b/i.test(statement))
|
|
63
|
+
return "exception";
|
|
64
|
+
if (normative)
|
|
65
|
+
return "normative";
|
|
66
|
+
return "descriptive";
|
|
67
|
+
}
|
|
68
|
+
// implements REQ-kibi-proposition-complete-ingestion
|
|
69
|
+
// The role the semantic advisor assigns to one claim of a requirement's
|
|
70
|
+
// semantic text. Writers derive persisted inventory roles from it so the
|
|
71
|
+
// write-time proposition-complete check, which compares against the same
|
|
72
|
+
// advisor, never rejects a plan Kibi itself generated.
|
|
73
|
+
export function advisorPropositionRole(semanticText, claimKey, suppliedClauses) {
|
|
74
|
+
const clause = extractSemanticClauses(semanticText, suppliedClauses).find((entry) => entry.claim_key === claimKey);
|
|
75
|
+
return clause ? propositionRole(clause.text, clause.normative) : null;
|
|
76
|
+
}
|
|
@@ -693,8 +693,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
693
693
|
readonly properties: {
|
|
694
694
|
readonly includeGenericMarkdown: {
|
|
695
695
|
readonly type: "boolean";
|
|
696
|
-
readonly
|
|
697
|
-
readonly description: "Whether to include generic markdown file content as candidate facts. Default: true.";
|
|
696
|
+
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.";
|
|
698
697
|
};
|
|
699
698
|
readonly minConfidence: {
|
|
700
699
|
readonly type: "number";
|
|
@@ -708,7 +707,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
708
707
|
readonly default: 50;
|
|
709
708
|
readonly minimum: 1;
|
|
710
709
|
readonly maximum: 200;
|
|
711
|
-
readonly description: "
|
|
710
|
+
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.";
|
|
712
711
|
};
|
|
713
712
|
readonly entityTypes: {
|
|
714
713
|
readonly type: "array";
|
|
@@ -799,11 +798,22 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
799
798
|
readonly intentClaims: {
|
|
800
799
|
readonly type: "array";
|
|
801
800
|
readonly maxItems: 200;
|
|
802
|
-
readonly description: "Statements
|
|
801
|
+
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.";
|
|
803
802
|
readonly items: {
|
|
804
803
|
readonly type: "object";
|
|
805
804
|
readonly required: readonly ["statement", "sourceId", "reference"];
|
|
806
805
|
readonly additionalProperties: false;
|
|
806
|
+
readonly if: {
|
|
807
|
+
readonly properties: {
|
|
808
|
+
readonly kind: {
|
|
809
|
+
readonly const: "open_question";
|
|
810
|
+
};
|
|
811
|
+
};
|
|
812
|
+
readonly required: readonly ["kind"];
|
|
813
|
+
};
|
|
814
|
+
readonly else: {
|
|
815
|
+
readonly required: readonly ["excerpt"];
|
|
816
|
+
};
|
|
807
817
|
readonly properties: {
|
|
808
818
|
readonly statement: {
|
|
809
819
|
readonly type: "string";
|
|
@@ -821,7 +831,51 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
821
831
|
};
|
|
822
832
|
readonly excerpt: {
|
|
823
833
|
readonly type: "string";
|
|
824
|
-
readonly
|
|
834
|
+
readonly minLength: 1;
|
|
835
|
+
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.";
|
|
836
|
+
};
|
|
837
|
+
readonly kind: {
|
|
838
|
+
readonly type: "string";
|
|
839
|
+
readonly enum: readonly ["intent", "observation", "open_question"];
|
|
840
|
+
readonly default: "intent";
|
|
841
|
+
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.";
|
|
842
|
+
};
|
|
843
|
+
};
|
|
844
|
+
};
|
|
845
|
+
};
|
|
846
|
+
readonly conflicts: {
|
|
847
|
+
readonly type: "array";
|
|
848
|
+
readonly maxItems: 50;
|
|
849
|
+
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.";
|
|
850
|
+
readonly items: {
|
|
851
|
+
readonly type: "object";
|
|
852
|
+
readonly required: readonly ["claimReferences", "note"];
|
|
853
|
+
readonly additionalProperties: false;
|
|
854
|
+
readonly properties: {
|
|
855
|
+
readonly claimReferences: {
|
|
856
|
+
readonly type: "array";
|
|
857
|
+
readonly minItems: 2;
|
|
858
|
+
readonly maxItems: 10;
|
|
859
|
+
readonly items: {
|
|
860
|
+
readonly type: "object";
|
|
861
|
+
readonly required: readonly ["sourceId", "reference"];
|
|
862
|
+
readonly additionalProperties: false;
|
|
863
|
+
readonly properties: {
|
|
864
|
+
readonly sourceId: {
|
|
865
|
+
readonly type: "string";
|
|
866
|
+
readonly minLength: 1;
|
|
867
|
+
};
|
|
868
|
+
readonly reference: {
|
|
869
|
+
readonly type: "string";
|
|
870
|
+
readonly minLength: 1;
|
|
871
|
+
};
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
};
|
|
875
|
+
readonly note: {
|
|
876
|
+
readonly type: "string";
|
|
877
|
+
readonly minLength: 1;
|
|
878
|
+
readonly description: "What disagrees, in one sentence, without resolving it.";
|
|
825
879
|
};
|
|
826
880
|
};
|
|
827
881
|
};
|
|
@@ -866,7 +920,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
866
920
|
}, {
|
|
867
921
|
readonly name: "kb_upsert";
|
|
868
922
|
readonly cliName: "upsert";
|
|
869
|
-
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.";
|
|
923
|
+
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.";
|
|
870
924
|
readonly businessInputSchema: {
|
|
871
925
|
readonly type: "object";
|
|
872
926
|
readonly required: readonly ["type", "id", "properties"];
|
|
@@ -1407,7 +1461,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1407
1461
|
};
|
|
1408
1462
|
readonly claim_text: {
|
|
1409
1463
|
readonly type: "string";
|
|
1410
|
-
readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit.";
|
|
1464
|
+
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.";
|
|
1411
1465
|
};
|
|
1412
1466
|
readonly predicate_name: {
|
|
1413
1467
|
readonly type: "string";
|
|
@@ -1574,7 +1628,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1574
1628
|
readonly document: {
|
|
1575
1629
|
readonly type: "object";
|
|
1576
1630
|
readonly additionalProperties: false;
|
|
1577
|
-
readonly description: "Optional source-first document write. Paths are workspace-relative; omit body when updating to preserve the existing body bytes.";
|
|
1631
|
+
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.";
|
|
1578
1632
|
readonly properties: {
|
|
1579
1633
|
readonly path: {
|
|
1580
1634
|
readonly type: "string";
|
|
@@ -1663,7 +1717,7 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1663
1717
|
readonly type: "string";
|
|
1664
1718
|
readonly enum: readonly string[];
|
|
1665
1719
|
};
|
|
1666
|
-
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.";
|
|
1720
|
+
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.";
|
|
1667
1721
|
};
|
|
1668
1722
|
readonly sourceFiles: {
|
|
1669
1723
|
readonly type: "array";
|
|
@@ -1791,6 +1845,21 @@ export declare const OPERATION_CATALOG: readonly [{
|
|
|
1791
1845
|
readonly enum: readonly ["create", "update"];
|
|
1792
1846
|
readonly description: "Create a new requirement or update an existing one. Update auto-selection is allowed only with a high-confidence, well-separated candidate.";
|
|
1793
1847
|
};
|
|
1848
|
+
readonly context: {
|
|
1849
|
+
readonly type: "string";
|
|
1850
|
+
readonly maxLength: 10000;
|
|
1851
|
+
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.";
|
|
1852
|
+
};
|
|
1853
|
+
readonly sourceExcerpt: {
|
|
1854
|
+
readonly type: "string";
|
|
1855
|
+
readonly maxLength: 10000;
|
|
1856
|
+
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.";
|
|
1857
|
+
};
|
|
1858
|
+
readonly sourceReference: {
|
|
1859
|
+
readonly type: "string";
|
|
1860
|
+
readonly maxLength: 2000;
|
|
1861
|
+
readonly description: "Optional locator of the source text (ticket id, URL, path). Rendered in the requirement's '## Source' section; requires context.";
|
|
1862
|
+
};
|
|
1794
1863
|
readonly requirementId: {
|
|
1795
1864
|
readonly type: "string";
|
|
1796
1865
|
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":"catalog.d.ts","sourceRoot":"","sources":["../../../src/public/operations/catalog.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/public/operations/catalog.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE,UAAU,EAChB,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CA2KxC"}
|
|
@@ -3,6 +3,7 @@ import { collectFullKbQualityDiagnostics } from "../impact-diagnostics.js";
|
|
|
3
3
|
import { buildStructuredContent, buildSummary, } from "./check-format-shared.js";
|
|
4
4
|
import { analyzeKbCheckImpact, collectQueryPlanSafetyViolations, getEffectiveRules, partitionCheckFindings, qualityDiagnosticsFromImpact, resolveCheckRules, stagedEntityIdStyleDiagnostics, } from "./check-helpers.js";
|
|
5
5
|
import { executeStatus } from "./discovery-executors.js";
|
|
6
|
+
import { collectEntityContextViolations } from "./entity-context.js";
|
|
6
7
|
import { buildActionsFromCheck, buildMigrationPlan, mergeMigrationPlans, } from "./migration-plan.js";
|
|
7
8
|
import { collectOriginReviewViolations } from "./origin-review.js";
|
|
8
9
|
import { collectPredicateSchemaConformanceViolations } from "./predicate-schema-conformance.js";
|
|
@@ -122,6 +123,7 @@ export async function executeCheck(args, context, options = {}) {
|
|
|
122
123
|
? collectSourcePathDanglingViolations(workspaceRoot)
|
|
123
124
|
: [];
|
|
124
125
|
const originReviewFindings = await collectOriginReviewViolations(prolog, rulesAllowlist, workspaceRoot);
|
|
126
|
+
const entityContextFindings = collectEntityContextViolations(rulesAllowlist, workspaceRoot);
|
|
125
127
|
const partitioned = partitionCheckFindings([
|
|
126
128
|
...aggregatedFindings,
|
|
127
129
|
...queryPlanViolations,
|
|
@@ -129,6 +131,7 @@ export async function executeCheck(args, context, options = {}) {
|
|
|
129
131
|
...sourcePathFindings,
|
|
130
132
|
...predicateConformanceFindings,
|
|
131
133
|
...originReviewFindings,
|
|
134
|
+
...entityContextFindings,
|
|
132
135
|
]);
|
|
133
136
|
const violations = partitioned.violations;
|
|
134
137
|
const diagnostics = violations.map((v) => ({
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Violation } from "../../utils/rule-registry.js";
|
|
2
|
+
/** A current entity must carry body context (blocking). */
|
|
3
|
+
export declare const ENTITY_CONTEXT_MISSING_RULE = "entity-context-missing";
|
|
4
|
+
/** How many legacy entities carry the review:context-missing tag (advisory). */
|
|
5
|
+
export declare const ENTITY_CONTEXT_ACKNOWLEDGED_RULE = "entity-context-acknowledged";
|
|
6
|
+
export declare const ENTITY_CONTEXT_RULES: readonly ["entity-context-missing", "entity-context-acknowledged"];
|
|
7
|
+
/** One authored entity document, front matter and body kept apart. */
|
|
8
|
+
export type AuthoredEntity = Readonly<{
|
|
9
|
+
id: string;
|
|
10
|
+
type: string;
|
|
11
|
+
path: string;
|
|
12
|
+
data: Readonly<Record<string, unknown>>;
|
|
13
|
+
body: string;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Split an authored Markdown document into its front matter record and its
|
|
17
|
+
* body. Returns null when the front matter is absent or does not parse.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readAuthoredEntity(content: string, relativePath: string): AuthoredEntity | null;
|
|
20
|
+
/**
|
|
21
|
+
* The checked meaning a requirement's context is compared against. A
|
|
22
|
+
* `semantic_text` that schema 8 pinned from the old derivation (statement plus
|
|
23
|
+
* context sections) is the body's derivation, not a statement of its own, so
|
|
24
|
+
* it is replaced by the statement-only derivation; an authored value stands.
|
|
25
|
+
*/
|
|
26
|
+
export declare function contextStatementOf(entity: AuthoredEntity): string | undefined;
|
|
27
|
+
/** The entity fields the context rules read, with the derived meaning. */
|
|
28
|
+
export declare function contextEntityOf(entity: AuthoredEntity): {
|
|
29
|
+
title: unknown;
|
|
30
|
+
semantic_text: unknown;
|
|
31
|
+
fact_kind: unknown;
|
|
32
|
+
tags: unknown;
|
|
33
|
+
};
|
|
34
|
+
/** Whether an authored entity is current: not retired, not superseded. */
|
|
35
|
+
export declare function isCurrentAuthoredEntity(entity: AuthoredEntity, superseded: ReadonlySet<string>): boolean;
|
|
36
|
+
/** Every authored entity of a type the context rules apply to. */
|
|
37
|
+
export declare function listContextAuthoredEntities(workspaceRoot: string): AuthoredEntity[];
|
|
38
|
+
/**
|
|
39
|
+
* Ids some other entity supersedes, read from authored `links` and the
|
|
40
|
+
* relationship shards so the check and the migration agree before a sync.
|
|
41
|
+
*/
|
|
42
|
+
export declare function authoredSupersededIds(workspaceRoot: string, entities: readonly AuthoredEntity[]): Set<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Evaluate the context rules over authored entities. Entities tagged
|
|
45
|
+
* review:context-missing are acknowledged legacy: they never violate, and one
|
|
46
|
+
* advisory finding counts them.
|
|
47
|
+
*/
|
|
48
|
+
export declare function evaluateEntityContext(entities: readonly AuthoredEntity[], superseded: ReadonlySet<string>, rules?: ReadonlySet<string>, acknowledgedIds?: ReadonlySet<string>): Violation[];
|
|
49
|
+
/** Read the authored entities once and evaluate the selected rules. */
|
|
50
|
+
export declare function collectEntityContextViolations(rules: ReadonlySet<string>, workspaceRoot: string): Violation[];
|
|
51
|
+
//# sourceMappingURL=entity-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-context.d.ts","sourceRoot":"","sources":["../../../src/public/operations/entity-context.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,2DAA2D;AAE3D,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AACpE,gFAAgF;AAEhF,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAG9E,eAAO,MAAM,oBAAoB,oEAGvB,CAAC;AAUX,sEAAsE;AAEtE,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH;;;GAGG;AAE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