@zabaca/lattice 1.0.11 → 1.0.16
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/main.js +38 -41
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -2119,43 +2119,37 @@ class SyncService {
|
|
|
2119
2119
|
const CHECKPOINT_BATCH_SIZE = 10;
|
|
2120
2120
|
let processedCount = 0;
|
|
2121
2121
|
for (const change of changes) {
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2149
|
-
result.errors.push({ path: change.path, error: errorMessage });
|
|
2150
|
-
this.logger.warn(`Error processing ${change.path}: ${errorMessage}`);
|
|
2122
|
+
const doc = docsByPath.get(change.path);
|
|
2123
|
+
const cascadeWarnings = await this.processChange(change, options, doc);
|
|
2124
|
+
result.cascadeWarnings.push(...cascadeWarnings);
|
|
2125
|
+
switch (change.changeType) {
|
|
2126
|
+
case "new":
|
|
2127
|
+
result.added++;
|
|
2128
|
+
break;
|
|
2129
|
+
case "updated":
|
|
2130
|
+
result.updated++;
|
|
2131
|
+
break;
|
|
2132
|
+
case "deleted":
|
|
2133
|
+
result.deleted++;
|
|
2134
|
+
break;
|
|
2135
|
+
case "unchanged":
|
|
2136
|
+
result.unchanged++;
|
|
2137
|
+
break;
|
|
2138
|
+
}
|
|
2139
|
+
if (change.embeddingGenerated) {
|
|
2140
|
+
result.embeddingsGenerated++;
|
|
2141
|
+
}
|
|
2142
|
+
if (!options.dryRun && change.changeType !== "unchanged") {
|
|
2143
|
+
await this.manifest.save();
|
|
2144
|
+
}
|
|
2145
|
+
processedCount++;
|
|
2146
|
+
if (!options.dryRun && processedCount % CHECKPOINT_BATCH_SIZE === 0) {
|
|
2147
|
+
await this.graph.checkpoint();
|
|
2151
2148
|
}
|
|
2152
2149
|
}
|
|
2153
2150
|
if (!options.dryRun && processedCount > 0) {
|
|
2154
2151
|
await this.graph.checkpoint();
|
|
2155
2152
|
}
|
|
2156
|
-
if (!options.dryRun) {
|
|
2157
|
-
await this.manifest.save();
|
|
2158
|
-
}
|
|
2159
2153
|
} catch (error) {
|
|
2160
2154
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2161
2155
|
this.logger.error(`Sync failed: ${errorMessage}`);
|
|
@@ -2245,7 +2239,7 @@ class SyncService {
|
|
|
2245
2239
|
}
|
|
2246
2240
|
} catch (error) {
|
|
2247
2241
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2248
|
-
|
|
2242
|
+
throw new Error(`Failed to generate embedding for ${doc.path}: ${errorMessage}`);
|
|
2249
2243
|
}
|
|
2250
2244
|
}
|
|
2251
2245
|
const entityTypeMap = new Map;
|
|
@@ -2402,7 +2396,7 @@ class SyncService {
|
|
|
2402
2396
|
this.logger.debug(`Generated embedding for ${entity.type}:${entity.name}`);
|
|
2403
2397
|
} catch (error) {
|
|
2404
2398
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2405
|
-
|
|
2399
|
+
throw new Error(`Failed to generate embedding for ${entity.type}:${entity.name}: ${errorMessage}`);
|
|
2406
2400
|
}
|
|
2407
2401
|
}
|
|
2408
2402
|
}
|
|
@@ -2702,6 +2696,14 @@ class SyncCommand extends CommandRunner5 {
|
|
|
2702
2696
|
if (options.watch && options.force) {
|
|
2703
2697
|
console.log(`
|
|
2704
2698
|
\u26A0\uFE0F Watch mode is not compatible with --force mode (for safety)
|
|
2699
|
+
`);
|
|
2700
|
+
process.exit(1);
|
|
2701
|
+
}
|
|
2702
|
+
if (options.force && paths.length === 0) {
|
|
2703
|
+
console.log(`
|
|
2704
|
+
\u26A0\uFE0F --force requires specific paths to be specified.
|
|
2705
|
+
`);
|
|
2706
|
+
console.log(` Usage: lattice sync --force <path1> [path2] ...
|
|
2705
2707
|
`);
|
|
2706
2708
|
process.exit(1);
|
|
2707
2709
|
}
|
|
@@ -2717,13 +2719,8 @@ class SyncCommand extends CommandRunner5 {
|
|
|
2717
2719
|
\uD83D\uDD04 Graph Sync
|
|
2718
2720
|
`);
|
|
2719
2721
|
if (syncOptions.force) {
|
|
2720
|
-
|
|
2721
|
-
console.log(`\u26A0\uFE0F Force mode: ${syncOptions.paths.length} document(s) will be cleared and re-synced
|
|
2722
|
-
`);
|
|
2723
|
-
} else {
|
|
2724
|
-
console.log(`\u26A0\uFE0F Force mode: Entire graph will be cleared and rebuilt
|
|
2722
|
+
console.log(`\u26A0\uFE0F Force mode: ${syncOptions.paths?.length} document(s) will be cleared and re-synced
|
|
2725
2723
|
`);
|
|
2726
|
-
}
|
|
2727
2724
|
}
|
|
2728
2725
|
if (syncOptions.dryRun) {
|
|
2729
2726
|
console.log(`\uD83D\uDCCB Dry run mode: No changes will be applied
|
|
@@ -2934,7 +2931,7 @@ class SyncCommand extends CommandRunner5 {
|
|
|
2934
2931
|
__legacyDecorateClassTS([
|
|
2935
2932
|
Option3({
|
|
2936
2933
|
flags: "-f, --force",
|
|
2937
|
-
description: "Force re-sync
|
|
2934
|
+
description: "Force re-sync specified documents (requires paths to be specified)"
|
|
2938
2935
|
}),
|
|
2939
2936
|
__legacyMetadataTS("design:type", Function),
|
|
2940
2937
|
__legacyMetadataTS("design:paramtypes", []),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zabaca/lattice",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Human-initiated, AI-powered knowledge graph for markdown documentation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"check:fix": "tsc --noEmit && biome check --write .",
|
|
20
20
|
"lattice": "bun run src/main.ts",
|
|
21
21
|
"prepublishOnly": "bun run build",
|
|
22
|
-
"release:patch": "bun run check && bun test && bun pm version patch &&
|
|
23
|
-
"release:minor": "bun run check && bun test && bun pm version minor &&
|
|
24
|
-
"release:major": "bun run check && bun test && bun pm version major &&
|
|
22
|
+
"release:patch": "bun run check && bun test && bun pm version patch && git push && git push --tags && bun publish",
|
|
23
|
+
"release:minor": "bun run check && bun test && bun pm version minor && git push && git push && bun publish",
|
|
24
|
+
"release:major": "bun run check && bun test && bun pm version major && git push && git push && bun publish",
|
|
25
25
|
"release:dry": "bun publish --dry-run"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|