bluera-knowledge 0.10.0 → 0.10.1

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 (34) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +12 -0
  3. package/README.md +73 -2
  4. package/commands/sync.md +96 -0
  5. package/dist/{chunk-ITH6FWQY.js → chunk-6U45VP5Z.js} +24 -3
  6. package/dist/{chunk-ITH6FWQY.js.map → chunk-6U45VP5Z.js.map} +1 -1
  7. package/dist/{chunk-CUHYSPRV.js → chunk-DP5XBPQV.js} +372 -2
  8. package/dist/chunk-DP5XBPQV.js.map +1 -0
  9. package/dist/{chunk-DWAIT2OD.js → chunk-UE4ZIJYA.js} +74 -5
  10. package/dist/{chunk-DWAIT2OD.js.map → chunk-UE4ZIJYA.js.map} +1 -1
  11. package/dist/index.js +213 -5
  12. package/dist/index.js.map +1 -1
  13. package/dist/mcp/server.js +2 -2
  14. package/dist/workers/background-worker-cli.js +2 -2
  15. package/package.json +1 -1
  16. package/src/cli/commands/sync.test.ts +54 -0
  17. package/src/cli/commands/sync.ts +264 -0
  18. package/src/cli/index.ts +1 -0
  19. package/src/crawl/claude-client.test.ts +56 -0
  20. package/src/crawl/claude-client.ts +27 -1
  21. package/src/index.ts +2 -0
  22. package/src/mcp/commands/index.ts +2 -0
  23. package/src/mcp/commands/sync.commands.test.ts +283 -0
  24. package/src/mcp/commands/sync.commands.ts +233 -0
  25. package/src/services/gitignore.service.test.ts +157 -0
  26. package/src/services/gitignore.service.ts +132 -0
  27. package/src/services/store-definition.service.test.ts +440 -0
  28. package/src/services/store-definition.service.ts +198 -0
  29. package/src/services/store.service.test.ts +279 -1
  30. package/src/services/store.service.ts +101 -4
  31. package/src/types/index.ts +18 -0
  32. package/src/types/store-definition.test.ts +492 -0
  33. package/src/types/store-definition.ts +129 -0
  34. package/dist/chunk-CUHYSPRV.js.map +0 -1
@@ -3554,15 +3554,61 @@ async function fileExists2(path3) {
3554
3554
  }
3555
3555
  var StoreService = class {
3556
3556
  dataDir;
3557
+ definitionService;
3557
3558
  registry = { stores: [] };
3558
- constructor(dataDir) {
3559
+ constructor(dataDir, options) {
3559
3560
  this.dataDir = dataDir;
3561
+ this.definitionService = options?.definitionService ?? void 0;
3560
3562
  }
3561
3563
  async initialize() {
3562
3564
  await mkdir4(this.dataDir, { recursive: true });
3563
3565
  await this.loadRegistry();
3564
3566
  }
3565
- async create(input) {
3567
+ /**
3568
+ * Convert a Store and CreateStoreInput to a StoreDefinition for persistence.
3569
+ */
3570
+ createDefinitionFromStore(store, input) {
3571
+ const tags = store.tags !== void 0 ? [...store.tags] : void 0;
3572
+ const base = {
3573
+ name: store.name,
3574
+ description: store.description,
3575
+ tags
3576
+ };
3577
+ switch (store.type) {
3578
+ case "file": {
3579
+ const fileStore = store;
3580
+ const fileDef = {
3581
+ ...base,
3582
+ type: "file",
3583
+ // Use original input path if provided (may be relative), otherwise use normalized
3584
+ path: input.path ?? fileStore.path
3585
+ };
3586
+ return fileDef;
3587
+ }
3588
+ case "repo": {
3589
+ const repoStore = store;
3590
+ const repoDef = {
3591
+ ...base,
3592
+ type: "repo",
3593
+ url: repoStore.url ?? "",
3594
+ branch: repoStore.branch,
3595
+ depth: input.depth
3596
+ };
3597
+ return repoDef;
3598
+ }
3599
+ case "web": {
3600
+ const webStore = store;
3601
+ const webDef = {
3602
+ ...base,
3603
+ type: "web",
3604
+ url: webStore.url,
3605
+ depth: webStore.depth
3606
+ };
3607
+ return webDef;
3608
+ }
3609
+ }
3610
+ }
3611
+ async create(input, options) {
3566
3612
  if (!input.name || input.name.trim() === "") {
3567
3613
  return err(new Error("Store name cannot be empty"));
3568
3614
  }
@@ -3654,6 +3700,10 @@ var StoreService = class {
3654
3700
  }
3655
3701
  this.registry.stores.push(store);
3656
3702
  await this.saveRegistry();
3703
+ if (this.definitionService !== void 0 && options?.skipDefinitionSync !== true) {
3704
+ const definition = this.createDefinitionFromStore(store, input);
3705
+ await this.definitionService.addDefinition(definition);
3706
+ }
3657
3707
  return ok(store);
3658
3708
  }
3659
3709
  async list(type) {
@@ -3673,7 +3723,7 @@ var StoreService = class {
3673
3723
  this.registry.stores.find((s) => s.id === idOrName || s.name === idOrName)
3674
3724
  );
3675
3725
  }
3676
- async update(id, updates) {
3726
+ async update(id, updates, options) {
3677
3727
  const index = this.registry.stores.findIndex((s) => s.id === id);
3678
3728
  if (index === -1) {
3679
3729
  return err(new Error(`Store not found: ${id}`));
@@ -3689,15 +3739,33 @@ var StoreService = class {
3689
3739
  };
3690
3740
  this.registry.stores[index] = updated;
3691
3741
  await this.saveRegistry();
3742
+ if (this.definitionService !== void 0 && options?.skipDefinitionSync !== true) {
3743
+ const defUpdates = {};
3744
+ if (updates.description !== void 0) {
3745
+ defUpdates.description = updates.description;
3746
+ }
3747
+ if (updates.tags !== void 0) {
3748
+ defUpdates.tags = [...updates.tags];
3749
+ }
3750
+ await this.definitionService.updateDefinition(store.name, defUpdates);
3751
+ }
3692
3752
  return ok(updated);
3693
3753
  }
3694
- async delete(id) {
3754
+ async delete(id, options) {
3695
3755
  const index = this.registry.stores.findIndex((s) => s.id === id);
3696
3756
  if (index === -1) {
3697
3757
  return err(new Error(`Store not found: ${id}`));
3698
3758
  }
3759
+ const store = this.registry.stores[index];
3760
+ if (store === void 0) {
3761
+ return err(new Error(`Store not found: ${id}`));
3762
+ }
3763
+ const storeName = store.name;
3699
3764
  this.registry.stores.splice(index, 1);
3700
3765
  await this.saveRegistry();
3766
+ if (this.definitionService !== void 0 && options?.skipDefinitionSync !== true) {
3767
+ await this.definitionService.removeDefinition(storeName);
3768
+ }
3701
3769
  return ok(void 0);
3702
3770
  }
3703
3771
  async loadRegistry() {
@@ -4257,6 +4325,7 @@ export {
4257
4325
  PythonBridge,
4258
4326
  ChunkingService,
4259
4327
  ASTParser,
4328
+ ProjectRootService,
4260
4329
  createStoreId,
4261
4330
  createDocumentId,
4262
4331
  ok,
@@ -4267,4 +4336,4 @@ export {
4267
4336
  createServices,
4268
4337
  destroyServices
4269
4338
  };
4270
- //# sourceMappingURL=chunk-DWAIT2OD.js.map
4339
+ //# sourceMappingURL=chunk-UE4ZIJYA.js.map