kibi-cli 2.26.2 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-operation-metadata.d.ts +1 -1
- package/dist/cli-operation-metadata.js +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +24 -0
- package/dist/commands/sync/cache.d.ts +21 -0
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +40 -15
- package/dist/commands/sync/persistence.d.ts +10 -0
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +24 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +26 -11
- package/dist/diagnostics.d.ts +6 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +25 -9
- package/dist/intent-search.d.ts +2 -0
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +5 -0
- package/dist/operations/bootstrap/activation.d.ts +6 -0
- package/dist/operations/bootstrap/activation.d.ts.map +1 -1
- package/dist/operations/bootstrap/activation.js +22 -0
- package/dist/operations/bootstrap/claim-restatement.d.ts +2 -0
- package/dist/operations/bootstrap/claim-restatement.d.ts.map +1 -1
- package/dist/operations/bootstrap/conflict-review.d.ts +16 -0
- package/dist/operations/bootstrap/conflict-review.d.ts.map +1 -0
- package/dist/operations/bootstrap/conflict-review.js +59 -0
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +17 -4
- package/dist/operations/bootstrap/types.d.ts +5 -0
- package/dist/operations/bootstrap/types.d.ts.map +1 -1
- package/dist/operations/migration/entity-type.d.ts +35 -0
- package/dist/operations/migration/entity-type.d.ts.map +1 -0
- package/dist/operations/migration/entity-type.js +89 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +32 -0
- package/dist/operations/mutation/requirement-semantics.d.ts +5 -0
- package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -1
- package/dist/operations/mutation/requirement-semantics.js +24 -5
- package/dist/operations/mutation/stored-entity.d.ts +7 -0
- package/dist/operations/mutation/stored-entity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.d.ts +1 -1
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +37 -7
- package/dist/operations/mutation/uncompiled-source.d.ts +6 -0
- package/dist/operations/mutation/uncompiled-source.d.ts.map +1 -1
- package/dist/operations/mutation/uncompiled-source.js +17 -1
- package/dist/operations/mutation/upsert.d.ts +9 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +43 -7
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +21 -0
- package/dist/operations/planning/compile-intent.d.ts +16 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +118 -5
- package/dist/operations/planning/conflict-review.d.ts +69 -0
- package/dist/operations/planning/conflict-review.d.ts.map +1 -0
- package/dist/operations/planning/conflict-review.js +133 -0
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +8 -0
- package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/ingestion-boundary.js +43 -2
- package/dist/prolog/utf8-transport.d.ts +21 -0
- package/dist/prolog/utf8-transport.d.ts.map +1 -0
- package/dist/prolog/utf8-transport.js +49 -0
- package/dist/prolog.d.ts +2 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +19 -10
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +26 -2
- package/dist/public/impact/requirement-statements.d.ts +29 -0
- package/dist/public/impact/requirement-statements.d.ts.map +1 -0
- package/dist/public/impact/requirement-statements.js +127 -0
- package/dist/public/operations/catalog.d.ts +26 -2
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-format-shared.d.ts +1 -1
- package/dist/public/operations/check-format-shared.d.ts.map +1 -1
- package/dist/public/operations/check-format-shared.js +19 -4
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +20 -13
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +7 -2
- package/dist/public/operations/result-envelope.d.ts +2 -0
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +21 -9
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/check.js +1 -1
- package/dist/public/operations/specs/planning.d.ts +25 -1
- package/dist/public/operations/specs/planning.d.ts.map +1 -1
- package/dist/public/operations/specs/planning.js +16 -1
- package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/dist/public/skills/kibi-usage/SKILL.md +11 -1
- package/dist/traceability/staged-diagnostics.d.ts +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/utils/config.d.ts +8 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +10 -0
- package/package.json +2 -2
- package/src/public/impact/analyzer.ts +38 -2
- package/src/public/impact/requirement-statements.ts +171 -0
- package/src/public/operations/check-format-shared.ts +27 -4
- package/src/public/operations/discovery-executors.ts +20 -13
- package/src/public/operations/migration-plan.ts +12 -4
- package/src/public/operations/result-envelope.ts +18 -4
- package/src/public/operations/specs/check.ts +1 -1
- package/src/public/operations/specs/planning.ts +17 -1
- package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/src/public/skills/kibi-usage/SKILL.md +11 -1
|
@@ -91,7 +91,7 @@ export declare const CLI_OPERATION_METADATA: readonly [{
|
|
|
91
91
|
}, {
|
|
92
92
|
readonly name: "kb_compile_intent";
|
|
93
93
|
readonly cliName: "compile-intent";
|
|
94
|
-
readonly description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. No mutation side effects.";
|
|
94
|
+
readonly description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.";
|
|
95
95
|
}, {
|
|
96
96
|
readonly name: "kb_apply_plan";
|
|
97
97
|
readonly cliName: "apply-plan";
|
|
@@ -110,7 +110,7 @@ export const CLI_OPERATION_METADATA = [
|
|
|
110
110
|
{
|
|
111
111
|
name: "kb_compile_intent",
|
|
112
112
|
cliName: "compile-intent",
|
|
113
|
-
description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. No mutation side effects.",
|
|
113
|
+
description: "Compile complete change intent into a deterministic, snapshot-bound read-only plan. Reuses intent-aware discovery and semantic modeling, accounts for every proposition, reports contradiction witnesses, proposes traceability links, and emits dependency-ordered kb_upsert-style steps only for resolved typed claims. contradictionAnalysis.outcome is no_conflict only when the check could decide: an unmodeled proposition or a related current requirement without logic leaves it unresolved with reasons and reviewCandidates to compare and judge through conflictReviews. No mutation side effects.",
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
name: "kb_apply_plan",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAyGA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAGD,wBAAsB,aAAa,CACjC,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAuH/B;AAED,wBAAsB,4BAA4B,CAChD,IAAI,GAAE,MAAM,OAAO,CAAC;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,CACT,GACxC,OAAO,CAAC,OAAO,CAAC,CAOlB;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;;;;;;;;;;;;;;;MAkE3C;AAkGD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGzE;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAepB"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -27,6 +27,7 @@ import { SwiplResolutionError, inspectSwiplBundle, probeRequiredLibraries, resol
|
|
|
27
27
|
import { buildMigrationPlan, migrationAction, } from "../public/operations/migration-plan.js";
|
|
28
28
|
import { resolveBranchAttachment, resolveReadBranchAttachment, } from "../utils/branch-resolver.js";
|
|
29
29
|
import { branchStoreCompilation, inspectBranchStore, storeLockTakeoverReason, uncompiledBranchStoreReason, } from "../utils/branch-store.js";
|
|
30
|
+
import { LEGACY_KB_MIGRATION_COMMAND, LEGACY_KB_MIGRATION_NOTE, } from "../utils/config.js";
|
|
30
31
|
import { resolveGitRepository, } from "../utils/git-repository-context.js";
|
|
31
32
|
import { readKbManifestStatus } from "../utils/kb-manifest.js";
|
|
32
33
|
import { MERGE_DRIVER_SETUP, manifestMergeDriverGaps, } from "../utils/merge-driver-setup.js";
|
|
@@ -612,7 +613,7 @@ function checkKbManifest() {
|
|
|
612
613
|
message: "Not found",
|
|
613
614
|
remediation: legacy.legacyConfig === "absent"
|
|
614
615
|
? "Run: kibi init"
|
|
615
|
-
:
|
|
616
|
+
: `Run: ${LEGACY_KB_MIGRATION_COMMAND} (${LEGACY_KB_MIGRATION_NOTE})`,
|
|
616
617
|
};
|
|
617
618
|
}
|
|
618
619
|
if (status.state !== "ok") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,wCAAwC,CAAC;AAwBhD,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,uFAAuF;IACvF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB,EAAE,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,IAAI,CAAC;IAC3E,MAAM,EAAE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, writeFileSync, } from "node:fs";
|
|
19
19
|
import * as path from "node:path";
|
|
20
|
+
import { countByType } from "../operations/migration/entity-body-context.js";
|
|
21
|
+
import { applyEntityTypeBackfill, planEntityTypeBackfill, } from "../operations/migration/entity-type.js";
|
|
20
22
|
import { applySafeInventoryRederivations, planInventoryRederivation, } from "../operations/migration/inventory-rederive.js";
|
|
21
23
|
import { applyOriginBackfill, planOriginBackfill, } from "../operations/migration/origin-backfill.js";
|
|
22
24
|
import { applyDeliveredStatusMappings, planRequirementStatusMappings, } from "../operations/migration/requirement-status.js";
|
|
@@ -357,6 +359,24 @@ function mapLegacyRequirementStatuses(cwd, dryRun) {
|
|
|
357
359
|
review: planRequirementStatusMappings(cwd),
|
|
358
360
|
};
|
|
359
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* State the folder-implied type on entity files without one, so the first
|
|
364
|
+
* kb_upsert on such a file changes only what it was asked to change.
|
|
365
|
+
* Returns how many files were (or, on a dry run, would be) rewritten.
|
|
366
|
+
*/
|
|
367
|
+
// implements REQ-cli-migrate-entity-type-backfill
|
|
368
|
+
function stateFolderImpliedTypes(cwd, dryRun) {
|
|
369
|
+
const plan = dryRun
|
|
370
|
+
? planEntityTypeBackfill(cwd)
|
|
371
|
+
: applyEntityTypeBackfill(cwd);
|
|
372
|
+
if (plan.targets.length > 0)
|
|
373
|
+
console.log(`${dryRun ? "dry run: would state" : "Stated"} the folder-implied type on ${plan.targets.length} entity file(s) without one (${Object.entries(countByType(plan.targets))
|
|
374
|
+
.map(([type, count]) => `${count} ${type}`)
|
|
375
|
+
.join(", ")}); no other line changes.`);
|
|
376
|
+
for (const skip of plan.skipped)
|
|
377
|
+
printWarning(`Type not stated for ${skip.path}: ${skip.reason}.`);
|
|
378
|
+
return plan.targets.length;
|
|
379
|
+
}
|
|
360
380
|
/**
|
|
361
381
|
* Print what a `kibi migrate --yes` run left for a person, naming the
|
|
362
382
|
* requirements kibi sync cannot compile first. Returns false when nothing
|
|
@@ -467,6 +487,7 @@ export async function migrateCommand(options = {}) {
|
|
|
467
487
|
const polarityCount = options.dryRun
|
|
468
488
|
? planPolarityValueBackfill(cwd).length
|
|
469
489
|
: applyPolarityValueBackfill(cwd);
|
|
490
|
+
const typesStated = stateFolderImpliedTypes(cwd, options.dryRun === true);
|
|
470
491
|
// Delivery statuses keep requirements out of the store at any version;
|
|
471
492
|
// map them before the drift check, which only sees compiled requirements.
|
|
472
493
|
const statuses = mapLegacyRequirementStatuses(cwd, options.dryRun === true);
|
|
@@ -476,6 +497,7 @@ export async function migrateCommand(options = {}) {
|
|
|
476
497
|
const lifecycle = repairLifecycleFindings(cwd, options.dryRun === true);
|
|
477
498
|
const legacyLinks = markLegacySymbolLinks(cwd, options.dryRun === true);
|
|
478
499
|
const rewroteSources = polarityCount > 0 ||
|
|
500
|
+
typesStated > 0 ||
|
|
479
501
|
statuses.mapped > 0 ||
|
|
480
502
|
legacyLinks > 0 ||
|
|
481
503
|
drift.rederived.length > 0 ||
|
|
@@ -569,6 +591,7 @@ export async function migrateCommand(options = {}) {
|
|
|
569
591
|
console.log(`dry run: would record origin {kind: migration} on ${backfill.targets.length} authored entit(ies) without one.`);
|
|
570
592
|
}
|
|
571
593
|
}
|
|
594
|
+
stateFolderImpliedTypes(cwd, true);
|
|
572
595
|
mapLegacyRequirementStatuses(cwd, true);
|
|
573
596
|
rederiveDriftedInventories(cwd, true);
|
|
574
597
|
repairLifecycleFindings(cwd, true);
|
|
@@ -600,6 +623,7 @@ export async function migrateCommand(options = {}) {
|
|
|
600
623
|
? "pending"
|
|
601
624
|
: "not_applicable");
|
|
602
625
|
const migratedAt = new Date().toISOString();
|
|
626
|
+
stateFolderImpliedTypes(cwd, false);
|
|
603
627
|
const polarityValuesRewritten = applyPolarityValueBackfill(cwd);
|
|
604
628
|
if (polarityValuesRewritten > 0)
|
|
605
629
|
console.log(`Encoded ${polarityValuesRewritten} legacy polarity-only fact(s) as typed booleans.`);
|
|
@@ -41,7 +41,28 @@ export type SourceExtractionFailure = {
|
|
|
41
41
|
* new authoring.
|
|
42
42
|
*/
|
|
43
43
|
baseline?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The semantic source hash and contract flag of the source's last
|
|
46
|
+
* successful compilation, carried while it fails.
|
|
47
|
+
*/
|
|
48
|
+
semanticHash?: string;
|
|
49
|
+
semanticContract?: boolean;
|
|
44
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Whether a requirement source the last sync could not extract is still
|
|
53
|
+
* accepted without a complete proposition inventory once it compiles with
|
|
54
|
+
* prose hashing to `sourceHash`. Legacy content that missed the store's first
|
|
55
|
+
* compilation keeps the baseline; a source that compiled before keeps it only
|
|
56
|
+
* while its prose is the prose it last compiled with. kibi sync and kb_upsert
|
|
57
|
+
* on the uncompiled file both apply this rule, so a write one accepts the
|
|
58
|
+
* other never refuses.
|
|
59
|
+
*/
|
|
60
|
+
export declare function failedSourceKeepsSemanticBaseline(failure: SourceExtractionFailure, sourceHash: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* What the last sync recorded about an authored source it could not extract,
|
|
63
|
+
* the record the next sync judges the source by; undefined when it compiled.
|
|
64
|
+
*/
|
|
65
|
+
export declare function sourceExtractionFailure(workspaceRoot: string, storePath: string, file: string, deps?: Partial<SyncCacheDeps>): SourceExtractionFailure | undefined;
|
|
45
66
|
/**
|
|
46
67
|
* v2: cache identities are workspace-root relative instead of process-cwd
|
|
47
68
|
* relative, and symbol manifests are fingerprinted together with their
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/cache.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAO7E,UAAU,aAAa;IACrB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,UAAU,EAAE,OAAO,UAAU,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AAM,CAM1E;AAED,wBAAgB,QAAQ,CAEtB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,MAAM,CAIR;AAED,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAerD;AAED;;;;;GAKG;AAEH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,MAAM,CA4FR;AAED,wBAAgB,aAAa,CAE3B,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,EAC7B,OAAO,GAAE;IACP,oEAAoE;IACpE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAClC,GACL,SAAS,CAiEX;AAED,wBAAgB,cAAc,CAE5B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,SAAS,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,IAAI,CAaN;AAED,wBAAgB,aAAa,CAE3B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,IAAI,CASN"}
|
|
@@ -32,6 +32,45 @@ function resolveDeps(overrides) {
|
|
|
32
32
|
...overrides,
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
+
// implements REQ-kibi-uncompiled-source-semantic-baseline
|
|
36
|
+
/**
|
|
37
|
+
* Whether a requirement source the last sync could not extract is still
|
|
38
|
+
* accepted without a complete proposition inventory once it compiles with
|
|
39
|
+
* prose hashing to `sourceHash`. Legacy content that missed the store's first
|
|
40
|
+
* compilation keeps the baseline; a source that compiled before keeps it only
|
|
41
|
+
* while its prose is the prose it last compiled with. kibi sync and kb_upsert
|
|
42
|
+
* on the uncompiled file both apply this rule, so a write one accepts the
|
|
43
|
+
* other never refuses.
|
|
44
|
+
*/
|
|
45
|
+
export function failedSourceKeepsSemanticBaseline(failure, sourceHash) {
|
|
46
|
+
if (failure.semanticContract === true)
|
|
47
|
+
return false;
|
|
48
|
+
return failure.semanticHash === undefined
|
|
49
|
+
? failure.baseline === true
|
|
50
|
+
: failure.semanticHash === sourceHash;
|
|
51
|
+
}
|
|
52
|
+
function readExtractionFailures(cachePath, resolved) {
|
|
53
|
+
if (!resolved.existsSync(cachePath))
|
|
54
|
+
return {};
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(resolved.readFileSync(cachePath, "utf8"));
|
|
57
|
+
if (parsed.extractionFailures === null ||
|
|
58
|
+
typeof parsed.extractionFailures !== "object")
|
|
59
|
+
return {};
|
|
60
|
+
return parsed.extractionFailures;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* What the last sync recorded about an authored source it could not extract,
|
|
68
|
+
* the record the next sync judges the source by; undefined when it compiled.
|
|
69
|
+
*/
|
|
70
|
+
// implements REQ-kibi-uncompiled-source-semantic-baseline
|
|
71
|
+
export function sourceExtractionFailure(workspaceRoot, storePath, file, deps) {
|
|
72
|
+
return readExtractionFailures(path.join(storePath, "sync-cache.json"), resolveDeps(deps))[toCacheKey(workspaceRoot, path.resolve(workspaceRoot, file))];
|
|
73
|
+
}
|
|
35
74
|
/**
|
|
36
75
|
* v2: cache identities are workspace-root relative instead of process-cwd
|
|
37
76
|
* relative, and symbol manifests are fingerprinted together with their
|
|
@@ -93,21 +132,7 @@ export const SOURCE_EXTRACTION_FAILED = "source_extraction_failed";
|
|
|
93
132
|
*/
|
|
94
133
|
// implements REQ-kibi-uncompiled-source-visibility
|
|
95
134
|
export function sourceExtractionFailureReasons(workspaceRoot, storePath, deps) {
|
|
96
|
-
const
|
|
97
|
-
const cachePath = path.join(storePath, "sync-cache.json");
|
|
98
|
-
if (!resolved.existsSync(cachePath))
|
|
99
|
-
return [];
|
|
100
|
-
let failures;
|
|
101
|
-
try {
|
|
102
|
-
const parsed = JSON.parse(resolved.readFileSync(cachePath, "utf8"));
|
|
103
|
-
if (parsed.extractionFailures === null ||
|
|
104
|
-
typeof parsed.extractionFailures !== "object")
|
|
105
|
-
return [];
|
|
106
|
-
failures = parsed.extractionFailures;
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
return [];
|
|
110
|
-
}
|
|
135
|
+
const failures = readExtractionFailures(path.join(storePath, "sync-cache.json"), resolveDeps(deps));
|
|
111
136
|
const reasons = [];
|
|
112
137
|
for (const [key, failure] of Object.entries(failures).sort(([a], [b]) => a.localeCompare(b))) {
|
|
113
138
|
const absolute = path.resolve(workspaceRoot, key);
|
|
@@ -12,6 +12,16 @@ export declare function retractEntitiesById(prolog: PrologProcess, entityIds: re
|
|
|
12
12
|
/** Clear outgoing inline relationships for entities whose payload changed. */
|
|
13
13
|
export declare function retractEntityRelationshipsById(prolog: PrologProcess, entityIds: readonly string[]): Promise<void>;
|
|
14
14
|
export declare function retractRelationships(prolog: PrologProcess, relationships: readonly ExtractedRelationship[]): Promise<number>;
|
|
15
|
+
/** What the store holds after a sync, by entity type, plus relationships. */
|
|
16
|
+
export type StoreTotals = Readonly<{
|
|
17
|
+
entities: Record<string, number>;
|
|
18
|
+
relationships: number;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Count what the store holds after this sync. Undefined when the store
|
|
22
|
+
* cannot be counted; the summary then shows only what was imported.
|
|
23
|
+
*/
|
|
24
|
+
export declare function queryStoreTotals(prolog: Pick<PrologProcess, "query">): Promise<StoreTotals | undefined>;
|
|
15
25
|
export declare function persistEntities(prolog: PrologProcess, results: ExtractionResult[], entityIds: Set<string>, options?: {
|
|
16
26
|
loadExistingEntityIds?: boolean;
|
|
17
27
|
}): Promise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AuBjB;AAmCD,6EAA6E;AAE7E,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH;;;GAGG;AAEH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAmBlC;AAED,wBAAsB,eAAe,CAEnC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EACtB,OAAO,GAAE;IAAE,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAO,GAChD,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAoRvD;AA4BD,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,MAAM,CAER;AAGD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,kBAAkB,EAAE,qBAAqB,EAAE,EAC3C,OAAO,GAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAO,GACvC,OAAO,CAAC;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAmO7D"}
|
|
@@ -284,6 +284,30 @@ async function tryResetPrologProcess(prolog) {
|
|
|
284
284
|
return false;
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Count what the store holds after this sync. Undefined when the store
|
|
289
|
+
* cannot be counted; the summary then shows only what was imported.
|
|
290
|
+
*/
|
|
291
|
+
// implements REQ-cli-sync-summary-kb-totals
|
|
292
|
+
export async function queryStoreTotals(prolog) {
|
|
293
|
+
const result = await prolog
|
|
294
|
+
.query(
|
|
295
|
+
// kb_entity and kb_relationship need the type bound.
|
|
296
|
+
"findall(Type-Count, (member(Type, [req,scenario,test,adr,flag,event,symbol,fact]), aggregate_all(count, kb_entity(_, Type, _), Count), Count > 0), Counts), aggregate_all(count, (kibi_relationships:relationship_type(Rel), kb_relationship(Rel, _, _)), Relationships)")
|
|
297
|
+
.catch(() => undefined);
|
|
298
|
+
const counts = result?.success ? result.bindings?.Counts : undefined;
|
|
299
|
+
const relationships = result?.success
|
|
300
|
+
? Number(result.bindings?.Relationships)
|
|
301
|
+
: Number.NaN;
|
|
302
|
+
if (typeof counts !== "string" || !Number.isInteger(relationships))
|
|
303
|
+
return undefined;
|
|
304
|
+
const entities = {};
|
|
305
|
+
for (const [, type, count] of counts.matchAll(/([a-z]+)-(\d+)/g)) {
|
|
306
|
+
if (type !== undefined && count !== undefined)
|
|
307
|
+
entities[type] = Number(count);
|
|
308
|
+
}
|
|
309
|
+
return { entities, relationships };
|
|
310
|
+
}
|
|
287
311
|
export async function persistEntities(
|
|
288
312
|
// implements REQ-009
|
|
289
313
|
prolog, results, entityIds, options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA6BjE,OAAO,EAEL,yBAAyB,EAE1B,MAAM,gDAAgD,CAAC;AAGxD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,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GD,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,IAAI,GAChB,IAAI,CAMN;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,UAAU,EAAE,EACzB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,IAAI,CAIN;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,IAAI,CAMP;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,UAAU,EAAE,EACzB,oBAAoB,EAAE,OAAO,EAC7B,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,MAAM,GAClB,IAAI,CAUN;AAGD,wBAAsB,WAAW,CAC/B,OAAO,GAAE;IACP,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;CACZ,EACN,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,UAAU,CAAC,CA2uCrB;AAED,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/commands/sync.js
CHANGED
|
@@ -30,11 +30,11 @@ import { PrologProcess } from "../prolog.js";
|
|
|
30
30
|
import { detachedHeadWriteRefusal, resolveBranchAttachment, } from "../utils/branch-resolver.js";
|
|
31
31
|
import { branchStoreManifestPath, branchStorePath, ensureBranchStoreManifest, expectedBranchStoreManifest, } from "../utils/branch-store-locator.js";
|
|
32
32
|
import { loadEntityPaths } from "../utils/config.js";
|
|
33
|
-
import { SYNC_CACHE_TTL_MS, SYNC_CACHE_VERSION, SYNC_COMPILER_FINGERPRINT, hashFile, hashManifestWithCoordinates, hashNormalized, readSyncCache, toCacheKey, writeSyncCache, } from "./sync/cache.js";
|
|
33
|
+
import { SYNC_CACHE_TTL_MS, SYNC_CACHE_VERSION, SYNC_COMPILER_FINGERPRINT, failedSourceKeepsSemanticBaseline, hashFile, hashManifestWithCoordinates, hashNormalized, readSyncCache, toCacheKey, writeSyncCache, } from "./sync/cache.js";
|
|
34
34
|
import { clearRecoveredPendingSourceReceipts, discoverSourceFiles, } from "./sync/discovery.js";
|
|
35
35
|
import { normalizeExtractionSources, processExtractions, } from "./sync/extraction.js";
|
|
36
36
|
import { normalizeManifestLayout, refreshManifestCoordinates, } from "./sync/manifest.js";
|
|
37
|
-
import { persistEntities, persistRelationships, retractEntitiesById, retractEntitiesForSources, retractEntityRelationshipsById, retractRelationships, } from "./sync/persistence.js";
|
|
37
|
+
import { persistEntities, persistRelationships, queryStoreTotals, retractEntitiesById, retractEntitiesForSources, retractEntityRelationshipsById, retractRelationships, } from "./sync/persistence.js";
|
|
38
38
|
import { atomicPublish, atomicPublishGeneration, cleanupStaging, createUniqueStagingPath, prepareStagingEnvironment, } from "./sync/staging.js";
|
|
39
39
|
import { adoptUpsertOnlySymbolManifest, findUntrackedDocumentMatches, } from "./sync/untracked-targets.js";
|
|
40
40
|
// Manual deletion of a written-but-unstaged source leaves a recovery receipt
|
|
@@ -649,6 +649,8 @@ export async function syncCommand(options = {}, runtime = {}) {
|
|
|
649
649
|
// kb_status can say so. A source that failed in the store's first
|
|
650
650
|
// compilation (and in every sync since) is legacy content that missed the
|
|
651
651
|
// semantic baseline, so it keeps the baseline treatment once it compiles.
|
|
652
|
+
// One that compiled before keeps the semantic hash it last compiled with,
|
|
653
|
+
// so restoring its prose (or fixing only what failed) is not new authoring.
|
|
652
654
|
const previousExtractionFailures = syncCache.extractionFailures ?? {};
|
|
653
655
|
const nextExtractionFailures = {};
|
|
654
656
|
for (const failure of extraction.failures) {
|
|
@@ -656,13 +658,17 @@ export async function syncCommand(options = {}, runtime = {}) {
|
|
|
656
658
|
const hash = nextHashes[key];
|
|
657
659
|
if (hash === undefined)
|
|
658
660
|
continue;
|
|
661
|
+
const previousFailure = previousExtractionFailures[key];
|
|
662
|
+
const semanticHash = syncCache.semanticHashes[key] ?? previousFailure?.semanticHash;
|
|
663
|
+
const semanticContract = syncCache.semanticContracts[key] ?? previousFailure?.semanticContract;
|
|
659
664
|
nextExtractionFailures[key] = {
|
|
660
665
|
hash,
|
|
661
666
|
message: failure.message,
|
|
662
|
-
...(initialSemanticBaseline ||
|
|
663
|
-
previousExtractionFailures[key]?.baseline === true
|
|
667
|
+
...(initialSemanticBaseline || previousFailure?.baseline === true
|
|
664
668
|
? { baseline: true }
|
|
665
669
|
: {}),
|
|
670
|
+
...(semanticHash !== undefined ? { semanticHash } : {}),
|
|
671
|
+
...(semanticContract !== undefined ? { semanticContract } : {}),
|
|
666
672
|
};
|
|
667
673
|
}
|
|
668
674
|
const extractedResults = normalizeExtractionSources(extraction.results, workspaceRoot);
|
|
@@ -760,13 +766,18 @@ export async function syncCommand(options = {}, runtime = {}) {
|
|
|
760
766
|
const advertisedContract = result.entity.semantic_inventory_version !== undefined ||
|
|
761
767
|
result.entity.semantic_source_hash !== undefined ||
|
|
762
768
|
result.entity.semantic_inventory !== undefined;
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
769
|
+
// A source the last sync could not extract is judged by what it last
|
|
770
|
+
// compiled with, by the rule kb_upsert applies to that file.
|
|
771
|
+
const previousFailure = syncCache.hashes[key] === undefined
|
|
772
|
+
? previousExtractionFailures[key]
|
|
773
|
+
: undefined;
|
|
774
|
+
const enforceBoundary = advertisedContract ||
|
|
775
|
+
(previousFailure !== undefined
|
|
776
|
+
? !failedSourceKeepsSemanticBaseline(previousFailure, boundary.sourceHash)
|
|
777
|
+
: (!initialSemanticBaseline && syncCache.hashes[key] === undefined) ||
|
|
778
|
+
syncCache.semanticContracts[key] === true ||
|
|
779
|
+
(previousSemanticHash !== undefined &&
|
|
780
|
+
previousSemanticHash !== boundary.sourceHash));
|
|
770
781
|
if (enforceBoundary && boundary.errors.length > 0) {
|
|
771
782
|
inventoryFailures.push(`${key}: proposition-complete ingestion failed: ${boundary.errors.join("; ")}.`);
|
|
772
783
|
if (!advertisedContract)
|
|
@@ -979,6 +990,7 @@ export async function syncCommand(options = {}, runtime = {}) {
|
|
|
979
990
|
}
|
|
980
991
|
}
|
|
981
992
|
const { relationshipCount, kbModified: relationshipsModified } = await persistRelationships(engineProlog, results, [...shardDeltaByKey.values()], { workspaceRoot });
|
|
993
|
+
const storeTotals = await queryStoreTotals(engineProlog);
|
|
982
994
|
const kbModified = removedCount > 0 ||
|
|
983
995
|
relationshipChanged ||
|
|
984
996
|
entitiesModified ||
|
|
@@ -1028,6 +1040,7 @@ export async function syncCommand(options = {}, runtime = {}) {
|
|
|
1028
1040
|
branch: currentBranch,
|
|
1029
1041
|
timestamp: new Date().toISOString(),
|
|
1030
1042
|
entityCounts,
|
|
1043
|
+
...(storeTotals !== undefined ? { storeTotals } : {}),
|
|
1031
1044
|
relationshipCount,
|
|
1032
1045
|
success: true,
|
|
1033
1046
|
published,
|
|
@@ -1132,6 +1145,7 @@ export async function syncCommand(options = {}, runtime = {}) {
|
|
|
1132
1145
|
prolog.invalidateCache();
|
|
1133
1146
|
}
|
|
1134
1147
|
await runtime.beforeSave?.({ ...runtimeContext, kbModified });
|
|
1148
|
+
const storeTotals = await queryStoreTotals(prolog);
|
|
1135
1149
|
const saveResult = await prolog.query("kb_save");
|
|
1136
1150
|
if (!saveResult.success) {
|
|
1137
1151
|
throw new SyncError(`Failed to save staging KB: ${saveResult.error || "Unknown error"}`);
|
|
@@ -1215,6 +1229,7 @@ export async function syncCommand(options = {}, runtime = {}) {
|
|
|
1215
1229
|
branch: currentBranch,
|
|
1216
1230
|
timestamp: new Date().toISOString(),
|
|
1217
1231
|
entityCounts,
|
|
1232
|
+
...(storeTotals !== undefined ? { storeTotals } : {}),
|
|
1218
1233
|
relationshipCount,
|
|
1219
1234
|
success: true,
|
|
1220
1235
|
published,
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -17,7 +17,13 @@ export interface SyncSummary {
|
|
|
17
17
|
branch: string;
|
|
18
18
|
commit?: string;
|
|
19
19
|
timestamp: string;
|
|
20
|
+
/** Entities this sync imported (changed sources only), by type. */
|
|
20
21
|
entityCounts: Record<string, number>;
|
|
22
|
+
/** What the store holds after this sync, when counted. */
|
|
23
|
+
storeTotals?: Readonly<{
|
|
24
|
+
entities: Record<string, number>;
|
|
25
|
+
relationships: number;
|
|
26
|
+
}>;
|
|
21
27
|
relationshipCount: number;
|
|
22
28
|
success: boolean;
|
|
23
29
|
published: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,kBAAkB,GAC1B,2BAA2B,GAC3B,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,YAAY,GACZ,kBAAkB,GAClB,oBAAoB,CAAC;AAEzB,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC,MAAM,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jB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CASD"}
|
package/dist/diagnostics.js
CHANGED
|
@@ -45,6 +45,16 @@ export function createInvalidAuthoringDiagnostic(filePath, embeddedTypes) {
|
|
|
45
45
|
suggestion: `Move ${embeddedTypes.join(" and ")} to separate entity files and link them using 'links' with relationship types like 'specified_by' or 'verified_by'.`,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
+
function pushCounts(lines, counts) {
|
|
49
|
+
const sortedTypes = Object.keys(counts).sort();
|
|
50
|
+
if (sortedTypes.length === 0) {
|
|
51
|
+
lines.push(" (none)");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
for (const type of sortedTypes) {
|
|
55
|
+
lines.push(` ${type}: ${counts[type]}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
48
58
|
/**
|
|
49
59
|
* Format sync summary for CLI output
|
|
50
60
|
*/
|
|
@@ -57,18 +67,24 @@ export function formatSyncSummary(summary) {
|
|
|
57
67
|
}
|
|
58
68
|
lines.push(`Timestamp: ${summary.timestamp}`);
|
|
59
69
|
lines.push("");
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
// A sync recompiles only changed sources, so what it imported is a delta;
|
|
71
|
+
// the store totals are what the KB holds now.
|
|
72
|
+
// implements REQ-cli-sync-summary-kb-totals
|
|
73
|
+
const totals = summary.storeTotals;
|
|
74
|
+
if (totals === undefined) {
|
|
75
|
+
lines.push("Entity Counts:");
|
|
76
|
+
pushCounts(lines, summary.entityCounts);
|
|
77
|
+
lines.push(`Total Relationships: ${summary.relationshipCount}`);
|
|
65
78
|
}
|
|
66
79
|
else {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
80
|
+
const entityTotal = Object.values(totals.entities).reduce((sum, count) => sum + count, 0);
|
|
81
|
+
const imported = Object.values(summary.entityCounts).reduce((sum, count) => sum + count, 0);
|
|
82
|
+
lines.push(`KB Totals: ${entityTotal} entities`);
|
|
83
|
+
pushCounts(lines, totals.entities);
|
|
84
|
+
lines.push(`KB Relationships: ${totals.relationships}`);
|
|
85
|
+
lines.push(`Imported This Sync (changed sources only): ${imported} entities, ${summary.relationshipCount} relationship records`);
|
|
86
|
+
pushCounts(lines, summary.entityCounts);
|
|
70
87
|
}
|
|
71
|
-
lines.push(`Total Relationships: ${summary.relationshipCount}`);
|
|
72
88
|
lines.push("");
|
|
73
89
|
lines.push(`Status: ${summary.success ? "✓ Success" : "✗ Failed"}`);
|
|
74
90
|
lines.push(`Published: ${summary.published ? "Yes" : "No"}`);
|
package/dist/intent-search.d.ts
CHANGED
|
@@ -63,6 +63,8 @@ type GraphEdge = Readonly<{
|
|
|
63
63
|
}>;
|
|
64
64
|
/** Workspace file paths the question names in its text, in order, once each. */
|
|
65
65
|
export declare function questionPaths(query: string): string[];
|
|
66
|
+
/** The signal tokens intent ranking compares (stop words dropped, stemmed). */
|
|
67
|
+
export declare function intentTokens(value: string): readonly string[];
|
|
66
68
|
/** Markdown bodies already read in this search, keyed by entity source. */
|
|
67
69
|
export type MarkdownBodyCache = Map<string, string | null>;
|
|
68
70
|
export declare function rankIntentEntities(entities: readonly Record<string, unknown>[], options: IntentSearchOptions, workspaceRoot: string, graphEdges?: readonly GraphEdge[], bodyCache?: MarkdownBodyCache): Promise<IntentSearchResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent-search.d.ts","sourceRoot":"","sources":["../src/intent-search.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,M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BAA6B,GACvC,OAAO,CAAC,kBAAkB,CAAC,CAuJ7B;AAoCD,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CAO1E;AA8FD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAoD7B;AAGD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CA0C1E"}
|
package/dist/intent-search.js
CHANGED
|
@@ -198,6 +198,11 @@ function tokens(value) {
|
|
|
198
198
|
.split(" ")
|
|
199
199
|
.filter((token) => token.length > 0 && !STOP_WORDS.has(token))));
|
|
200
200
|
}
|
|
201
|
+
/** The signal tokens intent ranking compares (stop words dropped, stemmed). */
|
|
202
|
+
// implements REQ-kibi-contradiction-review-candidates
|
|
203
|
+
export function intentTokens(value) {
|
|
204
|
+
return tokens(value);
|
|
205
|
+
}
|
|
201
206
|
// Clause boundaries an agent writes when it packs several questions into one
|
|
202
207
|
// query: "user roles: how many can a user have, support role".
|
|
203
208
|
const CLAUSE_SEPARATOR = /[;:,!?\n]+|\.(?=\s|$)|\s[-\u2013\u2014]\s/;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { OperationContext } from "../../public/operations/runtime-types.js";
|
|
2
2
|
import type { ActivationPolicy, Candidate } from "./types.js";
|
|
3
3
|
export declare function missingManifestActivation(vendored: boolean, projectSignal: boolean): ActivationPolicy;
|
|
4
|
+
/**
|
|
5
|
+
* A legacy `.kb/config.json` without a manifest holds knowledge written by an
|
|
6
|
+
* older Kibi: it is migrated, never initialized, so the first step is the one
|
|
7
|
+
* `kibi doctor` names.
|
|
8
|
+
*/
|
|
9
|
+
export declare function legacyKbActivation(): ActivationPolicy;
|
|
4
10
|
/**
|
|
5
11
|
* On a seeded KB the plan may hold declared intent claims, already
|
|
6
12
|
* deduplicated against the existing KB. Such a plan is applicable like a thin
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/activation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/activation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAQjF,OAAO,KAAK,EAAE,gBAAgB,EAAmB,SAAS,EAAE,MAAM,YAAY,CAAC;AAI/E,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,OAAO,GACrB,gBAAgB,CAIlB;AAED;;;;GAIG;AAEH,wBAAgB,kBAAkB,IAAI,gBAAgB,CAWrD;AAkED;;;;GAIG;AAGH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,gBAAgB,CAelB;AAyDD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,gBAAgB,EACzB,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CA8E3B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { LEGACY_KB_MIGRATION_COMMAND, LEGACY_KB_MIGRATION_NOTE, readLegacyKbConfig, } from "../../utils/config.js";
|
|
2
3
|
import { readKbManifestStatus } from "../../utils/kb-manifest.js";
|
|
3
4
|
import { KB_PATHS } from "../../utils/kb-paths.js";
|
|
4
5
|
// implements REQ-KIBI-BOOTSTRAP-PLAN
|
|
@@ -6,6 +7,24 @@ import { KB_PATHS } from "../../utils/kb-paths.js";
|
|
|
6
7
|
export function missingManifestActivation(vendored, projectSignal) {
|
|
7
8
|
return activationFor(vendored && !projectSignal ? "vendored_only" : "root_uninitialized");
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* A legacy `.kb/config.json` without a manifest holds knowledge written by an
|
|
12
|
+
* older Kibi: it is migrated, never initialized, so the first step is the one
|
|
13
|
+
* `kibi doctor` names.
|
|
14
|
+
*/
|
|
15
|
+
// implements REQ-legacy-kb-first-step-migrate
|
|
16
|
+
export function legacyKbActivation() {
|
|
17
|
+
return {
|
|
18
|
+
activationState: "root_partial",
|
|
19
|
+
activationMode: "repair_bootstrap",
|
|
20
|
+
applyBlocked: true,
|
|
21
|
+
allowCandidateGeneration: true,
|
|
22
|
+
allowDeclaredClaims: true,
|
|
23
|
+
reason: `Workspace has a legacy .kb/config.json and no .kb/manifest.json; run \`${LEGACY_KB_MIGRATION_COMMAND}\` (${LEGACY_KB_MIGRATION_NOTE}) before planning bootstrap knowledge.`,
|
|
24
|
+
handoffMessage: `This knowledge base was written by an older Kibi. Run \`${LEGACY_KB_MIGRATION_COMMAND}\` (${LEGACY_KB_MIGRATION_NOTE}), then check kb_status again.`,
|
|
25
|
+
nextOperation: LEGACY_KB_MIGRATION_COMMAND,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
9
28
|
function activationFor(state) {
|
|
10
29
|
switch (state) {
|
|
11
30
|
case "root_uninitialized":
|
|
@@ -138,6 +157,9 @@ export async function classifyActivation(context, files = []) {
|
|
|
138
157
|
return relative.replaceAll("\\", "/");
|
|
139
158
|
});
|
|
140
159
|
const manifestStatus = readKbManifestStatus(context.workspaceRoot);
|
|
160
|
+
if (manifestStatus.state === "missing" &&
|
|
161
|
+
readLegacyKbConfig(context.workspaceRoot).kind !== "none")
|
|
162
|
+
return legacyKbActivation();
|
|
141
163
|
if (manifestStatus.state === "missing") {
|
|
142
164
|
const vendored = normalizedFiles.some((file) => file.startsWith("kibi/"));
|
|
143
165
|
const projectSignalFromFiles = normalizedFiles.some((file) => !file.startsWith("kibi/") &&
|
|
@@ -3,6 +3,8 @@ export type ExistingRequirement = {
|
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly title: string;
|
|
5
5
|
readonly semanticText: string;
|
|
6
|
+
/** Whether it has a logical representation; unknown when not loaded. */
|
|
7
|
+
readonly modeled?: boolean;
|
|
6
8
|
};
|
|
7
9
|
/**
|
|
8
10
|
* Token-set Jaccard at or above which a claim that is not an exact
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim-restatement.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/claim-restatement.ts"],"names":[],"mappings":"AAKA,iEAAiE;AAEjE,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"claim-restatement.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/claim-restatement.ts"],"names":[],"mappings":"AAKA,iEAAiE;AAEjE,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AAEH,eAAO,MAAM,wBAAwB,MAAsB,CAAC;AAG5D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAAC;IAC1C,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;GAGG;AAEH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM7D;AAwBD;;;;;;;GAOG;AAEH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAC3C,YAAY,EAAE,SAAS,mBAAmB,EAAE,GAC3C,gBAAgB,GAAG,IAAI,CAoCzB"}
|