@zabaca/lattice 1.0.10 → 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.
Files changed (2) hide show
  1. package/dist/main.js +40 -42
  2. 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
- try {
2123
- const doc = docsByPath.get(change.path);
2124
- const cascadeWarnings = await this.processChange(change, options, doc);
2125
- result.cascadeWarnings.push(...cascadeWarnings);
2126
- switch (change.changeType) {
2127
- case "new":
2128
- result.added++;
2129
- break;
2130
- case "updated":
2131
- result.updated++;
2132
- break;
2133
- case "deleted":
2134
- result.deleted++;
2135
- break;
2136
- case "unchanged":
2137
- result.unchanged++;
2138
- break;
2139
- }
2140
- if (change.embeddingGenerated) {
2141
- result.embeddingsGenerated++;
2142
- }
2143
- processedCount++;
2144
- if (!options.dryRun && processedCount % CHECKPOINT_BATCH_SIZE === 0) {
2145
- await this.graph.checkpoint();
2146
- }
2147
- } catch (error) {
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
- this.logger.warn(`Failed to generate embedding for ${doc.path}: ${errorMessage}`);
2242
+ throw new Error(`Failed to generate embedding for ${doc.path}: ${errorMessage}`);
2249
2243
  }
2250
2244
  }
2251
2245
  const entityTypeMap = new Map;
@@ -2334,7 +2328,8 @@ class SyncService {
2334
2328
  }
2335
2329
  const embeddingGenerated = await this.syncDocument(doc, options, preloadedDoc !== undefined);
2336
2330
  change.embeddingGenerated = embeddingGenerated;
2337
- this.manifest.updateEntry(doc.path, doc.contentHash, doc.frontmatterHash, doc.entities.length, doc.relationships.length);
2331
+ const currentDoc = await this.parser.parseDocument(change.path);
2332
+ this.manifest.updateEntry(currentDoc.path, currentDoc.contentHash, currentDoc.frontmatterHash, currentDoc.entities.length, currentDoc.relationships.length);
2338
2333
  break;
2339
2334
  }
2340
2335
  case "deleted": {
@@ -2401,7 +2396,7 @@ class SyncService {
2401
2396
  this.logger.debug(`Generated embedding for ${entity.type}:${entity.name}`);
2402
2397
  } catch (error) {
2403
2398
  const errorMessage = error instanceof Error ? error.message : String(error);
2404
- this.logger.warn(`Failed to generate embedding for ${entity.type}:${entity.name}: ${errorMessage}`);
2399
+ throw new Error(`Failed to generate embedding for ${entity.type}:${entity.name}: ${errorMessage}`);
2405
2400
  }
2406
2401
  }
2407
2402
  }
@@ -2701,6 +2696,14 @@ class SyncCommand extends CommandRunner5 {
2701
2696
  if (options.watch && options.force) {
2702
2697
  console.log(`
2703
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] ...
2704
2707
  `);
2705
2708
  process.exit(1);
2706
2709
  }
@@ -2716,13 +2719,8 @@ class SyncCommand extends CommandRunner5 {
2716
2719
  \uD83D\uDD04 Graph Sync
2717
2720
  `);
2718
2721
  if (syncOptions.force) {
2719
- if (syncOptions.paths && syncOptions.paths.length > 0) {
2720
- console.log(`\u26A0\uFE0F Force mode: ${syncOptions.paths.length} document(s) will be cleared and re-synced
2721
- `);
2722
- } else {
2723
- 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
2724
2723
  `);
2725
- }
2726
2724
  }
2727
2725
  if (syncOptions.dryRun) {
2728
2726
  console.log(`\uD83D\uDCCB Dry run mode: No changes will be applied
@@ -2933,7 +2931,7 @@ class SyncCommand extends CommandRunner5 {
2933
2931
  __legacyDecorateClassTS([
2934
2932
  Option3({
2935
2933
  flags: "-f, --force",
2936
- description: "Force re-sync: with paths, clears only those docs; without paths, rebuilds entire graph"
2934
+ description: "Force re-sync specified documents (requires paths to be specified)"
2937
2935
  }),
2938
2936
  __legacyMetadataTS("design:type", Function),
2939
2937
  __legacyMetadataTS("design:paramtypes", []),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zabaca/lattice",
3
- "version": "1.0.10",
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 && bun publish && git push && git push --tags",
23
- "release:minor": "bun run check && bun test && bun pm version minor && bun publish && git push && git push --tags",
24
- "release:major": "bun run check && bun test && bun pm version major && bun publish && git push && git push --tags",
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": [