@lovelybunch/api 1.0.69 → 1.0.71-alpha.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.
@@ -4,6 +4,7 @@ export interface CPFilter {
4
4
  author?: string;
5
5
  priority?: string;
6
6
  tags?: string[];
7
+ search?: string;
7
8
  }
8
9
  export interface StorageAdapter {
9
10
  createCP(cp: ChangeProposal): Promise<void>;
@@ -162,7 +162,7 @@ export class FileStorageAdapter {
162
162
  return this.frontmatterToCP(data, body);
163
163
  }));
164
164
  // Apply filters
165
- return proposals.filter(cp => {
165
+ let filtered = proposals.filter(cp => {
166
166
  if (!cp)
167
167
  return false;
168
168
  if (filter?.status && cp.status !== filter.status)
@@ -178,6 +178,21 @@ export class FileStorageAdapter {
178
178
  }
179
179
  return true;
180
180
  }).filter(Boolean);
181
+ // Apply search filter using Fuse.js for fuzzy matching
182
+ if (filter?.search && filter.search.trim()) {
183
+ const fuse = new Fuse(filtered, {
184
+ keys: [
185
+ { name: 'intent', weight: 2 },
186
+ { name: 'content', weight: 1 },
187
+ { name: 'author.name', weight: 0.5 },
188
+ { name: 'metadata.tags', weight: 1 }
189
+ ],
190
+ threshold: 0.4,
191
+ includeScore: true
192
+ });
193
+ filtered = fuse.search(filter.search).map(result => result.item);
194
+ }
195
+ return filtered;
181
196
  }
182
197
  catch (error) {
183
198
  if (error.code === 'ENOENT')
@@ -1,5 +1,7 @@
1
1
  import { Hono } from 'hono';
2
2
  import { POST } from './route.js';
3
+ import { POST as toolsPost } from './tools.js';
3
4
  const app = new Hono();
4
5
  app.post('/', POST);
6
+ app.post('/tools', toolsPost);
5
7
  export default app;