kibi-cli 2.17.0 → 2.19.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.
Files changed (80) hide show
  1. package/dist/cli-operation-metadata.d.ts +1 -1
  2. package/dist/cli-operation-metadata.js +1 -1
  3. package/dist/cli-register-proof.js +9 -1
  4. package/dist/commands/doctor.d.ts.map +1 -1
  5. package/dist/commands/doctor.js +18 -6
  6. package/dist/commands/sync/manifest.d.ts +10 -0
  7. package/dist/commands/sync/manifest.d.ts.map +1 -1
  8. package/dist/commands/sync/manifest.js +27 -0
  9. package/dist/commands/sync/untracked-targets.d.ts +17 -0
  10. package/dist/commands/sync/untracked-targets.d.ts.map +1 -1
  11. package/dist/commands/sync/untracked-targets.js +81 -9
  12. package/dist/commands/sync.d.ts.map +1 -1
  13. package/dist/commands/sync.js +76 -6
  14. package/dist/engine.d.ts +4 -0
  15. package/dist/engine.d.ts.map +1 -1
  16. package/dist/engine.js +56 -33
  17. package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
  18. package/dist/operations/modeling/predicate-applicability.js +5 -2
  19. package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -1
  20. package/dist/operations/modeling/predicate-catalog-4.js +4 -0
  21. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  22. package/dist/operations/modeling/predicate-loader.js +3 -0
  23. package/dist/operations/modeling/predicate-score-3.js +1 -1
  24. package/dist/operations/modeling/predicate-types.d.ts +5 -0
  25. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  26. package/dist/operations/mutation/source-authoring.d.ts +9 -0
  27. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  28. package/dist/operations/mutation/source-authoring.js +30 -1
  29. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  30. package/dist/operations/planning/apply-plan.js +10 -1
  31. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  32. package/dist/operations/semantic-advisor/clauses.js +7 -1
  33. package/dist/prolog/store-lock.d.ts +41 -0
  34. package/dist/prolog/store-lock.d.ts.map +1 -1
  35. package/dist/prolog/store-lock.js +91 -1
  36. package/dist/prolog.d.ts +7 -1
  37. package/dist/prolog.d.ts.map +1 -1
  38. package/dist/prolog.js +21 -3
  39. package/dist/proof/inspect.d.ts +8 -1
  40. package/dist/proof/inspect.d.ts.map +1 -1
  41. package/dist/proof/inspect.js +19 -2
  42. package/dist/public/operations/catalog.d.ts +50 -1
  43. package/dist/public/operations/catalog.d.ts.map +1 -1
  44. package/dist/public/operations/contracts.d.ts.map +1 -1
  45. package/dist/public/operations/contracts.js +4 -4
  46. package/dist/public/operations/discovery-executors.d.ts +50 -1
  47. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  48. package/dist/public/operations/discovery-executors.js +418 -8
  49. package/dist/public/operations/migration-plan.d.ts +2 -0
  50. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  51. package/dist/public/operations/migration-plan.js +31 -0
  52. package/dist/public/operations/source-relationship-parity.d.ts.map +1 -1
  53. package/dist/public/operations/source-relationship-parity.js +55 -1
  54. package/dist/public/operations/specs/discovery.d.ts +50 -1
  55. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  56. package/dist/public/operations/specs/discovery.js +56 -1
  57. package/dist/public/skills/kibi-usage/SKILL.md +20 -3
  58. package/dist/public/skills/kibi-usage/resources/proof.md +23 -0
  59. package/dist/runtime/cli-runtime.d.ts.map +1 -1
  60. package/dist/runtime/cli-runtime.js +7 -2
  61. package/dist/search-answer.d.ts +12 -3
  62. package/dist/search-answer.d.ts.map +1 -1
  63. package/dist/search-answer.js +51 -4
  64. package/dist/utils/branch-store.d.ts +8 -0
  65. package/dist/utils/branch-store.d.ts.map +1 -1
  66. package/dist/utils/branch-store.js +27 -1
  67. package/dist/utils/content-freshness.d.ts +13 -0
  68. package/dist/utils/content-freshness.d.ts.map +1 -0
  69. package/dist/utils/content-freshness.js +171 -0
  70. package/dist/utils/symbol-manifest-layout.d.ts +9 -0
  71. package/dist/utils/symbol-manifest-layout.d.ts.map +1 -0
  72. package/dist/utils/symbol-manifest-layout.js +18 -0
  73. package/package.json +2 -2
  74. package/src/public/operations/contracts.ts +7 -4
  75. package/src/public/operations/discovery-executors.ts +556 -6
  76. package/src/public/operations/migration-plan.ts +44 -0
  77. package/src/public/operations/source-relationship-parity.ts +60 -3
  78. package/src/public/operations/specs/discovery.ts +67 -1
  79. package/src/public/skills/kibi-usage/SKILL.md +20 -3
  80. package/src/public/skills/kibi-usage/resources/proof.md +23 -0
@@ -23,7 +23,7 @@ export declare const CLI_OPERATION_METADATA: readonly [{
23
23
  }, {
24
24
  readonly name: "kb_query";
25
25
  readonly cliName: "query";
26
- readonly description: "Read entities from the KB with filters. Use for discovery and lookup before edits. Do not use for writes. No mutation side effects. Tags filter by metadata tags only, not entity IDs.";
26
+ readonly description: "Read entities from the KB with exact filters, or ask typed fact questions. Use for lookup by id, type, tags or sourceFile, and for precise questions about modeled facts: predicate facts by name with named arguments (predicate + where), property facts of a subject (subjectKey + propertyKey), or the catalog of facts of one kind (factKind; 'predicate_schema' lists the predicates you can ask about with their argument names and constants). Typed answers return matching fact rows plus factQuery: the schema used, distinct counts, values that do exist when nothing matched, warnings about the question and the next call to make. Read-only. Tags filter by metadata tags only, not entity IDs.";
27
27
  }, {
28
28
  readonly name: "kb_search";
29
29
  readonly cliName: "search";
@@ -25,7 +25,7 @@ export const CLI_OPERATION_METADATA = [
25
25
  {
26
26
  name: "kb_query",
27
27
  cliName: "query",
28
- description: "Read entities from the KB with filters. Use for discovery and lookup before edits. Do not use for writes. No mutation side effects. Tags filter by metadata tags only, not entity IDs.",
28
+ description: "Read entities from the KB with exact filters, or ask typed fact questions. Use for lookup by id, type, tags or sourceFile, and for precise questions about modeled facts: predicate facts by name with named arguments (predicate + where), property facts of a subject (subjectKey + propertyKey), or the catalog of facts of one kind (factKind; 'predicate_schema' lists the predicates you can ask about with their argument names and constants). Typed answers return matching fact rows plus factQuery: the schema used, distinct counts, values that do exist when nothing matched, warnings about the question and the next call to make. Read-only. Tags filter by metadata tags only, not entity IDs.",
29
29
  },
30
30
  {
31
31
  name: "kb_search",
@@ -162,7 +162,15 @@ function renderInspection(result) {
162
162
  if (inspection.ciWorkflows.length > 0)
163
163
  lines.push(`CI workflows: ${inspection.ciWorkflows.join(", ")}`);
164
164
  lines.push("");
165
- lines.push(`Current integration: ${inspection.currentIntegration ?? "none"}`);
165
+ const configured = inspection.currentIntegrations ?? [];
166
+ if (configured.length === 0) {
167
+ lines.push(`Current integration: ${inspection.currentIntegration ?? "none"}`);
168
+ }
169
+ else {
170
+ lines.push("Current integrations:");
171
+ for (const entry of configured)
172
+ lines.push(` ${entry.id} (${entry.producer}: ${entry.command.join(" ")})`);
173
+ }
166
174
  lines.push("");
167
175
  lines.push(`Recommendation: ${inspection.recommendation}`);
168
176
  if (inspection.missing.length > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AA2FA,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,CAmH/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"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AA4FA,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,CAmH/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"}
@@ -26,7 +26,7 @@ import { describeConfiguredCapabilityPlugins, readProjectKibiConfig, } from "../
26
26
  import { SwiplResolutionError, inspectSwiplBundle, probeRequiredLibraries, resolveSwipl, } from "../prolog/swipl-resolver.js";
27
27
  import { buildMigrationPlan, migrationAction, } from "../public/operations/migration-plan.js";
28
28
  import { resolveBranchAttachment, resolveReadBranchAttachment, } from "../utils/branch-resolver.js";
29
- import { branchStoreCompilation, inspectBranchStore, uncompiledBranchStoreReason, } from "../utils/branch-store.js";
29
+ import { branchStoreCompilation, inspectBranchStore, storeLockTakeoverReason, uncompiledBranchStoreReason, } from "../utils/branch-store.js";
30
30
  import { resolveGitRepository, } from "../utils/git-repository-context.js";
31
31
  import { readKbManifestStatus } from "../utils/kb-manifest.js";
32
32
  import { hasManagedHooks, outdatedManagedHooks } from "./init-helpers.js";
@@ -692,29 +692,41 @@ function checkBranchStore() {
692
692
  };
693
693
  }
694
694
  const compilation = branchStoreCompilation(store);
695
+ // implements REQ-core-journaled-engine-persistence
696
+ const takeover = storeLockTakeoverReason(store.path);
697
+ // A takeover is reported whether or not the store holds a compilation yet.
698
+ const withTakeover = (message) => takeover
699
+ ? `${message}${message.endsWith(".") ? "" : "."} ${String(takeover.detail)}`
700
+ : message;
701
+ const takeoverDetails = takeover ? { lockTakeover: takeover } : {};
695
702
  if (compilation.compiled) {
696
703
  return {
697
704
  passed: true,
698
- message: `Compiled for ${branch}${compilation.generation ? ` (${compilation.generation})` : ""}`,
699
- details: { ...details, generation: compilation.generation },
705
+ message: withTakeover(`Compiled for ${branch}${compilation.generation ? ` (${compilation.generation})` : ""}`),
706
+ details: {
707
+ ...details,
708
+ generation: compilation.generation,
709
+ ...takeoverDetails,
710
+ },
700
711
  };
701
712
  }
702
713
  const reason = uncompiledBranchStoreReason(workspaceRoot, store, branch);
703
714
  if (reason === null) {
704
715
  return {
705
716
  passed: true,
706
- message: `Not compiled yet for ${branch}; .kb/ holds no authored sources`,
707
- details,
717
+ message: withTakeover(`Not compiled yet for ${branch}; .kb/ holds no authored sources`),
718
+ details: { ...details, ...takeoverDetails },
708
719
  };
709
720
  }
710
721
  return {
711
722
  passed: false,
712
- message: String(reason.detail),
723
+ message: withTakeover(String(reason.detail)),
713
724
  remediation: "Run: kibi sync",
714
725
  details: {
715
726
  ...details,
716
727
  generation: compilation.generation,
717
728
  authoredSources: reason.authoredSources,
729
+ ...takeoverDetails,
718
730
  },
719
731
  };
720
732
  }
@@ -33,6 +33,16 @@ export declare function refreshManifestCoordinates(manifestPath: string, workspa
33
33
  refreshSymbolCoordinates?: boolean;
34
34
  quiet?: boolean;
35
35
  }): Promise<void>;
36
+ /**
37
+ * Rewrite a symbol manifest whose `symbols` sequence is in YAML flow layout
38
+ * (`symbols: [ { id: … }, … ]`) as block YAML, keeping comments and entry
39
+ * order. kibi-cli before 2.18.0 appended to the `symbols: []` that
40
+ * `kibi init` writes and kept every symbol on that one line; the hook
41
+ * scanners of older adapters cannot read it and diffs of it are unreviewable,
42
+ * so plain `kibi sync` normalises it once. Returns the number of symbols
43
+ * when the file was rewritten, otherwise null.
44
+ */
45
+ export declare function normalizeManifestLayout(manifestPath: string, deps?: Partial<ManifestDeps>): number | null;
36
46
  export declare function hasAllGeneratedCoordinates(entry: ManifestSymbolEntry): boolean;
37
47
  export declare function isEligibleForCoordinateRefresh(sourceFile: string | undefined, workspaceRoot: string, deps?: Partial<ManifestDeps>): boolean;
38
48
  //# sourceMappingURL=manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/manifest.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAML,uBAAuB,EACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,mBAAmB,EACxB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,0BAA0B,EAG3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,UAAU,YAAY;IACpB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,UAAU,EAAE,OAAO,UAAU,CAAC;IA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{ existsSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
19
19
  import * as path from "node:path";
20
20
  import { dump as dumpYAML, load as parseYAML } from "js-yaml";
21
+ import { isSeq, parseDocument } from "yaml";
21
22
  import { coarseCoordinateSpan, coordinateIdentityHash, coordinateSourceHash, parseCoordinateArtifact, writeCoordinateArtifact, } from "../../extractors/symbol-coordinates.js";
22
23
  import { enrichSymbolCoordinates, } from "../../extractors/symbols-coordinator.js";
23
24
  import { COARSE_GRANULARITY_REASONS, COARSE_GRANULARITY_REASONS_PARENTHESIZED, isCoarseGranularityReason, } from "../../public/symbol-granularity.js";
24
25
  import { resolveSymbolsManifestPaths } from "../../utils/manifest-paths.js";
26
+ import { blockifySymbolManifest } from "../../utils/symbol-manifest-layout.js";
25
27
  function resolveDeps(overrides) {
26
28
  return {
27
29
  dumpYAML,
@@ -307,6 +309,31 @@ manifestPath, workspaceRoot, deps) {
307
309
  }
308
310
  }
309
311
  }
312
+ /**
313
+ * Rewrite a symbol manifest whose `symbols` sequence is in YAML flow layout
314
+ * (`symbols: [ { id: … }, … ]`) as block YAML, keeping comments and entry
315
+ * order. kibi-cli before 2.18.0 appended to the `symbols: []` that
316
+ * `kibi init` writes and kept every symbol on that one line; the hook
317
+ * scanners of older adapters cannot read it and diffs of it are unreviewable,
318
+ * so plain `kibi sync` normalises it once. Returns the number of symbols
319
+ * when the file was rewritten, otherwise null.
320
+ */
321
+ // implements REQ-kibi-hooks-flow-manifest
322
+ export function normalizeManifestLayout(manifestPath, deps) {
323
+ const resolved = resolveDeps(deps);
324
+ const rawContent = String(resolved.readFileSync(manifestPath, "utf8"));
325
+ const doc = parseDocument(rawContent);
326
+ const symbols = doc.get("symbols", true);
327
+ if (!isSeq(symbols) || symbols.items.length === 0)
328
+ return null;
329
+ if (!blockifySymbolManifest(doc))
330
+ return null;
331
+ const nextContent = doc.toString({ lineWidth: 0 });
332
+ if (nextContent === rawContent)
333
+ return null;
334
+ publishAtomically(manifestPath, nextContent, resolved);
335
+ return symbols.items.length;
336
+ }
310
337
  export function hasAllGeneratedCoordinates(
311
338
  // implements REQ-003
312
339
  entry) {
@@ -20,5 +20,22 @@ interface UntrackedTargetsDeps {
20
20
  * the diagnostic can never break a sync run.
21
21
  */
22
22
  export declare function findUntrackedDocumentMatches(workspaceRoot: string, missingIds: readonly string[], deps?: Partial<UntrackedTargetsDeps>): Map<string, string>;
23
+ /**
24
+ * Give an upsert-only symbol manifest the pending-source receipt kb_upsert
25
+ * writes since it learned to (`writeSourceForUpsert`).
26
+ *
27
+ * Older Kibi appended symbols to the untracked `.kb/symbols.yaml` that
28
+ * `kibi init` creates without a receipt. The upsert wrote those symbols into
29
+ * the store directly, but sync never saw the manifest, so the store recorded
30
+ * no content hash for it and every source its symbols reference stayed
31
+ * "newer" after a clone or checkout, however many times sync ran.
32
+ *
33
+ * The manifest is adopted only when Git does not track it, no receipt covers
34
+ * it, and at least one symbol it declares is already in the compiled store
35
+ * (`isStored`): Kibi wrote it. A hand-written untracked manifest whose
36
+ * symbols the store never saw keeps the tracked-only boundary and sync's
37
+ * "stage this file" note. Returns whether a receipt was written.
38
+ */
39
+ export declare function adoptUpsertOnlySymbolManifest(workspaceRoot: string, isStored: (ids: readonly string[]) => Promise<boolean>): Promise<boolean>;
23
40
  export {};
24
41
  //# sourceMappingURL=untracked-targets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"untracked-targets.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/untracked-targets.ts"],"names":[],"mappings":"AAsBA,UAAU,oBAAoB;IAC5B,YAAY,EAAE,CACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAC5D,MAAM,CAAC;IACZ,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1D;AAQD;;;;;;;;;;;GAWG;AAEH,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,IAAI,GAAE,OAAO,CAAC,oBAAoB,CAAM,GACvC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAiDrB"}
1
+ {"version":3,"file":"untracked-targets.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/untracked-targets.ts"],"names":[],"mappings":"AA6BA,UAAU,oBAAoB;IAC5B,YAAY,EAAE,CACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAC5D,MAAM,CAAC;IACZ,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1D;AAQD;;;;;;;;;;;GAWG;AAEH,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,IAAI,GAAE,OAAO,CAAC,oBAAoB,CAAM,GACvC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAsDrB;AAED;;;;;;;;;;;;;;;GAeG;AAEH,wBAAsB,6BAA6B,CACjD,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GACrD,OAAO,CAAC,OAAO,CAAC,CAqBlB"}
@@ -16,8 +16,12 @@
16
16
  along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
  import { execFileSync } from "node:child_process";
19
+ import { createHash } from "node:crypto";
19
20
  import { existsSync, readFileSync } from "node:fs";
20
21
  import * as path from "node:path";
22
+ import { load as parseYAML } from "js-yaml";
23
+ import { isUntrackedByGit, writePendingSourceReceipt, } from "../../operations/mutation/source-authoring.js";
24
+ import { KB_PATHS, isSymbolsManifestPath } from "../../utils/kb-paths.js";
21
25
  const defaultDeps = {
22
26
  execFileSync: (file, args, options) => execFileSync(file, args, options),
23
27
  existsSync,
@@ -62,11 +66,20 @@ export function findUntrackedDocumentMatches(workspaceRoot, missingIds, deps = {
62
66
  for (const relative of untracked) {
63
67
  if (remaining.size === 0)
64
68
  break;
65
- if (!relative.endsWith(".md"))
69
+ const normalized = relative.replaceAll("\\", "/");
70
+ const manifest = isSymbolsManifestPath(normalized);
71
+ if (!normalized.endsWith(".md") && !manifest)
66
72
  continue;
67
- const absolute = path.resolve(workspaceRoot, relative.replaceAll("\\", "/"));
73
+ const absolute = path.resolve(workspaceRoot, normalized);
68
74
  if (!resolved.existsSync(absolute))
69
75
  continue;
76
+ const workspaceRelative = path
77
+ .relative(workspaceRoot, absolute)
78
+ .replaceAll("\\", "/");
79
+ // A pending-source receipt makes an untracked file visible to sync, so
80
+ // the file cannot be why an id is missing.
81
+ if (existsSync(pendingReceiptFor(workspaceRoot, workspaceRelative)))
82
+ continue;
70
83
  let content;
71
84
  try {
72
85
  content = resolved.readFileSync(absolute, "utf8");
@@ -74,17 +87,76 @@ export function findUntrackedDocumentMatches(workspaceRoot, missingIds, deps = {
74
87
  catch {
75
88
  continue;
76
89
  }
77
- const id = frontmatterId(content);
78
- if (id !== null && remaining.has(id)) {
79
- const workspaceRelative = path
80
- .relative(workspaceRoot, absolute)
81
- .replaceAll("\\", "/");
82
- matches.set(id, workspaceRelative);
83
- remaining.delete(id);
90
+ const ids = manifest ? manifestIds(content) : [frontmatterId(content)];
91
+ for (const id of ids) {
92
+ if (id !== null && remaining.has(id)) {
93
+ matches.set(id, workspaceRelative);
94
+ remaining.delete(id);
95
+ }
84
96
  }
85
97
  }
86
98
  return matches;
87
99
  }
100
+ /**
101
+ * Give an upsert-only symbol manifest the pending-source receipt kb_upsert
102
+ * writes since it learned to (`writeSourceForUpsert`).
103
+ *
104
+ * Older Kibi appended symbols to the untracked `.kb/symbols.yaml` that
105
+ * `kibi init` creates without a receipt. The upsert wrote those symbols into
106
+ * the store directly, but sync never saw the manifest, so the store recorded
107
+ * no content hash for it and every source its symbols reference stayed
108
+ * "newer" after a clone or checkout, however many times sync ran.
109
+ *
110
+ * The manifest is adopted only when Git does not track it, no receipt covers
111
+ * it, and at least one symbol it declares is already in the compiled store
112
+ * (`isStored`): Kibi wrote it. A hand-written untracked manifest whose
113
+ * symbols the store never saw keeps the tracked-only boundary and sync's
114
+ * "stage this file" note. Returns whether a receipt was written.
115
+ */
116
+ // implements REQ-cli-status-pre-first-sync, REQ-core-persistence
117
+ export async function adoptUpsertOnlySymbolManifest(workspaceRoot, isStored) {
118
+ const relative = KB_PATHS.symbolsManifest;
119
+ const absolute = path.resolve(workspaceRoot, relative);
120
+ if (!existsSync(absolute))
121
+ return false;
122
+ if (existsSync(pendingReceiptFor(workspaceRoot, relative)))
123
+ return false;
124
+ let bytes;
125
+ try {
126
+ bytes = readFileSync(absolute);
127
+ }
128
+ catch {
129
+ return false;
130
+ }
131
+ const ids = manifestIds(bytes.toString("utf8"));
132
+ if (ids.length === 0)
133
+ return false;
134
+ if (!isUntrackedByGit(workspaceRoot, relative))
135
+ return false;
136
+ if (!(await isStored(ids)))
137
+ return false;
138
+ writePendingSourceReceipt(workspaceRoot, relative, createHash("sha256").update(bytes).digest("hex"));
139
+ return true;
140
+ }
141
+ /** Where kb_upsert records the pending-source receipt of `relative`. */
142
+ function pendingReceiptFor(workspaceRoot, relative) {
143
+ return path.join(workspaceRoot, ".kb", "recovery", "pending-sources", `${createHash("sha256").update(relative).digest("hex")}.json`);
144
+ }
145
+ /** Symbol ids declared by an untracked symbols manifest. */
146
+ function manifestIds(content) {
147
+ try {
148
+ const parsed = parseYAML(content);
149
+ const symbols = Array.isArray(parsed?.symbols) ? parsed.symbols : [];
150
+ return symbols.flatMap((symbol) => symbol !== null &&
151
+ typeof symbol === "object" &&
152
+ typeof symbol.id === "string"
153
+ ? [symbol.id]
154
+ : []);
155
+ }
156
+ catch {
157
+ return [];
158
+ }
159
+ }
88
160
  /**
89
161
  * Extract `id:` from a markdown document's YAML frontmatter (the first
90
162
  * `---` block). Documents whose id never appears in the frontmatter region
@@ -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;AAyBrC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AA2BxE,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAmCD,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,EACxB,4BAA4B,UAAQ,EACpC,4BAA4B,GAAE,4BAA4B,EAAO,GAChE,MAAM,EAAE,CAuGV;AAqDD,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,yBAAyB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,kBAAkB;IAC1B,WAAW,CAAC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B,CAAC;IACpC,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;CACZ,EACN,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,UAAU,CAAC,CA+qCrB;AAED,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -33,9 +33,10 @@ import { loadEntityPaths } from "../utils/config.js";
33
33
  import { SYNC_CACHE_TTL_MS, SYNC_CACHE_VERSION, SYNC_COMPILER_FINGERPRINT, 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
- import { refreshManifestCoordinates } from "./sync/manifest.js";
36
+ import { normalizeManifestLayout, refreshManifestCoordinates, } from "./sync/manifest.js";
37
37
  import { persistEntities, persistRelationships, retractEntitiesById, retractEntitiesForSources, retractEntityRelationshipsById, retractRelationships, } from "./sync/persistence.js";
38
38
  import { atomicPublish, atomicPublishGeneration, cleanupStaging, createUniqueStagingPath, prepareStagingEnvironment, } from "./sync/staging.js";
39
+ import { adoptUpsertOnlySymbolManifest, findUntrackedDocumentMatches, } from "./sync/untracked-targets.js";
39
40
  // Manual deletion of a written-but-unstaged source leaves a recovery receipt
40
41
  // behind; sync refuses to guess, so the error must name the way out.
41
42
  const PENDING_SOURCE_RECOVERY_HINT = " If the file was deleted on purpose, run 'kibi branch recover --apply' to rebuild the branch KB from the sources that remain.";
@@ -201,9 +202,58 @@ async function checkpointNoopSync(workspaceRoot, branch) {
201
202
  await engine.terminate();
202
203
  }
203
204
  }
205
+ /** Whether the branch's compiled store already holds any of `ids`. */
206
+ // implements REQ-cli-status-pre-first-sync
207
+ async function storeHoldsAnyEntity(workspaceRoot, branch, ids) {
208
+ const engine = new EngineClient({
209
+ workspaceRoot,
210
+ branch,
211
+ timeout: 120_000,
212
+ });
213
+ try {
214
+ await engine.start();
215
+ for (const id of ids) {
216
+ const found = await engine.queryEntities({ id, limit: 1, offset: 0 });
217
+ if (found.count > 0 || found.entities.length > 0)
218
+ return true;
219
+ }
220
+ return false;
221
+ }
222
+ catch {
223
+ // Adoption is best effort: an unreadable store adopts nothing and the
224
+ // compile below reports the store itself.
225
+ return false;
226
+ }
227
+ finally {
228
+ await engine.terminate();
229
+ }
230
+ }
204
231
  function compilerCacheHasEntityDelta(cache) {
205
232
  return (cache.entityHashes !== undefined && cache.sourceEntityIds !== undefined);
206
233
  }
234
+ /**
235
+ * Name every dangling relationship and its missing endpoint, and say when an
236
+ * endpoint is declared in a source sync cannot see (untracked by Git and
237
+ * without a pending-source receipt): staging that file is the fix.
238
+ */
239
+ // implements REQ-core-persistence
240
+ function reportDanglingRelationships(workspaceRoot, validationErrors) {
241
+ console.warn(`Warning: ${validationErrors.length} dangling relationship(s) found`);
242
+ const missing = new Set();
243
+ for (const { relationship, error } of validationErrors) {
244
+ const endpoint = error === "missing_from" ? relationship.from : relationship.to;
245
+ missing.add(endpoint);
246
+ console.warn(` - ${error}: ${relationship.type} ${relationship.from} -> ${relationship.to} (${endpoint} is not in this branch's sources)`);
247
+ }
248
+ const untracked = findUntrackedDocumentMatches(workspaceRoot, [...missing]);
249
+ const byFile = new Map();
250
+ for (const [id, file] of untracked) {
251
+ byFile.set(file, [...(byFile.get(file) ?? []), id]);
252
+ }
253
+ for (const [file, ids] of byFile) {
254
+ console.warn(` Note: ${ids.sort().join(", ")} ${ids.length === 1 ? "is" : "are"} declared in ${file}, which Git does not track and no pending-source receipt covers, so sync ignores it. Run \`git add ${file}\` (staging is enough) or rewrite the entity with kb_upsert, then sync again.`);
255
+ }
256
+ }
207
257
  function compilerCacheIsFresh(cache, workspaceRoot, sourceFiles, nowMs) {
208
258
  const sourceKeys = sourceFiles.map((file) => toCacheKey(workspaceRoot, file));
209
259
  if (Object.keys(cache.hashes).some((key) => !sourceKeys.includes(key))) {
@@ -330,6 +380,18 @@ export async function syncCommand(options = {}, runtime = {}) {
330
380
  ensureBranchStoreManifest(workspaceRoot, currentBranch);
331
381
  await ensureJournaledBranchStoreAsync(livePathForEngine);
332
382
  }
383
+ // implements REQ-cli-status-pre-first-sync
384
+ // An untracked symbol manifest that only kb_upsert ever wrote (older Kibi
385
+ // left it without a pending-source receipt) gets the receipt here, so
386
+ // this sync compiles it and records its content hash. Without it the
387
+ // sources its symbols reference read as newer after every clone.
388
+ if (!validateOnly &&
389
+ recoveryBackupPath === undefined &&
390
+ options.detachedSnapshot === undefined &&
391
+ runtime.createProlog === undefined) {
392
+ const branch = currentBranch;
393
+ await adoptUpsertOnlySymbolManifest(workspaceRoot, (ids) => storeHoldsAnyEntity(workspaceRoot, branch, ids));
394
+ }
333
395
  const needsExclusiveGenerationPublish = !validateOnly && (rebuild || recoveryBackupPath !== undefined);
334
396
  if (needsExclusiveGenerationPublish) {
335
397
  // Recovery intentionally avoids attaching the broken live store. The
@@ -389,6 +451,17 @@ export async function syncCommand(options = {}, runtime = {}) {
389
451
  const relationshipShardFiles = existsSync(relationshipsDir)
390
452
  ? trackedRelationshipFiles(workspaceRoot, relationshipsDir, recoveryBackupPath !== undefined, recoveredPendingReceiptPaths)
391
453
  : [];
454
+ // A manifest an older writer left in flow layout is rewritten as block
455
+ // YAML before anything hashes it, ahead of the no-op fast path below, so
456
+ // a project whose cache is already fresh still gets it on the next sync.
457
+ if (!validateOnly) {
458
+ for (const file of manifestFiles) {
459
+ const normalized = normalizeManifestLayout(file);
460
+ if (normalized !== null) {
461
+ console.log(`\u2713 Rewrote ${path.relative(workspaceRoot, file)} in block layout (${normalized} symbol${normalized === 1 ? "" : "s"})`);
462
+ }
463
+ }
464
+ }
392
465
  // No-op is a first-class compiler result. Hashing the configured inputs is
393
466
  // sufficient when normalized entity/shard inventories are already fresh;
394
467
  // avoid rebuilding maps and rediscovering RDF state for the common path.
@@ -852,7 +925,7 @@ export async function syncCommand(options = {}, runtime = {}) {
852
925
  ? []
853
926
  : validateRelationships(allRelationships, entityIds);
854
927
  if (validationErrors.length > 0) {
855
- console.warn(`Warning: ${validationErrors.length} dangling relationship(s) found`);
928
+ reportDanglingRelationships(workspaceRoot, validationErrors);
856
929
  }
857
930
  const danglingKeys = new Set(validationErrors.map(({ relationship }) => `${relationship.type}|${relationship.from}|${relationship.to}`));
858
931
  const shardDeltaByKey = new Map();
@@ -973,10 +1046,7 @@ export async function syncCommand(options = {}, runtime = {}) {
973
1046
  const { entityCount, kbModified: entitiesModified } = await persistEntities(prolog, results, entityIds);
974
1047
  const validationErrors = validateRelationships(allRelationships, entityIds);
975
1048
  if (validationErrors.length > 0) {
976
- console.warn(`Warning: ${validationErrors.length} dangling relationship(s) found`);
977
- for (const { relationship, error } of validationErrors) {
978
- console.warn(` - ${error}: ${relationship.type} ${relationship.from} -> ${relationship.to}`);
979
- }
1049
+ reportDanglingRelationships(workspaceRoot, validationErrors);
980
1050
  }
981
1051
  const danglingKeys = new Set(validationErrors.map(({ relationship: r }) => `${r.type}|${r.from}|${r.to}`));
982
1052
  const validRelationships = allRelationships.filter((r) => !danglingKeys.has(`${r.type}|${r.from}|${r.to}`));
package/dist/engine.d.ts CHANGED
@@ -8,6 +8,10 @@ export { EngineQueryLimitError, QUERY_LIMIT_EXCEEDED_CODE, queryLimitExceededOf,
8
8
  export type { EngineLimitExceeded, EngineQueryLimits, } from "./engine-limits.js";
9
9
  export declare const ENGINE_PROTOCOL_VERSION = 1;
10
10
  export declare const ENGINE_IDLE_TIMEOUT_MS: number;
11
+ /** Upper bound between two wall-clock idle checks of the engine daemon. */
12
+ export declare const ENGINE_IDLE_CHECK_INTERVAL_MS: number;
13
+ /** How long a stopping daemon waits for SWI to halt on stdin EOF. */
14
+ export declare const ENGINE_PROLOG_EXIT_GRACE_MS = 1000;
11
15
  /**
12
16
  * Package versions this engine build carries (KIBI_PACKAGE_VERSIONS when
13
17
  * set). The client sends them on every request and the daemon reports its
@@ -1 +1 @@
1
- {"version":3,"file":"engine.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