skill-creator 0.0.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.
Files changed (55) hide show
  1. package/README.md +53 -0
  2. package/dist/cli.d.ts +8 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +378 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/core/chromaSearch.d.ts +24 -0
  7. package/dist/core/chromaSearch.d.ts.map +1 -0
  8. package/dist/core/chromaSearch.js +192 -0
  9. package/dist/core/chromaSearch.js.map +1 -0
  10. package/dist/core/contentManager.d.ts +40 -0
  11. package/dist/core/contentManager.d.ts.map +1 -0
  12. package/dist/core/contentManager.js +355 -0
  13. package/dist/core/contentManager.js.map +1 -0
  14. package/dist/core/runScript.d.ts +5 -0
  15. package/dist/core/runScript.d.ts.map +1 -0
  16. package/dist/core/runScript.js +220 -0
  17. package/dist/core/runScript.js.map +1 -0
  18. package/dist/core/searchEngine.d.ts +25 -0
  19. package/dist/core/searchEngine.d.ts.map +1 -0
  20. package/dist/core/searchEngine.js +198 -0
  21. package/dist/core/searchEngine.js.map +1 -0
  22. package/dist/core/simpleSearch.d.ts +21 -0
  23. package/dist/core/simpleSearch.d.ts.map +1 -0
  24. package/dist/core/simpleSearch.js +113 -0
  25. package/dist/core/simpleSearch.js.map +1 -0
  26. package/dist/core/skillCreator.d.ts +16 -0
  27. package/dist/core/skillCreator.d.ts.map +1 -0
  28. package/dist/core/skillCreator.js +291 -0
  29. package/dist/core/skillCreator.js.map +1 -0
  30. package/dist/core/templateManager.d.ts +28 -0
  31. package/dist/core/templateManager.d.ts.map +1 -0
  32. package/dist/core/templateManager.js +612 -0
  33. package/dist/core/templateManager.js.map +1 -0
  34. package/dist/core/unifiedSearch.d.ts +23 -0
  35. package/dist/core/unifiedSearch.d.ts.map +1 -0
  36. package/dist/core/unifiedSearch.js +46 -0
  37. package/dist/core/unifiedSearch.js.map +1 -0
  38. package/dist/index.d.ts +10 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +9 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/types/index.d.ts +86 -0
  43. package/dist/types/index.d.ts.map +1 -0
  44. package/dist/types/index.js +5 -0
  45. package/dist/types/index.js.map +1 -0
  46. package/dist/utils/config.d.ts +47 -0
  47. package/dist/utils/config.d.ts.map +1 -0
  48. package/dist/utils/config.js +69 -0
  49. package/dist/utils/config.js.map +1 -0
  50. package/dist/utils/package.d.ts +57 -0
  51. package/dist/utils/package.d.ts.map +1 -0
  52. package/dist/utils/package.js +170 -0
  53. package/dist/utils/package.js.map +1 -0
  54. package/package.json +57 -0
  55. package/templates/skill-creator.md +182 -0
@@ -0,0 +1,612 @@
1
+ /**
2
+ * Template system for framework-specific skill enhancements
3
+ */
4
+ import { join } from 'node:path';
5
+ import { existsSync, writeFileSync, mkdirSync, chmodSync, readFileSync } from 'node:fs';
6
+ export class TemplateManager {
7
+ templatesDir;
8
+ templates = new Map();
9
+ constructor() {
10
+ const __filename = new URL(import.meta.url).pathname;
11
+ const __dirname = join(__filename, '..');
12
+ this.templatesDir = join(__dirname, 'templates', 'frameworks');
13
+ this.loadTemplates();
14
+ }
15
+ loadTemplates() {
16
+ // Define built-in templates
17
+ this.templates.set('react', {
18
+ name: 'React',
19
+ description: 'React JavaScript library for building user interfaces',
20
+ context7Ids: ['/react/docs', '/reactjs/react/docs'],
21
+ additionalDependencies: {
22
+ '@types/react': '^18.2.0',
23
+ '@types/react-dom': '^18.2.0',
24
+ },
25
+ customConfig: {
26
+ embeddingModel: 'all-MiniLM-L6-v2',
27
+ chunkSize: 800,
28
+ chunkOverlap: 150,
29
+ },
30
+ });
31
+ this.templates.set('vue', {
32
+ name: 'Vue.js',
33
+ description: 'Progressive JavaScript framework',
34
+ context7Ids: ['/vuejs/core/docs', '/vuejs/vue/docs'],
35
+ additionalDependencies: {
36
+ '@types/node': '^20.0.0',
37
+ },
38
+ customConfig: {
39
+ embeddingModel: 'all-MiniLM-L6-v2',
40
+ chunkSize: 1000,
41
+ chunkOverlap: 200,
42
+ },
43
+ });
44
+ this.templates.set('angular', {
45
+ name: 'Angular',
46
+ description: 'Platform for building mobile and desktop web applications',
47
+ context7Ids: ['/angular/angular/docs'],
48
+ additionalDependencies: {
49
+ '@angular/common': '^17.0.0',
50
+ '@angular/core': '^17.0.0',
51
+ },
52
+ customConfig: {
53
+ embeddingModel: 'all-MiniLM-L6-v2',
54
+ chunkSize: 1200,
55
+ chunkOverlap: 250,
56
+ },
57
+ });
58
+ this.templates.set('express', {
59
+ name: 'Express.js',
60
+ description: 'Fast, unopinionated, minimalist web framework for Node.js',
61
+ context7Ids: ['/expressjs/express/docs'],
62
+ additionalDependencies: {
63
+ '@types/express': '^4.17.0',
64
+ 'cors': '^2.8.5',
65
+ 'helmet': '^7.0.0',
66
+ },
67
+ additionalScripts: {
68
+ 'server-example': 'node scripts/server-example.js',
69
+ },
70
+ });
71
+ this.templates.set('nextjs', {
72
+ name: 'Next.js',
73
+ description: 'The React Framework for Production',
74
+ context7Ids: ['/vercel/next.js/docs'],
75
+ additionalDependencies: {
76
+ 'next': '^14.0.0',
77
+ 'react': '^18.0.0',
78
+ 'react-dom': '^18.0.0',
79
+ },
80
+ customConfig: {
81
+ embeddingModel: 'all-MiniLM-L6-v2',
82
+ chunkSize: 1000,
83
+ chunkOverlap: 200,
84
+ },
85
+ });
86
+ this.templates.set('tanstack', {
87
+ name: 'TanStack',
88
+ description: 'Quality open-source software for web developers',
89
+ context7Ids: [
90
+ '/tanstack/query/docs',
91
+ '/tanstack/router/docs',
92
+ '/tanstack/table/docs',
93
+ '/tanstack/react-store/docs',
94
+ ],
95
+ additionalDependencies: {
96
+ '@tanstack/react-query': '^5.0.0',
97
+ '@tanstack/react-router': '^1.0.0',
98
+ '@tanstack/react-table': '^8.0.0',
99
+ },
100
+ });
101
+ this.templates.set('typeorm', {
102
+ name: 'TypeORM',
103
+ description: 'Modern ORM for TypeScript and JavaScript',
104
+ context7Ids: ['/typeorm/typeorm/docs'],
105
+ additionalDependencies: {
106
+ 'typeorm': '^0.3.17',
107
+ 'reflect-metadata': '^0.1.13',
108
+ },
109
+ additionalScripts: {
110
+ 'generate-entity': 'node scripts/generate-entity.js',
111
+ },
112
+ });
113
+ this.templates.set('prisma', {
114
+ name: 'Prisma',
115
+ description: 'Next-generation Node.js and TypeScript ORM',
116
+ context7Ids: ['/prisma/prisma/docs'],
117
+ additionalDependencies: {
118
+ '@prisma/client': '^5.0.0',
119
+ 'prisma': '^5.0.0',
120
+ },
121
+ additionalScripts: {
122
+ 'generate-schema': 'node scripts/generate-schema.js',
123
+ },
124
+ });
125
+ this.templates.set('nestjs', {
126
+ name: 'NestJS',
127
+ description: 'A progressive Node.js framework for building efficient applications',
128
+ context7Ids: ['/nestjs/nest/docs'],
129
+ additionalDependencies: {
130
+ '@nestjs/core': '^10.0.0',
131
+ '@nestjs/common': '^10.0.0',
132
+ '@nestjs/platform-express': '^10.0.0',
133
+ },
134
+ customConfig: {
135
+ embeddingModel: 'all-MiniLM-L6-v2',
136
+ chunkSize: 1200,
137
+ chunkOverlap: 250,
138
+ },
139
+ });
140
+ this.templates.set('fastify', {
141
+ name: 'Fastify',
142
+ description: 'Fast and low overhead web framework, for Node.js',
143
+ context7Ids: ['/fastify/fastify/docs'],
144
+ additionalDependencies: {
145
+ 'fastify': '^4.0.0',
146
+ '@fastify/cors': '^8.0.0',
147
+ '@fastify/helmet': '^11.0.0',
148
+ },
149
+ });
150
+ }
151
+ getTemplate(name) {
152
+ return this.templates.get(name.toLowerCase());
153
+ }
154
+ getAllTemplates() {
155
+ return Array.from(this.templates.values());
156
+ }
157
+ detectFramework(packageName) {
158
+ const keywords = packageName.toLowerCase().replace(/[^a-z0-9]/g, ' ').split(/\s+/);
159
+ for (const [templateName, template] of this.templates) {
160
+ // Check if template name matches package keywords
161
+ if (keywords.includes(templateName)) {
162
+ return template;
163
+ }
164
+ // Check for common aliases
165
+ const aliases = {
166
+ react: ['react', 'reactjs', 'react-dom'],
167
+ vue: ['vue', 'vuejs'],
168
+ angular: ['angular', 'angularjs', '@angular'],
169
+ express: ['express', 'expressjs'],
170
+ nextjs: ['next', 'nextjs', '@next'],
171
+ tanstack: ['tanstack', '@tanstack'],
172
+ typeorm: ['typeorm', '@typeorm'],
173
+ prisma: ['prisma', '@prisma'],
174
+ nestjs: ['nestjs', '@nestjs'],
175
+ fastify: ['fastify', '@fastify'],
176
+ };
177
+ for (const [key, values] of Object.entries(aliases)) {
178
+ if (key === templateName && values.some(v => keywords.includes(v))) {
179
+ return template;
180
+ }
181
+ }
182
+ }
183
+ return null;
184
+ }
185
+ applyTemplate(template, skillPath, config) {
186
+ // Update package.json with additional dependencies
187
+ if (template.additionalDependencies) {
188
+ const packageJsonPath = join(skillPath, 'package.json');
189
+ if (existsSync(packageJsonPath)) {
190
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
191
+ packageJson.dependencies = {
192
+ ...packageJson.dependencies,
193
+ ...template.additionalDependencies,
194
+ };
195
+ // Add additional scripts
196
+ if (template.additionalScripts) {
197
+ packageJson.scripts = {
198
+ ...packageJson.scripts,
199
+ ...template.additionalScripts,
200
+ };
201
+ }
202
+ writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
203
+ }
204
+ }
205
+ // Update config with custom settings
206
+ if (template.customConfig) {
207
+ Object.assign(config, template.customConfig);
208
+ // Update config file
209
+ const configPath = join(skillPath, 'config.json');
210
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
211
+ }
212
+ // Create additional script files
213
+ if (template.additionalScripts) {
214
+ const scriptsDir = join(skillPath, 'scripts');
215
+ mkdirSync(scriptsDir, { recursive: true });
216
+ // Generate framework-specific scripts
217
+ this.generateFrameworkScripts(template.name.toLowerCase(), scriptsDir);
218
+ }
219
+ }
220
+ generateFrameworkScripts(framework, scriptsDir) {
221
+ switch (framework) {
222
+ case 'express':
223
+ this.createExpressServerExample(scriptsDir);
224
+ break;
225
+ case 'typeorm':
226
+ this.createTypeormEntityGenerator(scriptsDir);
227
+ break;
228
+ case 'prisma':
229
+ this.createPrismaSchemaGenerator(scriptsDir);
230
+ break;
231
+ case 'react':
232
+ case 'nextjs':
233
+ this.createReactExampleScripts(scriptsDir);
234
+ break;
235
+ }
236
+ }
237
+ createExpressServerExample(scriptsDir) {
238
+ const content = `#!/usr/bin/env node
239
+ /**
240
+ * Example Express server setup
241
+ */
242
+
243
+ const express = require('express')
244
+ const cors = require('cors')
245
+ const helmet = require('helmet')
246
+
247
+ const app = express()
248
+ const PORT = process.env.PORT || 3000
249
+
250
+ // Middleware
251
+ app.use(helmet())
252
+ app.use(cors())
253
+ app.use(express.json())
254
+
255
+ // Routes
256
+ app.get('/', (req, res) => {
257
+ res.json({ message: 'Express server is running!' })
258
+ })
259
+
260
+ // Start server
261
+ app.listen(PORT, () => {
262
+ console.log(\`Server is running on port \${PORT}\`)
263
+ })
264
+ `;
265
+ const serverScriptPath = join(scriptsDir, 'server-example.js');
266
+ writeFileSync(serverScriptPath, content);
267
+ chmodSync(serverScriptPath, 0o755);
268
+ }
269
+ createTypeormEntityGenerator(scriptsDir) {
270
+ const content = `#!/usr/bin/env node
271
+ /**
272
+ * TypeORM entity generator helper
273
+ */
274
+
275
+ const inquirer = require('inquirer')
276
+ const fs = require('fs')
277
+ const path = require('path')
278
+
279
+ inquirer
280
+ .prompt([
281
+ {
282
+ type: 'input',
283
+ name: 'entityName',
284
+ message: 'Entity name:',
285
+ validate: input => input.length > 0 || 'Entity name is required'
286
+ },
287
+ {
288
+ type: 'checkbox',
289
+ name: 'columns',
290
+ message: 'Select columns:',
291
+ choices: [
292
+ { name: 'id (primary key)', value: 'id', checked: true },
293
+ { name: 'createdAt', value: 'createdAt', checked: true },
294
+ { name: 'updatedAt', value: 'updatedAt', checked: true },
295
+ { name: 'name (string)', value: 'name' },
296
+ { name: 'email (string)', value: 'email' },
297
+ { name: 'description (text)', value: 'description' },
298
+ { name: 'isActive (boolean)', value: 'isActive' }
299
+ ]
300
+ }
301
+ ])
302
+ .then(answers => {
303
+ const { entityName, columns } = answers
304
+ const className = entityName.charAt(0).toUpperCase() + entityName.slice(1)
305
+
306
+ let entity = \`import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm'
307
+
308
+ @Entity()
309
+ export class \${className} {\`
310
+
311
+ if (columns.includes('id')) {
312
+ entity += \`
313
+ @PrimaryGeneratedColumn()
314
+ id: number\`
315
+ }
316
+
317
+ if (columns.includes('name')) {
318
+ entity += \`
319
+ @Column()
320
+ name: string\`
321
+ }
322
+
323
+ if (columns.includes('email')) {
324
+ entity += \`
325
+ @Column({ unique: true })
326
+ email: string\`
327
+ }
328
+
329
+ if (columns.includes('description')) {
330
+ entity += \`
331
+ @Column('text')
332
+ description: string\`
333
+ }
334
+
335
+ if (columns.includes('isActive')) {
336
+ entity += \`
337
+ @Column({ default: true })
338
+ isActive: boolean\`
339
+ }
340
+
341
+ if (columns.includes('createdAt')) {
342
+ entity += \`
343
+ @CreateDateColumn()
344
+ createdAt: Date\`
345
+ }
346
+
347
+ if (columns.includes('updatedAt')) {
348
+ entity += \`
349
+ @UpdateDateColumn()
350
+ updatedAt: Date\`
351
+ }
352
+
353
+ entity += '\n}'
354
+
355
+ const outputPath = path.join(process.cwd(), 'src', 'entities', \`\${entityName}.ts\`)
356
+
357
+ // Ensure directory exists
358
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true })
359
+
360
+ // Write entity file
361
+ fs.writeFileSync(outputPath, entity)
362
+
363
+ console.log(\`✅ Entity created: \${outputPath}\`)
364
+ })
365
+ `;
366
+ const entityScriptPath = join(scriptsDir, 'generate-entity.js');
367
+ writeFileSync(entityScriptPath, content);
368
+ chmodSync(entityScriptPath, 0o755);
369
+ }
370
+ createPrismaSchemaGenerator(scriptsDir) {
371
+ const content = `#!/usr/bin/env node
372
+ /**
373
+ * Prisma schema helper
374
+ */
375
+
376
+ const inquirer = require('inquirer')
377
+ const fs = require('fs')
378
+
379
+ inquirer
380
+ .prompt([
381
+ {
382
+ type: 'input',
383
+ name: 'modelName',
384
+ message: 'Model name:',
385
+ validate: input => input.length > 0 || 'Model name is required'
386
+ },
387
+ {
388
+ type: 'checkbox',
389
+ name: 'fields',
390
+ message: 'Select fields:',
391
+ choices: [
392
+ { name: 'id (Int @id @default(autoincrement()))', value: 'id', checked: true },
393
+ { name: 'email (String @unique)', value: 'email' },
394
+ { name: 'name (String)', value: 'name' },
395
+ { name: 'title (String)', value: 'title' },
396
+ { name: 'content (String)', value: 'content' },
397
+ { name: 'published (Boolean @default(false))', value: 'published' },
398
+ { name: 'createdAt (DateTime @default(now()))', value: 'createdAt', checked: true },
399
+ { name: 'updatedAt (DateTime @updatedAt)', value: 'updatedAt', checked: true }
400
+ ]
401
+ }
402
+ ])
403
+ .then(answers => {
404
+ const { modelName, fields } = answers
405
+ const capitalizedName = modelName.charAt(0).toUpperCase() + modelName.slice(1)
406
+
407
+ let model = \`model \${capitalizedName} {\`
408
+
409
+ if (fields.includes('id')) {
410
+ model += '\\n id Int @id @default(autoincrement())'
411
+ }
412
+
413
+ if (fields.includes('email')) {
414
+ model += '\\n email String @unique'
415
+ }
416
+
417
+ if (fields.includes('name')) {
418
+ model += '\\n name String'
419
+ }
420
+
421
+ if (fields.includes('title')) {
422
+ model += '\\n title String'
423
+ }
424
+
425
+ if (fields.includes('content')) {
426
+ model += '\\n content String'
427
+ }
428
+
429
+ if (fields.includes('published')) {
430
+ model += '\\n published Boolean @default(false)'
431
+ }
432
+
433
+ if (fields.includes('createdAt')) {
434
+ model += '\\n createdAt DateTime @default(now())'
435
+ }
436
+
437
+ if (fields.includes('updatedAt')) {
438
+ model += '\\n updatedAt DateTime @updatedAt'
439
+ }
440
+
441
+ model += '\\n}'
442
+
443
+ const schemaPath = 'prisma/schema.prisma'
444
+
445
+ // Read existing schema or create new
446
+ let existingSchema = ''
447
+ if (fs.existsSync(schemaPath)) {
448
+ existingSchema = fs.readFileSync(schemaPath, 'utf-8')
449
+ }
450
+
451
+ // Append model to schema
452
+ const updatedSchema = existingSchema + '\\n\\n' + model
453
+
454
+ fs.writeFileSync(schemaPath, updatedSchema)
455
+
456
+ console.log(\`✅ Model added to schema.prisma\`)
457
+ console.log('\\nRun: npx prisma migrate dev --name init')
458
+ console.log('Then: npx prisma generate')
459
+ })
460
+ `;
461
+ const schemaScriptPath = join(scriptsDir, 'generate-schema.js');
462
+ writeFileSync(schemaScriptPath, content);
463
+ chmodSync(schemaScriptPath, 0o755);
464
+ }
465
+ createReactExampleScripts(scriptsDir) {
466
+ // Component generator
467
+ const componentContent = `#!/usr/bin/env node
468
+ /**
469
+ * React component generator
470
+ */
471
+
472
+ const inquirer = require('inquirer')
473
+ const fs = require('fs')
474
+ const path = require('path')
475
+
476
+ inquirer
477
+ .prompt([
478
+ {
479
+ type: 'input',
480
+ name: 'componentName',
481
+ message: 'Component name:',
482
+ validate: input => /^[A-Z][a-zA-Z0-9]*$/.test(input) || 'Component name must start with uppercase letter'
483
+ },
484
+ {
485
+ type: 'list',
486
+ name: 'componentType',
487
+ message: 'Component type:',
488
+ choices: [
489
+ { name: 'Functional Component', value: 'functional' },
490
+ { name: 'Functional Component with Hooks', value: 'hooks' },
491
+ { name: 'TypeScript Functional Component', value: 'ts-functional' }
492
+ ]
493
+ },
494
+ {
495
+ type: 'checkbox',
496
+ name: 'features',
497
+ message: 'Include features:',
498
+ choices: [
499
+ { name: 'Props interface', value: 'props' },
500
+ { name: 'React hooks (useState, useEffect)', value: 'hooks' },
501
+ { name: 'CSS Modules', value: 'css' },
502
+ { name: 'Storybook story', value: 'storybook' }
503
+ ]
504
+ }
505
+ ])
506
+ .then(answers => {
507
+ const { componentName, componentType, features } = answers
508
+ let component = ''
509
+
510
+ if (componentType.includes('ts')) {
511
+ component = \`import React from 'react'\`
512
+
513
+ if (features.includes('props')) {
514
+ component += \`
515
+ interface \${componentName}Props {
516
+ // Define props here
517
+ }
518
+
519
+ export const \${componentName}: React.FC<\${componentName}Props> = (props) => {
520
+ return (
521
+ <div className="\${componentName.toLowerCase()}">
522
+ <h1>\${componentName} Component</h1>
523
+ </div>
524
+ )
525
+ }
526
+
527
+ export default \${componentName}\`
528
+ } else {
529
+ component = \`
530
+ export const \${componentName}: React.FC = () => {
531
+ return (
532
+ <div className="\${componentName.toLowerCase()}">
533
+ <h1>\${componentName} Component</h1>
534
+ </div>
535
+ )
536
+ }
537
+
538
+ export default \${componentName}\`
539
+ }
540
+ } else {
541
+ component = \`import React from 'react'
542
+
543
+ export const \${componentName} = () => {
544
+ return (
545
+ <div className="\${componentName.toLowerCase()}">
546
+ <h1>\${componentName} Component</h1>
547
+ </div>
548
+ )
549
+ }
550
+
551
+ export default \${componentName}\`
552
+ }
553
+
554
+ const outputPath = path.join(process.cwd(), 'src', 'components', \`\${componentName}.tsx\`)
555
+
556
+ // Ensure directory exists
557
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true })
558
+
559
+ // Write component file
560
+ fs.writeFileSync(outputPath, component)
561
+
562
+ console.log(\`✅ Component created: \${outputPath}\`)
563
+
564
+ // Create CSS module if requested
565
+ if (features.includes('css')) {
566
+ const cssContent = \`.\${componentName.toLowerCase()} {
567
+ /* Add your styles here */
568
+ padding: 1rem;
569
+ border: 1px solid #ddd;
570
+ border-radius: 4px;
571
+ }
572
+
573
+ .\${componentName.toLowerCase()} h1 {
574
+ margin: 0 0 1rem 0;
575
+ font-size: 1.5rem;
576
+ }\`
577
+
578
+ const cssPath = outputPath.replace('.tsx', '.module.css')
579
+ fs.writeFileSync(cssPath, cssContent)
580
+ console.log(\`✅ CSS module created: \${cssPath}\`)
581
+ }
582
+
583
+ // Create Storybook story if requested
584
+ if (features.includes('storybook')) {
585
+ const storyContent = \`import type { Meta, StoryObj } from '@storybook/react'
586
+ import \${componentName} from './\${componentName}'
587
+
588
+ const meta: Meta<typeof \${componentName}> = {
589
+ title: 'Components/\${componentName}',
590
+ component: \${componentName},
591
+ tags: ['autodocs'],
592
+ }
593
+
594
+ export default meta
595
+ type Story = StoryObj<typeof meta>
596
+
597
+ export const Primary: Story = {}\`
598
+
599
+ const storyPath = outputPath.replace('.tsx', '.stories.tsx')
600
+ fs.writeFileSync(storyPath, storyContent)
601
+ console.log(\`✅ Storybook story created: \${storyPath}\`)
602
+ }
603
+ })
604
+ `;
605
+ const componentScriptPath = join(scriptsDir, 'generate-component.js');
606
+ writeFileSync(componentScriptPath, componentContent);
607
+ chmodSync(componentScriptPath, 0o755);
608
+ // Note: The package.json update is handled by the script itself
609
+ console.log('✅ React component generator created');
610
+ }
611
+ }
612
+ //# sourceMappingURL=templateManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateManager.js","sourceRoot":"","sources":["../../src/core/templateManager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAavF,MAAM,OAAO,eAAe;IAClB,YAAY,CAAQ;IACpB,SAAS,GAAmC,IAAI,GAAG,EAAE,CAAA;IAE7D;QACE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAA;QACpD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;QACxC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;QAC9D,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAEO,aAAa;QACnB,4BAA4B;QAC5B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE;YAC1B,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,uDAAuD;YACpE,WAAW,EAAE,CAAC,aAAa,EAAE,qBAAqB,CAAC;YACnD,sBAAsB,EAAE;gBACtB,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QACxC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;IACpC,CAAC;IAEO,yBAAyB,CAAC,UAAkB;QAClD,sBAAsB;QACtB,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyI5B,CAAA;QACG,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAA;QACrE,aAAa,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAA;QACpD,SAAS,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAA;QAErC,gEAAgE;QAChE,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;IACpD,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Unified search engine that can use either ChromaDB or simple search
3
+ */
4
+ import type { SearchResult } from '../types/index.js';
5
+ export interface UnifiedSearchOptions {
6
+ type: 'chroma' | 'simple';
7
+ dbPath: string;
8
+ collectionName: string;
9
+ referencesDir: string;
10
+ }
11
+ export declare class UnifiedSearchEngine {
12
+ private engine;
13
+ private options;
14
+ constructor(options: UnifiedSearchOptions);
15
+ private getEngine;
16
+ buildIndex(referencesDir: string, hashFile: string): Promise<void>;
17
+ search(query: string, topK?: number, where?: Record<string, any>): Promise<SearchResult[]>;
18
+ searchByPriority(query: string, topK?: number): Promise<SearchResult[]>;
19
+ getStats(): Promise<{
20
+ totalDocuments: number;
21
+ }>;
22
+ }
23
+ //# sourceMappingURL=unifiedSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unifiedSearch.d.ts","sourceRoot":"","sources":["../../src/core/unifiedSearch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIrD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAuD;IACrE,OAAO,CAAC,OAAO,CAAsB;gBAEzB,OAAO,EAAE,oBAAoB;YAI3B,SAAS;IAiBjB,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlE,MAAM,CACV,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,MAAU,EAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,OAAO,CAAC,YAAY,EAAE,CAAC;IAKpB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,MAAU,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAK1E,QAAQ,IAAI,OAAO,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;CAItD"}