kibi-cli 0.5.1 → 0.6.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/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +3 -2
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +64 -53
- package/dist/commands/discovery-shared.d.ts +12 -5
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +21 -13
- package/dist/commands/doctor.js +9 -1
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +2 -3
- package/dist/commands/query.d.ts.map +1 -1
- package/dist/commands/query.js +15 -5
- package/dist/commands/search.js +1 -1
- package/dist/commands/sync/cache.d.ts +14 -4
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +36 -14
- package/dist/commands/sync/extraction.d.ts.map +1 -1
- package/dist/commands/sync/extraction.js +4 -9
- package/dist/commands/sync/manifest.d.ts +14 -3
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +29 -10
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +9 -5
- package/dist/commands/sync/staging.d.ts +19 -3
- package/dist/commands/sync/staging.d.ts.map +1 -1
- package/dist/commands/sync/staging.js +50 -27
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +16 -20
- package/dist/diagnostics.d.ts +1 -10
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +6 -12
- package/dist/env.d.ts +7 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +41 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +17 -15
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +124 -30
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +10 -4
- package/dist/extractors/symbols-coordinator.d.ts +5 -2
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +5 -2
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +56 -10
- package/dist/prolog/codec.d.ts +0 -43
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +68 -74
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +39 -25
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -0
- package/dist/query/service.d.ts +9 -0
- package/dist/query/service.d.ts.map +1 -1
- package/dist/query/service.js +27 -10
- package/dist/schemas/entity.schema.json +22 -0
- package/dist/search-ranking.d.ts.map +1 -1
- package/dist/search-ranking.js +19 -3
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +22 -6
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +10 -4
- package/dist/traceability/temp-kb.d.ts +12 -0
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +42 -8
- package/dist/traceability/validate.d.ts.map +1 -1
- package/dist/traceability/validate.js +11 -2
- package/dist/utils/branch-resolver.d.ts +4 -0
- package/dist/utils/branch-resolver.d.ts.map +1 -1
- package/dist/utils/branch-resolver.js +29 -12
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +8 -2
- package/dist/utils/rule-registry.js +2 -2
- package/package.json +3 -9
- package/src/public/schemas/relationship.ts +1 -0
- package/src/schemas/entity.schema.json +22 -0
- package/src/schemas/relationship.schema.json +1 -0
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dump as dumpYAML, load as parseYAML } from "js-yaml";
|
|
3
|
+
import { type ManifestSymbolEntry, enrichSymbolCoordinates } from "../../extractors/symbols-coordinator.js";
|
|
4
|
+
interface ManifestDeps {
|
|
5
|
+
dumpYAML: typeof dumpYAML;
|
|
6
|
+
enrichSymbolCoordinates: typeof enrichSymbolCoordinates;
|
|
7
|
+
existsSync: typeof existsSync;
|
|
8
|
+
parseYAML: typeof parseYAML;
|
|
9
|
+
readFileSync: typeof readFileSync;
|
|
10
|
+
writeFileSync: typeof writeFileSync;
|
|
11
|
+
}
|
|
12
|
+
export declare function refreshManifestCoordinates(manifestPath: string, workspaceRoot: string, deps?: Partial<ManifestDeps>): Promise<void>;
|
|
3
13
|
export declare function hasAllGeneratedCoordinates(entry: ManifestSymbolEntry): boolean;
|
|
4
|
-
export declare function isEligibleForCoordinateRefresh(sourceFile: string | undefined, workspaceRoot: string): boolean;
|
|
14
|
+
export declare function isEligibleForCoordinateRefresh(sourceFile: string | undefined, workspaceRoot: string, deps?: Partial<ManifestDeps>): boolean;
|
|
15
|
+
export {};
|
|
5
16
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/manifest.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,KAAK,mBAAmB,EACxB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AAEjD,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,aAAa,EAAE,OAAO,aAAa,CAAC;CACrC;AAyCD,wBAAsB,0BAA0B,CAE9C,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC3B,OAAO,CAAC,IAAI,CAAC,CA8Ef;AAED,wBAAgB,0BAA0B,CAExC,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAST;AAED,wBAAgB,8BAA8B,CAE5C,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC3B,OAAO,CAUT"}
|
|
@@ -19,6 +19,17 @@ import { existsSync, readFileSync, 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
21
|
import { enrichSymbolCoordinates, } from "../../extractors/symbols-coordinator.js";
|
|
22
|
+
function resolveDeps(overrides) {
|
|
23
|
+
return {
|
|
24
|
+
dumpYAML,
|
|
25
|
+
enrichSymbolCoordinates,
|
|
26
|
+
existsSync,
|
|
27
|
+
parseYAML,
|
|
28
|
+
readFileSync,
|
|
29
|
+
writeFileSync,
|
|
30
|
+
...overrides,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
22
33
|
const SYMBOLS_MANIFEST_COMMENT_BLOCK = `# symbols.yaml
|
|
23
34
|
# AUTHORED fields (edit freely):
|
|
24
35
|
# id, title, sourceFile, links, status, tags, owner, priority
|
|
@@ -43,9 +54,12 @@ const GENERATED_COORD_FIELDS = [
|
|
|
43
54
|
"sourceEndColumn",
|
|
44
55
|
"coordinatesGeneratedAt",
|
|
45
56
|
];
|
|
46
|
-
export async function refreshManifestCoordinates(
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
export async function refreshManifestCoordinates(
|
|
58
|
+
// implements REQ-003
|
|
59
|
+
manifestPath, workspaceRoot, deps) {
|
|
60
|
+
const resolved = resolveDeps(deps);
|
|
61
|
+
const rawContent = resolved.readFileSync(manifestPath, "utf8");
|
|
62
|
+
const parsed = resolved.parseYAML(rawContent);
|
|
49
63
|
if (!isRecord(parsed)) {
|
|
50
64
|
console.warn(`Warning: symbols manifest ${manifestPath} is not a YAML object; skipping coordinate refresh`);
|
|
51
65
|
return;
|
|
@@ -58,7 +72,7 @@ export async function refreshManifestCoordinates(manifestPath, workspaceRoot) {
|
|
|
58
72
|
const before = rawSymbols.map((entry) => isRecord(entry)
|
|
59
73
|
? { ...entry }
|
|
60
74
|
: {});
|
|
61
|
-
const enriched = await enrichSymbolCoordinates(before, workspaceRoot);
|
|
75
|
+
const enriched = await resolved.enrichSymbolCoordinates(before, workspaceRoot);
|
|
62
76
|
parsed.symbols = enriched;
|
|
63
77
|
let refreshed = 0;
|
|
64
78
|
let failed = 0;
|
|
@@ -75,7 +89,7 @@ export async function refreshManifestCoordinates(manifestPath, workspaceRoot) {
|
|
|
75
89
|
? current.sourceFile
|
|
76
90
|
: typeof previous.sourceFile === "string"
|
|
77
91
|
? previous.sourceFile
|
|
78
|
-
: undefined, workspaceRoot);
|
|
92
|
+
: undefined, workspaceRoot, resolved);
|
|
79
93
|
if (eligible && !hasAllGeneratedCoordinates(current)) {
|
|
80
94
|
failed++;
|
|
81
95
|
}
|
|
@@ -83,18 +97,20 @@ export async function refreshManifestCoordinates(manifestPath, workspaceRoot) {
|
|
|
83
97
|
unchanged++;
|
|
84
98
|
}
|
|
85
99
|
}
|
|
86
|
-
const dumped = dumpYAML(parsed, {
|
|
100
|
+
const dumped = resolved.dumpYAML(parsed, {
|
|
87
101
|
lineWidth: -1,
|
|
88
102
|
noRefs: true,
|
|
89
103
|
sortKeys: false,
|
|
90
104
|
});
|
|
91
105
|
const nextContent = `${SYMBOLS_MANIFEST_COMMENT_BLOCK}${dumped}`;
|
|
92
106
|
if (rawContent !== nextContent) {
|
|
93
|
-
writeFileSync(manifestPath, nextContent, "utf8");
|
|
107
|
+
resolved.writeFileSync(manifestPath, nextContent, "utf8");
|
|
94
108
|
}
|
|
95
109
|
console.log(`✓ Refreshed symbol coordinates in ${path.relative(workspaceRoot, manifestPath)} (refreshed=${refreshed}, unchanged=${unchanged}, failed=${failed})`);
|
|
96
110
|
}
|
|
97
|
-
export function hasAllGeneratedCoordinates(
|
|
111
|
+
export function hasAllGeneratedCoordinates(
|
|
112
|
+
// implements REQ-003
|
|
113
|
+
entry) {
|
|
98
114
|
return (typeof entry.sourceLine === "number" &&
|
|
99
115
|
typeof entry.sourceColumn === "number" &&
|
|
100
116
|
typeof entry.sourceEndLine === "number" &&
|
|
@@ -102,13 +118,16 @@ export function hasAllGeneratedCoordinates(entry) {
|
|
|
102
118
|
typeof entry.coordinatesGeneratedAt === "string" &&
|
|
103
119
|
entry.coordinatesGeneratedAt.length > 0);
|
|
104
120
|
}
|
|
105
|
-
export function isEligibleForCoordinateRefresh(
|
|
121
|
+
export function isEligibleForCoordinateRefresh(
|
|
122
|
+
// implements REQ-003
|
|
123
|
+
sourceFile, workspaceRoot, deps) {
|
|
124
|
+
const resolved = resolveDeps(deps);
|
|
106
125
|
if (!sourceFile)
|
|
107
126
|
return false;
|
|
108
127
|
const absolute = path.isAbsolute(sourceFile)
|
|
109
128
|
? sourceFile
|
|
110
129
|
: path.resolve(workspaceRoot, sourceFile);
|
|
111
|
-
if (!existsSync(absolute))
|
|
130
|
+
if (!resolved.existsSync(absolute))
|
|
112
131
|
return false;
|
|
113
132
|
const ext = path.extname(absolute).toLowerCase();
|
|
114
133
|
return SYMBOL_COORD_EXTENSIONS.has(ext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/persistence.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/persistence.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0ErD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,eAAe,CAEnC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GACrB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAoEvD;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,kBAAkB,EAAE,qBAAqB,EAAE,GAC1C,OAAO,CAAC;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAiI7D"}
|
|
@@ -39,27 +39,31 @@ const STRING_FIELDS = new Set([
|
|
|
39
39
|
]);
|
|
40
40
|
const NUMBER_FIELDS = new Set(["value_int", "value_number"]);
|
|
41
41
|
const BOOLEAN_FIELDS = new Set(["value_bool", "closed_world"]);
|
|
42
|
+
function getEntityField(entity, field) {
|
|
43
|
+
// ExtractedEntity declares all fact fields as optional properties, so indexing
|
|
44
|
+
// via keyof is safe. The cast is confined to this single helper.
|
|
45
|
+
return entity[field];
|
|
46
|
+
}
|
|
42
47
|
// Serialize typed fact fields from entity
|
|
43
48
|
function serializeTypedFactFields(entity) {
|
|
44
49
|
const fields = [];
|
|
45
|
-
const entityRecord = entity;
|
|
46
50
|
// String fields (safely escaped double-quoted Prolog strings)
|
|
47
51
|
for (const field of STRING_FIELDS) {
|
|
48
|
-
const value =
|
|
52
|
+
const value = getEntityField(entity, field);
|
|
49
53
|
if (value !== undefined && value !== null) {
|
|
50
54
|
fields.push(`${field}=${toPrologString(String(value))}`);
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
// Atom fields (possibly unquoted if simple)
|
|
54
58
|
for (const field of ATOM_FIELDS) {
|
|
55
|
-
const value =
|
|
59
|
+
const value = getEntityField(entity, field);
|
|
56
60
|
if (value !== undefined && value !== null) {
|
|
57
61
|
fields.push(`${field}=${toPrologAtom(String(value))}`);
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
// Number fields (unquoted); value_int must be a true integer
|
|
61
65
|
for (const field of NUMBER_FIELDS) {
|
|
62
|
-
const value =
|
|
66
|
+
const value = getEntityField(entity, field);
|
|
63
67
|
if (value !== undefined && value !== null && typeof value === "number") {
|
|
64
68
|
if (field === "value_int" && !Number.isInteger(value)) {
|
|
65
69
|
continue; // silently drop non-integer value_int
|
|
@@ -69,7 +73,7 @@ function serializeTypedFactFields(entity) {
|
|
|
69
73
|
}
|
|
70
74
|
// Boolean fields (true/false atoms)
|
|
71
75
|
for (const field of BOOLEAN_FIELDS) {
|
|
72
|
-
const value =
|
|
76
|
+
const value = getEntityField(entity, field);
|
|
73
77
|
if (value !== undefined && value !== null && typeof value === "boolean") {
|
|
74
78
|
fields.push(`${field}=${value}`);
|
|
75
79
|
}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { existsSync, mkdirSync, renameSync, rmSync } from "node:fs";
|
|
2
|
+
import { copyFileSync } from "node:fs";
|
|
3
|
+
import fg from "fast-glob";
|
|
4
|
+
import { copyCleanSnapshot } from "../../utils/branch-resolver.js";
|
|
5
|
+
interface StagingDeps {
|
|
6
|
+
copyCleanSnapshot: typeof copyCleanSnapshot;
|
|
7
|
+
copyFileSync: typeof copyFileSync;
|
|
8
|
+
cwd: () => string;
|
|
9
|
+
existsSync: typeof existsSync;
|
|
10
|
+
fg: typeof fg;
|
|
11
|
+
mkdirSync: typeof mkdirSync;
|
|
12
|
+
moduleDir: string;
|
|
13
|
+
renameSync: typeof renameSync;
|
|
14
|
+
rmSync: typeof rmSync;
|
|
15
|
+
}
|
|
16
|
+
export declare function prepareStagingEnvironment(stagingPath: string, livePath: string, rebuild: boolean, deps?: Partial<StagingDeps>): Promise<void>;
|
|
17
|
+
export declare function atomicPublish(stagingPath: string, livePath: string, deps?: Partial<StagingDeps>): void;
|
|
18
|
+
export declare function cleanupStaging(stagingPath: string, deps?: Partial<StagingDeps>): void;
|
|
19
|
+
export {};
|
|
4
20
|
//# sourceMappingURL=staging.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/staging.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/staging.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,UAAU,WAAW;IACnB,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,EAAE,EAAE,OAAO,EAAE,CAAC;IACd,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,MAAM,EAAE,OAAO,MAAM,CAAC;CACvB;AAiBD,wBAAsB,yBAAyB,CAE7C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC1B,OAAO,CAAC,IAAI,CAAC,CAaf;AA0CD,wBAAgB,aAAa,CAE3B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC1B,IAAI,CAeN;AAED,wBAAgB,cAAc,CAE5B,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC1B,IAAI,CAKN"}
|
|
@@ -20,29 +20,46 @@ import { copyFileSync } from "node:fs";
|
|
|
20
20
|
import * as path from "node:path";
|
|
21
21
|
import fg from "fast-glob";
|
|
22
22
|
import { copyCleanSnapshot } from "../../utils/branch-resolver.js";
|
|
23
|
-
|
|
23
|
+
function resolveDeps(overrides) {
|
|
24
|
+
return {
|
|
25
|
+
copyCleanSnapshot,
|
|
26
|
+
copyFileSync,
|
|
27
|
+
cwd: () => process.cwd(),
|
|
28
|
+
existsSync,
|
|
29
|
+
fg,
|
|
30
|
+
mkdirSync,
|
|
31
|
+
moduleDir: import.meta.dirname,
|
|
32
|
+
renameSync,
|
|
33
|
+
rmSync,
|
|
34
|
+
...overrides,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export async function prepareStagingEnvironment(
|
|
38
|
+
// implements REQ-003
|
|
39
|
+
stagingPath, livePath, rebuild, deps) {
|
|
40
|
+
const resolved = resolveDeps(deps);
|
|
24
41
|
// Cleanup any existing staging directory
|
|
25
|
-
cleanupStaging(stagingPath);
|
|
26
|
-
mkdirSync(stagingPath, { recursive: true });
|
|
27
|
-
if (!rebuild && existsSync(livePath)) {
|
|
42
|
+
cleanupStaging(stagingPath, resolved);
|
|
43
|
+
resolved.mkdirSync(stagingPath, { recursive: true });
|
|
44
|
+
if (!rebuild && resolved.existsSync(livePath)) {
|
|
28
45
|
// Use existing live path if available
|
|
29
|
-
copyCleanSnapshot(livePath, stagingPath);
|
|
46
|
+
resolved.copyCleanSnapshot(livePath, stagingPath);
|
|
30
47
|
}
|
|
31
48
|
else {
|
|
32
49
|
// Start fresh with schema only
|
|
33
|
-
await copySchemaToStaging(stagingPath);
|
|
50
|
+
await copySchemaToStaging(stagingPath, resolved);
|
|
34
51
|
}
|
|
35
52
|
}
|
|
36
|
-
async function copySchemaToStaging(stagingPath) {
|
|
53
|
+
async function copySchemaToStaging(stagingPath, deps) {
|
|
37
54
|
const possibleSchemaPaths = [
|
|
38
|
-
path.resolve(
|
|
39
|
-
path.resolve(
|
|
40
|
-
path.resolve(
|
|
41
|
-
path.resolve(
|
|
55
|
+
path.resolve(deps.cwd(), "node_modules", "kibi-cli", "schema"),
|
|
56
|
+
path.resolve(deps.cwd(), "..", "..", "schema"),
|
|
57
|
+
path.resolve(deps.moduleDir, "..", "..", "schema"),
|
|
58
|
+
path.resolve(deps.cwd(), "packages", "cli", "schema"),
|
|
42
59
|
];
|
|
43
60
|
let schemaSourceDir = null;
|
|
44
61
|
for (const p of possibleSchemaPaths) {
|
|
45
|
-
if (existsSync(p)) {
|
|
62
|
+
if (deps.existsSync(p)) {
|
|
46
63
|
schemaSourceDir = p;
|
|
47
64
|
break;
|
|
48
65
|
}
|
|
@@ -50,37 +67,43 @@ async function copySchemaToStaging(stagingPath) {
|
|
|
50
67
|
if (!schemaSourceDir) {
|
|
51
68
|
return;
|
|
52
69
|
}
|
|
53
|
-
const schemaFiles = await fg("*.pl", {
|
|
70
|
+
const schemaFiles = await deps.fg("*.pl", {
|
|
54
71
|
cwd: schemaSourceDir,
|
|
55
72
|
absolute: false,
|
|
56
73
|
});
|
|
57
74
|
const schemaDestDir = path.join(stagingPath, "schema");
|
|
58
|
-
if (!existsSync(schemaDestDir)) {
|
|
59
|
-
mkdirSync(schemaDestDir, { recursive: true });
|
|
75
|
+
if (!deps.existsSync(schemaDestDir)) {
|
|
76
|
+
deps.mkdirSync(schemaDestDir, { recursive: true });
|
|
60
77
|
}
|
|
61
78
|
for (const file of schemaFiles) {
|
|
62
79
|
const sourcePath = path.join(schemaSourceDir, file);
|
|
63
80
|
const destPath = path.join(schemaDestDir, file);
|
|
64
|
-
copyFileSync(sourcePath, destPath);
|
|
81
|
+
deps.copyFileSync(sourcePath, destPath);
|
|
65
82
|
}
|
|
66
83
|
}
|
|
67
|
-
export function atomicPublish(
|
|
84
|
+
export function atomicPublish(
|
|
85
|
+
// implements REQ-003
|
|
86
|
+
stagingPath, livePath, deps) {
|
|
87
|
+
const resolved = resolveDeps(deps);
|
|
68
88
|
const liveParent = path.dirname(livePath);
|
|
69
|
-
if (!existsSync(liveParent)) {
|
|
70
|
-
mkdirSync(liveParent, { recursive: true });
|
|
89
|
+
if (!resolved.existsSync(liveParent)) {
|
|
90
|
+
resolved.mkdirSync(liveParent, { recursive: true });
|
|
71
91
|
}
|
|
72
|
-
if (existsSync(livePath)) {
|
|
92
|
+
if (resolved.existsSync(livePath)) {
|
|
73
93
|
const tempPath = `${livePath}.old.${Date.now()}`;
|
|
74
|
-
renameSync(livePath, tempPath);
|
|
75
|
-
renameSync(stagingPath, livePath);
|
|
76
|
-
rmSync(tempPath, { recursive: true, force: true });
|
|
94
|
+
resolved.renameSync(livePath, tempPath);
|
|
95
|
+
resolved.renameSync(stagingPath, livePath);
|
|
96
|
+
resolved.rmSync(tempPath, { recursive: true, force: true });
|
|
77
97
|
}
|
|
78
98
|
else {
|
|
79
|
-
renameSync(stagingPath, livePath);
|
|
99
|
+
resolved.renameSync(stagingPath, livePath);
|
|
80
100
|
}
|
|
81
101
|
}
|
|
82
|
-
export function cleanupStaging(
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
export function cleanupStaging(
|
|
103
|
+
// implements REQ-003
|
|
104
|
+
stagingPath, deps) {
|
|
105
|
+
const resolved = resolveDeps(deps);
|
|
106
|
+
if (resolved.existsSync(stagingPath)) {
|
|
107
|
+
resolved.rmSync(stagingPath, { recursive: true, force: true });
|
|
85
108
|
}
|
|
86
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0CjE,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAGD,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,wBAAsB,WAAW,CAC/B,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1D,OAAO,CAAC,UAAU,CAAC,CAqarB;AAED,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/commands/sync.js
CHANGED
|
@@ -19,6 +19,7 @@ import { execSync } from "node:child_process";
|
|
|
19
19
|
import { existsSync } from "node:fs";
|
|
20
20
|
import * as path from "node:path";
|
|
21
21
|
import { branchErrorToDiagnostic, createDocsNotIndexedDiagnostic, createInvalidAuthoringDiagnostic, createKbMissingDiagnostic, formatSyncSummary, } from "../diagnostics.js";
|
|
22
|
+
import { isCliDebugEnabled } from "../env.js";
|
|
22
23
|
import { extractFromRelationshipShards, flattenRelationships, validateRelationships, } from "../extractors/relationships.js";
|
|
23
24
|
import { PrologProcess } from "../prolog.js";
|
|
24
25
|
import { resolveActiveBranch, } from "../utils/branch-resolver.js";
|
|
@@ -57,6 +58,7 @@ export async function syncCommand(options = {}) {
|
|
|
57
58
|
return undefined;
|
|
58
59
|
}
|
|
59
60
|
};
|
|
61
|
+
const withOptionalCommit = (value, commit) => commit !== undefined ? { ...value, commit } : value;
|
|
60
62
|
try {
|
|
61
63
|
// Branch resolution
|
|
62
64
|
const branchResult = resolveActiveBranch(process.cwd());
|
|
@@ -67,14 +69,14 @@ export async function syncCommand(options = {}) {
|
|
|
67
69
|
throw new SyncError(`Failed to resolve active branch: ${branchResult.error}`);
|
|
68
70
|
}
|
|
69
71
|
currentBranch = branchResult.branch;
|
|
70
|
-
if (
|
|
72
|
+
if (isCliDebugEnabled()) {
|
|
71
73
|
// eslint-disable-next-line no-console
|
|
72
74
|
console.log("[kibi-debug] currentBranch:", currentBranch);
|
|
73
75
|
}
|
|
74
76
|
const config = loadSyncConfig(process.cwd());
|
|
75
77
|
const paths = config.paths;
|
|
76
78
|
const { markdownFiles, manifestFiles, relationshipsDir } = await discoverSourceFiles(process.cwd(), paths);
|
|
77
|
-
if (
|
|
79
|
+
if (isCliDebugEnabled()) {
|
|
78
80
|
// eslint-disable-next-line no-console
|
|
79
81
|
console.log("[kibi-debug] markdownFiles:", markdownFiles.length);
|
|
80
82
|
// eslint-disable-next-line no-console
|
|
@@ -152,9 +154,8 @@ export async function syncCommand(options = {}) {
|
|
|
152
154
|
console.error(`${err.file}: ${err.message}`);
|
|
153
155
|
}
|
|
154
156
|
console.error(`FAILED: ${errors.length} errors found`);
|
|
155
|
-
return {
|
|
157
|
+
return withOptionalCommit({
|
|
156
158
|
branch: currentBranch,
|
|
157
|
-
commit: getCurrentCommit(),
|
|
158
159
|
timestamp: new Date().toISOString(),
|
|
159
160
|
entityCounts,
|
|
160
161
|
relationshipCount: 0,
|
|
@@ -163,7 +164,7 @@ export async function syncCommand(options = {}) {
|
|
|
163
164
|
failures: diagnostics,
|
|
164
165
|
durationMs: Date.now() - startTime,
|
|
165
166
|
exitCode: 1,
|
|
166
|
-
};
|
|
167
|
+
}, getCurrentCommit());
|
|
167
168
|
}
|
|
168
169
|
if (results.length === 0 && allRelationships.length === 0 && !rebuild) {
|
|
169
170
|
const evictedHashes = {};
|
|
@@ -181,9 +182,8 @@ export async function syncCommand(options = {}) {
|
|
|
181
182
|
seenAt: evictedSeenAt,
|
|
182
183
|
});
|
|
183
184
|
console.log("✓ Imported 0 entities, 0 relationships (no changes)");
|
|
184
|
-
return {
|
|
185
|
+
return withOptionalCommit({
|
|
185
186
|
branch: currentBranch,
|
|
186
|
-
commit: getCurrentCommit(),
|
|
187
187
|
timestamp: new Date().toISOString(),
|
|
188
188
|
entityCounts,
|
|
189
189
|
relationshipCount: 0,
|
|
@@ -192,7 +192,7 @@ export async function syncCommand(options = {}) {
|
|
|
192
192
|
failures: diagnostics,
|
|
193
193
|
durationMs: Date.now() - startTime,
|
|
194
194
|
exitCode: 0,
|
|
195
|
-
};
|
|
195
|
+
}, getCurrentCommit());
|
|
196
196
|
}
|
|
197
197
|
const livePath = path.join(process.cwd(), `.kb/branches/${currentBranch}`);
|
|
198
198
|
const kbExists = existsSync(livePath);
|
|
@@ -235,9 +235,8 @@ export async function syncCommand(options = {}) {
|
|
|
235
235
|
console.error(`${err.file}: ${err.message}`);
|
|
236
236
|
}
|
|
237
237
|
console.error(`FAILED: ${errors.length} errors found`);
|
|
238
|
-
return {
|
|
238
|
+
return withOptionalCommit({
|
|
239
239
|
branch: currentBranch,
|
|
240
|
-
commit: getCurrentCommit(),
|
|
241
240
|
timestamp: new Date().toISOString(),
|
|
242
241
|
entityCounts,
|
|
243
242
|
relationshipCount: 0,
|
|
@@ -246,12 +245,11 @@ export async function syncCommand(options = {}) {
|
|
|
246
245
|
failures: diagnostics,
|
|
247
246
|
durationMs: Date.now() - startTime,
|
|
248
247
|
exitCode: 1,
|
|
249
|
-
};
|
|
248
|
+
}, getCurrentCommit());
|
|
250
249
|
}
|
|
251
250
|
console.log(`OK: Validation passed (${entityCount} entities)`);
|
|
252
|
-
return {
|
|
251
|
+
return withOptionalCommit({
|
|
253
252
|
branch: currentBranch,
|
|
254
|
-
commit: getCurrentCommit(),
|
|
255
253
|
timestamp: new Date().toISOString(),
|
|
256
254
|
entityCounts,
|
|
257
255
|
relationshipCount: 0,
|
|
@@ -260,7 +258,7 @@ export async function syncCommand(options = {}) {
|
|
|
260
258
|
failures: diagnostics,
|
|
261
259
|
durationMs: Date.now() - startTime,
|
|
262
260
|
exitCode: 0,
|
|
263
|
-
};
|
|
261
|
+
}, getCurrentCommit());
|
|
264
262
|
}
|
|
265
263
|
if (kbModified) {
|
|
266
264
|
prolog.invalidateCache();
|
|
@@ -295,9 +293,8 @@ export async function syncCommand(options = {}) {
|
|
|
295
293
|
}
|
|
296
294
|
console.log(`✓ Imported ${entityCount} entities, ${relationshipCount} relationships`);
|
|
297
295
|
const commit = getCurrentCommit();
|
|
298
|
-
const summary = {
|
|
296
|
+
const summary = withOptionalCommit({
|
|
299
297
|
branch: currentBranch,
|
|
300
|
-
commit,
|
|
301
298
|
timestamp: new Date().toISOString(),
|
|
302
299
|
entityCounts,
|
|
303
300
|
relationshipCount,
|
|
@@ -305,7 +302,7 @@ export async function syncCommand(options = {}) {
|
|
|
305
302
|
published,
|
|
306
303
|
failures: diagnostics,
|
|
307
304
|
durationMs: Date.now() - startTime,
|
|
308
|
-
};
|
|
305
|
+
}, commit);
|
|
309
306
|
console.log(formatSyncSummary(summary));
|
|
310
307
|
return { ...summary, exitCode: 0 };
|
|
311
308
|
}
|
|
@@ -318,9 +315,8 @@ export async function syncCommand(options = {}) {
|
|
|
318
315
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
319
316
|
console.error(`Error: ${errorMessage}`);
|
|
320
317
|
const commit = getCurrentCommit();
|
|
321
|
-
const summary = {
|
|
318
|
+
const summary = withOptionalCommit({
|
|
322
319
|
branch: currentBranch || "unknown",
|
|
323
|
-
commit,
|
|
324
320
|
timestamp: new Date().toISOString(),
|
|
325
321
|
entityCounts,
|
|
326
322
|
relationshipCount: 0,
|
|
@@ -328,7 +324,7 @@ export async function syncCommand(options = {}) {
|
|
|
328
324
|
published: false,
|
|
329
325
|
failures: diagnostics,
|
|
330
326
|
durationMs: Date.now() - startTime,
|
|
331
|
-
};
|
|
327
|
+
}, commit);
|
|
332
328
|
if (diagnostics.length > 0) {
|
|
333
329
|
console.log("\nDiagnostics:");
|
|
334
330
|
for (const d of diagnostics) {
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -28,21 +28,12 @@ export interface SyncSummary {
|
|
|
28
28
|
* Branch resolution error codes mapping to diagnostic categories
|
|
29
29
|
*/
|
|
30
30
|
export type BranchErrorCode = "DETACHED_HEAD" | "UNBORN_BRANCH" | "GIT_NOT_AVAILABLE" | "NOT_A_GIT_REPO" | "ENV_OVERRIDE" | "UNKNOWN_ERROR";
|
|
31
|
-
|
|
32
|
-
* Convert branch error code to diagnostic category
|
|
33
|
-
*/
|
|
34
|
-
export declare function branchErrorToDiagnostic(code: BranchErrorCode, message: string, branch?: string): Diagnostic;
|
|
31
|
+
export declare function branchErrorToDiagnostic(_code: BranchErrorCode, message: string, branch?: string): Diagnostic;
|
|
35
32
|
/**
|
|
36
33
|
* Create KB_MISSING diagnostic
|
|
37
34
|
*/
|
|
38
35
|
export declare function createKbMissingDiagnostic(branch: string, path: string): Diagnostic;
|
|
39
|
-
/**
|
|
40
|
-
* Create DOCS_NOT_INDEXED diagnostic
|
|
41
|
-
*/
|
|
42
36
|
export declare function createDocsNotIndexedDiagnostic(docCount: number, entityCount: number): Diagnostic;
|
|
43
|
-
/**
|
|
44
|
-
* Create INVALID_AUTHORING diagnostic for embedded entities
|
|
45
|
-
*/
|
|
46
37
|
export declare function createInvalidAuthoringDiagnostic(filePath: string, embeddedTypes: string[]): Diagnostic;
|
|
47
38
|
/**
|
|
48
39
|
* Format sync summary for CLI output
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mapp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,MAAM,CAAC;CACrB,CAAC,CASD"}
|
package/dist/diagnostics.js
CHANGED
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
* making it easier for both CLI users and MCP consumers to understand
|
|
6
6
|
* and respond to issues programmatically.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export function branchErrorToDiagnostic(code, message, branch) {
|
|
8
|
+
export function branchErrorToDiagnostic(
|
|
9
|
+
// implements REQ-008
|
|
10
|
+
_code, message, branch) {
|
|
12
11
|
return {
|
|
13
12
|
category: "BRANCH_RESOLUTION_FAILURE",
|
|
14
13
|
severity: "error",
|
|
@@ -29,9 +28,6 @@ export function createKbMissingDiagnostic(branch, path) {
|
|
|
29
28
|
suggestion: `Run 'kibi sync' to create the KB at ${path}`,
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Create DOCS_NOT_INDEXED diagnostic
|
|
34
|
-
*/
|
|
35
31
|
export function createDocsNotIndexedDiagnostic(docCount, entityCount) {
|
|
36
32
|
return {
|
|
37
33
|
category: "DOCS_NOT_INDEXED",
|
|
@@ -40,9 +36,6 @@ export function createDocsNotIndexedDiagnostic(docCount, entityCount) {
|
|
|
40
36
|
suggestion: "Some documents may have extraction errors. Run 'kibi sync --validate-only' to check.",
|
|
41
37
|
};
|
|
42
38
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Create INVALID_AUTHORING diagnostic for embedded entities
|
|
45
|
-
*/
|
|
46
39
|
export function createInvalidAuthoringDiagnostic(filePath, embeddedTypes) {
|
|
47
40
|
return {
|
|
48
41
|
category: "INVALID_AUTHORING",
|
|
@@ -102,11 +95,12 @@ export function formatSyncSummary(summary) {
|
|
|
102
95
|
* Format diagnostics for MCP structured response
|
|
103
96
|
*/
|
|
104
97
|
export function formatDiagnosticsForMcp(diagnostics) {
|
|
98
|
+
// implements REQ-003
|
|
105
99
|
return diagnostics.map((d) => ({
|
|
106
100
|
category: d.category,
|
|
107
101
|
severity: d.severity,
|
|
108
102
|
message: d.message,
|
|
109
|
-
file: d.file,
|
|
110
|
-
suggestion: d.suggestion,
|
|
103
|
+
...(d.file !== undefined ? { file: d.file } : {}),
|
|
104
|
+
...(d.suggestion !== undefined ? { suggestion: d.suggestion } : {}),
|
|
111
105
|
}));
|
|
112
106
|
}
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getBranchOverride(): string | undefined;
|
|
2
|
+
export declare function getKbPlPathOverride(): string | undefined;
|
|
3
|
+
export declare function isCliDebugEnabled(): boolean;
|
|
4
|
+
export declare function isCliTraceEnabled(): boolean;
|
|
5
|
+
export declare function isCliTraceOrDebugEnabled(): boolean;
|
|
6
|
+
export declare function isPrologDebugEnabled(): boolean;
|
|
7
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAoBA,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAGtD;AAED,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAGxD;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAGlD;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAG9C"}
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
* Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
*/
|
|
10
|
+
function getEnvValue(key) {
|
|
11
|
+
const value = process.env[key];
|
|
12
|
+
return typeof value === "string" ? value : undefined;
|
|
13
|
+
}
|
|
14
|
+
function getTrimmedEnvValue(key) {
|
|
15
|
+
const value = getEnvValue(key)?.trim();
|
|
16
|
+
return value ? value : undefined;
|
|
17
|
+
}
|
|
18
|
+
export function getBranchOverride() {
|
|
19
|
+
// implements REQ-003
|
|
20
|
+
return getTrimmedEnvValue("KIBI_BRANCH");
|
|
21
|
+
}
|
|
22
|
+
export function getKbPlPathOverride() {
|
|
23
|
+
// implements REQ-003
|
|
24
|
+
return getEnvValue("KIBI_KB_PL_PATH");
|
|
25
|
+
}
|
|
26
|
+
export function isCliDebugEnabled() {
|
|
27
|
+
// implements REQ-003
|
|
28
|
+
return Boolean(getEnvValue("KIBI_DEBUG"));
|
|
29
|
+
}
|
|
30
|
+
export function isCliTraceEnabled() {
|
|
31
|
+
// implements REQ-003
|
|
32
|
+
return Boolean(getEnvValue("KIBI_TRACE"));
|
|
33
|
+
}
|
|
34
|
+
export function isCliTraceOrDebugEnabled() {
|
|
35
|
+
// implements REQ-003
|
|
36
|
+
return isCliTraceEnabled() || isCliDebugEnabled();
|
|
37
|
+
}
|
|
38
|
+
export function isPrologDebugEnabled() {
|
|
39
|
+
// implements REQ-003
|
|
40
|
+
return Boolean(getEnvValue("KIBI_PROLOG_DEBUG"));
|
|
41
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/extractors/manifest.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KA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