@intentsolutions/blueprint 2.5.0 → 2.8.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 (212) hide show
  1. package/dist/analytics/collector.d.ts +73 -0
  2. package/dist/analytics/collector.d.ts.map +1 -0
  3. package/dist/analytics/collector.js +239 -0
  4. package/dist/analytics/collector.js.map +1 -0
  5. package/dist/analytics/dashboard.d.ts +62 -0
  6. package/dist/analytics/dashboard.d.ts.map +1 -0
  7. package/dist/analytics/dashboard.js +346 -0
  8. package/dist/analytics/dashboard.js.map +1 -0
  9. package/dist/analytics/index.d.ts +75 -0
  10. package/dist/analytics/index.d.ts.map +1 -0
  11. package/dist/analytics/index.js +115 -0
  12. package/dist/analytics/index.js.map +1 -0
  13. package/dist/analytics/types.d.ts +169 -0
  14. package/dist/analytics/types.d.ts.map +1 -0
  15. package/dist/analytics/types.js +16 -0
  16. package/dist/analytics/types.js.map +1 -0
  17. package/dist/cli.js +561 -6
  18. package/dist/cli.js.map +1 -1
  19. package/dist/commands/analytics.d.ts +38 -0
  20. package/dist/commands/analytics.d.ts.map +1 -0
  21. package/dist/commands/analytics.js +196 -0
  22. package/dist/commands/analytics.js.map +1 -0
  23. package/dist/commands/index.d.ts +26 -0
  24. package/dist/commands/index.d.ts.map +1 -0
  25. package/dist/commands/index.js +101 -0
  26. package/dist/commands/index.js.map +1 -0
  27. package/dist/commands/marketplace.d.ts +52 -0
  28. package/dist/commands/marketplace.d.ts.map +1 -0
  29. package/dist/commands/marketplace.js +356 -0
  30. package/dist/commands/marketplace.js.map +1 -0
  31. package/dist/enterprise/api/index.d.ts +8 -0
  32. package/dist/enterprise/api/index.d.ts.map +1 -0
  33. package/dist/enterprise/api/index.js +8 -0
  34. package/dist/enterprise/api/index.js.map +1 -0
  35. package/dist/enterprise/api/server.d.ts +79 -0
  36. package/dist/enterprise/api/server.d.ts.map +1 -0
  37. package/dist/enterprise/api/server.js +468 -0
  38. package/dist/enterprise/api/server.js.map +1 -0
  39. package/dist/enterprise/api/types.d.ts +269 -0
  40. package/dist/enterprise/api/types.d.ts.map +1 -0
  41. package/dist/enterprise/api/types.js +6 -0
  42. package/dist/enterprise/api/types.js.map +1 -0
  43. package/dist/enterprise/api/webhooks.d.ts +214 -0
  44. package/dist/enterprise/api/webhooks.d.ts.map +1 -0
  45. package/dist/enterprise/api/webhooks.js +308 -0
  46. package/dist/enterprise/api/webhooks.js.map +1 -0
  47. package/dist/enterprise/index.d.ts +9 -0
  48. package/dist/enterprise/index.d.ts.map +1 -0
  49. package/dist/enterprise/index.js +13 -0
  50. package/dist/enterprise/index.js.map +1 -0
  51. package/dist/enterprise/models/claude.d.ts +23 -0
  52. package/dist/enterprise/models/claude.d.ts.map +1 -0
  53. package/dist/enterprise/models/claude.js +176 -0
  54. package/dist/enterprise/models/claude.js.map +1 -0
  55. package/dist/enterprise/models/gemini.d.ts +25 -0
  56. package/dist/enterprise/models/gemini.d.ts.map +1 -0
  57. package/dist/enterprise/models/gemini.js +199 -0
  58. package/dist/enterprise/models/gemini.js.map +1 -0
  59. package/dist/enterprise/models/index.d.ts +11 -0
  60. package/dist/enterprise/models/index.d.ts.map +1 -0
  61. package/dist/enterprise/models/index.js +11 -0
  62. package/dist/enterprise/models/index.js.map +1 -0
  63. package/dist/enterprise/models/ollama.d.ts +32 -0
  64. package/dist/enterprise/models/ollama.d.ts.map +1 -0
  65. package/dist/enterprise/models/ollama.js +285 -0
  66. package/dist/enterprise/models/ollama.js.map +1 -0
  67. package/dist/enterprise/models/openai.d.ts +27 -0
  68. package/dist/enterprise/models/openai.d.ts.map +1 -0
  69. package/dist/enterprise/models/openai.js +222 -0
  70. package/dist/enterprise/models/openai.js.map +1 -0
  71. package/dist/enterprise/models/registry.d.ts +101 -0
  72. package/dist/enterprise/models/registry.d.ts.map +1 -0
  73. package/dist/enterprise/models/registry.js +263 -0
  74. package/dist/enterprise/models/registry.js.map +1 -0
  75. package/dist/enterprise/models/types.d.ts +141 -0
  76. package/dist/enterprise/models/types.d.ts.map +1 -0
  77. package/dist/enterprise/models/types.js +40 -0
  78. package/dist/enterprise/models/types.js.map +1 -0
  79. package/dist/enterprise/team/audit.d.ts +153 -0
  80. package/dist/enterprise/team/audit.d.ts.map +1 -0
  81. package/dist/enterprise/team/audit.js +346 -0
  82. package/dist/enterprise/team/audit.js.map +1 -0
  83. package/dist/enterprise/team/config.d.ts +83 -0
  84. package/dist/enterprise/team/config.d.ts.map +1 -0
  85. package/dist/enterprise/team/config.js +245 -0
  86. package/dist/enterprise/team/config.js.map +1 -0
  87. package/dist/enterprise/team/index.d.ts +7 -0
  88. package/dist/enterprise/team/index.d.ts.map +1 -0
  89. package/dist/enterprise/team/index.js +7 -0
  90. package/dist/enterprise/team/index.js.map +1 -0
  91. package/dist/enterprise/templates/engine.d.ts +100 -0
  92. package/dist/enterprise/templates/engine.d.ts.map +1 -0
  93. package/dist/enterprise/templates/engine.js +429 -0
  94. package/dist/enterprise/templates/engine.js.map +1 -0
  95. package/dist/enterprise/templates/index.d.ts +8 -0
  96. package/dist/enterprise/templates/index.d.ts.map +1 -0
  97. package/dist/enterprise/templates/index.js +8 -0
  98. package/dist/enterprise/templates/index.js.map +1 -0
  99. package/dist/enterprise/templates/loader.d.ts +65 -0
  100. package/dist/enterprise/templates/loader.d.ts.map +1 -0
  101. package/dist/enterprise/templates/loader.js +269 -0
  102. package/dist/enterprise/templates/loader.js.map +1 -0
  103. package/dist/enterprise/templates/types.d.ts +212 -0
  104. package/dist/enterprise/templates/types.d.ts.map +1 -0
  105. package/dist/enterprise/templates/types.js +55 -0
  106. package/dist/enterprise/templates/types.js.map +1 -0
  107. package/dist/index.d.ts +1 -0
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.js +2 -0
  110. package/dist/index.js.map +1 -1
  111. package/dist/integrations/notion/client.d.ts +114 -0
  112. package/dist/integrations/notion/client.d.ts.map +1 -0
  113. package/dist/integrations/notion/client.js +413 -0
  114. package/dist/integrations/notion/client.js.map +1 -0
  115. package/dist/integrations/notion/exporter.d.ts +56 -0
  116. package/dist/integrations/notion/exporter.d.ts.map +1 -0
  117. package/dist/integrations/notion/exporter.js +278 -0
  118. package/dist/integrations/notion/exporter.js.map +1 -0
  119. package/dist/integrations/notion/index.d.ts +9 -0
  120. package/dist/integrations/notion/index.d.ts.map +1 -0
  121. package/dist/integrations/notion/index.js +8 -0
  122. package/dist/integrations/notion/index.js.map +1 -0
  123. package/dist/integrations/notion/types.d.ts +276 -0
  124. package/dist/integrations/notion/types.d.ts.map +1 -0
  125. package/dist/integrations/notion/types.js +45 -0
  126. package/dist/integrations/notion/types.js.map +1 -0
  127. package/dist/marketplace/index.d.ts +86 -0
  128. package/dist/marketplace/index.d.ts.map +1 -0
  129. package/dist/marketplace/index.js +112 -0
  130. package/dist/marketplace/index.js.map +1 -0
  131. package/dist/marketplace/manager.d.ts +81 -0
  132. package/dist/marketplace/manager.d.ts.map +1 -0
  133. package/dist/marketplace/manager.js +292 -0
  134. package/dist/marketplace/manager.js.map +1 -0
  135. package/dist/marketplace/packs/fastapi.d.ts +8 -0
  136. package/dist/marketplace/packs/fastapi.d.ts.map +1 -0
  137. package/dist/marketplace/packs/fastapi.js +728 -0
  138. package/dist/marketplace/packs/fastapi.js.map +1 -0
  139. package/dist/marketplace/packs/fintech.d.ts +8 -0
  140. package/dist/marketplace/packs/fintech.d.ts.map +1 -0
  141. package/dist/marketplace/packs/fintech.js +366 -0
  142. package/dist/marketplace/packs/fintech.js.map +1 -0
  143. package/dist/marketplace/packs/gdpr.d.ts +8 -0
  144. package/dist/marketplace/packs/gdpr.d.ts.map +1 -0
  145. package/dist/marketplace/packs/gdpr.js +637 -0
  146. package/dist/marketplace/packs/gdpr.js.map +1 -0
  147. package/dist/marketplace/packs/healthtech.d.ts +8 -0
  148. package/dist/marketplace/packs/healthtech.d.ts.map +1 -0
  149. package/dist/marketplace/packs/healthtech.js +470 -0
  150. package/dist/marketplace/packs/healthtech.js.map +1 -0
  151. package/dist/marketplace/packs/hipaa.d.ts +8 -0
  152. package/dist/marketplace/packs/hipaa.d.ts.map +1 -0
  153. package/dist/marketplace/packs/hipaa.js +473 -0
  154. package/dist/marketplace/packs/hipaa.js.map +1 -0
  155. package/dist/marketplace/packs/index.d.ts +250 -0
  156. package/dist/marketplace/packs/index.d.ts.map +1 -0
  157. package/dist/marketplace/packs/index.js +205 -0
  158. package/dist/marketplace/packs/index.js.map +1 -0
  159. package/dist/marketplace/packs/nextjs.d.ts +8 -0
  160. package/dist/marketplace/packs/nextjs.d.ts.map +1 -0
  161. package/dist/marketplace/packs/nextjs.js +532 -0
  162. package/dist/marketplace/packs/nextjs.js.map +1 -0
  163. package/dist/marketplace/packs/rails.d.ts +8 -0
  164. package/dist/marketplace/packs/rails.d.ts.map +1 -0
  165. package/dist/marketplace/packs/rails.js +866 -0
  166. package/dist/marketplace/packs/rails.js.map +1 -0
  167. package/dist/marketplace/packs/saas.d.ts +8 -0
  168. package/dist/marketplace/packs/saas.d.ts.map +1 -0
  169. package/dist/marketplace/packs/saas.js +516 -0
  170. package/dist/marketplace/packs/saas.js.map +1 -0
  171. package/dist/marketplace/packs/soc2.d.ts +8 -0
  172. package/dist/marketplace/packs/soc2.d.ts.map +1 -0
  173. package/dist/marketplace/packs/soc2.js +455 -0
  174. package/dist/marketplace/packs/soc2.js.map +1 -0
  175. package/dist/marketplace/registry.d.ts +76 -0
  176. package/dist/marketplace/registry.d.ts.map +1 -0
  177. package/dist/marketplace/registry.js +454 -0
  178. package/dist/marketplace/registry.js.map +1 -0
  179. package/dist/marketplace/types.d.ts +202 -0
  180. package/dist/marketplace/types.d.ts.map +1 -0
  181. package/dist/marketplace/types.js +61 -0
  182. package/dist/marketplace/types.js.map +1 -0
  183. package/dist/mcp/index.js +1 -1
  184. package/dist/plugins/builtin/html-formatter.d.ts +11 -0
  185. package/dist/plugins/builtin/html-formatter.d.ts.map +1 -0
  186. package/dist/plugins/builtin/html-formatter.js +214 -0
  187. package/dist/plugins/builtin/html-formatter.js.map +1 -0
  188. package/dist/plugins/builtin/index.d.ts +21 -0
  189. package/dist/plugins/builtin/index.d.ts.map +1 -0
  190. package/dist/plugins/builtin/index.js +31 -0
  191. package/dist/plugins/builtin/index.js.map +1 -0
  192. package/dist/plugins/builtin/markdown-formatter.d.ts +11 -0
  193. package/dist/plugins/builtin/markdown-formatter.d.ts.map +1 -0
  194. package/dist/plugins/builtin/markdown-formatter.js +77 -0
  195. package/dist/plugins/builtin/markdown-formatter.js.map +1 -0
  196. package/dist/plugins/builtin/quality-validator.d.ts +11 -0
  197. package/dist/plugins/builtin/quality-validator.d.ts.map +1 -0
  198. package/dist/plugins/builtin/quality-validator.js +355 -0
  199. package/dist/plugins/builtin/quality-validator.js.map +1 -0
  200. package/dist/plugins/index.d.ts +98 -0
  201. package/dist/plugins/index.d.ts.map +1 -0
  202. package/dist/plugins/index.js +187 -0
  203. package/dist/plugins/index.js.map +1 -0
  204. package/dist/plugins/manager.d.ts +122 -0
  205. package/dist/plugins/manager.d.ts.map +1 -0
  206. package/dist/plugins/manager.js +349 -0
  207. package/dist/plugins/manager.js.map +1 -0
  208. package/dist/plugins/types.d.ts +348 -0
  209. package/dist/plugins/types.d.ts.map +1 -0
  210. package/dist/plugins/types.js +13 -0
  211. package/dist/plugins/types.js.map +1 -0
  212. package/package.json +5 -4
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ const program = new Command();
12
12
  program
13
13
  .name('blueprint')
14
14
  .description('Intent Blueprint - Enterprise AI Documentation Generator')
15
- .version('2.5.0');
15
+ .version('2.7.0');
16
16
  // Init command
17
17
  program
18
18
  .command('init')
@@ -292,19 +292,21 @@ program
292
292
  }
293
293
  console.log(chalk.dim(`\nTotal: ${templates.length} templates`));
294
294
  });
295
- // Export command - GitHub, Linear, and Jira integration
295
+ // Export command - GitHub, Linear, Jira, and Notion integration
296
296
  program
297
297
  .command('export <target>')
298
- .description('Export to GitHub, Linear, or Jira (issues, milestones, sprints)')
298
+ .description('Export to GitHub, Linear, Jira, or Notion')
299
299
  .option('-p, --project <name>', 'Project name')
300
300
  .option('-d, --docs <dir>', 'Generated docs directory')
301
- .option('-t, --token <token>', 'API token (or use GITHUB_TOKEN / LINEAR_API_KEY / JIRA_API_TOKEN env)')
301
+ .option('-t, --token <token>', 'API token (or use GITHUB_TOKEN / LINEAR_API_KEY / JIRA_API_TOKEN / NOTION_API_KEY env)')
302
302
  .option('-o, --owner <owner>', 'Repository owner (GitHub)')
303
303
  .option('-r, --repo <repo>', 'Repository name (GitHub)')
304
304
  .option('--team <id>', 'Linear team ID')
305
305
  .option('--base-url <url>', 'Jira instance URL (e.g., https://your-domain.atlassian.net)')
306
306
  .option('--email <email>', 'Jira user email')
307
307
  .option('--project-key <key>', 'Jira project key')
308
+ .option('--page-id <id>', 'Notion parent page ID')
309
+ .option('--database-id <id>', 'Notion database ID')
308
310
  .option('--dry-run', 'Preview what would be exported without making changes')
309
311
  .option('--no-issues', 'Skip creating issues')
310
312
  .option('--no-milestones', 'Skip creating milestones/cycles/sprints')
@@ -313,10 +315,11 @@ program
313
315
  .option('--create-project', 'Create a new project in Linear')
314
316
  .option('--create-epic', 'Create an Epic in Jira')
315
317
  .option('--create-versions', 'Create versions/releases in Jira')
318
+ .option('--create-database', 'Create a Notion database for documents')
316
319
  .action(async (target, options) => {
317
- if (target !== 'github' && target !== 'linear' && target !== 'jira') {
320
+ if (target !== 'github' && target !== 'linear' && target !== 'jira' && target !== 'notion') {
318
321
  console.log(chalk.yellow(`\n⚠️ Export to ${target} not supported.\n`));
319
- console.log(chalk.dim('Currently supported: github, linear, jira'));
322
+ console.log(chalk.dim('Currently supported: github, linear, jira, notion'));
320
323
  return;
321
324
  }
322
325
  // Handle Linear export
@@ -329,6 +332,11 @@ program
329
332
  await handleJiraExport(options);
330
333
  return;
331
334
  }
335
+ // Handle Notion export
336
+ if (target === 'notion') {
337
+ await handleNotionExport(options);
338
+ return;
339
+ }
332
340
  console.log(chalk.blue('\n🚀 Intent Blueprint - GitHub Export\n'));
333
341
  const { GitHubExporter } = await import('./integrations/github/index.js');
334
342
  // Get GitHub config
@@ -511,6 +519,364 @@ program
511
519
  .action(() => {
512
520
  console.log(chalk.yellow('\n⚠️ Sync feature coming soon!\n'));
513
521
  });
522
+ // Enterprise: API Server command
523
+ program
524
+ .command('serve')
525
+ .description('Start the Blueprint REST API server')
526
+ .option('-p, --port <port>', 'Port to listen on', '3456')
527
+ .option('-h, --host <host>', 'Host to bind to', 'localhost')
528
+ .option('-k, --api-key <key>', 'API key for authentication')
529
+ .option('--no-cors', 'Disable CORS')
530
+ .option('-t, --templates <dir>', 'Custom templates directory')
531
+ .action(async (options) => {
532
+ console.log(chalk.blue('\n🚀 Intent Blueprint - API Server\n'));
533
+ const { ApiServer } = await import('./enterprise/api/index.js');
534
+ const { TemplateLoader } = await import('./enterprise/templates/index.js');
535
+ const server = new ApiServer({
536
+ port: parseInt(options.port),
537
+ host: options.host,
538
+ apiKey: options.apiKey,
539
+ cors: options.cors !== false,
540
+ logging: true,
541
+ });
542
+ // Load custom templates if specified
543
+ if (options.templates) {
544
+ const { existsSync } = await import('fs');
545
+ if (existsSync(options.templates)) {
546
+ const loader = new TemplateLoader(options.templates);
547
+ try {
548
+ const templates = loader.loadDirectory(options.templates);
549
+ server.loadTemplates(templates);
550
+ console.log(chalk.dim(`Loaded ${templates.length} custom templates\n`));
551
+ }
552
+ catch (error) {
553
+ console.log(chalk.yellow(`Warning: Failed to load templates from ${options.templates}`));
554
+ }
555
+ }
556
+ }
557
+ try {
558
+ await server.start();
559
+ console.log(chalk.dim('Press Ctrl+C to stop\n'));
560
+ // Handle shutdown
561
+ process.on('SIGINT', async () => {
562
+ console.log(chalk.dim('\nShutting down...'));
563
+ await server.stop();
564
+ process.exit(0);
565
+ });
566
+ }
567
+ catch (error) {
568
+ console.log(chalk.red('Failed to start server'));
569
+ console.error(error);
570
+ process.exit(1);
571
+ }
572
+ });
573
+ // Enterprise: Template management
574
+ program
575
+ .command('template <action>')
576
+ .description('Manage custom templates (list, create, validate, export)')
577
+ .option('-i, --id <id>', 'Template ID')
578
+ .option('-n, --name <name>', 'Template name')
579
+ .option('-f, --file <path>', 'Template file path')
580
+ .option('-o, --output <path>', 'Output file path')
581
+ .action(async (action, options) => {
582
+ const { TemplateLoader, TemplateEngine } = await import('./enterprise/templates/index.js');
583
+ const loader = new TemplateLoader();
584
+ switch (action) {
585
+ case 'list': {
586
+ console.log(chalk.blue('\n📋 Custom Templates\n'));
587
+ const { existsSync, readdirSync } = await import('fs');
588
+ const templatesDir = './templates';
589
+ if (!existsSync(templatesDir)) {
590
+ console.log(chalk.dim('No custom templates directory found.'));
591
+ console.log(chalk.dim('Create templates in ./templates/ directory.'));
592
+ return;
593
+ }
594
+ try {
595
+ const templates = loader.loadDirectory(templatesDir);
596
+ if (templates.length === 0) {
597
+ console.log(chalk.dim('No templates found.'));
598
+ return;
599
+ }
600
+ for (const t of templates) {
601
+ console.log(` ${chalk.cyan(t.meta.id.padEnd(25))} ${t.meta.name}`);
602
+ console.log(chalk.dim(` ${t.meta.description}`));
603
+ }
604
+ console.log(chalk.dim(`\nTotal: ${templates.length} templates`));
605
+ }
606
+ catch (error) {
607
+ console.log(chalk.red('Failed to load templates'));
608
+ console.error(error);
609
+ }
610
+ break;
611
+ }
612
+ case 'create': {
613
+ console.log(chalk.blue('\n✨ Create Custom Template\n'));
614
+ const id = options.id || 'custom-template';
615
+ const name = options.name || 'Custom Template';
616
+ const template = TemplateLoader.createBlankTemplate(id, name);
617
+ const yaml = TemplateLoader.toYaml(template);
618
+ if (options.output) {
619
+ const { writeFileSync, mkdirSync, existsSync } = await import('fs');
620
+ const { dirname } = await import('path');
621
+ const dir = dirname(options.output);
622
+ if (!existsSync(dir)) {
623
+ mkdirSync(dir, { recursive: true });
624
+ }
625
+ writeFileSync(options.output, yaml);
626
+ console.log(chalk.green(`Created: ${options.output}`));
627
+ }
628
+ else {
629
+ console.log(yaml);
630
+ }
631
+ break;
632
+ }
633
+ case 'validate': {
634
+ console.log(chalk.blue('\n✅ Validate Template\n'));
635
+ if (!options.file) {
636
+ console.log(chalk.red('Error: --file required'));
637
+ return;
638
+ }
639
+ try {
640
+ const template = loader.loadFile(options.file);
641
+ console.log(chalk.green('Template is valid!'));
642
+ console.log(` ID: ${template.meta.id}`);
643
+ console.log(` Name: ${template.meta.name}`);
644
+ console.log(` Variables: ${template.variables.length}`);
645
+ console.log(` Sections: ${template.sections.length}`);
646
+ }
647
+ catch (error) {
648
+ console.log(chalk.red('Template validation failed:'));
649
+ console.error(error);
650
+ }
651
+ break;
652
+ }
653
+ case 'export': {
654
+ console.log(chalk.blue('\n📤 Export Template to YAML\n'));
655
+ if (!options.file && !options.id) {
656
+ console.log(chalk.red('Error: --file or --id required'));
657
+ return;
658
+ }
659
+ try {
660
+ const template = options.file
661
+ ? loader.loadFile(options.file)
662
+ : TemplateLoader.createBlankTemplate(options.id, options.name || options.id);
663
+ const yaml = TemplateLoader.toYaml(template);
664
+ if (options.output) {
665
+ const { writeFileSync } = await import('fs');
666
+ writeFileSync(options.output, yaml);
667
+ console.log(chalk.green(`Exported to: ${options.output}`));
668
+ }
669
+ else {
670
+ console.log(yaml);
671
+ }
672
+ }
673
+ catch (error) {
674
+ console.log(chalk.red('Export failed:'));
675
+ console.error(error);
676
+ }
677
+ break;
678
+ }
679
+ default:
680
+ console.log(chalk.yellow(`Unknown action: ${action}`));
681
+ console.log(chalk.dim('Available actions: list, create, validate, export'));
682
+ }
683
+ });
684
+ // Enterprise: Team management
685
+ program
686
+ .command('team <action>')
687
+ .description('Manage team configuration (init, members, libraries)')
688
+ .option('-i, --id <id>', 'Team or member ID')
689
+ .option('-n, --name <name>', 'Name')
690
+ .option('-e, --email <email>', 'Email')
691
+ .option('-r, --role <role>', 'Role: owner, admin, member, viewer')
692
+ .action(async (action, options) => {
693
+ const { TeamConfigManager } = await import('./enterprise/team/index.js');
694
+ const manager = new TeamConfigManager();
695
+ switch (action) {
696
+ case 'init': {
697
+ console.log(chalk.blue('\n🏢 Initialize Team Configuration\n'));
698
+ const id = options.id || 'my-team';
699
+ const name = options.name || 'My Team';
700
+ const config = manager.init(id, name);
701
+ console.log(chalk.green('Team configuration created!'));
702
+ console.log(` ID: ${config.id}`);
703
+ console.log(` Name: ${config.name}`);
704
+ console.log(` Config: ${manager.getConfigPath()}`);
705
+ break;
706
+ }
707
+ case 'info': {
708
+ console.log(chalk.blue('\n🏢 Team Information\n'));
709
+ const config = manager.get();
710
+ if (!config) {
711
+ console.log(chalk.dim('No team configuration found.'));
712
+ console.log(chalk.dim('Run: blueprint team init'));
713
+ return;
714
+ }
715
+ console.log(` ID: ${config.id}`);
716
+ console.log(` Name: ${config.name}`);
717
+ console.log(` Members: ${config.members?.length || 0}`);
718
+ console.log(` Libraries: ${config.libraries?.length || 0}`);
719
+ console.log(` Audit: ${config.audit?.enabled ? 'enabled' : 'disabled'}`);
720
+ break;
721
+ }
722
+ case 'add-member': {
723
+ console.log(chalk.blue('\n👤 Add Team Member\n'));
724
+ if (!options.id || !options.name) {
725
+ console.log(chalk.red('Error: --id and --name required'));
726
+ return;
727
+ }
728
+ try {
729
+ manager.addMember({
730
+ id: options.id,
731
+ name: options.name,
732
+ email: options.email,
733
+ role: options.role || 'member',
734
+ });
735
+ console.log(chalk.green(`Added member: ${options.name}`));
736
+ }
737
+ catch (error) {
738
+ console.log(chalk.red('Failed to add member:'));
739
+ console.error(error);
740
+ }
741
+ break;
742
+ }
743
+ case 'remove-member': {
744
+ console.log(chalk.blue('\n👤 Remove Team Member\n'));
745
+ if (!options.id) {
746
+ console.log(chalk.red('Error: --id required'));
747
+ return;
748
+ }
749
+ const removed = manager.removeMember(options.id);
750
+ if (removed) {
751
+ console.log(chalk.green(`Removed member: ${options.id}`));
752
+ }
753
+ else {
754
+ console.log(chalk.yellow(`Member not found: ${options.id}`));
755
+ }
756
+ break;
757
+ }
758
+ case 'list-members': {
759
+ console.log(chalk.blue('\n👥 Team Members\n'));
760
+ const members = manager.listMembers();
761
+ if (members.length === 0) {
762
+ console.log(chalk.dim('No team members.'));
763
+ return;
764
+ }
765
+ for (const m of members) {
766
+ console.log(` ${chalk.cyan(m.id.padEnd(20))} ${m.name} (${m.role})`);
767
+ if (m.email)
768
+ console.log(chalk.dim(` ${m.email}`));
769
+ }
770
+ break;
771
+ }
772
+ case 'audit': {
773
+ console.log(chalk.blue('\n📊 Audit Log\n'));
774
+ const { AuditTrail } = await import('./enterprise/team/index.js');
775
+ const config = manager.get();
776
+ const audit = config
777
+ ? AuditTrail.fromTeamConfig(config)
778
+ : new AuditTrail();
779
+ const stats = audit.getStats();
780
+ console.log(` Total generations: ${stats.totalGenerations}`);
781
+ console.log(` Successful: ${stats.successfulGenerations}`);
782
+ console.log(` Failed: ${stats.failedGenerations}`);
783
+ console.log(` Avg duration: ${Math.round(stats.averageDuration)}ms`);
784
+ if (stats.recentActivity.length > 0) {
785
+ console.log(chalk.yellow('\nRecent activity:'));
786
+ for (const entry of stats.recentActivity.slice(0, 5)) {
787
+ console.log(` ${chalk.dim(entry.timestamp)} ${entry.action} ${entry.template}`);
788
+ }
789
+ }
790
+ break;
791
+ }
792
+ default:
793
+ console.log(chalk.yellow(`Unknown action: ${action}`));
794
+ console.log(chalk.dim('Available actions: init, info, add-member, remove-member, list-members, audit'));
795
+ }
796
+ });
797
+ // Enterprise: Model configuration
798
+ program
799
+ .command('model <action>')
800
+ .description('Configure AI models (list, use, test)')
801
+ .option('-p, --provider <provider>', 'Provider: claude, openai, gemini, ollama')
802
+ .option('-m, --model <model>', 'Model ID or alias')
803
+ .option('-k, --key <key>', 'API key')
804
+ .option('--prompt <prompt>', 'Test prompt')
805
+ .action(async (action, options) => {
806
+ const { ModelRegistry } = await import('./enterprise/models/index.js');
807
+ switch (action) {
808
+ case 'list': {
809
+ console.log(chalk.blue('\n🤖 Available Models\n'));
810
+ const registry = new ModelRegistry();
811
+ const providers = registry.listProviders();
812
+ for (const p of providers) {
813
+ const status = p.configured ? chalk.green('✓') : chalk.red('✗');
814
+ console.log(` ${status} ${chalk.cyan(p.name.padEnd(10))} ${p.configured ? 'configured' : 'not configured'}`);
815
+ }
816
+ console.log(chalk.dim('\nSet API keys via environment variables:'));
817
+ console.log(chalk.dim(' ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY'));
818
+ break;
819
+ }
820
+ case 'test': {
821
+ console.log(chalk.blue('\n🧪 Test Model\n'));
822
+ const provider = options.provider || 'claude';
823
+ const prompt = options.prompt || 'Say hello in one sentence.';
824
+ const registry = new ModelRegistry();
825
+ const providerInstance = registry.getProvider(provider);
826
+ if (!providerInstance) {
827
+ console.log(chalk.red(`Unknown provider: ${provider}`));
828
+ return;
829
+ }
830
+ if (!providerInstance.isConfigured()) {
831
+ console.log(chalk.red(`Provider ${provider} is not configured.`));
832
+ console.log(chalk.dim('Set the appropriate API key environment variable.'));
833
+ return;
834
+ }
835
+ const spinner = ora(`Testing ${provider}...`).start();
836
+ try {
837
+ const response = await registry.complete({
838
+ messages: [{ role: 'user', content: prompt }],
839
+ maxTokens: 100,
840
+ }, provider);
841
+ spinner.succeed(chalk.green('Model responded!'));
842
+ console.log(`\n${chalk.cyan('Response:')} ${response.content}`);
843
+ if (response.usage) {
844
+ console.log(chalk.dim(`\nTokens: ${response.usage.promptTokens} in, ${response.usage.completionTokens} out`));
845
+ }
846
+ }
847
+ catch (error) {
848
+ spinner.fail(chalk.red('Test failed'));
849
+ console.error(error);
850
+ }
851
+ break;
852
+ }
853
+ case 'info': {
854
+ console.log(chalk.blue('\n📋 Model Information\n'));
855
+ const modelId = options.model || 'claude';
856
+ const registry = new ModelRegistry();
857
+ const { provider, model } = registry.resolveAlias(modelId);
858
+ console.log(` Alias: ${modelId}`);
859
+ console.log(` Provider: ${provider}`);
860
+ console.log(` Model: ${model}`);
861
+ const info = await registry.getModelInfo(model);
862
+ if (info) {
863
+ if (info.contextWindow)
864
+ console.log(` Context: ${info.contextWindow.toLocaleString()} tokens`);
865
+ if (info.maxOutput)
866
+ console.log(` Max output: ${info.maxOutput.toLocaleString()} tokens`);
867
+ if (info.capabilities)
868
+ console.log(` Capabilities: ${info.capabilities.join(', ')}`);
869
+ if (info.pricing) {
870
+ console.log(` Pricing: $${info.pricing.input}/M in, $${info.pricing.output}/M out`);
871
+ }
872
+ }
873
+ break;
874
+ }
875
+ default:
876
+ console.log(chalk.yellow(`Unknown action: ${action}`));
877
+ console.log(chalk.dim('Available actions: list, test, info'));
878
+ }
879
+ });
514
880
  /**
515
881
  * Handle Linear export
516
882
  */
@@ -849,5 +1215,194 @@ async function handleJiraExport(options) {
849
1215
  process.exit(1);
850
1216
  }
851
1217
  }
1218
+ /**
1219
+ * Handle Notion export
1220
+ */
1221
+ async function handleNotionExport(options) {
1222
+ console.log(chalk.blue('\n📝 Intent Blueprint - Notion Export\n'));
1223
+ const { NotionExporter, NotionClient } = await import('./integrations/notion/index.js');
1224
+ // Get Notion API key
1225
+ const apiKey = options.token || process.env.NOTION_API_KEY;
1226
+ if (!apiKey) {
1227
+ console.log(chalk.red('Error: Notion API key required'));
1228
+ console.log(chalk.dim('Use --token or set NOTION_API_KEY environment variable'));
1229
+ console.log(chalk.dim('Get your integration token from: https://www.notion.so/my-integrations'));
1230
+ process.exit(1);
1231
+ }
1232
+ let parentPageId = options.pageId;
1233
+ let databaseId = options.databaseId;
1234
+ // Verify connection
1235
+ try {
1236
+ const tempClient = new NotionClient({ apiKey });
1237
+ await tempClient.verify();
1238
+ console.log(chalk.dim('Connected to Notion\n'));
1239
+ }
1240
+ catch (error) {
1241
+ console.log(chalk.red('Error: Could not connect to Notion. Check your API key.'));
1242
+ console.error(error);
1243
+ process.exit(1);
1244
+ }
1245
+ // If no parent page or database specified, try to list available pages
1246
+ if (!parentPageId && !databaseId) {
1247
+ console.log(chalk.dim('No parent page or database specified. Searching for accessible pages...\n'));
1248
+ const tempClient = new NotionClient({ apiKey });
1249
+ try {
1250
+ const pages = await tempClient.listPages();
1251
+ const databases = await tempClient.listDatabases();
1252
+ if (pages.length === 0 && databases.length === 0) {
1253
+ console.log(chalk.red('Error: No pages or databases accessible to this integration.'));
1254
+ console.log(chalk.dim('Make sure you\'ve shared a page with your integration in Notion.'));
1255
+ process.exit(1);
1256
+ }
1257
+ // Let user choose
1258
+ const choices = [];
1259
+ for (const page of pages.slice(0, 10)) {
1260
+ const title = page.properties.title?.title?.[0]?.plain_text || 'Untitled';
1261
+ choices.push({ name: `📄 ${title} (page)`, value: { type: 'page', id: page.id } });
1262
+ }
1263
+ for (const db of databases.slice(0, 10)) {
1264
+ const title = db.title?.[0]?.plain_text || 'Untitled';
1265
+ choices.push({ name: `🗃️ ${title} (database)`, value: { type: 'database', id: db.id } });
1266
+ }
1267
+ const answer = await inquirer.prompt([
1268
+ {
1269
+ type: 'list',
1270
+ name: 'target',
1271
+ message: 'Select where to export documents:',
1272
+ choices,
1273
+ },
1274
+ ]);
1275
+ if (answer.target.type === 'page') {
1276
+ parentPageId = answer.target.id;
1277
+ }
1278
+ else {
1279
+ databaseId = answer.target.id;
1280
+ }
1281
+ }
1282
+ catch (error) {
1283
+ console.log(chalk.red('Error: Could not list pages/databases.'));
1284
+ console.error(error);
1285
+ process.exit(1);
1286
+ }
1287
+ }
1288
+ // Read generated docs
1289
+ const docsDir = options.docs || './docs';
1290
+ const { readdirSync, readFileSync, existsSync } = await import('fs');
1291
+ const { join } = await import('path');
1292
+ if (!existsSync(docsDir)) {
1293
+ console.log(chalk.red(`Error: Docs directory not found: ${docsDir}`));
1294
+ console.log(chalk.dim('Generate docs first with: blueprint generate'));
1295
+ process.exit(1);
1296
+ }
1297
+ // Find project folder
1298
+ const projects = readdirSync(docsDir).filter((f) => {
1299
+ const path = join(docsDir, f);
1300
+ return existsSync(path) && readdirSync(path).some((file) => file.endsWith('.md'));
1301
+ });
1302
+ if (projects.length === 0) {
1303
+ console.log(chalk.red('Error: No documentation projects found'));
1304
+ process.exit(1);
1305
+ }
1306
+ let projectDir = projects[0];
1307
+ if (projects.length > 1 && !options.project) {
1308
+ const answer = await inquirer.prompt([
1309
+ {
1310
+ type: 'list',
1311
+ name: 'project',
1312
+ message: 'Select project:',
1313
+ choices: projects,
1314
+ },
1315
+ ]);
1316
+ projectDir = answer.project;
1317
+ }
1318
+ else if (options.project) {
1319
+ projectDir = options.project;
1320
+ }
1321
+ const projectPath = join(docsDir, projectDir);
1322
+ const files = readdirSync(projectPath).filter((f) => f.endsWith('.md'));
1323
+ const documents = files.map((f) => ({
1324
+ name: f.replace('.md', '').replace(/-/g, ' '),
1325
+ content: readFileSync(join(projectPath, f), 'utf-8'),
1326
+ }));
1327
+ console.log(`Found ${documents.length} documents in ${projectDir}\n`);
1328
+ const exporter = new NotionExporter({
1329
+ apiKey,
1330
+ parentPageId,
1331
+ databaseId,
1332
+ });
1333
+ if (options.dryRun) {
1334
+ console.log(chalk.yellow('Dry run - showing what would be created:\n'));
1335
+ const preview = await exporter.preview(documents, {
1336
+ createDatabase: options.createDatabase,
1337
+ databaseTitle: projectDir,
1338
+ parentPageId,
1339
+ addCategory: true,
1340
+ addStatus: true,
1341
+ convertContent: true,
1342
+ dryRun: true,
1343
+ });
1344
+ if (preview.database) {
1345
+ console.log(chalk.cyan('Database:'), preview.database.title[0]?.text?.content || 'Blueprint Documents');
1346
+ }
1347
+ console.log(chalk.cyan('Pages:'), preview.pages.length);
1348
+ if (preview.pages.length > 0) {
1349
+ console.log(chalk.dim('\nSample pages:'));
1350
+ for (const page of preview.pages.slice(0, 5)) {
1351
+ const title = page.properties.Name?.title?.[0]?.text?.content || 'Untitled';
1352
+ console.log(` ${chalk.dim('•')} ${title}`);
1353
+ }
1354
+ if (preview.pages.length > 5) {
1355
+ console.log(chalk.dim(` ... and ${preview.pages.length - 5} more`));
1356
+ }
1357
+ }
1358
+ return;
1359
+ }
1360
+ const spinner = ora('Exporting to Notion...').start();
1361
+ try {
1362
+ const result = await exporter.export(documents, {
1363
+ createDatabase: options.createDatabase,
1364
+ databaseTitle: projectDir,
1365
+ parentPageId,
1366
+ addCategory: true,
1367
+ addStatus: true,
1368
+ convertContent: true,
1369
+ dryRun: false,
1370
+ });
1371
+ if (result.errors.length === 0) {
1372
+ spinner.succeed(chalk.green('Export complete!'));
1373
+ if (result.database) {
1374
+ console.log(`\n Database created: ${result.database.title[0]?.text?.content || 'Blueprint Documents'}`);
1375
+ console.log(chalk.dim(` ${result.database.url}`));
1376
+ }
1377
+ console.log(` Pages created: ${result.pages.length}`);
1378
+ if (result.pages.length > 0) {
1379
+ console.log(chalk.cyan('\nCreated pages:'));
1380
+ for (const page of result.pages.slice(0, 5)) {
1381
+ const title = page.properties.Name?.title?.[0]?.text?.content ||
1382
+ page.properties.title?.title?.[0]?.text?.content ||
1383
+ 'Untitled';
1384
+ console.log(` ${title}`);
1385
+ console.log(chalk.dim(` ${page.url}`));
1386
+ }
1387
+ if (result.pages.length > 5) {
1388
+ console.log(chalk.dim(` ... and ${result.pages.length - 5} more`));
1389
+ }
1390
+ }
1391
+ }
1392
+ else {
1393
+ spinner.fail(chalk.red('Export completed with errors'));
1394
+ console.log(`\n Pages created: ${result.pages.length}`);
1395
+ console.log(chalk.red('\nErrors:'));
1396
+ for (const error of result.errors) {
1397
+ console.log(chalk.red(` ${error}`));
1398
+ }
1399
+ }
1400
+ }
1401
+ catch (error) {
1402
+ spinner.fail(chalk.red('Export failed'));
1403
+ console.error(error);
1404
+ process.exit(1);
1405
+ }
1406
+ }
852
1407
  program.parse();
853
1408
  //# sourceMappingURL=cli.js.map