@synapsync/cli 0.1.7 → 0.1.10

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.
package/dist/index.js CHANGED
@@ -23,12 +23,14 @@ var version_exports = {};
23
23
  __export(version_exports, {
24
24
  version: () => version
25
25
  });
26
- var version;
26
+ import { createRequire } from "module";
27
+ var require2, version;
27
28
  var init_version = __esm({
28
29
  "src/version.ts"() {
29
30
  "use strict";
30
31
  init_esm_shims();
31
- version = "0.1.7";
32
+ require2 = createRequire(import.meta.url);
33
+ version = require2("../package.json").version;
32
34
  }
33
35
  });
34
36
 
@@ -146,8 +148,13 @@ var REGISTRY_MANIFEST_FILE = "manifest.json";
146
148
 
147
149
  // src/ui/repl.ts
148
150
  init_esm_shims();
149
- import * as readline from "readline";
150
- import pc17 from "picocolors";
151
+
152
+ // src/ui/repl/index.ts
153
+ init_esm_shims();
154
+
155
+ // src/ui/repl/help.ts
156
+ init_esm_shims();
157
+ import pc3 from "picocolors";
151
158
 
152
159
  // src/ui/banner.ts
153
160
  init_esm_shims();
@@ -339,7 +346,7 @@ function showBanner() {
339
346
  logger.line();
340
347
  logger.command("synapsync init", "Initialize a new project");
341
348
  logger.command("synapsync connect", "Connect to AI providers");
342
- logger.command("synapsync search", "Search registry for assets");
349
+ logger.command("synapsync list --remote", "Browse registry for cognitives");
343
350
  logger.command("synapsync add <name>", "Add skill, agent, or prompt");
344
351
  logger.command("synapsync sync", "Sync assets to providers");
345
352
  logger.line();
@@ -353,9 +360,124 @@ function showInfo(message) {
353
360
  logger.info(message);
354
361
  }
355
362
 
363
+ // src/ui/repl/registry.ts
364
+ init_esm_shims();
365
+ var COMMANDS = {};
366
+ function registerInteractiveCommand(name, description, handler, options) {
367
+ const def = { description, handler };
368
+ if (options?.usage !== void 0) def.usage = options.usage;
369
+ if (options?.options !== void 0) def.options = options.options;
370
+ if (options?.examples !== void 0) def.examples = options.examples;
371
+ COMMANDS[name] = def;
372
+ }
373
+
374
+ // src/ui/repl/help.ts
375
+ function showCommandHelp(commandName) {
376
+ const cmd = COMMANDS[commandName];
377
+ if (!cmd) {
378
+ showError(`Unknown command: /${commandName}`);
379
+ return;
380
+ }
381
+ logger.line();
382
+ logger.log(pc3.bold(pc3.cyan(` /${commandName}`)) + pc3.dim(` - ${cmd.description}`));
383
+ logger.line();
384
+ if (cmd.usage) {
385
+ logger.log(pc3.bold(" Usage:"));
386
+ logger.log(` ${pc3.cyan(cmd.usage)}`);
387
+ logger.line();
388
+ }
389
+ if (cmd.options && cmd.options.length > 0) {
390
+ logger.log(pc3.bold(" Options:"));
391
+ for (const opt of cmd.options) {
392
+ logger.log(` ${pc3.yellow(opt.flag.padEnd(16))} ${pc3.dim(opt.description)}`);
393
+ }
394
+ logger.line();
395
+ }
396
+ if (cmd.examples && cmd.examples.length > 0) {
397
+ logger.log(pc3.bold(" Examples:"));
398
+ for (const example of cmd.examples) {
399
+ logger.log(` ${pc3.dim("$")} ${pc3.cyan(example)}`);
400
+ }
401
+ logger.line();
402
+ }
403
+ }
404
+ registerInteractiveCommand(
405
+ "help",
406
+ "Show available commands or help for a specific command",
407
+ (args) => {
408
+ const commandName = args.trim().toLowerCase().replace(/^\//, "");
409
+ if (commandName) {
410
+ showCommandHelp(commandName);
411
+ return;
412
+ }
413
+ logger.line();
414
+ logger.bold(" Available Commands:");
415
+ logger.line();
416
+ logger.log(` ${pc3.cyan("/help [command]")} ${pc3.dim("Show help (or help for a command)")}`);
417
+ logger.log(` ${pc3.cyan("/clear")} ${pc3.dim("Clear the screen")}`);
418
+ logger.log(` ${pc3.cyan("/exit")} ${pc3.dim("Exit interactive mode")}`);
419
+ logger.line();
420
+ const categories = {
421
+ Information: ["info", "version"],
422
+ Project: ["init", "config", "status"],
423
+ Providers: ["providers"],
424
+ Cognitives: ["add", "list", "uninstall"],
425
+ Sync: ["sync"],
426
+ Maintenance: ["update", "doctor", "clean", "purge"]
427
+ };
428
+ for (const [category, cmds] of Object.entries(categories)) {
429
+ const availableCmds = cmds.filter((name) => COMMANDS[name]);
430
+ if (availableCmds.length > 0) {
431
+ logger.bold(` ${category}:`);
432
+ for (const name of availableCmds) {
433
+ const cmd = COMMANDS[name];
434
+ const hasOptions = cmd?.options !== void 0 && cmd.options.length > 0;
435
+ const paddedName = `/${name}`.padEnd(18);
436
+ const optionsHint = hasOptions ? pc3.yellow(" [options]") : "";
437
+ logger.log(` ${pc3.cyan(paddedName)} ${pc3.dim(cmd?.description ?? "")}${optionsHint}`);
438
+ }
439
+ logger.line();
440
+ }
441
+ }
442
+ logger.hint("Tip: Use /help <command> for detailed help. Example: /help info");
443
+ logger.line();
444
+ },
445
+ {
446
+ usage: "/help [command]",
447
+ examples: ["/help", "/help info", "/help add"]
448
+ }
449
+ );
450
+
451
+ // src/ui/repl/commands.ts
452
+ init_esm_shims();
453
+ import pc17 from "picocolors";
454
+
455
+ // src/ui/repl/arg-parser.ts
456
+ init_esm_shims();
457
+ function parseArgs(argsString, flagDefs) {
458
+ const parts = argsString.split(/\s+/);
459
+ const positional = [];
460
+ const options = {};
461
+ for (let i = 0; i < parts.length; i++) {
462
+ const part = parts[i];
463
+ if (part === void 0 || part === "") continue;
464
+ const flagDef = flagDefs.find((f) => f.flags.includes(part));
465
+ if (flagDef) {
466
+ if (flagDef.type === "boolean") {
467
+ options[flagDef.key] = true;
468
+ } else {
469
+ options[flagDef.key] = parts[++i] ?? "";
470
+ }
471
+ } else if (!part.startsWith("-")) {
472
+ positional.push(part);
473
+ }
474
+ }
475
+ return { positional, options };
476
+ }
477
+
356
478
  // src/commands/info.ts
357
479
  init_esm_shims();
358
- import pc3 from "picocolors";
480
+ import pc4 from "picocolors";
359
481
  var INFO_TOPICS = {
360
482
  cognitives: {
361
483
  name: "Cognitives",
@@ -390,11 +512,9 @@ var INFO_TOPICS = {
390
512
  };
391
513
  function showCognitivesInfo() {
392
514
  logger.line();
393
- logger.log(pc3.bold(pc3.cyan(" Cognitive Types")));
515
+ logger.log(pc4.bold(pc4.cyan(" Cognitive Types")));
394
516
  logger.line();
395
- logger.dim(
396
- " SynapSync manages multiple types of AI cognitives that can be installed,"
397
- );
517
+ logger.dim(" SynapSync manages multiple types of AI cognitives that can be installed,");
398
518
  logger.dim(" synced across providers, and shared via the registry.");
399
519
  logger.line();
400
520
  const cognitives = [
@@ -402,73 +522,85 @@ function showCognitivesInfo() {
402
522
  type: "skill",
403
523
  file: "SKILL.md",
404
524
  description: "Reusable instruction sets for AI assistants",
405
- color: pc3.blue
525
+ color: pc4.blue
406
526
  },
407
527
  {
408
528
  type: "agent",
409
529
  file: "AGENT.md",
410
530
  description: "Autonomous AI entities with specific behaviors",
411
- color: pc3.yellow
531
+ color: pc4.yellow
412
532
  },
413
533
  {
414
534
  type: "prompt",
415
535
  file: "PROMPT.md",
416
536
  description: "Reusable prompt templates with variables",
417
- color: pc3.magenta
537
+ color: pc4.magenta
418
538
  },
419
539
  {
420
540
  type: "workflow",
421
541
  file: "WORKFLOW.yaml",
422
542
  description: "Multi-step processes combining agents and prompts",
423
- color: pc3.green
543
+ color: pc4.green
424
544
  },
425
545
  {
426
546
  type: "tool",
427
547
  file: "TOOL.md",
428
548
  description: "External integrations and functions",
429
- color: pc3.cyan
549
+ color: pc4.cyan
430
550
  }
431
551
  ];
432
- logger.log(
433
- ` ${pc3.dim("Type")} ${pc3.dim("File")} ${pc3.dim("Description")}`
434
- );
435
- logger.log(pc3.dim(" " + "\u2500".repeat(70)));
552
+ logger.log(` ${pc4.dim("Type")} ${pc4.dim("File")} ${pc4.dim("Description")}`);
553
+ logger.log(pc4.dim(" " + "\u2500".repeat(70)));
436
554
  for (const cognitive of cognitives) {
437
555
  const typeCol = cognitive.color(cognitive.type.padEnd(10));
438
- const fileCol = pc3.white(cognitive.file.padEnd(16));
439
- const descCol = pc3.dim(cognitive.description);
556
+ const fileCol = pc4.white(cognitive.file.padEnd(16));
557
+ const descCol = pc4.dim(cognitive.description);
440
558
  logger.log(` ${typeCol} ${fileCol} ${descCol}`);
441
559
  }
442
560
  logger.line();
443
- logger.log(pc3.bold(" Usage Examples:"));
561
+ logger.log(pc4.bold(" Usage Examples:"));
444
562
  logger.line();
445
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync add")} code-reviewer ${pc3.dim("# Add a skill")}`);
446
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync add")} ci-agent ${pc3.dim("# Add an agent")}`);
447
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync list")} --type agent ${pc3.dim("# List only agents")}`);
448
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync sync")} --type skill ${pc3.dim("# Sync only skills")}`);
563
+ logger.log(
564
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync add")} code-reviewer ${pc4.dim("# Add a skill")}`
565
+ );
566
+ logger.log(
567
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync add")} ci-agent ${pc4.dim("# Add an agent")}`
568
+ );
569
+ logger.log(
570
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync list")} --type agent ${pc4.dim("# List only agents")}`
571
+ );
572
+ logger.log(
573
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync sync")} --type skill ${pc4.dim("# Sync only skills")}`
574
+ );
449
575
  logger.line();
450
- logger.log(pc3.bold(" Storage:"));
576
+ logger.log(pc4.bold(" Storage:"));
451
577
  logger.line();
452
578
  logger.dim(" Cognitives are stored in .synapsync/{type}s/{category}/{name}/");
453
579
  logger.dim(" Example: .synapsync/skills/frontend/react-patterns/SKILL.md");
454
580
  logger.line();
455
- logger.log(pc3.bold(" Type Detection:"));
581
+ logger.log(pc4.bold(" Type Detection:"));
456
582
  logger.line();
457
583
  logger.dim(" When adding, SynapSync detects the cognitive type automatically:");
458
584
  logger.line();
459
- logger.log(` ${pc3.cyan("1.")} ${pc3.white("Flag")} ${pc3.dim("--type skill (explicit, highest priority)")}`);
460
- logger.log(` ${pc3.cyan("2.")} ${pc3.white("Registry")} ${pc3.dim("Metadata from the registry")}`);
461
- logger.log(` ${pc3.cyan("3.")} ${pc3.white("File")} ${pc3.dim("Detects SKILL.md, AGENT.md, etc.")}`);
462
- logger.log(` ${pc3.cyan("4.")} ${pc3.white("Prompt")} ${pc3.dim("Asks you if cannot detect")}`);
585
+ logger.log(
586
+ ` ${pc4.cyan("1.")} ${pc4.white("Flag")} ${pc4.dim("--type skill (explicit, highest priority)")}`
587
+ );
588
+ logger.log(
589
+ ` ${pc4.cyan("2.")} ${pc4.white("Registry")} ${pc4.dim("Metadata from the registry")}`
590
+ );
591
+ logger.log(
592
+ ` ${pc4.cyan("3.")} ${pc4.white("File")} ${pc4.dim("Detects SKILL.md, AGENT.md, etc.")}`
593
+ );
594
+ logger.log(` ${pc4.cyan("4.")} ${pc4.white("Prompt")} ${pc4.dim("Asks you if cannot detect")}`);
463
595
  logger.line();
464
596
  }
465
597
  function showAddInfo() {
466
598
  logger.line();
467
- logger.log(pc3.bold(pc3.cyan(" Installation Sources")));
599
+ logger.log(pc4.bold(pc4.cyan(" Installation Sources")));
468
600
  logger.line();
469
601
  logger.dim(" SynapSync can add cognitives from multiple sources:");
470
602
  logger.line();
471
- logger.log(pc3.bold(" Supported Sources:"));
603
+ logger.log(pc4.bold(" Supported Sources:"));
472
604
  logger.line();
473
605
  const sources = [
474
606
  {
@@ -503,166 +635,222 @@ function showAddInfo() {
503
635
  }
504
636
  ];
505
637
  for (const src of sources) {
506
- logger.log(` ${pc3.green(src.source.padEnd(14))} ${pc3.dim(src.description)}`);
507
- logger.log(` ${" ".repeat(14)} ${pc3.cyan(src.format)}`);
638
+ logger.log(` ${pc4.green(src.source.padEnd(14))} ${pc4.dim(src.description)}`);
639
+ logger.log(` ${" ".repeat(14)} ${pc4.cyan(src.format)}`);
508
640
  logger.line();
509
641
  }
510
- logger.log(pc3.bold(" Type Detection:"));
642
+ logger.log(pc4.bold(" Type Detection:"));
511
643
  logger.line();
512
644
  logger.dim(" SynapSync automatically detects the cognitive type using:");
513
645
  logger.line();
514
- logger.log(` ${pc3.cyan("1.")} ${pc3.white("Explicit flag")} ${pc3.dim("synapsync add code-reviewer --type skill")}`);
515
- logger.log(` ${pc3.cyan("2.")} ${pc3.white("Registry lookup")} ${pc3.dim("Registry provides type metadata")}`);
516
- logger.log(` ${pc3.cyan("3.")} ${pc3.white("File detection")} ${pc3.dim("Scans for SKILL.md, AGENT.md, etc.")}`);
517
- logger.log(` ${pc3.cyan("4.")} ${pc3.white("Interactive")} ${pc3.dim("Prompts you to select if unknown")}`);
646
+ logger.log(
647
+ ` ${pc4.cyan("1.")} ${pc4.white("Explicit flag")} ${pc4.dim("synapsync add code-reviewer --type skill")}`
648
+ );
649
+ logger.log(
650
+ ` ${pc4.cyan("2.")} ${pc4.white("Registry lookup")} ${pc4.dim("Registry provides type metadata")}`
651
+ );
652
+ logger.log(
653
+ ` ${pc4.cyan("3.")} ${pc4.white("File detection")} ${pc4.dim("Scans for SKILL.md, AGENT.md, etc.")}`
654
+ );
655
+ logger.log(
656
+ ` ${pc4.cyan("4.")} ${pc4.white("Interactive")} ${pc4.dim("Prompts you to select if unknown")}`
657
+ );
518
658
  logger.line();
519
- logger.log(pc3.bold(" Version Specification:"));
659
+ logger.log(pc4.bold(" Version Specification:"));
520
660
  logger.line();
521
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync add")} code-reviewer ${pc3.dim("# Latest version")}`);
522
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync add")} code-reviewer@1.2.0 ${pc3.dim("# Specific version")}`);
523
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync add")} code-reviewer@^1.0.0 ${pc3.dim("# Version range")}`);
661
+ logger.log(
662
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync add")} code-reviewer ${pc4.dim("# Latest version")}`
663
+ );
664
+ logger.log(
665
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync add")} code-reviewer@1.2.0 ${pc4.dim("# Specific version")}`
666
+ );
667
+ logger.log(
668
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync add")} code-reviewer@^1.0.0 ${pc4.dim("# Version range")}`
669
+ );
524
670
  logger.line();
525
- logger.log(pc3.bold(" Common Options:"));
671
+ logger.log(pc4.bold(" Common Options:"));
526
672
  logger.line();
527
- logger.log(` ${pc3.yellow("--type <type>")} ${pc3.dim("Explicit cognitive type (skill, agent, prompt, workflow, tool)")}`);
528
- logger.log(` ${pc3.yellow("--category <cat>")} ${pc3.dim("Explicit category (frontend, backend, etc.)")}`);
529
- logger.log(` ${pc3.yellow("--force")} ${pc3.dim("Force reinstall even if exists")}`);
673
+ logger.log(
674
+ ` ${pc4.yellow("--type <type>")} ${pc4.dim("Explicit cognitive type (skill, agent, prompt, workflow, tool)")}`
675
+ );
676
+ logger.log(
677
+ ` ${pc4.yellow("--category <cat>")} ${pc4.dim("Explicit category (frontend, backend, etc.)")}`
678
+ );
679
+ logger.log(` ${pc4.yellow("--force")} ${pc4.dim("Force reinstall even if exists")}`);
530
680
  logger.line();
531
681
  }
532
682
  function showProvidersInfo() {
533
683
  logger.line();
534
- logger.log(pc3.bold(pc3.cyan(" Supported Providers")));
684
+ logger.log(pc4.bold(pc4.cyan(" Supported Providers")));
535
685
  logger.line();
536
686
  logger.dim(" SynapSync can sync your cognitives to multiple AI providers.");
537
687
  logger.dim(" Each provider has its own directory structure for cognitives.");
538
688
  logger.line();
539
689
  const providers = [
540
- { name: "claude", vendor: "Anthropic", path: ".claude/", color: pc3.yellow },
541
- { name: "openai", vendor: "OpenAI", path: ".openai/", color: pc3.green },
542
- { name: "gemini", vendor: "Google", path: ".gemini/", color: pc3.blue },
543
- { name: "cursor", vendor: "Cursor IDE", path: ".cursor/", color: pc3.magenta },
544
- { name: "windsurf", vendor: "Codeium", path: ".windsurf/", color: pc3.cyan },
545
- { name: "copilot", vendor: "GitHub", path: ".github/", color: pc3.white }
690
+ { name: "claude", vendor: "Anthropic", path: ".claude/", color: pc4.yellow },
691
+ { name: "openai", vendor: "OpenAI", path: ".openai/", color: pc4.green },
692
+ { name: "gemini", vendor: "Google", path: ".gemini/", color: pc4.blue },
693
+ { name: "cursor", vendor: "Cursor IDE", path: ".cursor/", color: pc4.magenta },
694
+ { name: "windsurf", vendor: "Codeium", path: ".windsurf/", color: pc4.cyan },
695
+ { name: "copilot", vendor: "GitHub", path: ".github/", color: pc4.white }
546
696
  ];
547
- logger.log(` ${pc3.dim("Provider")} ${pc3.dim("Vendor")} ${pc3.dim("Path")}`);
548
- logger.log(pc3.dim(" " + "\u2500".repeat(45)));
697
+ logger.log(` ${pc4.dim("Provider")} ${pc4.dim("Vendor")} ${pc4.dim("Path")}`);
698
+ logger.log(pc4.dim(" " + "\u2500".repeat(45)));
549
699
  for (const provider of providers) {
550
700
  const nameCol = provider.color(provider.name.padEnd(11));
551
- const vendorCol = pc3.white(provider.vendor.padEnd(12));
552
- const pathCol = pc3.dim(provider.path);
701
+ const vendorCol = pc4.white(provider.vendor.padEnd(12));
702
+ const pathCol = pc4.dim(provider.path);
553
703
  logger.log(` ${nameCol} ${vendorCol} ${pathCol}`);
554
704
  }
555
705
  logger.line();
556
- logger.log(pc3.bold(" Usage:"));
706
+ logger.log(pc4.bold(" Usage:"));
557
707
  logger.line();
558
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync connect")} claude ${pc3.dim("# Connect to Claude")}`);
559
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync providers")} ${pc3.dim("# List connected providers")}`);
560
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync sync")} --provider claude ${pc3.dim("# Sync to specific provider")}`);
708
+ logger.log(
709
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync connect")} claude ${pc4.dim("# Connect to Claude")}`
710
+ );
711
+ logger.log(
712
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync providers")} ${pc4.dim("# List connected providers")}`
713
+ );
714
+ logger.log(
715
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync sync")} --provider claude ${pc4.dim("# Sync to specific provider")}`
716
+ );
561
717
  logger.line();
562
718
  }
563
719
  function showCategoriesInfo() {
564
720
  logger.line();
565
- logger.log(pc3.bold(pc3.cyan(" Cognitive Categories")));
721
+ logger.log(pc4.bold(pc4.cyan(" Cognitive Categories")));
566
722
  logger.line();
567
723
  logger.dim(" Cognitives are organized by category for better management.");
568
724
  logger.dim(" Categories help group related cognitives together.");
569
725
  logger.line();
570
726
  const categories = [
571
- { name: "frontend", description: "UI, components, styling, React, Vue, etc.", color: pc3.yellow },
572
- { name: "backend", description: "APIs, servers, authentication, databases", color: pc3.blue },
573
- { name: "database", description: "Queries, schemas, migrations, optimization", color: pc3.yellow },
574
- { name: "devops", description: "CI/CD, Docker, Kubernetes, infrastructure", color: pc3.magenta },
575
- { name: "security", description: "Audits, vulnerabilities, authentication", color: pc3.red },
576
- { name: "testing", description: "Unit tests, E2E, test generation", color: pc3.green },
577
- { name: "analytics", description: "Metrics, tracking, data analysis", color: pc3.cyan },
578
- { name: "automation", description: "Scripts, workflows, task automation", color: pc3.green },
579
- { name: "general", description: "General purpose, code review, docs", color: pc3.white },
580
- { name: "integrations", description: "External services (Supabase, Stripe, etc.)", color: pc3.blue },
581
- { name: "planning", description: "Project planning, SDLC, requirements, architecture", color: pc3.magenta }
727
+ {
728
+ name: "frontend",
729
+ description: "UI, components, styling, React, Vue, etc.",
730
+ color: pc4.yellow
731
+ },
732
+ { name: "backend", description: "APIs, servers, authentication, databases", color: pc4.blue },
733
+ {
734
+ name: "database",
735
+ description: "Queries, schemas, migrations, optimization",
736
+ color: pc4.yellow
737
+ },
738
+ { name: "devops", description: "CI/CD, Docker, Kubernetes, infrastructure", color: pc4.magenta },
739
+ { name: "security", description: "Audits, vulnerabilities, authentication", color: pc4.red },
740
+ { name: "testing", description: "Unit tests, E2E, test generation", color: pc4.green },
741
+ { name: "analytics", description: "Metrics, tracking, data analysis", color: pc4.cyan },
742
+ { name: "automation", description: "Scripts, workflows, task automation", color: pc4.green },
743
+ { name: "general", description: "General purpose, code review, docs", color: pc4.white },
744
+ {
745
+ name: "integrations",
746
+ description: "External services (Supabase, Stripe, etc.)",
747
+ color: pc4.blue
748
+ },
749
+ {
750
+ name: "planning",
751
+ description: "Project planning, SDLC, requirements, architecture",
752
+ color: pc4.magenta
753
+ }
582
754
  ];
583
- logger.log(` ${pc3.dim("Category")} ${pc3.dim("Description")}`);
584
- logger.log(pc3.dim(" " + "\u2500".repeat(55)));
755
+ logger.log(` ${pc4.dim("Category")} ${pc4.dim("Description")}`);
756
+ logger.log(pc4.dim(" " + "\u2500".repeat(55)));
585
757
  for (const cat of categories) {
586
758
  const nameCol = cat.color(cat.name.padEnd(13));
587
- const descCol = pc3.dim(cat.description);
759
+ const descCol = pc4.dim(cat.description);
588
760
  logger.log(` ${nameCol} ${descCol}`);
589
761
  }
590
762
  logger.line();
591
- logger.log(pc3.bold(" Usage:"));
763
+ logger.log(pc4.bold(" Usage:"));
592
764
  logger.line();
593
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync add")} react-patterns ${pc3.dim("--category frontend")}`);
594
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync list")} --category devops`);
595
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync search")} --category security`);
765
+ logger.log(
766
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync add")} react-patterns ${pc4.dim("--category frontend")}`
767
+ );
768
+ logger.log(` ${pc4.dim("$")} ${pc4.cyan("synapsync list")} --category devops`);
769
+ logger.log(` ${pc4.dim("$")} ${pc4.cyan("synapsync list")} --remote --category security`);
596
770
  logger.line();
597
771
  }
598
772
  function showSyncInfo() {
599
773
  logger.line();
600
- logger.log(pc3.bold(pc3.cyan(" Synchronization")));
774
+ logger.log(pc4.bold(pc4.cyan(" Synchronization")));
601
775
  logger.line();
602
776
  logger.dim(" Sync copies or links your cognitives to provider directories.");
603
777
  logger.dim(" This makes them available to each AI provider.");
604
778
  logger.line();
605
- logger.log(pc3.bold(" Sync Methods:"));
779
+ logger.log(pc4.bold(" Sync Methods:"));
606
780
  logger.line();
607
- logger.log(` ${pc3.green("symlink")} ${pc3.dim("(recommended)")}`);
781
+ logger.log(` ${pc4.green("symlink")} ${pc4.dim("(recommended)")}`);
608
782
  logger.dim(" Creates symbolic links to the central storage.");
609
783
  logger.dim(" Changes reflect immediately in all providers.");
610
784
  logger.dim(" Single source of truth, less disk space.");
611
785
  logger.line();
612
- logger.log(` ${pc3.yellow("copy")}`);
786
+ logger.log(` ${pc4.yellow("copy")}`);
613
787
  logger.dim(" Creates independent copies in each provider folder.");
614
788
  logger.dim(" Works on systems without symlink support.");
615
789
  logger.dim(" Requires re-sync after changes.");
616
790
  logger.line();
617
- logger.log(pc3.bold(" How it works:"));
791
+ logger.log(pc4.bold(" How it works:"));
618
792
  logger.line();
619
- logger.log(pc3.dim(" Central storage:"));
620
- logger.log(` ${pc3.cyan(".synapsync/skills/frontend/react-patterns/SKILL.md")}`);
793
+ logger.log(pc4.dim(" Central storage:"));
794
+ logger.log(` ${pc4.cyan(".synapsync/skills/frontend/react-patterns/SKILL.md")}`);
621
795
  logger.line();
622
- logger.log(pc3.dim(" After sync (symlink):"));
623
- logger.log(` ${pc3.green(".claude/skills/react-patterns/")} -> ${pc3.dim("../../.synapsync/skills/frontend/react-patterns/")}`);
624
- logger.log(` ${pc3.green(".openai/skills/react-patterns/")} -> ${pc3.dim("../../.synapsync/skills/frontend/react-patterns/")}`);
796
+ logger.log(pc4.dim(" After sync (symlink):"));
797
+ logger.log(
798
+ ` ${pc4.green(".claude/skills/react-patterns/")} -> ${pc4.dim("../../.synapsync/skills/frontend/react-patterns/")}`
799
+ );
800
+ logger.log(
801
+ ` ${pc4.green(".openai/skills/react-patterns/")} -> ${pc4.dim("../../.synapsync/skills/frontend/react-patterns/")}`
802
+ );
625
803
  logger.line();
626
- logger.log(pc3.bold(" Commands:"));
804
+ logger.log(pc4.bold(" Commands:"));
627
805
  logger.line();
628
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync sync")} ${pc3.dim("# Sync all cognitives to all providers")}`);
629
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync sync")} --provider claude ${pc3.dim("# Sync to specific provider")}`);
630
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync sync")} --type skill ${pc3.dim("# Sync only skills")}`);
631
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync sync")} --copy ${pc3.dim("# Force copy mode")}`);
632
- logger.log(` ${pc3.dim("$")} ${pc3.cyan("synapsync sync")} --dry-run ${pc3.dim("# Preview without changes")}`);
806
+ logger.log(
807
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync sync")} ${pc4.dim("# Sync all cognitives to all providers")}`
808
+ );
809
+ logger.log(
810
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync sync")} --provider claude ${pc4.dim("# Sync to specific provider")}`
811
+ );
812
+ logger.log(
813
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync sync")} --type skill ${pc4.dim("# Sync only skills")}`
814
+ );
815
+ logger.log(
816
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync sync")} --copy ${pc4.dim("# Force copy mode")}`
817
+ );
818
+ logger.log(
819
+ ` ${pc4.dim("$")} ${pc4.cyan("synapsync sync")} --dry-run ${pc4.dim("# Preview without changes")}`
820
+ );
633
821
  logger.line();
634
822
  }
635
823
  function showStructureInfo() {
636
824
  logger.line();
637
- logger.log(pc3.bold(pc3.cyan(" Project Structure")));
825
+ logger.log(pc4.bold(pc4.cyan(" Project Structure")));
638
826
  logger.line();
639
827
  logger.dim(" After running `synapsync init`, your project will have:");
640
828
  logger.line();
641
829
  const structure = `
642
- ${pc3.cyan(".synapsync/")} ${pc3.dim("# Central cognitive storage")}
643
- ${pc3.dim("\u251C\u2500\u2500")} ${pc3.white("manifest.json")} ${pc3.dim("# Installed cognitives manifest")}
644
- ${pc3.dim("\u251C\u2500\u2500")} ${pc3.cyan("skills/")} ${pc3.dim("# Skills by category")}
645
- ${pc3.dim("\u2502 \u251C\u2500\u2500")} ${pc3.cyan("frontend/")}
646
- ${pc3.dim("\u2502 \u251C\u2500\u2500")} ${pc3.cyan("backend/")}
647
- ${pc3.dim("\u2502 \u2514\u2500\u2500")} ${pc3.cyan("general/")}
648
- ${pc3.dim("\u251C\u2500\u2500")} ${pc3.cyan("agents/")} ${pc3.dim("# Agents by category")}
649
- ${pc3.dim("\u251C\u2500\u2500")} ${pc3.cyan("prompts/")} ${pc3.dim("# Prompts by category")}
650
- ${pc3.dim("\u251C\u2500\u2500")} ${pc3.cyan("workflows/")} ${pc3.dim("# Workflows by category")}
651
- ${pc3.dim("\u2514\u2500\u2500")} ${pc3.cyan("tools/")} ${pc3.dim("# Tools by category")}
830
+ ${pc4.cyan(".synapsync/")} ${pc4.dim("# Central cognitive storage")}
831
+ ${pc4.dim("\u251C\u2500\u2500")} ${pc4.white("manifest.json")} ${pc4.dim("# Installed cognitives manifest")}
832
+ ${pc4.dim("\u251C\u2500\u2500")} ${pc4.cyan("skills/")} ${pc4.dim("# Skills by category")}
833
+ ${pc4.dim("\u2502 \u251C\u2500\u2500")} ${pc4.cyan("frontend/")}
834
+ ${pc4.dim("\u2502 \u251C\u2500\u2500")} ${pc4.cyan("backend/")}
835
+ ${pc4.dim("\u2502 \u2514\u2500\u2500")} ${pc4.cyan("general/")}
836
+ ${pc4.dim("\u251C\u2500\u2500")} ${pc4.cyan("agents/")} ${pc4.dim("# Agents by category")}
837
+ ${pc4.dim("\u251C\u2500\u2500")} ${pc4.cyan("prompts/")} ${pc4.dim("# Prompts by category")}
838
+ ${pc4.dim("\u251C\u2500\u2500")} ${pc4.cyan("workflows/")} ${pc4.dim("# Workflows by category")}
839
+ ${pc4.dim("\u2514\u2500\u2500")} ${pc4.cyan("tools/")} ${pc4.dim("# Tools by category")}
652
840
 
653
- ${pc3.green("synapsync.config.yaml")} ${pc3.dim("# Project configuration")}
841
+ ${pc4.green("synapsync.config.yaml")} ${pc4.dim("# Project configuration")}
654
842
 
655
- ${pc3.yellow(".claude/")} ${pc3.dim("# Claude provider (after sync)")}
656
- ${pc3.dim("\u251C\u2500\u2500")} ${pc3.white("skills/")} ${pc3.dim("# Symlinks to .synapsync/skills/*")}
657
- ${pc3.dim("\u251C\u2500\u2500")} ${pc3.white("agents/")} ${pc3.dim("# Symlinks to .synapsync/agents/*")}
658
- ${pc3.dim("\u2514\u2500\u2500")} ${pc3.white("prompts/")} ${pc3.dim("# Symlinks to .synapsync/prompts/*")}
843
+ ${pc4.yellow(".claude/")} ${pc4.dim("# Claude provider (after sync)")}
844
+ ${pc4.dim("\u251C\u2500\u2500")} ${pc4.white("skills/")} ${pc4.dim("# Symlinks to .synapsync/skills/*")}
845
+ ${pc4.dim("\u251C\u2500\u2500")} ${pc4.white("agents/")} ${pc4.dim("# Symlinks to .synapsync/agents/*")}
846
+ ${pc4.dim("\u2514\u2500\u2500")} ${pc4.white("prompts/")} ${pc4.dim("# Symlinks to .synapsync/prompts/*")}
659
847
  `;
660
848
  logger.log(structure);
661
849
  logger.line();
662
850
  }
663
851
  function showAllTopics() {
664
852
  logger.line();
665
- logger.log(pc3.bold(pc3.cyan(" SynapSync Info")));
853
+ logger.log(pc4.bold(pc4.cyan(" SynapSync Info")));
666
854
  logger.line();
667
855
  logger.dim(" Use /info with a topic flag to learn more:");
668
856
  logger.line();
@@ -675,7 +863,7 @@ function showAllTopics() {
675
863
  { flag: "--structure", desc: "Project directory structure" }
676
864
  ];
677
865
  for (const topic of topics) {
678
- logger.log(` ${pc3.cyan("/info " + topic.flag.padEnd(14))} ${pc3.dim(topic.desc)}`);
866
+ logger.log(` ${pc4.cyan("/info " + topic.flag.padEnd(14))} ${pc4.dim(topic.desc)}`);
679
867
  }
680
868
  logger.line();
681
869
  logger.dim(" Example: /info --cognitives");
@@ -726,7 +914,7 @@ init_esm_shims();
726
914
  import * as fs5 from "fs";
727
915
  import * as path6 from "path";
728
916
  import * as p from "@clack/prompts";
729
- import pc4 from "picocolors";
917
+ import pc5 from "picocolors";
730
918
 
731
919
  // src/services/config/manager.ts
732
920
  init_esm_shims();
@@ -769,7 +957,9 @@ function createDefaultConfig(name, description) {
769
957
  storage: { ...DEFAULT_STORAGE_CONFIG },
770
958
  sync: {
771
959
  method: DEFAULT_SYNC_CONFIG.method,
772
- providers: JSON.parse(JSON.stringify(DEFAULT_SYNC_CONFIG.providers))
960
+ providers: JSON.parse(
961
+ JSON.stringify(DEFAULT_SYNC_CONFIG.providers)
962
+ )
773
963
  }
774
964
  };
775
965
  if (description !== void 0) {
@@ -818,7 +1008,10 @@ function validateConfig(config) {
818
1008
  });
819
1009
  }
820
1010
  if (typeof value !== "object" || value === null) {
821
- errors.push({ path: `sync.providers.${key}`, message: "Provider config must be an object" });
1011
+ errors.push({
1012
+ path: `sync.providers.${key}`,
1013
+ message: "Provider config must be an object"
1014
+ });
822
1015
  }
823
1016
  }
824
1017
  }
@@ -1623,7 +1816,12 @@ var AgentsMdGenerator = class {
1623
1816
  fileName = scannedCognitive.fileName ?? path5.basename(scannedCognitive.filePath);
1624
1817
  } else {
1625
1818
  const typeDir = `${cognitive.type}s`;
1626
- const expectedDir = path5.join(this.synapSyncDir, typeDir, cognitive.category, cognitive.name);
1819
+ const expectedDir = path5.join(
1820
+ this.synapSyncDir,
1821
+ typeDir,
1822
+ cognitive.category,
1823
+ cognitive.name
1824
+ );
1627
1825
  relativePath = path5.relative(this.projectRoot, expectedDir);
1628
1826
  fileName = cognitive.name;
1629
1827
  }
@@ -1648,7 +1846,7 @@ var AgentsMdGenerator = class {
1648
1846
  START_MARKER,
1649
1847
  "# SynapSync Project Cognitives",
1650
1848
  "",
1651
- "> Auto-generated by [SynapSync](https://synapsync.github.io/synapsync-cli/). Do not edit this section manually.",
1849
+ "> Auto-generated by [SynapSync](https://synapsync.github.io/synapse-cli/). Do not edit this section manually.",
1652
1850
  ""
1653
1851
  ];
1654
1852
  if (entries.length === 0) {
@@ -1666,7 +1864,9 @@ var AgentsMdGenerator = class {
1666
1864
  }
1667
1865
  lines.push("---");
1668
1866
  lines.push("");
1669
- lines.push(`*Last updated: ${(/* @__PURE__ */ new Date()).toISOString()} \xB7 ${entries.length} cognitive${entries.length !== 1 ? "s" : ""} installed*`);
1867
+ lines.push(
1868
+ `*Last updated: ${(/* @__PURE__ */ new Date()).toISOString()} \xB7 ${entries.length} cognitive${entries.length !== 1 ? "s" : ""} installed*`
1869
+ );
1670
1870
  }
1671
1871
  lines.push(END_MARKER);
1672
1872
  return lines.join("\n");
@@ -1679,7 +1879,7 @@ var AgentsMdGenerator = class {
1679
1879
  START_MARKER,
1680
1880
  "# SynapSync Project Cognitives",
1681
1881
  "",
1682
- "> Auto-generated by [SynapSync](https://synapsync.github.io/synapsync-cli/). Do not edit this section manually.",
1882
+ "> Auto-generated by [SynapSync](https://synapsync.github.io/synapse-cli/). Do not edit this section manually.",
1683
1883
  "",
1684
1884
  "*No cognitives installed yet. Run `synapsync add <name>` to get started.*",
1685
1885
  END_MARKER
@@ -1752,8 +1952,8 @@ async function executeInitCommand(options = {}) {
1752
1952
  if (ConfigManager.isProjectInitialized(projectRoot)) {
1753
1953
  logger.line();
1754
1954
  logger.warning("Project already initialized.");
1755
- logger.log(` ${pc4.dim("Config:")} ${configPath}`);
1756
- logger.log(` ${pc4.dim("Storage:")} ${storagePath}`);
1955
+ logger.log(` ${pc5.dim("Config:")} ${configPath}`);
1956
+ logger.log(` ${pc5.dim("Storage:")} ${storagePath}`);
1757
1957
  logger.line();
1758
1958
  logger.hint("Use /config to view or modify settings.");
1759
1959
  return null;
@@ -1766,7 +1966,7 @@ async function executeInitCommand(options = {}) {
1766
1966
  });
1767
1967
  }
1768
1968
  logger.line();
1769
- p.intro(pc4.bgCyan(pc4.black(" Initialize SynapSync Project ")));
1969
+ p.intro(pc5.bgCyan(pc5.black(" Initialize SynapSync Project ")));
1770
1970
  const result = await p.group(
1771
1971
  {
1772
1972
  name: () => {
@@ -1776,7 +1976,7 @@ async function executeInitCommand(options = {}) {
1776
1976
  placeholder: defaultName,
1777
1977
  defaultValue: defaultName,
1778
1978
  validate: (value) => {
1779
- const finalValue = value.trim() === "" ? defaultName : value;
1979
+ const finalValue = (value ?? "").trim() === "" ? defaultName : String(value);
1780
1980
  if (!/^[a-z0-9-_]+$/i.test(finalValue)) {
1781
1981
  return "Project name can only contain letters, numbers, hyphens, and underscores";
1782
1982
  }
@@ -1910,39 +2110,43 @@ function showSuccessMessage(setup, configPath, storagePath) {
1910
2110
  logger.line();
1911
2111
  p.note(
1912
2112
  [
1913
- `${pc4.dim("Config:")} ${pc4.cyan(configPath)}`,
1914
- `${pc4.dim("Storage:")} ${pc4.cyan(storagePath)}`,
2113
+ `${pc5.dim("Config:")} ${pc5.cyan(configPath)}`,
2114
+ `${pc5.dim("Storage:")} ${pc5.cyan(storagePath)}`,
1915
2115
  "",
1916
- `${pc4.dim("Providers:")} ${setup.providers.map((p2) => pc4.green(p2)).join(", ") || pc4.dim("none")}`
2116
+ `${pc5.dim("Providers:")} ${setup.providers.map((p2) => pc5.green(p2)).join(", ") || pc5.dim("none")}`
1917
2117
  ].join("\n"),
1918
2118
  `Project "${setup.name}" initialized!`
1919
2119
  );
1920
2120
  logger.line();
1921
2121
  logger.bold(" Next Steps:");
1922
2122
  logger.line();
1923
- logger.log(` ${pc4.cyan("1.")} Browse available cognitives:`);
1924
- logger.log(` ${pc4.dim("$")} synapsync list --remote`);
2123
+ logger.log(` ${pc5.cyan("1.")} Browse available cognitives:`);
2124
+ logger.log(` ${pc5.dim("$")} synapsync list --remote`);
1925
2125
  logger.line();
1926
- logger.log(` ${pc4.cyan("2.")} Add cognitives:`);
1927
- logger.log(` ${pc4.dim("$")} synapsync add code-reviewer`);
1928
- logger.log(` ${pc4.dim("$")} synapsync add github:user/my-skill`);
2126
+ logger.log(` ${pc5.cyan("2.")} Add cognitives:`);
2127
+ logger.log(` ${pc5.dim("$")} synapsync add code-reviewer`);
2128
+ logger.log(` ${pc5.dim("$")} synapsync add github:user/my-skill`);
1929
2129
  logger.line();
1930
- p.outro(pc4.green("Happy syncing!"));
2130
+ p.outro(pc5.green("Happy syncing!"));
1931
2131
  }
1932
2132
  function registerInitCommand(program) {
1933
- program.command("init").description("Initialize a new SynapSync project").option("-n, --name <name>", "Project name").option("-d, --description <desc>", "Project description").option("-p, --provider <providers...>", "Enable providers (claude, openai, etc.)").option("-y, --yes", "Skip prompts and use defaults").action(async (options) => {
1934
- await executeInitCommand({
1935
- ...options.name !== void 0 && { name: options.name },
1936
- ...options.description !== void 0 && { description: options.description },
1937
- ...options.provider !== void 0 && { providers: options.provider },
1938
- ...options.yes !== void 0 && { yes: options.yes }
1939
- });
1940
- });
2133
+ program.command("init").description("Initialize a new SynapSync project").option("-n, --name <name>", "Project name").option("-d, --description <desc>", "Project description").option("-p, --provider <providers...>", "Enable providers (claude, openai, etc.)").option("-y, --yes", "Skip prompts and use defaults").action(
2134
+ async (options) => {
2135
+ await executeInitCommand({
2136
+ ...options.name !== void 0 && { name: options.name },
2137
+ ...options.description !== void 0 && { description: options.description },
2138
+ ...options.provider !== void 0 && {
2139
+ providers: options.provider
2140
+ },
2141
+ ...options.yes !== void 0 && { yes: options.yes }
2142
+ });
2143
+ }
2144
+ );
1941
2145
  }
1942
2146
 
1943
2147
  // src/commands/config.ts
1944
2148
  init_esm_shims();
1945
- import pc5 from "picocolors";
2149
+ import pc6 from "picocolors";
1946
2150
  function executeConfigCommand(args) {
1947
2151
  const options = parseConfigArgs(args);
1948
2152
  const configManager = ConfigManager.findConfig();
@@ -1977,11 +2181,11 @@ function showConfigList(configManager) {
1977
2181
  groups[group2][key] = value;
1978
2182
  }
1979
2183
  for (const [group2, values] of Object.entries(groups)) {
1980
- logger.log(` ${pc5.cyan(group2)}:`);
2184
+ logger.log(` ${pc6.cyan(group2)}:`);
1981
2185
  for (const [key, value] of Object.entries(values)) {
1982
2186
  const displayKey = key.replace(`${group2}.`, "");
1983
2187
  const displayValue = formatValue(value);
1984
- logger.log(` ${pc5.dim(displayKey.padEnd(30))} ${displayValue}`);
2188
+ logger.log(` ${pc6.dim(displayKey.padEnd(30))} ${displayValue}`);
1985
2189
  }
1986
2190
  logger.line();
1987
2191
  }
@@ -1998,11 +2202,11 @@ function showConfigValue(configManager, key) {
1998
2202
  const value = configManager.get(key);
1999
2203
  logger.line();
2000
2204
  if (value === void 0) {
2001
- logger.warning(`Key not found: ${pc5.cyan(key)}`);
2205
+ logger.warning(`Key not found: ${pc6.cyan(key)}`);
2002
2206
  logger.line();
2003
2207
  logger.hint("Use /config list to see all available keys.");
2004
2208
  } else {
2005
- logger.log(` ${pc5.cyan(key)} = ${formatValue(value)}`);
2209
+ logger.log(` ${pc6.cyan(key)} = ${formatValue(value)}`);
2006
2210
  }
2007
2211
  }
2008
2212
  function setConfigValue(configManager, key, value) {
@@ -2026,9 +2230,9 @@ function setConfigValue(configManager, key, value) {
2026
2230
  configManager.save();
2027
2231
  logger.line();
2028
2232
  if (isNewKey) {
2029
- logger.warning(`Created new key: ${pc5.cyan(key)}`);
2233
+ logger.warning(`Created new key: ${pc6.cyan(key)}`);
2030
2234
  }
2031
- logger.success(`${pc5.cyan(key)} = ${formatValue(parsedValue)}`);
2235
+ logger.success(`${pc6.cyan(key)} = ${formatValue(parsedValue)}`);
2032
2236
  }
2033
2237
  function parseConfigArgs(args) {
2034
2238
  const parts = args.trim().split(/\s+/);
@@ -2056,21 +2260,21 @@ function parseConfigArgs(args) {
2056
2260
  }
2057
2261
  function formatValue(value) {
2058
2262
  if (value === null || value === void 0) {
2059
- return pc5.dim("(not set)");
2263
+ return pc6.dim("(not set)");
2060
2264
  }
2061
2265
  if (typeof value === "boolean") {
2062
- return value ? pc5.green("true") : pc5.red("false");
2266
+ return value ? pc6.green("true") : pc6.red("false");
2063
2267
  }
2064
2268
  if (typeof value === "number") {
2065
- return pc5.yellow(String(value));
2269
+ return pc6.yellow(String(value));
2066
2270
  }
2067
2271
  if (typeof value === "string") {
2068
- return pc5.white(`"${value}"`);
2272
+ return pc6.white(`"${value}"`);
2069
2273
  }
2070
2274
  if (Array.isArray(value)) {
2071
- return pc5.dim(`[${value.join(", ")}]`);
2275
+ return pc6.dim(`[${value.join(", ")}]`);
2072
2276
  }
2073
- return pc5.dim(JSON.stringify(value));
2277
+ return pc6.dim(JSON.stringify(value));
2074
2278
  }
2075
2279
  function parseValue(value) {
2076
2280
  if (value.toLowerCase() === "true") return true;
@@ -2099,7 +2303,7 @@ function registerConfigCommand(program) {
2099
2303
  init_esm_shims();
2100
2304
  import * as fs6 from "fs";
2101
2305
  import * as path7 from "path";
2102
- import pc6 from "picocolors";
2306
+ import pc7 from "picocolors";
2103
2307
  function executeStatusCommand(_args = "") {
2104
2308
  const status = getProjectStatus();
2105
2309
  logger.line();
@@ -2208,59 +2412,59 @@ function getLastSyncTime(storagePath) {
2208
2412
  function showNotInitialized() {
2209
2413
  logger.bold(" Project Status");
2210
2414
  logger.line();
2211
- logger.log(` ${pc6.red("\u25CF")} ${pc6.dim("Not initialized")}`);
2415
+ logger.log(` ${pc7.red("\u25CF")} ${pc7.dim("Not initialized")}`);
2212
2416
  logger.line();
2213
2417
  logger.hint("Run /init to initialize a SynapSync project.");
2214
2418
  }
2215
2419
  function showProjectStatus(status) {
2216
2420
  logger.bold(` ${status.projectName ?? "SynapSync Project"}`);
2217
2421
  logger.line();
2218
- logger.log(` ${pc6.green("\u25CF")} ${pc6.dim("Initialized")}`);
2219
- logger.log(` ${pc6.dim("Root:")} ${status.projectRoot}`);
2422
+ logger.log(` ${pc7.green("\u25CF")} ${pc7.dim("Initialized")}`);
2423
+ logger.log(` ${pc7.dim("Root:")} ${status.projectRoot}`);
2220
2424
  logger.line();
2221
2425
  logger.bold(" Cognitives");
2222
2426
  const totalCognitives = Object.values(status.cognitives).reduce((a, b) => a + b, 0);
2223
2427
  if (totalCognitives === 0) {
2224
- logger.log(` ${pc6.dim("No cognitives installed")}`);
2428
+ logger.log(` ${pc7.dim("No cognitives installed")}`);
2225
2429
  } else {
2226
2430
  for (const type of COGNITIVE_TYPES) {
2227
2431
  const count = status.cognitives[type];
2228
2432
  if (count > 0) {
2229
2433
  const icon = getCognitiveIcon(type);
2230
- logger.log(` ${icon} ${pc6.white(count.toString().padStart(3))} ${type}s`);
2434
+ logger.log(` ${icon} ${pc7.white(count.toString().padStart(3))} ${type}s`);
2231
2435
  }
2232
2436
  }
2233
- logger.log(` ${pc6.dim("\u2500\u2500\u2500")}`);
2234
- logger.log(` ${pc6.bold(totalCognitives.toString().padStart(5))} total`);
2437
+ logger.log(` ${pc7.dim("\u2500\u2500\u2500")}`);
2438
+ logger.log(` ${pc7.bold(totalCognitives.toString().padStart(5))} total`);
2235
2439
  }
2236
2440
  logger.line();
2237
2441
  logger.bold(" Providers");
2238
2442
  const enabledProviders = status.providers.filter((p2) => p2.enabled);
2239
2443
  if (enabledProviders.length === 0) {
2240
- logger.log(` ${pc6.dim("No providers enabled")}`);
2444
+ logger.log(` ${pc7.dim("No providers enabled")}`);
2241
2445
  } else {
2242
2446
  for (const provider of enabledProviders) {
2243
- const icon = provider.cognitivesCount > 0 ? pc6.green("\u25CF") : pc6.yellow("\u25CB");
2244
- const syncStatus = provider.cognitivesCount > 0 ? pc6.dim(`(${provider.cognitivesCount} synced)`) : pc6.dim("(not synced)");
2245
- logger.log(` ${icon} ${pc6.white(provider.name)} ${syncStatus}`);
2447
+ const icon = provider.cognitivesCount > 0 ? pc7.green("\u25CF") : pc7.yellow("\u25CB");
2448
+ const syncStatus = provider.cognitivesCount > 0 ? pc7.dim(`(${provider.cognitivesCount} synced)`) : pc7.dim("(not synced)");
2449
+ logger.log(` ${icon} ${pc7.white(provider.name)} ${syncStatus}`);
2246
2450
  }
2247
2451
  }
2248
2452
  logger.line();
2249
2453
  if (status.lastSync !== void 0) {
2250
2454
  const syncDate = new Date(status.lastSync);
2251
2455
  const relativeTime = getRelativeTime(syncDate);
2252
- logger.log(` ${pc6.dim("Last updated:")} ${relativeTime}`);
2456
+ logger.log(` ${pc7.dim("Last updated:")} ${relativeTime}`);
2253
2457
  logger.line();
2254
2458
  }
2255
2459
  logger.hint("Run /help for available commands.");
2256
2460
  }
2257
2461
  function getCognitiveIcon(type) {
2258
2462
  const icons = {
2259
- skill: pc6.blue("\u25C6"),
2260
- agent: pc6.magenta("\u25C6"),
2261
- prompt: pc6.yellow("\u25C6"),
2262
- workflow: pc6.cyan("\u25C6"),
2263
- tool: pc6.green("\u25C6")
2463
+ skill: pc7.blue("\u25C6"),
2464
+ agent: pc7.magenta("\u25C6"),
2465
+ prompt: pc7.yellow("\u25C6"),
2466
+ workflow: pc7.cyan("\u25C6"),
2467
+ tool: pc7.green("\u25C6")
2264
2468
  };
2265
2469
  return icons[type];
2266
2470
  }
@@ -2286,7 +2490,7 @@ function registerStatusCommand(program) {
2286
2490
  init_esm_shims();
2287
2491
  import * as fs7 from "fs";
2288
2492
  import * as path8 from "path";
2289
- import pc7 from "picocolors";
2493
+ import pc8 from "picocolors";
2290
2494
  function executeProvidersCommand(args) {
2291
2495
  const parts = args.trim().split(/\s+/);
2292
2496
  const subcommand = parts[0]?.toLowerCase() ?? "";
@@ -2327,21 +2531,21 @@ function listProviders(configManager) {
2327
2531
  logger.bold(" Providers");
2328
2532
  logger.line();
2329
2533
  logger.log(
2330
- ` ${pc7.dim("Provider".padEnd(12))} ${pc7.dim("Status".padEnd(10))} ${pc7.dim("Path".padEnd(20))} ${pc7.dim("Directory")}`
2534
+ ` ${pc8.dim("Provider".padEnd(12))} ${pc8.dim("Status".padEnd(10))} ${pc8.dim("Path".padEnd(20))} ${pc8.dim("Directory")}`
2331
2535
  );
2332
- logger.log(` ${pc7.dim("\u2500".repeat(60))}`);
2536
+ logger.log(` ${pc8.dim("\u2500".repeat(60))}`);
2333
2537
  for (const provider of providers) {
2334
- const statusIcon = provider.enabled ? pc7.green("\u25CF") : pc7.dim("\u25CB");
2335
- const statusText = provider.enabled ? pc7.green("enabled") : pc7.dim("disabled");
2336
- const pathText = pc7.cyan(provider.path);
2337
- const existsText = provider.exists ? pc7.green("\u2713 exists") : pc7.dim("\u2717 missing");
2538
+ const statusIcon = provider.enabled ? pc8.green("\u25CF") : pc8.dim("\u25CB");
2539
+ const statusText = provider.enabled ? pc8.green("enabled") : pc8.dim("disabled");
2540
+ const pathText = pc8.cyan(provider.path);
2541
+ const existsText = provider.exists ? pc8.green("\u2713 exists") : pc8.dim("\u2717 missing");
2338
2542
  logger.log(
2339
- ` ${statusIcon} ${pc7.white(provider.name.padEnd(10))} ${statusText.padEnd(19)} ${pathText.padEnd(29)} ${existsText}`
2543
+ ` ${statusIcon} ${pc8.white(provider.name.padEnd(10))} ${statusText.padEnd(19)} ${pathText.padEnd(29)} ${existsText}`
2340
2544
  );
2341
2545
  }
2342
2546
  logger.line();
2343
2547
  const enabledCount = providers.filter((p2) => p2.enabled).length;
2344
- logger.log(` ${pc7.dim("Enabled:")} ${enabledCount} of ${providers.length} providers`);
2548
+ logger.log(` ${pc8.dim("Enabled:")} ${enabledCount} of ${providers.length} providers`);
2345
2549
  logger.line();
2346
2550
  logger.hint("Use /providers enable <name> or /providers disable <name>");
2347
2551
  }
@@ -2374,8 +2578,8 @@ function enableProvider(configManager, providerName) {
2374
2578
  }
2375
2579
  configManager.save();
2376
2580
  logger.line();
2377
- logger.success(`Provider '${pc7.cyan(provider)}' enabled`);
2378
- logger.log(` ${pc7.dim("Path:")} ${defaultPaths.skill.split("/")[0]}/`);
2581
+ logger.success(`Provider '${pc8.cyan(provider)}' enabled`);
2582
+ logger.log(` ${pc8.dim("Path:")} ${defaultPaths.skill.split("/")[0]}/`);
2379
2583
  logger.line();
2380
2584
  logger.hint("Run /sync to synchronize cognitives to this provider.");
2381
2585
  }
@@ -2402,7 +2606,7 @@ function disableProvider(configManager, providerName) {
2402
2606
  configManager.set(`sync.providers.${provider}.enabled`, false);
2403
2607
  configManager.save();
2404
2608
  logger.line();
2405
- logger.success(`Provider '${pc7.cyan(provider)}' disabled`);
2609
+ logger.success(`Provider '${pc8.cyan(provider)}' disabled`);
2406
2610
  }
2407
2611
  function setProviderPath(configManager, providerName, newPath) {
2408
2612
  if (providerName === void 0 || providerName === "") {
@@ -2432,8 +2636,8 @@ function setProviderPath(configManager, providerName, newPath) {
2432
2636
  }
2433
2637
  configManager.save();
2434
2638
  logger.line();
2435
- logger.success(`Updated paths for '${pc7.cyan(provider)}'`);
2436
- logger.log(` ${pc7.dim("Base path:")} ${pc7.cyan(normalizedPath)}`);
2639
+ logger.success(`Updated paths for '${pc8.cyan(provider)}'`);
2640
+ logger.log(` ${pc8.dim("Base path:")} ${pc8.cyan(normalizedPath)}`);
2437
2641
  logger.line();
2438
2642
  }
2439
2643
  function showProviderInfo(configManager, provider) {
@@ -2445,18 +2649,18 @@ function showProviderInfo(configManager, provider) {
2445
2649
  logger.line();
2446
2650
  logger.bold(` ${getProviderDisplayName(provider)}`);
2447
2651
  logger.line();
2448
- const statusIcon = enabled ? pc7.green("\u25CF") : pc7.dim("\u25CB");
2449
- const statusText = enabled ? pc7.green("Enabled") : pc7.dim("Disabled");
2450
- logger.log(` ${pc7.dim("Status:")} ${statusIcon} ${statusText}`);
2652
+ const statusIcon = enabled ? pc8.green("\u25CF") : pc8.dim("\u25CB");
2653
+ const statusText = enabled ? pc8.green("Enabled") : pc8.dim("Disabled");
2654
+ logger.log(` ${pc8.dim("Status:")} ${statusIcon} ${statusText}`);
2451
2655
  logger.line();
2452
- logger.log(` ${pc7.dim("Paths:")}`);
2656
+ logger.log(` ${pc8.dim("Paths:")}`);
2453
2657
  const cognitiveTypes = ["skill", "agent", "prompt", "workflow", "tool"];
2454
2658
  for (const type of cognitiveTypes) {
2455
2659
  const typePath = paths[type] ?? "";
2456
2660
  const fullPath = path8.join(projectRoot, typePath);
2457
2661
  const exists = fs7.existsSync(fullPath);
2458
- const existsIcon = exists ? pc7.green("\u2713") : pc7.dim("\u2717");
2459
- logger.log(` ${pc7.dim(type.padEnd(10))} ${pc7.cyan(typePath)} ${existsIcon}`);
2662
+ const existsIcon = exists ? pc8.green("\u2713") : pc8.dim("\u2717");
2663
+ logger.log(` ${pc8.dim(type.padEnd(10))} ${pc8.cyan(typePath)} ${existsIcon}`);
2460
2664
  }
2461
2665
  logger.line();
2462
2666
  }
@@ -2509,9 +2713,11 @@ function registerProvidersCommand(program) {
2509
2713
  });
2510
2714
  }
2511
2715
 
2512
- // src/commands/search.ts
2716
+ // src/commands/add.ts
2513
2717
  init_esm_shims();
2514
- import pc8 from "picocolors";
2718
+ import * as fs9 from "fs";
2719
+ import * as path11 from "path";
2720
+ import pc9 from "picocolors";
2515
2721
 
2516
2722
  // src/services/registry/client.ts
2517
2723
  init_esm_shims();
@@ -2538,7 +2744,10 @@ var RegistryClient = class {
2538
2744
  const url = `${this.baseUrl}/${REGISTRY_INDEX_FILE}`;
2539
2745
  const response = await this.fetch(url);
2540
2746
  if (!response.ok) {
2541
- throw new RegistryError(`Failed to fetch registry index: ${response.status} ${response.statusText}`, url);
2747
+ throw new RegistryError(
2748
+ `Failed to fetch registry index: ${response.status} ${response.statusText}`,
2749
+ url
2750
+ );
2542
2751
  }
2543
2752
  const index = await response.json();
2544
2753
  this.indexCache = index;
@@ -2730,146 +2939,6 @@ var CognitiveNotFoundError = class extends Error {
2730
2939
  }
2731
2940
  };
2732
2941
 
2733
- // src/commands/search.ts
2734
- async function executeSearchCommand(query, options) {
2735
- logger.line();
2736
- const validatedOptions = validateOptions(options);
2737
- if (validatedOptions === null) {
2738
- return;
2739
- }
2740
- const searchingText = query !== void 0 && query.trim() !== "" ? `Searching for "${query}"...` : "Fetching cognitives from registry...";
2741
- logger.log(` ${pc8.dim(searchingText)}`);
2742
- try {
2743
- const client = new RegistryClient();
2744
- const isReachable = await client.ping();
2745
- if (!isReachable) {
2746
- logger.line();
2747
- logger.error("Unable to reach the registry. Check your internet connection.");
2748
- return;
2749
- }
2750
- const searchOpts = {};
2751
- if (validatedOptions.type !== void 0) searchOpts.type = validatedOptions.type;
2752
- if (validatedOptions.category !== void 0) searchOpts.category = validatedOptions.category;
2753
- if (validatedOptions.tag !== void 0) searchOpts.tag = validatedOptions.tag;
2754
- if (validatedOptions.limit !== void 0) searchOpts.limit = validatedOptions.limit;
2755
- const result = await client.search(query, searchOpts);
2756
- process.stdout.write("\x1B[1A\x1B[2K");
2757
- if (options.json === true) {
2758
- console.log(JSON.stringify(result, null, 2));
2759
- return;
2760
- }
2761
- displaySearchResults(result.cognitives, query, result.total);
2762
- } catch (error) {
2763
- logger.line();
2764
- if (error instanceof RegistryError) {
2765
- logger.error(`Registry error: ${error.message}`);
2766
- } else if (error instanceof Error) {
2767
- logger.error(`Search failed: ${error.message}`);
2768
- } else {
2769
- logger.error("Search failed with unknown error");
2770
- }
2771
- }
2772
- }
2773
- function validateOptions(options) {
2774
- const validated = {};
2775
- if (options.type !== void 0) {
2776
- if (!COGNITIVE_TYPES.includes(options.type)) {
2777
- logger.error(`Invalid type: ${options.type}`);
2778
- logger.hint(`Valid types: ${COGNITIVE_TYPES.join(", ")}`);
2779
- return null;
2780
- }
2781
- validated.type = options.type;
2782
- }
2783
- if (options.category !== void 0) {
2784
- if (!CATEGORIES.includes(options.category)) {
2785
- logger.error(`Invalid category: ${options.category}`);
2786
- logger.hint(`Valid categories: ${CATEGORIES.join(", ")}`);
2787
- return null;
2788
- }
2789
- validated.category = options.category;
2790
- }
2791
- if (options.tag !== void 0) {
2792
- validated.tag = options.tag;
2793
- }
2794
- if (options.limit !== void 0) {
2795
- const limit = parseInt(options.limit, 10);
2796
- if (isNaN(limit) || limit < 1) {
2797
- logger.error("Limit must be a positive number");
2798
- return null;
2799
- }
2800
- validated.limit = limit;
2801
- }
2802
- return validated;
2803
- }
2804
- function displaySearchResults(cognitives, query, total) {
2805
- if (query !== void 0 && query.trim() !== "") {
2806
- logger.bold(` Search Results for "${query}"`);
2807
- } else {
2808
- logger.bold(" Registry Cognitives");
2809
- }
2810
- logger.line();
2811
- if (cognitives.length === 0) {
2812
- logger.log(` ${pc8.dim("No cognitives found")}`);
2813
- logger.line();
2814
- logger.hint("Try a different search query or remove filters.");
2815
- return;
2816
- }
2817
- if (cognitives.length < total) {
2818
- logger.log(` ${pc8.dim(`Showing ${cognitives.length} of ${total} results`)}`);
2819
- } else {
2820
- logger.log(` ${pc8.dim(`Found ${total} cognitive${total === 1 ? "" : "s"}`)}`);
2821
- }
2822
- logger.line();
2823
- for (const cognitive of cognitives) {
2824
- displayCognitive(cognitive);
2825
- }
2826
- logger.line();
2827
- logger.hint("Run synapsync add <name> to add a cognitive.");
2828
- }
2829
- function displayCognitive(cognitive) {
2830
- const typeIcon = getCognitiveIcon2(cognitive.type);
2831
- const typeLabel = pc8.dim(`[${cognitive.type}]`);
2832
- logger.log(` ${typeIcon} ${pc8.bold(pc8.white(cognitive.name))} ${typeLabel}`);
2833
- logger.log(` ${pc8.dim(truncate(cognitive.description, 60))}`);
2834
- const meta = [];
2835
- meta.push(pc8.dim(`v${cognitive.version}`));
2836
- meta.push(pc8.dim(cognitive.category));
2837
- if (cognitive.downloads > 0) {
2838
- meta.push(pc8.dim(`${cognitive.downloads} downloads`));
2839
- }
2840
- logger.log(` ${meta.join(" \xB7 ")}`);
2841
- if (cognitive.tags.length > 0) {
2842
- const tags = cognitive.tags.slice(0, 5).map((t) => pc8.cyan(t)).join(" ");
2843
- logger.log(` ${tags}`);
2844
- }
2845
- logger.line();
2846
- }
2847
- function getCognitiveIcon2(type) {
2848
- const icons = {
2849
- skill: pc8.blue("\u25C6"),
2850
- agent: pc8.magenta("\u25C6"),
2851
- prompt: pc8.yellow("\u25C6"),
2852
- workflow: pc8.cyan("\u25C6"),
2853
- tool: pc8.green("\u25C6")
2854
- };
2855
- return icons[type];
2856
- }
2857
- function truncate(text2, maxLength) {
2858
- if (text2.length <= maxLength) return text2;
2859
- return text2.slice(0, maxLength - 3) + "...";
2860
- }
2861
- function registerSearchCommand(program) {
2862
- program.command("search [query]").description("Search for cognitives in the registry").option("-t, --type <type>", "Filter by type (skill, agent, prompt, workflow, tool)").option("-c, --category <category>", "Filter by category").option("--tag <tag>", "Filter by tag").option("-l, --limit <number>", "Limit results", "20").option("--json", "Output as JSON").action(async (query, options) => {
2863
- await executeSearchCommand(query, options);
2864
- });
2865
- }
2866
-
2867
- // src/commands/add.ts
2868
- init_esm_shims();
2869
- import * as fs9 from "fs";
2870
- import * as path11 from "path";
2871
- import pc9 from "picocolors";
2872
-
2873
2942
  // src/services/sync/engine.ts
2874
2943
  init_esm_shims();
2875
2944
  import * as path10 from "path";
@@ -3554,6 +3623,13 @@ var SyncEngine = class {
3554
3623
  };
3555
3624
 
3556
3625
  // src/commands/add.ts
3626
+ var GitHubInstallError = class extends Error {
3627
+ constructor(message, repoUrl) {
3628
+ super(message);
3629
+ this.repoUrl = repoUrl;
3630
+ this.name = "GitHubInstallError";
3631
+ }
3632
+ };
3557
3633
  async function executeAddCommand(source, options) {
3558
3634
  logger.line();
3559
3635
  const configManager = ConfigManager.findConfig();
@@ -3576,7 +3652,7 @@ async function executeAddCommand(source, options) {
3576
3652
  }
3577
3653
  break;
3578
3654
  case "github":
3579
- success = installFromGitHub(parsedSource, options, configManager);
3655
+ success = await installFromGitHub(parsedSource, options, configManager);
3580
3656
  break;
3581
3657
  }
3582
3658
  if (success) {
@@ -3604,7 +3680,10 @@ async function executeAddCommand(source, options) {
3604
3680
  logger.line();
3605
3681
  if (error instanceof CognitiveNotFoundError) {
3606
3682
  logger.error(`Cognitive '${error.cognitiveName}' not found in registry.`);
3607
- logger.hint("Run synapsync search to find available cognitives.");
3683
+ logger.hint("Run synapsync list --remote to browse available cognitives.");
3684
+ } else if (error instanceof GitHubInstallError) {
3685
+ logger.error(`GitHub install failed: ${error.message}`);
3686
+ logger.hint(`Repository: ${error.repoUrl}`);
3608
3687
  } else if (error instanceof RegistryError) {
3609
3688
  logger.error(`Registry error: ${error.message}`);
3610
3689
  } else if (error instanceof Error) {
@@ -3665,7 +3744,9 @@ async function installFromRegistry(name, options, configManager) {
3665
3744
  saveCognitive(targetDir, manifest, downloaded.content, assets);
3666
3745
  updateProjectManifest(configManager, manifest, "registry");
3667
3746
  logger.line();
3668
- logger.log(` ${pc9.green("\u2713")} Installed ${pc9.bold(manifest.name)} ${pc9.dim(`v${manifest.version}`)}`);
3747
+ logger.log(
3748
+ ` ${pc9.green("\u2713")} Installed ${pc9.bold(manifest.name)} ${pc9.dim(`v${manifest.version}`)}`
3749
+ );
3669
3750
  logger.log(` ${pc9.dim("Type:")} ${manifest.type}`);
3670
3751
  logger.log(` ${pc9.dim("Category:")} ${category}`);
3671
3752
  logger.log(` ${pc9.dim("Location:")} ${path11.relative(process.cwd(), targetDir)}`);
@@ -3675,10 +3756,7 @@ async function downloadAssets(client, name, _manifest) {
3675
3756
  const assets = /* @__PURE__ */ new Map();
3676
3757
  const entry = await client.findByName(name);
3677
3758
  if (entry === null) return assets;
3678
- const assetFiles = [
3679
- "assets/SKILL-TEMPLATE-BASIC.md",
3680
- "assets/SKILL-TEMPLATE-ADVANCED.md"
3681
- ];
3759
+ const assetFiles = ["assets/SKILL-TEMPLATE-BASIC.md", "assets/SKILL-TEMPLATE-ADVANCED.md"];
3682
3760
  for (const assetPath of assetFiles) {
3683
3761
  try {
3684
3762
  const content = await client.downloadAsset(entry, assetPath);
@@ -3695,9 +3773,7 @@ function installFromLocal(sourcePath, options, configManager) {
3695
3773
  }
3696
3774
  const detected = detectCognitiveType(absolutePath);
3697
3775
  if (detected === null && options.type === void 0) {
3698
- throw new Error(
3699
- "Could not detect cognitive type. Please specify with --type flag."
3700
- );
3776
+ throw new Error("Could not detect cognitive type. Please specify with --type flag.");
3701
3777
  }
3702
3778
  const cognitiveType = options.type ?? detected?.type ?? "skill";
3703
3779
  const fileName = detected?.fileName ?? COGNITIVE_FILE_NAMES[cognitiveType];
@@ -3802,11 +3878,116 @@ function parseMetadata(content) {
3802
3878
  return {};
3803
3879
  }
3804
3880
  }
3805
- function installFromGitHub(_source, _options, _configManager) {
3881
+ function parseGitHubUrl(url) {
3882
+ const parts = url.replace("https://github.com/", "").split("/");
3883
+ const owner = parts[0];
3884
+ const repo = parts[1];
3885
+ if (!owner || !repo) return null;
3886
+ const subpath = parts.slice(2).join("/");
3887
+ return { owner, repo, subpath };
3888
+ }
3889
+ async function fetchGitHubFile(owner, repo, branch, filePath) {
3890
+ const url = `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${filePath}`;
3891
+ try {
3892
+ const response = await fetch(url, { headers: { "User-Agent": "SynapSync-CLI" } });
3893
+ if (!response.ok) return null;
3894
+ return response.text();
3895
+ } catch {
3896
+ return null;
3897
+ }
3898
+ }
3899
+ async function installFromGitHub(source, options, configManager) {
3900
+ const repoUrl = source.url ?? "";
3901
+ const branch = source.branch ?? "main";
3902
+ const parsed = parseGitHubUrl(repoUrl);
3903
+ if (!parsed) {
3904
+ throw new GitHubInstallError("Invalid GitHub URL format.", repoUrl);
3905
+ }
3906
+ const { owner, repo, subpath } = parsed;
3907
+ const basePath = subpath ? `${subpath}/` : "";
3908
+ const manifestContent = await fetchGitHubFile(owner, repo, branch, `${basePath}manifest.json`);
3909
+ let manifest;
3910
+ let content;
3911
+ if (manifestContent) {
3912
+ try {
3913
+ manifest = JSON.parse(manifestContent);
3914
+ } catch {
3915
+ throw new GitHubInstallError("Invalid manifest.json in repository.", repoUrl);
3916
+ }
3917
+ const mainFile = await fetchGitHubFile(owner, repo, branch, `${basePath}${manifest.file}`);
3918
+ if (!mainFile) {
3919
+ throw new GitHubInstallError(
3920
+ `Main file '${manifest.file}' referenced in manifest.json not found.`,
3921
+ repoUrl
3922
+ );
3923
+ }
3924
+ content = mainFile;
3925
+ } else {
3926
+ let foundType = null;
3927
+ let foundFileName = null;
3928
+ let foundContent = null;
3929
+ for (const type of COGNITIVE_TYPES) {
3930
+ const fileName = COGNITIVE_FILE_NAMES[type];
3931
+ const fileContent = await fetchGitHubFile(owner, repo, branch, `${basePath}${fileName}`);
3932
+ if (fileContent) {
3933
+ foundType = type;
3934
+ foundFileName = fileName;
3935
+ foundContent = fileContent;
3936
+ break;
3937
+ }
3938
+ }
3939
+ if (!foundType || !foundFileName || !foundContent) {
3940
+ throw new GitHubInstallError(
3941
+ "No cognitive file found in repository. Expected SKILL.md, AGENT.md, PROMPT.md, WORKFLOW.yaml, or TOOL.md.",
3942
+ repoUrl
3943
+ );
3944
+ }
3945
+ content = foundContent;
3946
+ const metadata = parseMetadata(content);
3947
+ const cognitiveType = options.type ?? foundType;
3948
+ const name = metadata["name"] ?? source.name;
3949
+ const category2 = options.category ?? metadata["category"] ?? "general";
3950
+ manifest = {
3951
+ name,
3952
+ type: cognitiveType,
3953
+ version: metadata["version"] ?? "1.0.0",
3954
+ description: metadata["description"] ?? "",
3955
+ author: metadata["author"] ?? `${owner}`,
3956
+ license: metadata["license"] ?? "MIT",
3957
+ category: category2,
3958
+ tags: metadata["tags"] ?? [],
3959
+ providers: metadata["providers"] ?? [],
3960
+ file: foundFileName,
3961
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3962
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
3963
+ };
3964
+ }
3965
+ if (options.type) {
3966
+ manifest.type = options.type;
3967
+ }
3968
+ if (options.category) {
3969
+ manifest.category = options.category;
3970
+ }
3971
+ const category = manifest.category;
3972
+ const targetDir = getTargetDir(configManager, manifest.type, category, manifest.name);
3973
+ if (fs9.existsSync(targetDir) && options.force !== true) {
3974
+ logger.line();
3975
+ logger.error(`Cognitive '${manifest.name}' is already installed.`);
3976
+ logger.hint("Use --force to overwrite.");
3977
+ return false;
3978
+ }
3979
+ const assets = /* @__PURE__ */ new Map();
3980
+ saveCognitive(targetDir, manifest, content, assets);
3981
+ updateProjectManifest(configManager, manifest, "github", repoUrl);
3806
3982
  logger.line();
3807
- logger.error("GitHub installation is not yet fully implemented.");
3808
- logger.hint("For now, clone the repo locally and use: synapsync add ./path/to/cognitive");
3809
- return false;
3983
+ logger.log(
3984
+ ` ${pc9.green("\u2713")} Installed ${pc9.bold(manifest.name)} ${pc9.dim(`v${manifest.version}`)}`
3985
+ );
3986
+ logger.log(` ${pc9.dim("Type:")} ${manifest.type}`);
3987
+ logger.log(` ${pc9.dim("Category:")} ${category}`);
3988
+ logger.log(` ${pc9.dim("Source:")} github`);
3989
+ logger.log(` ${pc9.dim("Location:")} ${path11.relative(process.cwd(), targetDir)}`);
3990
+ return true;
3810
3991
  }
3811
3992
  function getTargetDir(configManager, type, category, name) {
3812
3993
  const synapSyncDir = configManager.getSynapSyncDir();
@@ -3823,7 +4004,7 @@ function saveCognitive(targetDir, manifest, content, assets) {
3823
4004
  fs9.writeFileSync(fullPath, assetContent, "utf-8");
3824
4005
  }
3825
4006
  }
3826
- function updateProjectManifest(configManager, manifest, source) {
4007
+ function updateProjectManifest(configManager, manifest, source, sourceUrl) {
3827
4008
  const synapSyncDir = configManager.getSynapSyncDir();
3828
4009
  const manifestPath = path11.join(synapSyncDir, "manifest.json");
3829
4010
  let projectManifest;
@@ -3847,7 +4028,9 @@ function updateProjectManifest(configManager, manifest, source) {
3847
4028
  installedAt: /* @__PURE__ */ new Date(),
3848
4029
  source: mappedSource
3849
4030
  };
3850
- if (source === "registry") {
4031
+ if (sourceUrl) {
4032
+ entry.sourceUrl = sourceUrl;
4033
+ } else if (source === "registry") {
3851
4034
  entry.sourceUrl = "https://github.com/SynapSync/synapse-registry";
3852
4035
  }
3853
4036
  projectManifest.cognitives[manifest.name] = entry;
@@ -3877,7 +4060,7 @@ async function executeListCommand(options) {
3877
4060
  logger.hint("Run synapsync init to initialize a project first.");
3878
4061
  return;
3879
4062
  }
3880
- const validatedOptions = validateOptions2(options);
4063
+ const validatedOptions = validateOptions(options);
3881
4064
  if (validatedOptions === null) {
3882
4065
  return;
3883
4066
  }
@@ -3895,7 +4078,7 @@ async function listRemoteCognitives(options) {
3895
4078
  logger.log(` ${pc10.dim("Fetching registry...")}`);
3896
4079
  try {
3897
4080
  const cognitives = await client.list();
3898
- const validatedOptions = validateOptions2(options);
4081
+ const validatedOptions = validateOptions(options);
3899
4082
  if (validatedOptions === null) {
3900
4083
  return;
3901
4084
  }
@@ -3906,7 +4089,9 @@ async function listRemoteCognitives(options) {
3906
4089
  }
3907
4090
  displayRemoteCognitives(filtered);
3908
4091
  } catch (error) {
3909
- logger.error(`Failed to fetch registry: ${error instanceof Error ? error.message : "Unknown error"}`);
4092
+ logger.error(
4093
+ `Failed to fetch registry: ${error instanceof Error ? error.message : "Unknown error"}`
4094
+ );
3910
4095
  }
3911
4096
  }
3912
4097
  function filterRemoteCognitives(cognitives, options) {
@@ -3917,6 +4102,12 @@ function filterRemoteCognitives(cognitives, options) {
3917
4102
  if (options.category !== void 0 && c.category !== options.category) {
3918
4103
  return false;
3919
4104
  }
4105
+ if (options.tag !== void 0) {
4106
+ const tag = options.tag;
4107
+ if (!c.tags.some((t) => t.toLowerCase() === tag.toLowerCase())) {
4108
+ return false;
4109
+ }
4110
+ }
3920
4111
  return true;
3921
4112
  });
3922
4113
  }
@@ -3934,9 +4125,11 @@ function displayRemoteCognitives(cognitives) {
3934
4125
  grouped[cognitive.type].push(cognitive);
3935
4126
  }
3936
4127
  for (const [type, items] of Object.entries(grouped)) {
3937
- const typeIcon = getCognitiveIcon3(type);
4128
+ const typeIcon = getCognitiveIcon2(type);
3938
4129
  const typeLabel = `${type}s`;
3939
- logger.log(` ${typeIcon} ${pc10.bold(typeLabel.charAt(0).toUpperCase() + typeLabel.slice(1))} (${items.length})`);
4130
+ logger.log(
4131
+ ` ${typeIcon} ${pc10.bold(typeLabel.charAt(0).toUpperCase() + typeLabel.slice(1))} (${items.length})`
4132
+ );
3940
4133
  logger.line();
3941
4134
  for (const cognitive of items) {
3942
4135
  logger.log(` ${pc10.white(cognitive.name)} ${pc10.dim(`v${cognitive.version}`)}`);
@@ -3957,11 +4150,13 @@ function displayRemoteCognitives(cognitives) {
3957
4150
  logger.line();
3958
4151
  }
3959
4152
  }
3960
- logger.log(` ${pc10.dim(`Total: ${cognitives.length} cognitive${cognitives.length === 1 ? "" : "s"} available`)}`);
4153
+ logger.log(
4154
+ ` ${pc10.dim(`Total: ${cognitives.length} cognitive${cognitives.length === 1 ? "" : "s"} available`)}`
4155
+ );
3961
4156
  logger.line();
3962
4157
  logger.hint("Run synapsync add <name> to add a cognitive.");
3963
4158
  }
3964
- function validateOptions2(options) {
4159
+ function validateOptions(options) {
3965
4160
  const validated = {};
3966
4161
  if (options.type !== void 0) {
3967
4162
  if (!COGNITIVE_TYPES.includes(options.type)) {
@@ -3979,6 +4174,9 @@ function validateOptions2(options) {
3979
4174
  }
3980
4175
  validated.category = options.category;
3981
4176
  }
4177
+ if (options.tag !== void 0) {
4178
+ validated.tag = options.tag;
4179
+ }
3982
4180
  return validated;
3983
4181
  }
3984
4182
  function readManifest(configManager) {
@@ -4024,7 +4222,7 @@ function displayCognitives(manifest, options) {
4024
4222
  if (cognitives.length === 0) {
4025
4223
  logger.log(` ${pc10.dim("No cognitives installed yet.")}`);
4026
4224
  logger.line();
4027
- logger.hint("Run synapsync search to find cognitives to add.");
4225
+ logger.hint("Run synapsync list --remote to browse available cognitives.");
4028
4226
  } else {
4029
4227
  logger.log(` ${pc10.dim("No cognitives match the specified filters.")}`);
4030
4228
  logger.line();
@@ -4034,16 +4232,20 @@ function displayCognitives(manifest, options) {
4034
4232
  }
4035
4233
  const grouped = groupByType(filtered);
4036
4234
  for (const [type, items] of Object.entries(grouped)) {
4037
- const typeIcon = getCognitiveIcon3(type);
4235
+ const typeIcon = getCognitiveIcon2(type);
4038
4236
  const typeLabel = `${type}s`;
4039
- logger.log(` ${typeIcon} ${pc10.bold(typeLabel.charAt(0).toUpperCase() + typeLabel.slice(1))} (${items.length})`);
4237
+ logger.log(
4238
+ ` ${typeIcon} ${pc10.bold(typeLabel.charAt(0).toUpperCase() + typeLabel.slice(1))} (${items.length})`
4239
+ );
4040
4240
  logger.line();
4041
4241
  for (const cognitive of items) {
4042
- displayCognitive2(cognitive);
4242
+ displayCognitive(cognitive);
4043
4243
  }
4044
4244
  }
4045
4245
  logger.line();
4046
- logger.log(` ${pc10.dim(`Total: ${filtered.length} cognitive${filtered.length === 1 ? "" : "s"}`)}`);
4246
+ logger.log(
4247
+ ` ${pc10.dim(`Total: ${filtered.length} cognitive${filtered.length === 1 ? "" : "s"}`)}`
4248
+ );
4047
4249
  logger.line();
4048
4250
  logger.hint("Run synapsync uninstall <name> to remove a cognitive.");
4049
4251
  }
@@ -4055,7 +4257,7 @@ function groupByType(cognitives) {
4055
4257
  }
4056
4258
  return grouped;
4057
4259
  }
4058
- function displayCognitive2(cognitive) {
4260
+ function displayCognitive(cognitive) {
4059
4261
  logger.log(` ${pc10.white(cognitive.name)} ${pc10.dim(`v${cognitive.version}`)}`);
4060
4262
  const details = [];
4061
4263
  details.push(pc10.dim(cognitive.category));
@@ -4067,7 +4269,7 @@ function displayCognitive2(cognitive) {
4067
4269
  logger.log(` ${details.join(" \xB7 ")}`);
4068
4270
  logger.line();
4069
4271
  }
4070
- function getCognitiveIcon3(type) {
4272
+ function getCognitiveIcon2(type) {
4071
4273
  const icons = {
4072
4274
  skill: pc10.blue("\u25C6"),
4073
4275
  agent: pc10.magenta("\u25C6"),
@@ -4095,7 +4297,7 @@ function formatDate(date) {
4095
4297
  }
4096
4298
  }
4097
4299
  function registerListCommand(program) {
4098
- program.command("list").alias("ls").description("List installed cognitives or browse registry").option("-t, --type <type>", "Filter by type (skill, agent, prompt, workflow, tool)").option("-c, --category <category>", "Filter by category").option("-r, --remote", "List all cognitives available in the registry").option("--json", "Output as JSON").action(async (options) => {
4300
+ program.command("list").alias("ls").description("List installed cognitives or browse registry").option("-t, --type <type>", "Filter by type (skill, agent, prompt, workflow, tool)").option("-c, --category <category>", "Filter by category").option("--tag <tag>", "Filter by tag (remote only)").option("-r, --remote", "List all cognitives available in the registry").option("--json", "Output as JSON").action(async (options) => {
4099
4301
  await executeListCommand(options);
4100
4302
  });
4101
4303
  }
@@ -4135,7 +4337,9 @@ function executeUninstallCommand(name, options) {
4135
4337
  const cognitiveDir = getCognitiveDir(configManager, cognitive);
4136
4338
  if (fs11.existsSync(cognitiveDir)) {
4137
4339
  fs11.rmSync(cognitiveDir, { recursive: true, force: true });
4138
- logger.log(` ${pc11.dim("Removed files from")} ${path13.relative(process.cwd(), cognitiveDir)}`);
4340
+ logger.log(
4341
+ ` ${pc11.dim("Removed files from")} ${path13.relative(process.cwd(), cognitiveDir)}`
4342
+ );
4139
4343
  }
4140
4344
  }
4141
4345
  delete manifest.cognitives[name];
@@ -4204,7 +4408,7 @@ function executeSyncCommand(options) {
4204
4408
  logger.hint("Run synapsync init to initialize a project first.");
4205
4409
  return;
4206
4410
  }
4207
- const validatedOptions = validateOptions3(options);
4411
+ const validatedOptions = validateOptions2(options);
4208
4412
  if (validatedOptions === null) {
4209
4413
  return;
4210
4414
  }
@@ -4247,7 +4451,7 @@ function executeSyncCommand(options) {
4247
4451
  }
4248
4452
  displayResults(result, options);
4249
4453
  }
4250
- function validateOptions3(options) {
4454
+ function validateOptions2(options) {
4251
4455
  const validated = {};
4252
4456
  if (options.type !== void 0) {
4253
4457
  if (!COGNITIVE_TYPES.includes(options.type)) {
@@ -4278,15 +4482,15 @@ function validateOptions3(options) {
4278
4482
  function displayResults(result, options) {
4279
4483
  const hasManifestChanges = result.added > 0 || result.removed > 0 || result.updated > 0;
4280
4484
  const hasProviderResults = result.providerResults !== void 0 && result.providerResults.length > 0;
4281
- const hasProviderChanges = hasProviderResults && result.providerResults?.some(
4282
- (pr) => pr.created.length > 0 || pr.removed.length > 0
4283
- );
4485
+ const hasProviderChanges = hasProviderResults && result.providerResults?.some((pr) => pr.created.length > 0 || pr.removed.length > 0);
4284
4486
  if (!hasManifestChanges && hasProviderChanges !== true) {
4285
4487
  logger.log(` ${pc12.green("\u2713")} Everything is in sync`);
4286
4488
  logger.line();
4287
4489
  logger.log(` ${pc12.dim(`${result.total} cognitives in manifest`)}`);
4288
4490
  if (hasProviderResults && result.providerResults !== void 0) {
4289
- const syncedProviders = result.providerResults.filter((pr) => pr.skipped.length > 0 || pr.created.length > 0);
4491
+ const syncedProviders = result.providerResults.filter(
4492
+ (pr) => pr.skipped.length > 0 || pr.created.length > 0
4493
+ );
4290
4494
  if (syncedProviders.length > 0) {
4291
4495
  logger.log(` ${pc12.dim(`${syncedProviders.length} provider(s) synced`)}`);
4292
4496
  }
@@ -4613,7 +4817,9 @@ async function executeUpdateCommand(cognitiveName, options = {}) {
4613
4817
  return;
4614
4818
  }
4615
4819
  if (cognitive.source !== "registry") {
4616
- logger.error(`Cognitive '${cognitiveName}' was installed locally and cannot be updated from registry.`);
4820
+ logger.error(
4821
+ `Cognitive '${cognitiveName}' was installed locally and cannot be updated from registry.`
4822
+ );
4617
4823
  return;
4618
4824
  }
4619
4825
  const updateInfo = await checker.checkOne(cognitive);
@@ -4654,12 +4860,7 @@ async function executeUpdateCommand(cognitiveName, options = {}) {
4654
4860
  const downloaded = await registry.download(update.name);
4655
4861
  const manifestEntry = installed.find((c) => c.name === update.name);
4656
4862
  if (manifestEntry === void 0) continue;
4657
- const targetDir = path14.join(
4658
- synapSyncDir,
4659
- `${update.type}s`,
4660
- update.category,
4661
- update.name
4662
- );
4863
+ const targetDir = path14.join(synapSyncDir, `${update.type}s`, update.category, update.name);
4663
4864
  const fileName = COGNITIVE_FILE_NAMES[update.type];
4664
4865
  const filePath = path14.join(targetDir, fileName);
4665
4866
  if (!fs12.existsSync(targetDir)) {
@@ -4676,7 +4877,9 @@ async function executeUpdateCommand(cognitiveName, options = {}) {
4676
4877
  name: update.name,
4677
4878
  error: error instanceof Error ? error.message : "Unknown error"
4678
4879
  });
4679
- logger.log(` ${pc13.red("\u2717")} Failed: ${error instanceof Error ? error.message : "Unknown error"}`);
4880
+ logger.log(
4881
+ ` ${pc13.red("\u2717")} Failed: ${error instanceof Error ? error.message : "Unknown error"}`
4882
+ );
4680
4883
  }
4681
4884
  }
4682
4885
  manifest.save();
@@ -5589,10 +5792,14 @@ function executeCleanCommand(options = {}) {
5589
5792
  if (result.cleaned.length === 0) {
5590
5793
  logger.log(` ${pc15.green("\u2713")} Nothing to clean`);
5591
5794
  } else if (options.dryRun === true) {
5592
- logger.log(` ${pc15.dim(`Would clean ${result.cleaned.length} item(s), freeing ${result.sizeFreed}`)}`);
5795
+ logger.log(
5796
+ ` ${pc15.dim(`Would clean ${result.cleaned.length} item(s), freeing ${result.sizeFreed}`)}`
5797
+ );
5593
5798
  logger.hint("Run synapsync clean without --dry-run to apply changes.");
5594
5799
  } else {
5595
- logger.log(` ${pc15.green("\u2713")} Cleaned ${result.cleaned.length} item(s), freed ${result.sizeFreed}`);
5800
+ logger.log(
5801
+ ` ${pc15.green("\u2713")} Cleaned ${result.cleaned.length} item(s), freed ${result.sizeFreed}`
5802
+ );
5596
5803
  }
5597
5804
  if (result.errors.length > 0) {
5598
5805
  logger.log(` ${pc15.red("!")} ${result.errors.length} error(s) occurred`);
@@ -5807,90 +6014,7 @@ function registerPurgeCommand(program) {
5807
6014
  });
5808
6015
  }
5809
6016
 
5810
- // src/ui/repl.ts
5811
- var COMMANDS = {};
5812
- function registerInteractiveCommand(name, description, handler, options) {
5813
- const def = { description, handler };
5814
- if (options?.usage !== void 0) def.usage = options.usage;
5815
- if (options?.options !== void 0) def.options = options.options;
5816
- if (options?.examples !== void 0) def.examples = options.examples;
5817
- COMMANDS[name] = def;
5818
- }
5819
- function showCommandHelp(commandName) {
5820
- const cmd = COMMANDS[commandName];
5821
- if (!cmd) {
5822
- showError(`Unknown command: /${commandName}`);
5823
- return;
5824
- }
5825
- logger.line();
5826
- logger.log(pc17.bold(pc17.cyan(` /${commandName}`)) + pc17.dim(` - ${cmd.description}`));
5827
- logger.line();
5828
- if (cmd.usage) {
5829
- logger.log(pc17.bold(" Usage:"));
5830
- logger.log(` ${pc17.cyan(cmd.usage)}`);
5831
- logger.line();
5832
- }
5833
- if (cmd.options && cmd.options.length > 0) {
5834
- logger.log(pc17.bold(" Options:"));
5835
- for (const opt of cmd.options) {
5836
- logger.log(` ${pc17.yellow(opt.flag.padEnd(16))} ${pc17.dim(opt.description)}`);
5837
- }
5838
- logger.line();
5839
- }
5840
- if (cmd.examples && cmd.examples.length > 0) {
5841
- logger.log(pc17.bold(" Examples:"));
5842
- for (const example of cmd.examples) {
5843
- logger.log(` ${pc17.dim("$")} ${pc17.cyan(example)}`);
5844
- }
5845
- logger.line();
5846
- }
5847
- }
5848
- registerInteractiveCommand(
5849
- "help",
5850
- "Show available commands or help for a specific command",
5851
- (args) => {
5852
- const commandName = args.trim().toLowerCase().replace(/^\//, "");
5853
- if (commandName) {
5854
- showCommandHelp(commandName);
5855
- return;
5856
- }
5857
- logger.line();
5858
- logger.bold(" Available Commands:");
5859
- logger.line();
5860
- logger.log(` ${pc17.cyan("/help [command]")} ${pc17.dim("Show help (or help for a command)")}`);
5861
- logger.log(` ${pc17.cyan("/clear")} ${pc17.dim("Clear the screen")}`);
5862
- logger.log(` ${pc17.cyan("/exit")} ${pc17.dim("Exit interactive mode")}`);
5863
- logger.line();
5864
- const categories = {
5865
- "Information": ["info", "version"],
5866
- "Project": ["init", "config", "status"],
5867
- "Providers": ["providers"],
5868
- "Cognitives": ["search", "add", "list", "uninstall"],
5869
- "Sync": ["sync"],
5870
- "Maintenance": ["update", "doctor", "clean", "purge"]
5871
- };
5872
- for (const [category, cmds] of Object.entries(categories)) {
5873
- const availableCmds = cmds.filter((name) => COMMANDS[name]);
5874
- if (availableCmds.length > 0) {
5875
- logger.bold(` ${category}:`);
5876
- for (const name of availableCmds) {
5877
- const cmd = COMMANDS[name];
5878
- const hasOptions = cmd?.options !== void 0 && cmd.options.length > 0;
5879
- const paddedName = `/${name}`.padEnd(18);
5880
- const optionsHint = hasOptions ? pc17.yellow(" [options]") : "";
5881
- logger.log(` ${pc17.cyan(paddedName)} ${pc17.dim(cmd?.description ?? "")}${optionsHint}`);
5882
- }
5883
- logger.line();
5884
- }
5885
- }
5886
- logger.hint("Tip: Use /help <command> for detailed help. Example: /help info");
5887
- logger.line();
5888
- },
5889
- {
5890
- usage: "/help [command]",
5891
- examples: ["/help", "/help info", "/help add"]
5892
- }
5893
- );
6017
+ // src/ui/repl/commands.ts
5894
6018
  registerInteractiveCommand("clear", "Clear the screen", (_args) => {
5895
6019
  logger.clear();
5896
6020
  showBanner();
@@ -5920,6 +6044,15 @@ registerInteractiveCommand(
5920
6044
  examples: ["/info", "/info --cognitives", "/info --add"]
5921
6045
  }
5922
6046
  );
6047
+ registerInteractiveCommand("version", "Show version information", async (_args) => {
6048
+ const { version: version2 } = await Promise.resolve().then(() => (init_version(), version_exports));
6049
+ logger.line();
6050
+ logger.log(`${pc17.bold("SynapSync CLI")} ${pc17.cyan(`v${version2}`)}`);
6051
+ logger.line();
6052
+ logger.label("Node.js", process.version);
6053
+ logger.label("Platform", `${process.platform} ${process.arch}`);
6054
+ logger.line();
6055
+ });
5923
6056
  registerInteractiveCommand(
5924
6057
  "init",
5925
6058
  "Initialize a new SynapSync project",
@@ -5984,64 +6117,16 @@ registerInteractiveCommand(
5984
6117
  ]
5985
6118
  }
5986
6119
  );
5987
- registerInteractiveCommand(
5988
- "search",
5989
- "Search for cognitives in the registry",
5990
- async (args) => {
5991
- const parts = args.split(/\s+/);
5992
- let query;
5993
- const options = {};
5994
- for (let i = 0; i < parts.length; i++) {
5995
- const part = parts[i];
5996
- if (part === void 0 || part === "") continue;
5997
- if (part === "--type" || part === "-t") {
5998
- options["type"] = parts[++i] ?? "";
5999
- } else if (part === "--category" || part === "-c") {
6000
- options["category"] = parts[++i] ?? "";
6001
- } else if (part === "--tag") {
6002
- options["tag"] = parts[++i] ?? "";
6003
- } else if (part === "--limit" || part === "-l") {
6004
- options["limit"] = parts[++i] ?? "20";
6005
- } else if (part === "--json") {
6006
- options["json"] = true;
6007
- } else if (!part.startsWith("-")) {
6008
- query = part;
6009
- }
6010
- }
6011
- await executeSearchCommand(query, options);
6012
- },
6013
- {
6014
- usage: "/search [query] [options]",
6015
- options: [
6016
- { flag: "-t, --type <type>", description: "Filter by type (skill, agent, prompt, etc.)" },
6017
- { flag: "-c, --category <cat>", description: "Filter by category" },
6018
- { flag: "--tag <tag>", description: "Filter by tag" },
6019
- { flag: "-l, --limit <n>", description: "Limit results (default: 20)" },
6020
- { flag: "--json", description: "Output as JSON" }
6021
- ],
6022
- examples: ["/search", "/search react", "/search --type skill", "/search api --category backend"]
6023
- }
6024
- );
6025
6120
  registerInteractiveCommand(
6026
6121
  "add",
6027
6122
  "Add a cognitive from registry, local path, or GitHub",
6028
6123
  async (args) => {
6029
- const parts = args.split(/\s+/);
6030
- let source;
6031
- const options = {};
6032
- for (let i = 0; i < parts.length; i++) {
6033
- const part = parts[i];
6034
- if (part === void 0 || part === "") continue;
6035
- if (part === "--type" || part === "-t") {
6036
- options["type"] = parts[++i] ?? "";
6037
- } else if (part === "--category" || part === "-c") {
6038
- options["category"] = parts[++i] ?? "";
6039
- } else if (part === "--force" || part === "-f") {
6040
- options["force"] = true;
6041
- } else if (!part.startsWith("-")) {
6042
- source = part;
6043
- }
6044
- }
6124
+ const { positional, options } = parseArgs(args, [
6125
+ { flags: ["--type", "-t"], key: "type", type: "string" },
6126
+ { flags: ["--category", "-c"], key: "category", type: "string" },
6127
+ { flags: ["--force", "-f"], key: "force", type: "boolean" }
6128
+ ]);
6129
+ const source = positional[0];
6045
6130
  if (source === void 0 || source === "") {
6046
6131
  logger.error("Please specify a cognitive to add.");
6047
6132
  logger.hint("Usage: /add <name|path|github:user/repo>");
@@ -6068,21 +6153,13 @@ registerInteractiveCommand(
6068
6153
  "list",
6069
6154
  "List installed cognitives or browse registry",
6070
6155
  async (args) => {
6071
- const parts = args.split(/\s+/);
6072
- const options = {};
6073
- for (let i = 0; i < parts.length; i++) {
6074
- const part = parts[i];
6075
- if (part === void 0 || part === "") continue;
6076
- if (part === "--type" || part === "-t") {
6077
- options["type"] = parts[++i] ?? "";
6078
- } else if (part === "--category" || part === "-c") {
6079
- options["category"] = parts[++i] ?? "";
6080
- } else if (part === "--remote" || part === "-r") {
6081
- options["remote"] = true;
6082
- } else if (part === "--json") {
6083
- options["json"] = true;
6084
- }
6085
- }
6156
+ const { options } = parseArgs(args, [
6157
+ { flags: ["--type", "-t"], key: "type", type: "string" },
6158
+ { flags: ["--category", "-c"], key: "category", type: "string" },
6159
+ { flags: ["--tag"], key: "tag", type: "string" },
6160
+ { flags: ["--remote", "-r"], key: "remote", type: "boolean" },
6161
+ { flags: ["--json"], key: "json", type: "boolean" }
6162
+ ]);
6086
6163
  await executeListCommand(options);
6087
6164
  },
6088
6165
  {
@@ -6090,30 +6167,27 @@ registerInteractiveCommand(
6090
6167
  options: [
6091
6168
  { flag: "-t, --type <type>", description: "Filter by type (skill, agent, prompt, etc.)" },
6092
6169
  { flag: "-c, --category <cat>", description: "Filter by category" },
6170
+ { flag: "--tag <tag>", description: "Filter by tag (remote only)" },
6093
6171
  { flag: "-r, --remote", description: "Browse all cognitives in registry" },
6094
6172
  { flag: "--json", description: "Output as JSON" }
6095
6173
  ],
6096
- examples: ["/list", "/list --remote", "/list --type skill", "/list --category backend"]
6174
+ examples: [
6175
+ "/list",
6176
+ "/list --remote",
6177
+ "/list --remote --category planning",
6178
+ "/list --type skill"
6179
+ ]
6097
6180
  }
6098
6181
  );
6099
6182
  registerInteractiveCommand(
6100
6183
  "uninstall",
6101
6184
  "Uninstall a cognitive",
6102
6185
  (args) => {
6103
- const parts = args.split(/\s+/);
6104
- let name;
6105
- const options = {};
6106
- for (let i = 0; i < parts.length; i++) {
6107
- const part = parts[i];
6108
- if (part === void 0 || part === "") continue;
6109
- if (part === "--force" || part === "-f") {
6110
- options["force"] = true;
6111
- } else if (part === "--keep-files") {
6112
- options["keepFiles"] = true;
6113
- } else if (!part.startsWith("-")) {
6114
- name = part;
6115
- }
6116
- }
6186
+ const { positional, options } = parseArgs(args, [
6187
+ { flags: ["--force", "-f"], key: "force", type: "boolean" },
6188
+ { flags: ["--keep-files"], key: "keepFiles", type: "boolean" }
6189
+ ]);
6190
+ const name = positional[0];
6117
6191
  if (name === void 0 || name === "") {
6118
6192
  logger.error("Please specify a cognitive to uninstall.");
6119
6193
  logger.hint("Usage: /uninstall <name> [--force]");
@@ -6134,33 +6208,17 @@ registerInteractiveCommand(
6134
6208
  "sync",
6135
6209
  "Sync cognitives to providers",
6136
6210
  (args) => {
6137
- const parts = args.split(/\s+/);
6138
- const options = {};
6139
- let subcommand;
6140
- for (let i = 0; i < parts.length; i++) {
6141
- const part = parts[i];
6142
- if (part === void 0 || part === "") continue;
6143
- if (part === "status") {
6144
- subcommand = "status";
6145
- } else if (part === "--dry-run" || part === "-n") {
6146
- options["dryRun"] = true;
6147
- } else if (part === "--type" || part === "-t") {
6148
- options["type"] = parts[++i] ?? "";
6149
- } else if (part === "--category" || part === "-c") {
6150
- options["category"] = parts[++i] ?? "";
6151
- } else if (part === "--provider" || part === "-p") {
6152
- options["provider"] = parts[++i] ?? "";
6153
- } else if (part === "--copy") {
6154
- options["copy"] = true;
6155
- } else if (part === "--force" || part === "-f") {
6156
- options["force"] = true;
6157
- } else if (part === "--verbose" || part === "-v") {
6158
- options["verbose"] = true;
6159
- } else if (part === "--json") {
6160
- options["json"] = true;
6161
- }
6162
- }
6163
- if (subcommand === "status") {
6211
+ const { positional, options } = parseArgs(args, [
6212
+ { flags: ["--dry-run", "-n"], key: "dryRun", type: "boolean" },
6213
+ { flags: ["--type", "-t"], key: "type", type: "string" },
6214
+ { flags: ["--category", "-c"], key: "category", type: "string" },
6215
+ { flags: ["--provider", "-p"], key: "provider", type: "string" },
6216
+ { flags: ["--copy"], key: "copy", type: "boolean" },
6217
+ { flags: ["--force", "-f"], key: "force", type: "boolean" },
6218
+ { flags: ["--verbose", "-v"], key: "verbose", type: "boolean" },
6219
+ { flags: ["--json"], key: "json", type: "boolean" }
6220
+ ]);
6221
+ if (positional[0] === "status") {
6164
6222
  executeSyncStatusCommand({ json: options["json"] === true });
6165
6223
  } else {
6166
6224
  executeSyncCommand(options);
@@ -6186,25 +6244,13 @@ registerInteractiveCommand(
6186
6244
  "update",
6187
6245
  "Update installed cognitives",
6188
6246
  async (args) => {
6189
- const parts = args.split(/\s+/);
6190
- let name;
6191
- const options = {};
6192
- for (let i = 0; i < parts.length; i++) {
6193
- const part = parts[i];
6194
- if (part === void 0 || part === "") continue;
6195
- if (part === "--all" || part === "-a") {
6196
- options["all"] = true;
6197
- } else if (part === "--force" || part === "-f") {
6198
- options["force"] = true;
6199
- } else if (part === "--dry-run" || part === "-n") {
6200
- options["dryRun"] = true;
6201
- } else if (part === "--json") {
6202
- options["json"] = true;
6203
- } else if (!part.startsWith("-")) {
6204
- name = part;
6205
- }
6206
- }
6207
- await executeUpdateCommand(name, options);
6247
+ const { positional, options } = parseArgs(args, [
6248
+ { flags: ["--all", "-a"], key: "all", type: "boolean" },
6249
+ { flags: ["--force", "-f"], key: "force", type: "boolean" },
6250
+ { flags: ["--dry-run", "-n"], key: "dryRun", type: "boolean" },
6251
+ { flags: ["--json"], key: "json", type: "boolean" }
6252
+ ]);
6253
+ await executeUpdateCommand(positional[0], options);
6208
6254
  },
6209
6255
  {
6210
6256
  usage: "/update [name] [options]",
@@ -6221,19 +6267,11 @@ registerInteractiveCommand(
6221
6267
  "doctor",
6222
6268
  "Check project health and diagnose issues",
6223
6269
  async (args) => {
6224
- const parts = args.split(/\s+/);
6225
- const options = {};
6226
- for (let i = 0; i < parts.length; i++) {
6227
- const part = parts[i];
6228
- if (part === void 0 || part === "") continue;
6229
- if (part === "--fix") {
6230
- options["fix"] = true;
6231
- } else if (part === "--verbose" || part === "-v") {
6232
- options["verbose"] = true;
6233
- } else if (part === "--json") {
6234
- options["json"] = true;
6235
- }
6236
- }
6270
+ const { options } = parseArgs(args, [
6271
+ { flags: ["--fix"], key: "fix", type: "boolean" },
6272
+ { flags: ["--verbose", "-v"], key: "verbose", type: "boolean" },
6273
+ { flags: ["--json"], key: "json", type: "boolean" }
6274
+ ]);
6237
6275
  await executeDoctorCommand(options);
6238
6276
  },
6239
6277
  {
@@ -6250,21 +6288,12 @@ registerInteractiveCommand(
6250
6288
  "clean",
6251
6289
  "Remove orphaned files and fix broken symlinks",
6252
6290
  (args) => {
6253
- const parts = args.split(/\s+/);
6254
- const options = {};
6255
- for (let i = 0; i < parts.length; i++) {
6256
- const part = parts[i];
6257
- if (part === void 0 || part === "") continue;
6258
- if (part === "--dry-run" || part === "-n") {
6259
- options["dryRun"] = true;
6260
- } else if (part === "--force" || part === "-f") {
6261
- options["force"] = true;
6262
- } else if (part === "--verbose" || part === "-v") {
6263
- options["verbose"] = true;
6264
- } else if (part === "--json") {
6265
- options["json"] = true;
6266
- }
6267
- }
6291
+ const { options } = parseArgs(args, [
6292
+ { flags: ["--dry-run", "-n"], key: "dryRun", type: "boolean" },
6293
+ { flags: ["--force", "-f"], key: "force", type: "boolean" },
6294
+ { flags: ["--verbose", "-v"], key: "verbose", type: "boolean" },
6295
+ { flags: ["--json"], key: "json", type: "boolean" }
6296
+ ]);
6268
6297
  executeCleanCommand(options);
6269
6298
  },
6270
6299
  {
@@ -6282,32 +6311,26 @@ registerInteractiveCommand(
6282
6311
  "purge",
6283
6312
  "Completely remove SynapSync from the project",
6284
6313
  (args) => {
6285
- const parts = args.split(/\s+/);
6286
- const options = {};
6287
- for (const part of parts) {
6288
- if (part === "--force" || part === "-f") {
6289
- options["force"] = true;
6290
- }
6291
- }
6314
+ const { options } = parseArgs(args, [
6315
+ { flags: ["--force", "-f"], key: "force", type: "boolean" }
6316
+ ]);
6292
6317
  executePurgeCommand(options);
6293
6318
  },
6294
6319
  {
6295
6320
  usage: "/purge [options]",
6296
- options: [
6297
- { flag: "-f, --force", description: "Skip confirmation and remove everything" }
6298
- ],
6321
+ options: [{ flag: "-f, --force", description: "Skip confirmation and remove everything" }],
6299
6322
  examples: ["/purge", "/purge --force"]
6300
6323
  }
6301
6324
  );
6302
- registerInteractiveCommand("version", "Show version information", async (_args) => {
6303
- const { version: version2 } = await Promise.resolve().then(() => (init_version(), version_exports));
6304
- logger.line();
6305
- logger.log(`${pc17.bold("SynapSync CLI")} ${pc17.cyan(`v${version2}`)}`);
6306
- logger.line();
6307
- logger.label("Node.js", process.version);
6308
- logger.label("Platform", `${process.platform} ${process.arch}`);
6309
- logger.line();
6310
- });
6325
+
6326
+ // src/ui/repl/loop.ts
6327
+ init_esm_shims();
6328
+ import * as readline from "readline";
6329
+ import pc19 from "picocolors";
6330
+
6331
+ // src/ui/repl/dispatcher.ts
6332
+ init_esm_shims();
6333
+ import pc18 from "picocolors";
6311
6334
  async function executeCommand(input) {
6312
6335
  const trimmed = input.trim();
6313
6336
  if (!trimmed) {
@@ -6315,7 +6338,7 @@ async function executeCommand(input) {
6315
6338
  }
6316
6339
  if (!trimmed.startsWith("/")) {
6317
6340
  showError(`Unknown input. Commands must start with /`);
6318
- logger.log(`${pc17.dim("Type")} ${pc17.cyan("/help")} ${pc17.dim("for available commands.")}`);
6341
+ logger.log(`${pc18.dim("Type")} ${pc18.cyan("/help")} ${pc18.dim("for available commands.")}`);
6319
6342
  return;
6320
6343
  }
6321
6344
  const parts = trimmed.slice(1).split(/\s+/);
@@ -6327,7 +6350,7 @@ async function executeCommand(input) {
6327
6350
  const command = COMMANDS[commandName];
6328
6351
  if (!command) {
6329
6352
  showError(`Unknown command: /${commandName}`);
6330
- logger.log(`${pc17.dim("Type")} ${pc17.cyan("/help")} ${pc17.dim("for available commands.")}`);
6353
+ logger.log(`${pc18.dim("Type")} ${pc18.cyan("/help")} ${pc18.dim("for available commands.")}`);
6331
6354
  return;
6332
6355
  }
6333
6356
  try {
@@ -6340,16 +6363,18 @@ async function executeCommand(input) {
6340
6363
  }
6341
6364
  }
6342
6365
  }
6366
+
6367
+ // src/ui/repl/loop.ts
6343
6368
  function startInteractiveMode() {
6344
6369
  showBanner();
6345
6370
  logger.log(
6346
- `${pc17.dim("Type")} ${pc17.cyan("/help")} ${pc17.dim("for commands,")} ${pc17.cyan("/exit")} ${pc17.dim("to quit.")}`
6371
+ `${pc19.dim("Type")} ${pc19.cyan("/help")} ${pc19.dim("for commands,")} ${pc19.cyan("/exit")} ${pc19.dim("to quit.")}`
6347
6372
  );
6348
6373
  logger.line();
6349
6374
  const rl = readline.createInterface({
6350
6375
  input: process.stdin,
6351
6376
  output: process.stdout,
6352
- prompt: `${pc17.green(CLI_NAME)} ${pc17.dim(">")} `,
6377
+ prompt: `${pc19.green(CLI_NAME)} ${pc19.dim(">")} `,
6353
6378
  terminal: true
6354
6379
  });
6355
6380
  rl.on("line", (line) => {
@@ -6375,7 +6400,7 @@ init_version();
6375
6400
 
6376
6401
  // src/commands/help.ts
6377
6402
  init_esm_shims();
6378
- import pc18 from "picocolors";
6403
+ import pc20 from "picocolors";
6379
6404
  function registerHelpCommand(program) {
6380
6405
  program.command("help [command]").description("Display help for a command").action((commandName) => {
6381
6406
  if (commandName) {
@@ -6385,7 +6410,7 @@ function registerHelpCommand(program) {
6385
6410
  } else {
6386
6411
  logger.error(`Unknown command: ${commandName}`);
6387
6412
  logger.line();
6388
- logger.log(`Run ${pc18.cyan("synapsync --help")} to see available commands.`);
6413
+ logger.log(`Run ${pc20.cyan("synapsync --help")} to see available commands.`);
6389
6414
  }
6390
6415
  } else {
6391
6416
  program.outputHelp();
@@ -6396,7 +6421,7 @@ function registerHelpCommand(program) {
6396
6421
  // src/commands/version.ts
6397
6422
  init_esm_shims();
6398
6423
  init_version();
6399
- import pc19 from "picocolors";
6424
+ import pc21 from "picocolors";
6400
6425
  var PACKAGE_NAME = "synapsync";
6401
6426
  function compareVersions(a, b) {
6402
6427
  const partsA = a.split(".").map(Number);
@@ -6437,12 +6462,14 @@ async function checkForUpdates() {
6437
6462
  const comparison = compareVersions(version, latestVersion);
6438
6463
  if (comparison < 0) {
6439
6464
  logger.line();
6440
- logger.warning(`Update available: ${pc19.cyan(`v${version}`)} \u2192 ${pc19.green(`v${latestVersion}`)}`);
6465
+ logger.warning(
6466
+ `Update available: ${pc21.cyan(`v${version}`)} \u2192 ${pc21.green(`v${latestVersion}`)}`
6467
+ );
6441
6468
  logger.line();
6442
- logger.log(` Run ${pc19.cyan("npm install -g synapsync")} to update`);
6469
+ logger.log(` Run ${pc21.cyan("npm install -g synapsync")} to update`);
6443
6470
  } else if (comparison > 0) {
6444
- logger.info(`You are running a development version (${pc19.cyan(`v${version}`)})`);
6445
- logger.log(` Latest published: ${pc19.dim(`v${latestVersion}`)}`);
6471
+ logger.info(`You are running a development version (${pc21.cyan(`v${version}`)})`);
6472
+ logger.log(` Latest published: ${pc21.dim(`v${latestVersion}`)}`);
6446
6473
  } else {
6447
6474
  logger.success("You are using the latest version");
6448
6475
  }
@@ -6450,7 +6477,7 @@ async function checkForUpdates() {
6450
6477
  function registerVersionCommand(program) {
6451
6478
  program.command("version").description("Show detailed version information").option("--check", "Check for available updates").action(async (options) => {
6452
6479
  logger.line();
6453
- logger.log(`${pc19.bold("SynapSync CLI")} ${pc19.cyan(`v${version}`)}`);
6480
+ logger.log(`${pc21.bold("SynapSync CLI")} ${pc21.cyan(`v${version}`)}`);
6454
6481
  logger.line();
6455
6482
  logger.label("Node.js", process.version);
6456
6483
  logger.label("Platform", `${process.platform} ${process.arch}`);
@@ -6477,7 +6504,6 @@ function createCLI() {
6477
6504
  registerConfigCommand(program);
6478
6505
  registerStatusCommand(program);
6479
6506
  registerProvidersCommand(program);
6480
- registerSearchCommand(program);
6481
6507
  registerAddCommand(program);
6482
6508
  registerListCommand(program);
6483
6509
  registerUninstallCommand(program);