@kernelius/forge-cli 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { Command as Command7 } from "commander";
4
+ import { Command as Command8 } from "commander";
5
5
  import { readFileSync } from "fs";
6
6
  import { fileURLToPath } from "url";
7
7
  import { dirname, join as join2 } from "path";
@@ -301,11 +301,318 @@ function createAuthCommand() {
301
301
  }
302
302
 
303
303
  // src/commands/repos.ts
304
+ import { Command as Command3 } from "commander";
305
+ import chalk3 from "chalk";
306
+ import { spawn } from "child_process";
307
+
308
+ // src/commands/templates.ts
304
309
  import { Command as Command2 } from "commander";
305
310
  import chalk2 from "chalk";
306
- import { spawn } from "child_process";
311
+ var HEALTHCARE_TEMPLATES = [
312
+ {
313
+ id: "patient-record",
314
+ name: "Patient Record",
315
+ description: "FHIR-compliant patient medical record repository",
316
+ icon: "User",
317
+ orgType: "healthcare",
318
+ metadata: {
319
+ repoType: "patient-record",
320
+ tags: ["patient", "medical-record"],
321
+ domainData: {
322
+ healthcare: {
323
+ resourceType: "Patient",
324
+ fhirVersion: "R4"
325
+ }
326
+ }
327
+ },
328
+ namingPattern: "patient-{name}",
329
+ namingExample: "patient-john-doe",
330
+ initialFiles: []
331
+ },
332
+ {
333
+ id: "fhir-resource",
334
+ name: "FHIR Resource Collection",
335
+ description: "Collection of FHIR resources (observations, conditions, etc.)",
336
+ icon: "FileJson",
337
+ orgType: "healthcare",
338
+ metadata: {
339
+ repoType: "fhir",
340
+ tags: ["fhir", "resources"],
341
+ domainData: {
342
+ healthcare: {
343
+ fhirVersion: "R4"
344
+ }
345
+ }
346
+ },
347
+ namingPattern: "fhir-{resource-type}",
348
+ namingExample: "fhir-observations-2026",
349
+ initialFiles: []
350
+ },
351
+ {
352
+ id: "medical-protocol",
353
+ name: "Medical Protocol",
354
+ description: "Clinical protocol or treatment guideline",
355
+ icon: "FileText",
356
+ orgType: "healthcare",
357
+ metadata: {
358
+ repoType: "protocol",
359
+ tags: ["protocol", "guidelines"]
360
+ },
361
+ namingPattern: "protocol-{name}",
362
+ namingExample: "protocol-diabetes-management",
363
+ initialFiles: []
364
+ },
365
+ {
366
+ id: "clinical-study",
367
+ name: "Clinical Study",
368
+ description: "Clinical trial or research study data",
369
+ icon: "FlaskConical",
370
+ orgType: "healthcare",
371
+ metadata: {
372
+ repoType: "experiment",
373
+ tags: ["clinical-trial", "research"]
374
+ },
375
+ namingPattern: "study-{name}",
376
+ namingExample: "study-drug-efficacy-2026",
377
+ initialFiles: []
378
+ }
379
+ ];
380
+ var RESEARCH_TEMPLATES = [
381
+ {
382
+ id: "research-dataset",
383
+ name: "Research Dataset",
384
+ description: "Versioned research dataset with metadata",
385
+ icon: "Database",
386
+ orgType: "research",
387
+ metadata: {
388
+ repoType: "dataset",
389
+ tags: ["dataset", "data"]
390
+ },
391
+ namingPattern: "{topic}-dataset",
392
+ namingExample: "climate-data-2026",
393
+ initialFiles: []
394
+ },
395
+ {
396
+ id: "research-experiment",
397
+ name: "Research Experiment",
398
+ description: "Experimental study with methodology and results",
399
+ icon: "FlaskConical",
400
+ orgType: "research",
401
+ metadata: {
402
+ repoType: "experiment",
403
+ tags: ["experiment", "study"]
404
+ },
405
+ namingPattern: "experiment-{name}",
406
+ namingExample: "experiment-protein-analysis",
407
+ initialFiles: []
408
+ },
409
+ {
410
+ id: "research-publication",
411
+ name: "Research Publication",
412
+ description: "Academic paper with LaTeX source and supplementary materials",
413
+ icon: "BookOpen",
414
+ orgType: "research",
415
+ metadata: {
416
+ repoType: "publication",
417
+ tags: ["paper", "publication"]
418
+ },
419
+ namingPattern: "paper-{title}",
420
+ namingExample: "paper-ml-genomics-2026",
421
+ initialFiles: []
422
+ },
423
+ {
424
+ id: "research-analysis",
425
+ name: "Data Analysis",
426
+ description: "Statistical analysis and computational notebooks",
427
+ icon: "TrendingUp",
428
+ orgType: "research",
429
+ metadata: {
430
+ repoType: "analysis",
431
+ tags: ["analysis", "statistics"]
432
+ },
433
+ namingPattern: "analysis-{topic}",
434
+ namingExample: "analysis-gene-expression",
435
+ initialFiles: []
436
+ }
437
+ ];
438
+ var COMPANY_TEMPLATES = [
439
+ {
440
+ id: "code-repository",
441
+ name: "Code Repository",
442
+ description: "Standard software project",
443
+ icon: "Code",
444
+ orgType: "company",
445
+ metadata: {
446
+ repoType: "code",
447
+ tags: ["code", "software"]
448
+ },
449
+ namingPattern: "{project-name}",
450
+ namingExample: "web-app",
451
+ initialFiles: []
452
+ }
453
+ ];
454
+ var EDUCATION_TEMPLATES = [
455
+ {
456
+ id: "course-materials",
457
+ name: "Course Materials",
458
+ description: "Course curriculum and lecture materials",
459
+ icon: "GraduationCap",
460
+ orgType: "education",
461
+ metadata: {
462
+ repoType: "course",
463
+ tags: ["course", "curriculum"]
464
+ },
465
+ namingPattern: "{course-code}-{title}",
466
+ namingExample: "cs101-intro-programming",
467
+ initialFiles: []
468
+ }
469
+ ];
470
+ var NONPROFIT_TEMPLATES = [
471
+ {
472
+ id: "campaign",
473
+ name: "Campaign",
474
+ description: "Fundraising or advocacy campaign materials",
475
+ icon: "Megaphone",
476
+ orgType: "nonprofit",
477
+ metadata: {
478
+ repoType: "campaign",
479
+ tags: ["campaign", "advocacy"]
480
+ },
481
+ namingPattern: "campaign-{name}",
482
+ namingExample: "campaign-clean-water-2026",
483
+ initialFiles: []
484
+ }
485
+ ];
486
+ var REPO_TEMPLATES = {
487
+ healthcare: HEALTHCARE_TEMPLATES,
488
+ research: RESEARCH_TEMPLATES,
489
+ company: COMPANY_TEMPLATES,
490
+ education: EDUCATION_TEMPLATES,
491
+ nonprofit: NONPROFIT_TEMPLATES,
492
+ generic: COMPANY_TEMPLATES
493
+ };
494
+ function getAllTemplates() {
495
+ return Object.values(REPO_TEMPLATES).flat();
496
+ }
497
+ function getTemplatesForOrgType(orgType) {
498
+ return REPO_TEMPLATES[orgType || "generic"] || COMPANY_TEMPLATES;
499
+ }
500
+ function getTemplateById(templateId) {
501
+ for (const templates of Object.values(REPO_TEMPLATES)) {
502
+ const template = templates.find((t) => t.id === templateId);
503
+ if (template) return template;
504
+ }
505
+ return void 0;
506
+ }
507
+ function getOrgTypeIcon(orgType) {
508
+ const icons = {
509
+ healthcare: "\u{1F3E5}",
510
+ research: "\u{1F52C}",
511
+ company: "\u{1F3E2}",
512
+ education: "\u{1F393}",
513
+ nonprofit: "\u{1F91D}",
514
+ generic: "\u{1F4E6}"
515
+ };
516
+ return icons[orgType] || "\u{1F4E6}";
517
+ }
518
+ function createTemplatesCommand() {
519
+ const templates = new Command2("templates").description(
520
+ "Manage repository templates"
521
+ );
522
+ templates.command("list").description("List available repository templates").option("--org-type <type>", "Filter by organization type (healthcare, research, company, education, nonprofit)").action((options) => {
523
+ try {
524
+ let templateList;
525
+ if (options.orgType) {
526
+ const orgType = options.orgType;
527
+ if (!REPO_TEMPLATES[orgType]) {
528
+ console.error(chalk2.red(`Error: Invalid org type "${orgType}"`));
529
+ console.log(chalk2.dim("\nAvailable types: healthcare, research, company, education, nonprofit"));
530
+ process.exit(1);
531
+ }
532
+ templateList = getTemplatesForOrgType(orgType);
533
+ console.log(chalk2.bold(`${getOrgTypeIcon(orgType)} ${orgType.charAt(0).toUpperCase() + orgType.slice(1)} Templates
534
+ `));
535
+ } else {
536
+ templateList = getAllTemplates();
537
+ console.log(chalk2.bold("Available Repository Templates\n"));
538
+ }
539
+ if (templateList.length === 0) {
540
+ console.log(chalk2.yellow("No templates found"));
541
+ return;
542
+ }
543
+ if (!options.orgType) {
544
+ const grouped = templateList.reduce((acc, template) => {
545
+ if (!acc[template.orgType]) {
546
+ acc[template.orgType] = [];
547
+ }
548
+ acc[template.orgType].push(template);
549
+ return acc;
550
+ }, {});
551
+ for (const [orgType, templates2] of Object.entries(grouped)) {
552
+ console.log(chalk2.bold(`${getOrgTypeIcon(orgType)} ${orgType.charAt(0).toUpperCase() + orgType.slice(1)}`));
553
+ for (const template of templates2) {
554
+ console.log(` ${chalk2.cyan(template.id.padEnd(25))} ${chalk2.dim(template.name)}`);
555
+ console.log(` ${" ".repeat(25)} ${chalk2.dim(template.description)}`);
556
+ }
557
+ console.log();
558
+ }
559
+ } else {
560
+ for (const template of templateList) {
561
+ console.log(`${chalk2.cyan(template.id.padEnd(25))} ${chalk2.dim(template.name)}`);
562
+ console.log(`${" ".repeat(25)} ${chalk2.dim(template.description)}`);
563
+ }
564
+ }
565
+ console.log(chalk2.dim("\nUse 'forge templates view <id>' to see details"));
566
+ } catch (error) {
567
+ console.error(chalk2.red(`Error: ${error.message}`));
568
+ process.exit(1);
569
+ }
570
+ });
571
+ templates.command("view").description("View template details").argument("<id>", "Template ID").action((templateId) => {
572
+ try {
573
+ const template = getTemplateById(templateId);
574
+ if (!template) {
575
+ console.error(chalk2.red(`Error: Template "${templateId}" not found`));
576
+ console.log(chalk2.dim("\nUse 'forge templates list' to see available templates"));
577
+ process.exit(1);
578
+ }
579
+ console.log(chalk2.bold(`${template.name}
580
+ `));
581
+ console.log(chalk2.dim("ID: ") + chalk2.cyan(template.id));
582
+ console.log(chalk2.dim("Type: ") + `${getOrgTypeIcon(template.orgType)} ${template.orgType}`);
583
+ console.log(chalk2.dim("Description: ") + template.description);
584
+ console.log();
585
+ console.log(chalk2.bold("Naming Pattern"));
586
+ console.log(chalk2.dim(" Pattern: ") + template.namingPattern);
587
+ console.log(chalk2.dim(" Example: ") + chalk2.cyan(template.namingExample));
588
+ console.log();
589
+ if (template.metadata) {
590
+ console.log(chalk2.bold("Metadata"));
591
+ if (template.metadata.repoType) {
592
+ console.log(chalk2.dim(" Repo Type: ") + template.metadata.repoType);
593
+ }
594
+ if (template.metadata.tags && template.metadata.tags.length > 0) {
595
+ console.log(chalk2.dim(" Tags: ") + template.metadata.tags.join(", "));
596
+ }
597
+ if (template.metadata.domainData) {
598
+ console.log(chalk2.dim(" Domain: ") + JSON.stringify(template.metadata.domainData, null, 2).split("\n").join("\n "));
599
+ }
600
+ console.log();
601
+ }
602
+ console.log(chalk2.bold("Usage"));
603
+ console.log(chalk2.dim(" forge repos create --name ") + chalk2.cyan(template.namingExample) + chalk2.dim(" --template ") + chalk2.cyan(template.id));
604
+ console.log();
605
+ } catch (error) {
606
+ console.error(chalk2.red(`Error: ${error.message}`));
607
+ process.exit(1);
608
+ }
609
+ });
610
+ return templates;
611
+ }
612
+
613
+ // src/commands/repos.ts
307
614
  function createReposCommand() {
308
- const repos = new Command2("repos").description(
615
+ const repos = new Command3("repos").description(
309
616
  "Manage repositories"
310
617
  );
311
618
  repos.command("list").description("List accessible repositories").action(async () => {
@@ -316,22 +623,22 @@ function createReposCommand() {
316
623
  );
317
624
  const repositories = result.repos || [];
318
625
  if (repositories.length === 0) {
319
- console.log(chalk2.yellow("No repositories found"));
626
+ console.log(chalk3.yellow("No repositories found"));
320
627
  return;
321
628
  }
322
- console.log(chalk2.bold(`Repositories (${repositories.length})`));
629
+ console.log(chalk3.bold(`Repositories (${repositories.length})`));
323
630
  console.log();
324
631
  for (const repo of repositories) {
325
632
  const ownerName = repo.owner?.identifier || repo.owner?.username || user.username;
326
633
  const identifier = `@${ownerName}/${repo.name}`;
327
634
  const visibility = repo.visibility === "private" ? "\u{1F512}" : "\u{1F310}";
328
- console.log(`${visibility} ${chalk2.cyan(identifier)}`);
635
+ console.log(`${visibility} ${chalk3.cyan(identifier)}`);
329
636
  if (repo.description) {
330
- console.log(chalk2.dim(` ${repo.description}`));
637
+ console.log(chalk3.dim(` ${repo.description}`));
331
638
  }
332
639
  }
333
640
  } catch (error) {
334
- console.error(chalk2.red(`Error: ${error.message}`));
641
+ console.error(chalk3.red(`Error: ${error.message}`));
335
642
  process.exit(1);
336
643
  }
337
644
  });
@@ -341,16 +648,16 @@ function createReposCommand() {
341
648
  const repo = await apiGet(
342
649
  `/api/repositories/${ownerIdentifier}/${name}`
343
650
  );
344
- console.log(chalk2.bold(`${repo.ownerIdentifier}/${repo.name}`));
651
+ console.log(chalk3.bold(`${repo.ownerIdentifier}/${repo.name}`));
345
652
  if (repo.description) {
346
- console.log(chalk2.dim(repo.description));
653
+ console.log(chalk3.dim(repo.description));
347
654
  }
348
655
  console.log();
349
- console.log(chalk2.dim(` Visibility: ${repo.visibility}`));
350
- console.log(chalk2.dim(` Type: ${repo.repoType || "standard"}`));
351
- console.log(chalk2.dim(` Created: ${new Date(repo.createdAt).toLocaleDateString()}`));
656
+ console.log(chalk3.dim(` Visibility: ${repo.visibility}`));
657
+ console.log(chalk3.dim(` Type: ${repo.repoType || "standard"}`));
658
+ console.log(chalk3.dim(` Created: ${new Date(repo.createdAt).toLocaleDateString()}`));
352
659
  } catch (error) {
353
- console.error(chalk2.red(`Error: ${error.message}`));
660
+ console.error(chalk3.red(`Error: ${error.message}`));
354
661
  process.exit(1);
355
662
  }
356
663
  });
@@ -362,7 +669,7 @@ function createReposCommand() {
362
669
  const apiUrl = new URL(config.apiUrl);
363
670
  const cloneUrl = `${apiUrl.protocol}//${apiUrl.host}/git/${ownerIdentifier}/${name}`;
364
671
  const dest = destination || name;
365
- console.log(chalk2.dim(`Cloning ${ownerIdentifier}/${name} into ${dest}...`));
672
+ console.log(chalk3.dim(`Cloning ${ownerIdentifier}/${name} into ${dest}...`));
366
673
  const gitProcess = spawn(
367
674
  "git",
368
675
  ["clone", cloneUrl, dest],
@@ -383,27 +690,51 @@ function createReposCommand() {
383
690
  }
384
691
  });
385
692
  });
386
- console.log(chalk2.green(`\u2713 Repository cloned successfully`));
693
+ console.log(chalk3.green(`\u2713 Repository cloned successfully`));
387
694
  } catch (error) {
388
- console.error(chalk2.red(`Error: ${error.message}`));
695
+ console.error(chalk3.red(`Error: ${error.message}`));
389
696
  process.exit(1);
390
697
  }
391
698
  });
392
- repos.command("create").description("Create a new repository").requiredOption("--name <name>", "Repository name").option("--description <desc>", "Repository description").option("--visibility <type>", "Visibility (public/private)", "private").option("--org <identifier>", "Organization identifier (defaults to your personal org)").action(async (options) => {
699
+ repos.command("create").description("Create a new repository").requiredOption("--name <name>", "Repository name").option("--description <desc>", "Repository description").option("--visibility <type>", "Visibility (public/private)", "private").option("--org <identifier>", "Organization identifier (defaults to your personal org)").option("--template <id>", "Repository template ID (e.g., patient-record, research-dataset, code-repository)").action(async (options) => {
393
700
  try {
394
- const { name, description, visibility, org } = options;
395
- const user = await apiGet("/api/users/me");
396
- const orgIdentifier = org || user.username;
397
- const repo = await apiPost("/api/repositories", {
398
- name,
399
- description,
400
- visibility,
401
- orgIdentifier
402
- });
403
- console.log(chalk2.green("\u2713 Repository created successfully"));
404
- console.log(chalk2.dim(` @${repo.ownerIdentifier}/${repo.name}`));
701
+ const { name, description, visibility, org, template } = options;
702
+ if (template) {
703
+ const templateObj = getTemplateById(template);
704
+ if (!templateObj) {
705
+ console.error(chalk3.red(`Error: Template "${template}" not found`));
706
+ console.log(chalk3.dim("\nAvailable templates:"));
707
+ console.log(chalk3.dim(" Use 'forge templates list' to see all available templates"));
708
+ console.log(chalk3.dim(" Use 'forge templates view <id>' to see template details"));
709
+ process.exit(1);
710
+ }
711
+ }
712
+ let repo;
713
+ if (org) {
714
+ repo = await apiPost(`/api/orgs/${org}/repos`, {
715
+ name,
716
+ description,
717
+ visibility,
718
+ templateId: template
719
+ });
720
+ } else {
721
+ const user = await apiGet("/api/users/me");
722
+ repo = await apiPost("/api/repositories", {
723
+ name,
724
+ description,
725
+ visibility,
726
+ orgIdentifier: user.username,
727
+ templateId: template
728
+ });
729
+ }
730
+ console.log(chalk3.green("\u2713 Repository created successfully"));
731
+ console.log(chalk3.dim(` @${repo.ownerIdentifier}/${repo.name}`));
732
+ if (template) {
733
+ const templateObj = getTemplateById(template);
734
+ console.log(chalk3.dim(` Template: ${templateObj?.name || template}`));
735
+ }
405
736
  } catch (error) {
406
- console.error(chalk2.red(`Error: ${error.message}`));
737
+ console.error(chalk3.red(`Error: ${error.message}`));
407
738
  process.exit(1);
408
739
  }
409
740
  });
@@ -419,11 +750,11 @@ function createReposCommand() {
419
750
  orgIdentifier: targetOrgIdentifier
420
751
  }
421
752
  );
422
- console.log(chalk2.green("\u2713 Repository forked successfully"));
423
- console.log(chalk2.dim(` @${fork.ownerIdentifier}/${fork.name}`));
424
- console.log(chalk2.dim(` Forked from @${ownerIdentifier}/${name}`));
753
+ console.log(chalk3.green("\u2713 Repository forked successfully"));
754
+ console.log(chalk3.dim(` @${fork.ownerIdentifier}/${fork.name}`));
755
+ console.log(chalk3.dim(` Forked from @${ownerIdentifier}/${name}`));
425
756
  } catch (error) {
426
- console.error(chalk2.red(`Error: ${error.message}`));
757
+ console.error(chalk3.red(`Error: ${error.message}`));
427
758
  process.exit(1);
428
759
  }
429
760
  });
@@ -434,9 +765,9 @@ function createReposCommand() {
434
765
  `/api/repositories/${ownerIdentifier}/${name}/star`,
435
766
  {}
436
767
  );
437
- console.log(chalk2.green(`\u2713 Starred @${ownerIdentifier}/${name}`));
768
+ console.log(chalk3.green(`\u2713 Starred @${ownerIdentifier}/${name}`));
438
769
  } catch (error) {
439
- console.error(chalk2.red(`Error: ${error.message}`));
770
+ console.error(chalk3.red(`Error: ${error.message}`));
440
771
  process.exit(1);
441
772
  }
442
773
  });
@@ -447,9 +778,9 @@ function createReposCommand() {
447
778
  `/api/repositories/${ownerIdentifier}/${name}/unstar`,
448
779
  {}
449
780
  );
450
- console.log(chalk2.green(`\u2713 Unstarred @${ownerIdentifier}/${name}`));
781
+ console.log(chalk3.green(`\u2713 Unstarred @${ownerIdentifier}/${name}`));
451
782
  } catch (error) {
452
- console.error(chalk2.red(`Error: ${error.message}`));
783
+ console.error(chalk3.red(`Error: ${error.message}`));
453
784
  process.exit(1);
454
785
  }
455
786
  });
@@ -461,22 +792,22 @@ function createReposCommand() {
461
792
  );
462
793
  const stars = result.stars || [];
463
794
  if (stars.length === 0) {
464
- console.log(chalk2.yellow("No starred repositories"));
795
+ console.log(chalk3.yellow("No starred repositories"));
465
796
  return;
466
797
  }
467
- console.log(chalk2.bold(`Starred Repositories (${stars.length})`));
798
+ console.log(chalk3.bold(`Starred Repositories (${stars.length})`));
468
799
  console.log();
469
800
  for (const star of stars) {
470
801
  const repo = star.repository;
471
802
  const identifier = `@${repo.ownerIdentifier}/${repo.name}`;
472
803
  const visibility = repo.visibility === "private" ? "\u{1F512}" : "\u{1F310}";
473
- console.log(`${visibility} ${chalk2.cyan(identifier)}`);
804
+ console.log(`${visibility} ${chalk3.cyan(identifier)}`);
474
805
  if (repo.description) {
475
- console.log(chalk2.dim(` ${repo.description}`));
806
+ console.log(chalk3.dim(` ${repo.description}`));
476
807
  }
477
808
  }
478
809
  } catch (error) {
479
- console.error(chalk2.red(`Error: ${error.message}`));
810
+ console.error(chalk3.red(`Error: ${error.message}`));
480
811
  process.exit(1);
481
812
  }
482
813
  });
@@ -488,19 +819,19 @@ function createReposCommand() {
488
819
  if (options.description !== void 0) updates.description = options.description;
489
820
  if (options.visibility) updates.visibility = options.visibility;
490
821
  if (Object.keys(updates).length === 0) {
491
- console.log(chalk2.yellow("No updates specified. Use --name, --description, or --visibility"));
822
+ console.log(chalk3.yellow("No updates specified. Use --name, --description, or --visibility"));
492
823
  return;
493
824
  }
494
825
  await apiPost(
495
826
  `/api/repositories/${ownerIdentifier}/${name}/settings`,
496
827
  updates
497
828
  );
498
- console.log(chalk2.green("\u2713 Repository updated successfully"));
829
+ console.log(chalk3.green("\u2713 Repository updated successfully"));
499
830
  if (options.name) {
500
- console.log(chalk2.dim(` Renamed to: ${options.name}`));
831
+ console.log(chalk3.dim(` Renamed to: ${options.name}`));
501
832
  }
502
833
  } catch (error) {
503
- console.error(chalk2.red(`Error: ${error.message}`));
834
+ console.error(chalk3.red(`Error: ${error.message}`));
504
835
  process.exit(1);
505
836
  }
506
837
  });
@@ -508,17 +839,17 @@ function createReposCommand() {
508
839
  try {
509
840
  const [ownerIdentifier, name] = parseRepoArg(repoArg);
510
841
  if (!options.confirm) {
511
- console.log(chalk2.yellow(`\u26A0\uFE0F WARNING: This will permanently delete @${ownerIdentifier}/${name}`));
512
- console.log(chalk2.dim("Run with --confirm to proceed"));
842
+ console.log(chalk3.yellow(`\u26A0\uFE0F WARNING: This will permanently delete @${ownerIdentifier}/${name}`));
843
+ console.log(chalk3.dim("Run with --confirm to proceed"));
513
844
  process.exit(1);
514
845
  }
515
846
  await apiPost(
516
847
  `/api/repositories/${ownerIdentifier}/${name}/delete`,
517
848
  {}
518
849
  );
519
- console.log(chalk2.green(`\u2713 Repository @${ownerIdentifier}/${name} deleted`));
850
+ console.log(chalk3.green(`\u2713 Repository @${ownerIdentifier}/${name} deleted`));
520
851
  } catch (error) {
521
- console.error(chalk2.red(`Error: ${error.message}`));
852
+ console.error(chalk3.red(`Error: ${error.message}`));
522
853
  process.exit(1);
523
854
  }
524
855
  });
@@ -535,10 +866,10 @@ function parseRepoArg(arg) {
535
866
  }
536
867
 
537
868
  // src/commands/issues.ts
538
- import { Command as Command3 } from "commander";
539
- import chalk3 from "chalk";
869
+ import { Command as Command4 } from "commander";
870
+ import chalk4 from "chalk";
540
871
  function createIssuesCommand() {
541
- const issues = new Command3("issues").description("Manage issues");
872
+ const issues = new Command4("issues").description("Manage issues");
542
873
  issues.command("list").description("List issues in a repository").requiredOption("--repo <repo>", "Repository (@owner/name)").option("--state <state>", "Filter by state (open/closed)", "open").action(async (options) => {
543
874
  try {
544
875
  const [ownerIdentifier, name] = parseRepoArg2(options.repo);
@@ -547,24 +878,24 @@ function createIssuesCommand() {
547
878
  );
548
879
  const issuesList = result.issues || [];
549
880
  if (issuesList.length === 0) {
550
- console.log(chalk3.yellow(`No ${options.state} issues found`));
881
+ console.log(chalk4.yellow(`No ${options.state} issues found`));
551
882
  return;
552
883
  }
553
884
  console.log(
554
- chalk3.bold(`Issues in @${ownerIdentifier}/${name} (${issuesList.length})`)
885
+ chalk4.bold(`Issues in @${ownerIdentifier}/${name} (${issuesList.length})`)
555
886
  );
556
887
  console.log();
557
888
  for (const issue of issuesList) {
558
889
  const stateIcon = issue.state === "open" ? "\u{1F7E2}" : "\u26AA";
559
890
  console.log(
560
- `${stateIcon} #${issue.number} ${chalk3.cyan(issue.title)}`
891
+ `${stateIcon} #${issue.number} ${chalk4.cyan(issue.title)}`
561
892
  );
562
893
  console.log(
563
- chalk3.dim(` by @${issue.author?.username || "unknown"} \xB7 ${new Date(issue.createdAt).toLocaleDateString()}`)
894
+ chalk4.dim(` by @${issue.author?.username || "unknown"} \xB7 ${new Date(issue.createdAt).toLocaleDateString()}`)
564
895
  );
565
896
  }
566
897
  } catch (error) {
567
- console.error(chalk3.red(`Error: ${error.message}`));
898
+ console.error(chalk4.red(`Error: ${error.message}`));
568
899
  process.exit(1);
569
900
  }
570
901
  });
@@ -576,10 +907,10 @@ function createIssuesCommand() {
576
907
  );
577
908
  const stateIcon = issue.state === "open" ? "\u{1F7E2}" : "\u26AA";
578
909
  console.log(
579
- `${stateIcon} ${chalk3.bold(`#${issue.number} ${issue.title}`)}`
910
+ `${stateIcon} ${chalk4.bold(`#${issue.number} ${issue.title}`)}`
580
911
  );
581
912
  console.log(
582
- chalk3.dim(
913
+ chalk4.dim(
583
914
  `by @${issue.author.username} \xB7 ${new Date(issue.createdAt).toLocaleDateString()}`
584
915
  )
585
916
  );
@@ -588,14 +919,14 @@ function createIssuesCommand() {
588
919
  console.log(issue.body);
589
920
  console.log();
590
921
  }
591
- console.log(chalk3.dim(`State: ${issue.state}`));
922
+ console.log(chalk4.dim(`State: ${issue.state}`));
592
923
  if (issue.closedAt) {
593
924
  console.log(
594
- chalk3.dim(`Closed: ${new Date(issue.closedAt).toLocaleDateString()}`)
925
+ chalk4.dim(`Closed: ${new Date(issue.closedAt).toLocaleDateString()}`)
595
926
  );
596
927
  }
597
928
  } catch (error) {
598
- console.error(chalk3.red(`Error: ${error.message}`));
929
+ console.error(chalk4.red(`Error: ${error.message}`));
599
930
  process.exit(1);
600
931
  }
601
932
  });
@@ -609,13 +940,13 @@ function createIssuesCommand() {
609
940
  body: options.body || ""
610
941
  }
611
942
  );
612
- console.log(chalk3.green("\u2713 Issue created successfully"));
613
- console.log(chalk3.dim(` #${issue.number} ${issue.title}`));
943
+ console.log(chalk4.green("\u2713 Issue created successfully"));
944
+ console.log(chalk4.dim(` #${issue.number} ${issue.title}`));
614
945
  console.log(
615
- chalk3.dim(` @${ownerIdentifier}/${name}#${issue.number}`)
946
+ chalk4.dim(` @${ownerIdentifier}/${name}#${issue.number}`)
616
947
  );
617
948
  } catch (error) {
618
- console.error(chalk3.red(`Error: ${error.message}`));
949
+ console.error(chalk4.red(`Error: ${error.message}`));
619
950
  process.exit(1);
620
951
  }
621
952
  });
@@ -628,9 +959,9 @@ function createIssuesCommand() {
628
959
  state: "closed"
629
960
  }
630
961
  );
631
- console.log(chalk3.green("\u2713 Issue closed successfully"));
962
+ console.log(chalk4.green("\u2713 Issue closed successfully"));
632
963
  } catch (error) {
633
- console.error(chalk3.red(`Error: ${error.message}`));
964
+ console.error(chalk4.red(`Error: ${error.message}`));
634
965
  process.exit(1);
635
966
  }
636
967
  });
@@ -643,9 +974,9 @@ function createIssuesCommand() {
643
974
  body: options.body
644
975
  }
645
976
  );
646
- console.log(chalk3.green("\u2713 Comment added successfully"));
977
+ console.log(chalk4.green("\u2713 Comment added successfully"));
647
978
  } catch (error) {
648
- console.error(chalk3.red(`Error: ${error.message}`));
979
+ console.error(chalk4.red(`Error: ${error.message}`));
649
980
  process.exit(1);
650
981
  }
651
982
  });
@@ -657,16 +988,16 @@ function createIssuesCommand() {
657
988
  if (options.body !== void 0) updates.body = options.body;
658
989
  if (options.state) updates.state = options.state;
659
990
  if (Object.keys(updates).length === 0) {
660
- console.log(chalk3.yellow("No updates specified. Use --title, --body, or --state"));
991
+ console.log(chalk4.yellow("No updates specified. Use --title, --body, or --state"));
661
992
  return;
662
993
  }
663
994
  await apiPatch(
664
995
  `/api/repositories/${ownerIdentifier}/${name}/issues/${options.number}`,
665
996
  updates
666
997
  );
667
- console.log(chalk3.green("\u2713 Issue updated successfully"));
998
+ console.log(chalk4.green("\u2713 Issue updated successfully"));
668
999
  } catch (error) {
669
- console.error(chalk3.red(`Error: ${error.message}`));
1000
+ console.error(chalk4.red(`Error: ${error.message}`));
670
1001
  process.exit(1);
671
1002
  }
672
1003
  });
@@ -679,9 +1010,9 @@ function createIssuesCommand() {
679
1010
  state: "open"
680
1011
  }
681
1012
  );
682
- console.log(chalk3.green("\u2713 Issue reopened successfully"));
1013
+ console.log(chalk4.green("\u2713 Issue reopened successfully"));
683
1014
  } catch (error) {
684
- console.error(chalk3.red(`Error: ${error.message}`));
1015
+ console.error(chalk4.red(`Error: ${error.message}`));
685
1016
  process.exit(1);
686
1017
  }
687
1018
  });
@@ -693,19 +1024,19 @@ function createIssuesCommand() {
693
1024
  );
694
1025
  const comments = result.comments || [];
695
1026
  if (comments.length === 0) {
696
- console.log(chalk3.yellow("No comments found"));
1027
+ console.log(chalk4.yellow("No comments found"));
697
1028
  return;
698
1029
  }
699
- console.log(chalk3.bold(`Comments (${comments.length})`));
1030
+ console.log(chalk4.bold(`Comments (${comments.length})`));
700
1031
  console.log();
701
1032
  for (const comment of comments) {
702
- console.log(chalk3.cyan(`@${comment.author?.username || "unknown"}`));
703
- console.log(chalk3.dim(` ${new Date(comment.createdAt).toLocaleString()}`));
1033
+ console.log(chalk4.cyan(`@${comment.author?.username || "unknown"}`));
1034
+ console.log(chalk4.dim(` ${new Date(comment.createdAt).toLocaleString()}`));
704
1035
  console.log(` ${comment.body}`);
705
1036
  console.log();
706
1037
  }
707
1038
  } catch (error) {
708
- console.error(chalk3.red(`Error: ${error.message}`));
1039
+ console.error(chalk4.red(`Error: ${error.message}`));
709
1040
  process.exit(1);
710
1041
  }
711
1042
  });
@@ -716,19 +1047,19 @@ function createIssuesCommand() {
716
1047
  `/api/repositories/${ownerIdentifier}/${name}/labels`
717
1048
  );
718
1049
  if (labels.length === 0) {
719
- console.log(chalk3.yellow("No labels found"));
1050
+ console.log(chalk4.yellow("No labels found"));
720
1051
  return;
721
1052
  }
722
- console.log(chalk3.bold(`Labels (${labels.length})`));
1053
+ console.log(chalk4.bold(`Labels (${labels.length})`));
723
1054
  console.log();
724
1055
  for (const label of labels) {
725
- console.log(`${chalk3.hex(label.color || "#000000")("\u25A0")} ${label.name}`);
1056
+ console.log(`${chalk4.hex(label.color || "#000000")("\u25A0")} ${label.name}`);
726
1057
  if (label.description) {
727
- console.log(chalk3.dim(` ${label.description}`));
1058
+ console.log(chalk4.dim(` ${label.description}`));
728
1059
  }
729
1060
  }
730
1061
  } catch (error) {
731
- console.error(chalk3.red(`Error: ${error.message}`));
1062
+ console.error(chalk4.red(`Error: ${error.message}`));
732
1063
  process.exit(1);
733
1064
  }
734
1065
  });
@@ -741,9 +1072,9 @@ function createIssuesCommand() {
741
1072
  labelName: options.label
742
1073
  }
743
1074
  );
744
- console.log(chalk3.green(`\u2713 Label "${options.label}" added to issue #${options.number}`));
1075
+ console.log(chalk4.green(`\u2713 Label "${options.label}" added to issue #${options.number}`));
745
1076
  } catch (error) {
746
- console.error(chalk3.red(`Error: ${error.message}`));
1077
+ console.error(chalk4.red(`Error: ${error.message}`));
747
1078
  process.exit(1);
748
1079
  }
749
1080
  });
@@ -753,9 +1084,9 @@ function createIssuesCommand() {
753
1084
  await apiDelete(
754
1085
  `/api/repositories/${ownerIdentifier}/${name}/issues/${options.number}/labels/${options.label}`
755
1086
  );
756
- console.log(chalk3.green(`\u2713 Label "${options.label}" removed from issue #${options.number}`));
1087
+ console.log(chalk4.green(`\u2713 Label "${options.label}" removed from issue #${options.number}`));
757
1088
  } catch (error) {
758
- console.error(chalk3.red(`Error: ${error.message}`));
1089
+ console.error(chalk4.red(`Error: ${error.message}`));
759
1090
  process.exit(1);
760
1091
  }
761
1092
  });
@@ -768,9 +1099,9 @@ function createIssuesCommand() {
768
1099
  username: options.user
769
1100
  }
770
1101
  );
771
- console.log(chalk3.green(`\u2713 Assigned @${options.user} to issue #${options.number}`));
1102
+ console.log(chalk4.green(`\u2713 Assigned @${options.user} to issue #${options.number}`));
772
1103
  } catch (error) {
773
- console.error(chalk3.red(`Error: ${error.message}`));
1104
+ console.error(chalk4.red(`Error: ${error.message}`));
774
1105
  process.exit(1);
775
1106
  }
776
1107
  });
@@ -780,9 +1111,9 @@ function createIssuesCommand() {
780
1111
  await apiDelete(
781
1112
  `/api/repositories/${ownerIdentifier}/${name}/issues/${options.number}/assignees/${options.user}`
782
1113
  );
783
- console.log(chalk3.green(`\u2713 Unassigned @${options.user} from issue #${options.number}`));
1114
+ console.log(chalk4.green(`\u2713 Unassigned @${options.user} from issue #${options.number}`));
784
1115
  } catch (error) {
785
- console.error(chalk3.red(`Error: ${error.message}`));
1116
+ console.error(chalk4.red(`Error: ${error.message}`));
786
1117
  process.exit(1);
787
1118
  }
788
1119
  });
@@ -799,10 +1130,10 @@ function parseRepoArg2(arg) {
799
1130
  }
800
1131
 
801
1132
  // src/commands/prs.ts
802
- import { Command as Command4 } from "commander";
803
- import chalk4 from "chalk";
1133
+ import { Command as Command5 } from "commander";
1134
+ import chalk5 from "chalk";
804
1135
  function createPrsCommand() {
805
- const prs = new Command4("prs").alias("pr").description("Manage pull requests");
1136
+ const prs = new Command5("prs").alias("pr").description("Manage pull requests");
806
1137
  prs.command("list").description("List pull requests in a repository").requiredOption("--repo <repo>", "Repository (@owner/name)").option("--state <state>", "Filter by state (open/closed/merged)", "open").action(async (options) => {
807
1138
  try {
808
1139
  const [ownerIdentifier, name] = parseRepoArg3(options.repo);
@@ -811,26 +1142,26 @@ function createPrsCommand() {
811
1142
  );
812
1143
  const prsList = result.pullRequests || [];
813
1144
  if (prsList.length === 0) {
814
- console.log(chalk4.yellow(`No ${options.state} pull requests found`));
1145
+ console.log(chalk5.yellow(`No ${options.state} pull requests found`));
815
1146
  return;
816
1147
  }
817
1148
  console.log(
818
- chalk4.bold(
1149
+ chalk5.bold(
819
1150
  `Pull Requests in @${ownerIdentifier}/${name} (${prsList.length})`
820
1151
  )
821
1152
  );
822
1153
  console.log();
823
1154
  for (const pr of prsList) {
824
1155
  const stateIcon = pr.merged ? "\u{1F7E3}" : pr.state === "open" ? "\u{1F7E2}" : "\u26AA";
825
- console.log(`${stateIcon} #${pr.number} ${chalk4.cyan(pr.title)}`);
1156
+ console.log(`${stateIcon} #${pr.number} ${chalk5.cyan(pr.title)}`);
826
1157
  console.log(
827
- chalk4.dim(
1158
+ chalk5.dim(
828
1159
  ` ${pr.headBranch} \u2192 ${pr.baseBranch} by @${pr.author?.username || "unknown"} \xB7 ${new Date(pr.createdAt).toLocaleDateString()}`
829
1160
  )
830
1161
  );
831
1162
  }
832
1163
  } catch (error) {
833
- console.error(chalk4.red(`Error: ${error.message}`));
1164
+ console.error(chalk5.red(`Error: ${error.message}`));
834
1165
  process.exit(1);
835
1166
  }
836
1167
  });
@@ -841,9 +1172,9 @@ function createPrsCommand() {
841
1172
  `/api/repositories/${ownerIdentifier}/${name}/pulls/${options.number}`
842
1173
  );
843
1174
  const stateIcon = pr.merged ? "\u{1F7E3}" : pr.state === "open" ? "\u{1F7E2}" : "\u26AA";
844
- console.log(`${stateIcon} ${chalk4.bold(`#${pr.number} ${pr.title}`)}`);
1175
+ console.log(`${stateIcon} ${chalk5.bold(`#${pr.number} ${pr.title}`)}`);
845
1176
  console.log(
846
- chalk4.dim(
1177
+ chalk5.dim(
847
1178
  `${pr.headBranch} \u2192 ${pr.baseBranch} by @${pr.author?.username || "unknown"} \xB7 ${new Date(pr.createdAt).toLocaleDateString()}`
848
1179
  )
849
1180
  );
@@ -852,19 +1183,19 @@ function createPrsCommand() {
852
1183
  console.log(pr.body);
853
1184
  console.log();
854
1185
  }
855
- console.log(chalk4.dim(`State: ${pr.merged ? "merged" : pr.state}`));
1186
+ console.log(chalk5.dim(`State: ${pr.merged ? "merged" : pr.state}`));
856
1187
  if (pr.mergedAt) {
857
1188
  console.log(
858
- chalk4.dim(`Merged: ${new Date(pr.mergedAt).toLocaleDateString()}`)
1189
+ chalk5.dim(`Merged: ${new Date(pr.mergedAt).toLocaleDateString()}`)
859
1190
  );
860
1191
  }
861
1192
  if (pr.closedAt && !pr.merged) {
862
1193
  console.log(
863
- chalk4.dim(`Closed: ${new Date(pr.closedAt).toLocaleDateString()}`)
1194
+ chalk5.dim(`Closed: ${new Date(pr.closedAt).toLocaleDateString()}`)
864
1195
  );
865
1196
  }
866
1197
  } catch (error) {
867
- console.error(chalk4.red(`Error: ${error.message}`));
1198
+ console.error(chalk5.red(`Error: ${error.message}`));
868
1199
  process.exit(1);
869
1200
  }
870
1201
  });
@@ -880,13 +1211,13 @@ function createPrsCommand() {
880
1211
  body: options.body || ""
881
1212
  }
882
1213
  );
883
- console.log(chalk4.green("\u2713 Pull request created successfully"));
884
- console.log(chalk4.dim(` #${pr.number} ${pr.title}`));
1214
+ console.log(chalk5.green("\u2713 Pull request created successfully"));
1215
+ console.log(chalk5.dim(` #${pr.number} ${pr.title}`));
885
1216
  console.log(
886
- chalk4.dim(` @${ownerIdentifier}/${name}#${pr.number}`)
1217
+ chalk5.dim(` @${ownerIdentifier}/${name}#${pr.number}`)
887
1218
  );
888
1219
  } catch (error) {
889
- console.error(chalk4.red(`Error: ${error.message}`));
1220
+ console.error(chalk5.red(`Error: ${error.message}`));
890
1221
  process.exit(1);
891
1222
  }
892
1223
  });
@@ -899,9 +1230,9 @@ function createPrsCommand() {
899
1230
  await apiPost(`/api/pulls/${pr.id}/merge`, {
900
1231
  commitMessage: options.message
901
1232
  });
902
- console.log(chalk4.green("\u2713 Pull request merged successfully"));
1233
+ console.log(chalk5.green("\u2713 Pull request merged successfully"));
903
1234
  } catch (error) {
904
- console.error(chalk4.red(`Error: ${error.message}`));
1235
+ console.error(chalk5.red(`Error: ${error.message}`));
905
1236
  process.exit(1);
906
1237
  }
907
1238
  });
@@ -914,9 +1245,9 @@ function createPrsCommand() {
914
1245
  await apiPatch(`/api/pulls/${pr.id}`, {
915
1246
  state: "closed"
916
1247
  });
917
- console.log(chalk4.green("\u2713 Pull request closed successfully"));
1248
+ console.log(chalk5.green("\u2713 Pull request closed successfully"));
918
1249
  } catch (error) {
919
- console.error(chalk4.red(`Error: ${error.message}`));
1250
+ console.error(chalk5.red(`Error: ${error.message}`));
920
1251
  process.exit(1);
921
1252
  }
922
1253
  });
@@ -929,9 +1260,9 @@ function createPrsCommand() {
929
1260
  await apiPost(`/api/pulls/${pr.id}/comments`, {
930
1261
  body: options.body
931
1262
  });
932
- console.log(chalk4.green("\u2713 Comment added successfully"));
1263
+ console.log(chalk5.green("\u2713 Comment added successfully"));
933
1264
  } catch (error) {
934
- console.error(chalk4.red(`Error: ${error.message}`));
1265
+ console.error(chalk5.red(`Error: ${error.message}`));
935
1266
  process.exit(1);
936
1267
  }
937
1268
  });
@@ -942,16 +1273,16 @@ function createPrsCommand() {
942
1273
  if (options.title) updates.title = options.title;
943
1274
  if (options.body !== void 0) updates.body = options.body;
944
1275
  if (Object.keys(updates).length === 0) {
945
- console.log(chalk4.yellow("No updates specified. Use --title or --body"));
1276
+ console.log(chalk5.yellow("No updates specified. Use --title or --body"));
946
1277
  return;
947
1278
  }
948
1279
  const pr = await apiGet(
949
1280
  `/api/repositories/${ownerIdentifier}/${name}/pulls/${options.number}`
950
1281
  );
951
1282
  await apiPatch(`/api/pulls/${pr.id}`, updates);
952
- console.log(chalk4.green("\u2713 Pull request updated successfully"));
1283
+ console.log(chalk5.green("\u2713 Pull request updated successfully"));
953
1284
  } catch (error) {
954
- console.error(chalk4.red(`Error: ${error.message}`));
1285
+ console.error(chalk5.red(`Error: ${error.message}`));
955
1286
  process.exit(1);
956
1287
  }
957
1288
  });
@@ -964,9 +1295,9 @@ function createPrsCommand() {
964
1295
  await apiPatch(`/api/pulls/${pr.id}`, {
965
1296
  state: "open"
966
1297
  });
967
- console.log(chalk4.green("\u2713 Pull request reopened successfully"));
1298
+ console.log(chalk5.green("\u2713 Pull request reopened successfully"));
968
1299
  } catch (error) {
969
- console.error(chalk4.red(`Error: ${error.message}`));
1300
+ console.error(chalk5.red(`Error: ${error.message}`));
970
1301
  process.exit(1);
971
1302
  }
972
1303
  });
@@ -979,9 +1310,9 @@ function createPrsCommand() {
979
1310
  await apiPatch(`/api/pulls/${pr.id}`, {
980
1311
  draft: true
981
1312
  });
982
- console.log(chalk4.green("\u2713 Pull request marked as draft"));
1313
+ console.log(chalk5.green("\u2713 Pull request marked as draft"));
983
1314
  } catch (error) {
984
- console.error(chalk4.red(`Error: ${error.message}`));
1315
+ console.error(chalk5.red(`Error: ${error.message}`));
985
1316
  process.exit(1);
986
1317
  }
987
1318
  });
@@ -994,9 +1325,9 @@ function createPrsCommand() {
994
1325
  await apiPatch(`/api/pulls/${pr.id}`, {
995
1326
  draft: false
996
1327
  });
997
- console.log(chalk4.green("\u2713 Pull request marked as ready for review"));
1328
+ console.log(chalk5.green("\u2713 Pull request marked as ready for review"));
998
1329
  } catch (error) {
999
- console.error(chalk4.red(`Error: ${error.message}`));
1330
+ console.error(chalk5.red(`Error: ${error.message}`));
1000
1331
  process.exit(1);
1001
1332
  }
1002
1333
  });
@@ -1008,7 +1339,7 @@ function createPrsCommand() {
1008
1339
  );
1009
1340
  const validStates = ["approve", "request_changes", "comment"];
1010
1341
  if (!validStates.includes(options.state)) {
1011
- console.log(chalk4.red(`Invalid state. Must be one of: ${validStates.join(", ")}`));
1342
+ console.log(chalk5.red(`Invalid state. Must be one of: ${validStates.join(", ")}`));
1012
1343
  process.exit(1);
1013
1344
  }
1014
1345
  await apiPost(`/api/pulls/${pr.id}/reviews`, {
@@ -1020,9 +1351,9 @@ function createPrsCommand() {
1020
1351
  request_changes: "requested changes",
1021
1352
  comment: "commented"
1022
1353
  };
1023
- console.log(chalk4.green(`\u2713 Review submitted: ${stateLabels[options.state]}`));
1354
+ console.log(chalk5.green(`\u2713 Review submitted: ${stateLabels[options.state]}`));
1024
1355
  } catch (error) {
1025
- console.error(chalk4.red(`Error: ${error.message}`));
1356
+ console.error(chalk5.red(`Error: ${error.message}`));
1026
1357
  process.exit(1);
1027
1358
  }
1028
1359
  });
@@ -1034,10 +1365,10 @@ function createPrsCommand() {
1034
1365
  );
1035
1366
  const reviews = await apiGet(`/api/pulls/${pr.id}/reviews`);
1036
1367
  if (reviews.length === 0) {
1037
- console.log(chalk4.yellow("No reviews found"));
1368
+ console.log(chalk5.yellow("No reviews found"));
1038
1369
  return;
1039
1370
  }
1040
- console.log(chalk4.bold(`Reviews (${reviews.length})`));
1371
+ console.log(chalk5.bold(`Reviews (${reviews.length})`));
1041
1372
  console.log();
1042
1373
  for (const review of reviews) {
1043
1374
  const stateIcons = {
@@ -1047,16 +1378,16 @@ function createPrsCommand() {
1047
1378
  };
1048
1379
  const icon = stateIcons[review.state] || "\u2022";
1049
1380
  console.log(
1050
- `${icon} ${chalk4.cyan(`@${review.author?.username || "unknown"}`)} ${chalk4.dim(review.state)}`
1381
+ `${icon} ${chalk5.cyan(`@${review.author?.username || "unknown"}`)} ${chalk5.dim(review.state)}`
1051
1382
  );
1052
- console.log(chalk4.dim(` ${new Date(review.createdAt).toLocaleString()}`));
1383
+ console.log(chalk5.dim(` ${new Date(review.createdAt).toLocaleString()}`));
1053
1384
  if (review.body) {
1054
1385
  console.log(` ${review.body}`);
1055
1386
  }
1056
1387
  console.log();
1057
1388
  }
1058
1389
  } catch (error) {
1059
- console.error(chalk4.red(`Error: ${error.message}`));
1390
+ console.error(chalk5.red(`Error: ${error.message}`));
1060
1391
  process.exit(1);
1061
1392
  }
1062
1393
  });
@@ -1068,21 +1399,21 @@ function createPrsCommand() {
1068
1399
  );
1069
1400
  const commits = await apiGet(`/api/pulls/${pr.id}/commits`);
1070
1401
  if (commits.length === 0) {
1071
- console.log(chalk4.yellow("No commits found"));
1402
+ console.log(chalk5.yellow("No commits found"));
1072
1403
  return;
1073
1404
  }
1074
- console.log(chalk4.bold(`Commits (${commits.length})`));
1405
+ console.log(chalk5.bold(`Commits (${commits.length})`));
1075
1406
  console.log();
1076
1407
  for (const commit of commits) {
1077
- console.log(chalk4.cyan(commit.sha?.substring(0, 7) || "unknown"));
1408
+ console.log(chalk5.cyan(commit.sha?.substring(0, 7) || "unknown"));
1078
1409
  console.log(` ${commit.message || "(no message)"}`);
1079
1410
  console.log(
1080
- chalk4.dim(` by ${commit.author?.name || "unknown"} on ${new Date(commit.createdAt).toLocaleDateString()}`)
1411
+ chalk5.dim(` by ${commit.author?.name || "unknown"} on ${new Date(commit.createdAt).toLocaleDateString()}`)
1081
1412
  );
1082
1413
  console.log();
1083
1414
  }
1084
1415
  } catch (error) {
1085
- console.error(chalk4.red(`Error: ${error.message}`));
1416
+ console.error(chalk5.red(`Error: ${error.message}`));
1086
1417
  process.exit(1);
1087
1418
  }
1088
1419
  });
@@ -1094,25 +1425,25 @@ function createPrsCommand() {
1094
1425
  );
1095
1426
  const diff = await apiGet(`/api/pulls/${pr.id}/diff`);
1096
1427
  if (!diff || !diff.files || diff.files.length === 0) {
1097
- console.log(chalk4.yellow("No changes found"));
1428
+ console.log(chalk5.yellow("No changes found"));
1098
1429
  return;
1099
1430
  }
1100
- console.log(chalk4.bold(`Diff for PR #${options.number}`));
1431
+ console.log(chalk5.bold(`Diff for PR #${options.number}`));
1101
1432
  console.log();
1102
1433
  for (const file of diff.files) {
1103
- console.log(chalk4.cyan(`${file.path}`));
1434
+ console.log(chalk5.cyan(`${file.path}`));
1104
1435
  console.log(
1105
- chalk4.dim(` ${file.additions || 0} additions, ${file.deletions || 0} deletions`)
1436
+ chalk5.dim(` ${file.additions || 0} additions, ${file.deletions || 0} deletions`)
1106
1437
  );
1107
1438
  }
1108
1439
  console.log();
1109
1440
  console.log(
1110
- chalk4.dim(
1441
+ chalk5.dim(
1111
1442
  `Total: ${diff.additions || 0} additions, ${diff.deletions || 0} deletions across ${diff.files.length} files`
1112
1443
  )
1113
1444
  );
1114
1445
  } catch (error) {
1115
- console.error(chalk4.red(`Error: ${error.message}`));
1446
+ console.error(chalk5.red(`Error: ${error.message}`));
1116
1447
  process.exit(1);
1117
1448
  }
1118
1449
  });
@@ -1129,10 +1460,10 @@ function parseRepoArg3(arg) {
1129
1460
  }
1130
1461
 
1131
1462
  // src/commands/orgs.ts
1132
- import { Command as Command5 } from "commander";
1133
- import chalk5 from "chalk";
1463
+ import { Command as Command6 } from "commander";
1464
+ import chalk6 from "chalk";
1134
1465
  function createOrgsCommand() {
1135
- const orgs = new Command5("orgs").alias("org").description("Manage organizations");
1466
+ const orgs = new Command6("orgs").alias("org").description("Manage organizations");
1136
1467
  orgs.command("list").description("List organizations").option("--member", "Show only organizations you're a member of").action(async (options) => {
1137
1468
  try {
1138
1469
  let organizations;
@@ -1144,42 +1475,42 @@ function createOrgsCommand() {
1144
1475
  organizations = result.organizations || [];
1145
1476
  }
1146
1477
  if (organizations.length === 0) {
1147
- console.log(chalk5.yellow("No organizations found"));
1478
+ console.log(chalk6.yellow("No organizations found"));
1148
1479
  return;
1149
1480
  }
1150
- console.log(chalk5.bold(`Organizations (${organizations.length})`));
1481
+ console.log(chalk6.bold(`Organizations (${organizations.length})`));
1151
1482
  console.log();
1152
1483
  for (const org of organizations) {
1153
- console.log(chalk5.cyan(`@${org.slug}`));
1154
- console.log(chalk5.dim(` ${org.name}`));
1484
+ console.log(chalk6.cyan(`@${org.slug}`));
1485
+ console.log(chalk6.dim(` ${org.name}`));
1155
1486
  if (org.metadata?.type) {
1156
- console.log(chalk5.dim(` Type: ${org.metadata.type}`));
1487
+ console.log(chalk6.dim(` Type: ${org.metadata.type}`));
1157
1488
  }
1158
1489
  if (org.metadata?.description) {
1159
- console.log(chalk5.dim(` ${org.metadata.description}`));
1490
+ console.log(chalk6.dim(` ${org.metadata.description}`));
1160
1491
  }
1161
1492
  }
1162
1493
  } catch (error) {
1163
- console.error(chalk5.red(`Error: ${error.message}`));
1494
+ console.error(chalk6.red(`Error: ${error.message}`));
1164
1495
  process.exit(1);
1165
1496
  }
1166
1497
  });
1167
1498
  orgs.command("view").description("View organization details").argument("<slug>", "Organization slug").action(async (slug) => {
1168
1499
  try {
1169
1500
  const org = await apiGet(`/api/orgs/${slug}`);
1170
- console.log(chalk5.bold(`@${org.slug}`));
1171
- console.log(chalk5.dim(org.name));
1501
+ console.log(chalk6.bold(`@${org.slug}`));
1502
+ console.log(chalk6.dim(org.name));
1172
1503
  if (org.metadata?.type) {
1173
- console.log(chalk5.dim(`Type: ${org.metadata.type}`));
1504
+ console.log(chalk6.dim(`Type: ${org.metadata.type}`));
1174
1505
  }
1175
1506
  console.log();
1176
1507
  if (org.metadata?.description) {
1177
1508
  console.log(org.metadata.description);
1178
1509
  console.log();
1179
1510
  }
1180
- console.log(chalk5.dim(`Created: ${new Date(org.createdAt).toLocaleDateString()}`));
1511
+ console.log(chalk6.dim(`Created: ${new Date(org.createdAt).toLocaleDateString()}`));
1181
1512
  } catch (error) {
1182
- console.error(chalk5.red(`Error: ${error.message}`));
1513
+ console.error(chalk6.red(`Error: ${error.message}`));
1183
1514
  process.exit(1);
1184
1515
  }
1185
1516
  });
@@ -1197,13 +1528,13 @@ function createOrgsCommand() {
1197
1528
  slug: options.slug,
1198
1529
  metadata: Object.keys(metadata).length > 0 ? metadata : void 0
1199
1530
  });
1200
- console.log(chalk5.green("\u2713 Organization created successfully"));
1201
- console.log(chalk5.dim(` @${org.slug}`));
1531
+ console.log(chalk6.green("\u2713 Organization created successfully"));
1532
+ console.log(chalk6.dim(` @${org.slug}`));
1202
1533
  if (options.type) {
1203
- console.log(chalk5.dim(` Type: ${options.type}`));
1534
+ console.log(chalk6.dim(` Type: ${options.type}`));
1204
1535
  }
1205
1536
  } catch (error) {
1206
- console.error(chalk5.red(`Error: ${error.message}`));
1537
+ console.error(chalk6.red(`Error: ${error.message}`));
1207
1538
  process.exit(1);
1208
1539
  }
1209
1540
  });
@@ -1211,17 +1542,17 @@ function createOrgsCommand() {
1211
1542
  try {
1212
1543
  const members = await apiGet(`/api/organizations/${slug}/members`);
1213
1544
  if (members.length === 0) {
1214
- console.log(chalk5.yellow("No members found"));
1545
+ console.log(chalk6.yellow("No members found"));
1215
1546
  return;
1216
1547
  }
1217
- console.log(chalk5.bold(`Members (${members.length})`));
1548
+ console.log(chalk6.bold(`Members (${members.length})`));
1218
1549
  console.log();
1219
1550
  for (const member of members) {
1220
1551
  const roleIcon = member.role === "owner" ? "\u{1F451}" : member.role === "admin" ? "\u26A1" : "\u2022";
1221
- console.log(`${roleIcon} ${chalk5.cyan(`@${member.user?.username || "unknown"}`)} ${chalk5.dim(member.role)}`);
1552
+ console.log(`${roleIcon} ${chalk6.cyan(`@${member.user?.username || "unknown"}`)} ${chalk6.dim(member.role)}`);
1222
1553
  }
1223
1554
  } catch (error) {
1224
- console.error(chalk5.red(`Error: ${error.message}`));
1555
+ console.error(chalk6.red(`Error: ${error.message}`));
1225
1556
  process.exit(1);
1226
1557
  }
1227
1558
  });
@@ -1231,18 +1562,18 @@ function createOrgsCommand() {
1231
1562
  username,
1232
1563
  role: options.role
1233
1564
  });
1234
- console.log(chalk5.green(`\u2713 Added @${username} to @${slug} as ${options.role}`));
1565
+ console.log(chalk6.green(`\u2713 Added @${username} to @${slug} as ${options.role}`));
1235
1566
  } catch (error) {
1236
- console.error(chalk5.red(`Error: ${error.message}`));
1567
+ console.error(chalk6.red(`Error: ${error.message}`));
1237
1568
  process.exit(1);
1238
1569
  }
1239
1570
  });
1240
1571
  orgs.command("member-remove").description("Remove a member from organization").argument("<slug>", "Organization slug").argument("<username>", "Username to remove").action(async (slug, username) => {
1241
1572
  try {
1242
1573
  await apiDelete(`/api/organizations/${slug}/members/${username}`);
1243
- console.log(chalk5.green(`\u2713 Removed @${username} from @${slug}`));
1574
+ console.log(chalk6.green(`\u2713 Removed @${username} from @${slug}`));
1244
1575
  } catch (error) {
1245
- console.error(chalk5.red(`Error: ${error.message}`));
1576
+ console.error(chalk6.red(`Error: ${error.message}`));
1246
1577
  process.exit(1);
1247
1578
  }
1248
1579
  });
@@ -1250,19 +1581,19 @@ function createOrgsCommand() {
1250
1581
  try {
1251
1582
  const teams = await apiGet(`/api/organizations/${slug}/teams`);
1252
1583
  if (teams.length === 0) {
1253
- console.log(chalk5.yellow("No teams found"));
1584
+ console.log(chalk6.yellow("No teams found"));
1254
1585
  return;
1255
1586
  }
1256
- console.log(chalk5.bold(`Teams (${teams.length})`));
1587
+ console.log(chalk6.bold(`Teams (${teams.length})`));
1257
1588
  console.log();
1258
1589
  for (const team of teams) {
1259
- console.log(chalk5.cyan(team.name));
1590
+ console.log(chalk6.cyan(team.name));
1260
1591
  if (team.description) {
1261
- console.log(chalk5.dim(` ${team.description}`));
1592
+ console.log(chalk6.dim(` ${team.description}`));
1262
1593
  }
1263
1594
  }
1264
1595
  } catch (error) {
1265
- console.error(chalk5.red(`Error: ${error.message}`));
1596
+ console.error(chalk6.red(`Error: ${error.message}`));
1266
1597
  process.exit(1);
1267
1598
  }
1268
1599
  });
@@ -1272,9 +1603,9 @@ function createOrgsCommand() {
1272
1603
  name: options.name,
1273
1604
  description: options.description
1274
1605
  });
1275
- console.log(chalk5.green(`\u2713 Team "${team.name}" created in @${slug}`));
1606
+ console.log(chalk6.green(`\u2713 Team "${team.name}" created in @${slug}`));
1276
1607
  } catch (error) {
1277
- console.error(chalk5.red(`Error: ${error.message}`));
1608
+ console.error(chalk6.red(`Error: ${error.message}`));
1278
1609
  process.exit(1);
1279
1610
  }
1280
1611
  });
@@ -1284,16 +1615,16 @@ function createOrgsCommand() {
1284
1615
  `/api/organizations/${slug}/teams/${team}/members`
1285
1616
  );
1286
1617
  if (members.length === 0) {
1287
- console.log(chalk5.yellow("No team members found"));
1618
+ console.log(chalk6.yellow("No team members found"));
1288
1619
  return;
1289
1620
  }
1290
- console.log(chalk5.bold(`Team Members (${members.length})`));
1621
+ console.log(chalk6.bold(`Team Members (${members.length})`));
1291
1622
  console.log();
1292
1623
  for (const member of members) {
1293
- console.log(chalk5.cyan(`@${member.user?.username || "unknown"}`));
1624
+ console.log(chalk6.cyan(`@${member.user?.username || "unknown"}`));
1294
1625
  }
1295
1626
  } catch (error) {
1296
- console.error(chalk5.red(`Error: ${error.message}`));
1627
+ console.error(chalk6.red(`Error: ${error.message}`));
1297
1628
  process.exit(1);
1298
1629
  }
1299
1630
  });
@@ -1305,9 +1636,9 @@ function createOrgsCommand() {
1305
1636
  username
1306
1637
  }
1307
1638
  );
1308
- console.log(chalk5.green(`\u2713 Added @${username} to team ${team}`));
1639
+ console.log(chalk6.green(`\u2713 Added @${username} to team ${team}`));
1309
1640
  } catch (error) {
1310
- console.error(chalk5.red(`Error: ${error.message}`));
1641
+ console.error(chalk6.red(`Error: ${error.message}`));
1311
1642
  process.exit(1);
1312
1643
  }
1313
1644
  });
@@ -1316,9 +1647,9 @@ function createOrgsCommand() {
1316
1647
  await apiDelete(
1317
1648
  `/api/organizations/${slug}/teams/${team}/members/${username}`
1318
1649
  );
1319
- console.log(chalk5.green(`\u2713 Removed @${username} from team ${team}`));
1650
+ console.log(chalk6.green(`\u2713 Removed @${username} from team ${team}`));
1320
1651
  } catch (error) {
1321
- console.error(chalk5.red(`Error: ${error.message}`));
1652
+ console.error(chalk6.red(`Error: ${error.message}`));
1322
1653
  process.exit(1);
1323
1654
  }
1324
1655
  });
@@ -1326,10 +1657,10 @@ function createOrgsCommand() {
1326
1657
  }
1327
1658
 
1328
1659
  // src/commands/user.ts
1329
- import { Command as Command6 } from "commander";
1330
- import chalk6 from "chalk";
1660
+ import { Command as Command7 } from "commander";
1661
+ import chalk7 from "chalk";
1331
1662
  function createUserCommand() {
1332
- const user = new Command6("user").description("Manage user profile and settings");
1663
+ const user = new Command7("user").description("Manage user profile and settings");
1333
1664
  user.command("profile").description("View user profile").argument("[username]", "Username (defaults to current user)").action(async (username) => {
1334
1665
  try {
1335
1666
  let profile;
@@ -1338,9 +1669,9 @@ function createUserCommand() {
1338
1669
  } else {
1339
1670
  profile = await apiGet("/api/users/me");
1340
1671
  }
1341
- console.log(chalk6.bold(`@${profile.username}`));
1672
+ console.log(chalk7.bold(`@${profile.username}`));
1342
1673
  if (profile.name) {
1343
- console.log(chalk6.dim(profile.name));
1674
+ console.log(chalk7.dim(profile.name));
1344
1675
  }
1345
1676
  console.log();
1346
1677
  if (profile.bio) {
@@ -1348,25 +1679,25 @@ function createUserCommand() {
1348
1679
  console.log();
1349
1680
  }
1350
1681
  if (profile.location) {
1351
- console.log(chalk6.dim(`\u{1F4CD} ${profile.location}`));
1682
+ console.log(chalk7.dim(`\u{1F4CD} ${profile.location}`));
1352
1683
  }
1353
1684
  if (profile.website) {
1354
- console.log(chalk6.dim(`\u{1F517} ${profile.website}`));
1685
+ console.log(chalk7.dim(`\u{1F517} ${profile.website}`));
1355
1686
  }
1356
1687
  if (profile.company) {
1357
- console.log(chalk6.dim(`\u{1F3E2} ${profile.company}`));
1688
+ console.log(chalk7.dim(`\u{1F3E2} ${profile.company}`));
1358
1689
  }
1359
1690
  if (profile.pronouns) {
1360
- console.log(chalk6.dim(`Pronouns: ${profile.pronouns}`));
1691
+ console.log(chalk7.dim(`Pronouns: ${profile.pronouns}`));
1361
1692
  }
1362
1693
  if (profile.gitEmail) {
1363
- console.log(chalk6.dim(`Git Email: ${profile.gitEmail}`));
1694
+ console.log(chalk7.dim(`Git Email: ${profile.gitEmail}`));
1364
1695
  }
1365
1696
  console.log();
1366
- console.log(chalk6.dim(`User type: ${profile.userType || "human"}`));
1367
- console.log(chalk6.dim(`Joined: ${new Date(profile.createdAt).toLocaleDateString()}`));
1697
+ console.log(chalk7.dim(`User type: ${profile.userType || "human"}`));
1698
+ console.log(chalk7.dim(`Joined: ${new Date(profile.createdAt).toLocaleDateString()}`));
1368
1699
  } catch (error) {
1369
- console.error(chalk6.red(`Error: ${error.message}`));
1700
+ console.error(chalk7.red(`Error: ${error.message}`));
1370
1701
  process.exit(1);
1371
1702
  }
1372
1703
  });
@@ -1382,16 +1713,16 @@ function createUserCommand() {
1382
1713
  if (options.gitEmail !== void 0) updates.gitEmail = options.gitEmail;
1383
1714
  if (Object.keys(updates).length === 0) {
1384
1715
  console.log(
1385
- chalk6.yellow(
1716
+ chalk7.yellow(
1386
1717
  "No updates specified. Use --name, --bio, --location, --website, --pronouns, --company, or --git-email"
1387
1718
  )
1388
1719
  );
1389
1720
  return;
1390
1721
  }
1391
1722
  await apiPatch("/api/users/me", updates);
1392
- console.log(chalk6.green("\u2713 Profile updated successfully"));
1723
+ console.log(chalk7.green("\u2713 Profile updated successfully"));
1393
1724
  } catch (error) {
1394
- console.error(chalk6.red(`Error: ${error.message}`));
1725
+ console.error(chalk7.red(`Error: ${error.message}`));
1395
1726
  process.exit(1);
1396
1727
  }
1397
1728
  });
@@ -1402,24 +1733,24 @@ function createUserCommand() {
1402
1733
  );
1403
1734
  const users = results.users || [];
1404
1735
  if (users.length === 0) {
1405
- console.log(chalk6.yellow("No users found"));
1736
+ console.log(chalk7.yellow("No users found"));
1406
1737
  return;
1407
1738
  }
1408
- console.log(chalk6.bold(`Users (${users.length})`));
1739
+ console.log(chalk7.bold(`Users (${users.length})`));
1409
1740
  console.log();
1410
1741
  for (const u of users) {
1411
- console.log(chalk6.cyan(`@${u.username}`));
1742
+ console.log(chalk7.cyan(`@${u.username}`));
1412
1743
  if (u.name) {
1413
- console.log(chalk6.dim(` ${u.name}`));
1744
+ console.log(chalk7.dim(` ${u.name}`));
1414
1745
  }
1415
1746
  if (u.bio) {
1416
1747
  const shortBio = u.bio.length > 60 ? u.bio.substring(0, 60) + "..." : u.bio;
1417
- console.log(chalk6.dim(` ${shortBio}`));
1748
+ console.log(chalk7.dim(` ${shortBio}`));
1418
1749
  }
1419
1750
  console.log();
1420
1751
  }
1421
1752
  } catch (error) {
1422
- console.error(chalk6.red(`Error: ${error.message}`));
1753
+ console.error(chalk7.red(`Error: ${error.message}`));
1423
1754
  process.exit(1);
1424
1755
  }
1425
1756
  });
@@ -1437,20 +1768,20 @@ function createUserCommand() {
1437
1768
  );
1438
1769
  const repositories = result.repos || [];
1439
1770
  if (repositories.length === 0) {
1440
- console.log(chalk6.yellow(`No repositories found for @${targetUsername}`));
1771
+ console.log(chalk7.yellow(`No repositories found for @${targetUsername}`));
1441
1772
  return;
1442
1773
  }
1443
- console.log(chalk6.bold(`@${targetUsername}'s Repositories (${repositories.length})`));
1774
+ console.log(chalk7.bold(`@${targetUsername}'s Repositories (${repositories.length})`));
1444
1775
  console.log();
1445
1776
  for (const repo of repositories) {
1446
1777
  const visibility = repo.visibility === "private" ? "\u{1F512}" : "\u{1F310}";
1447
- console.log(`${visibility} ${chalk6.cyan(repo.name)}`);
1778
+ console.log(`${visibility} ${chalk7.cyan(repo.name)}`);
1448
1779
  if (repo.description) {
1449
- console.log(chalk6.dim(` ${repo.description}`));
1780
+ console.log(chalk7.dim(` ${repo.description}`));
1450
1781
  }
1451
1782
  }
1452
1783
  } catch (error) {
1453
- console.error(chalk6.red(`Error: ${error.message}`));
1784
+ console.error(chalk7.red(`Error: ${error.message}`));
1454
1785
  process.exit(1);
1455
1786
  }
1456
1787
  });
@@ -1463,7 +1794,7 @@ var __dirname2 = dirname(__filename2);
1463
1794
  var packageJson = JSON.parse(
1464
1795
  readFileSync(join2(__dirname2, "../package.json"), "utf-8")
1465
1796
  );
1466
- var program = new Command7();
1797
+ var program = new Command8();
1467
1798
  program.name("forge").description("CLI tool for Kernelius Forge - the agent-native Git platform").version(packageJson.version);
1468
1799
  program.addCommand(createAuthCommand());
1469
1800
  program.addCommand(createReposCommand());
@@ -1471,4 +1802,5 @@ program.addCommand(createIssuesCommand());
1471
1802
  program.addCommand(createPrsCommand());
1472
1803
  program.addCommand(createOrgsCommand());
1473
1804
  program.addCommand(createUserCommand());
1805
+ program.addCommand(createTemplatesCommand());
1474
1806
  program.parse();