hale-commenting-system 1.0.1 → 1.0.3

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/cli/dist/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { Command } from "commander";
5
- import chalk11 from "chalk";
5
+ import chalk12 from "chalk";
6
6
 
7
7
  // src/commands/init.ts
8
- import chalk9 from "chalk";
8
+ import chalk10 from "chalk";
9
9
  import ora from "ora";
10
10
  import inquirer3 from "inquirer";
11
11
 
@@ -158,6 +158,7 @@ async function promptPlatform(projectRoot) {
158
158
  name: "platform",
159
159
  message: "Select your deployment platform:",
160
160
  choices: [
161
+ { name: "Local development (runs locally only)", value: "local" },
161
162
  { name: "Vercel", value: "vercel" },
162
163
  { name: "Netlify", value: "netlify" },
163
164
  { name: "Manual (I will configure myself)", value: "manual" }
@@ -476,7 +477,7 @@ export { handler };
476
477
 
477
478
  // src/generators/serverless.ts
478
479
  async function generateServerless(platform, projectRoot) {
479
- if (platform === "vercel") {
480
+ if (platform === "vercel" || platform === "local") {
480
481
  const apiDir = path2.join(projectRoot, "api");
481
482
  await ensureDir(apiDir);
482
483
  await writeFile(
@@ -602,6 +603,136 @@ async function generateConfig(githubConfig, platform, projectRoot) {
602
603
  console.log(chalk6.dim(" \u2192 Created apollo-comments.config.json"));
603
604
  }
604
605
 
606
+ // src/generators/code.ts
607
+ import path5 from "path";
608
+ import chalk7 from "chalk";
609
+ async function integrateProviders(projectRoot) {
610
+ const possiblePaths = [
611
+ "src/app/index.tsx",
612
+ "src/app/App.tsx",
613
+ "src/App.tsx",
614
+ "src/index.tsx"
615
+ ];
616
+ let appFilePath = null;
617
+ for (const p of possiblePaths) {
618
+ const fullPath = path5.join(projectRoot, p);
619
+ if (await fileExists(fullPath)) {
620
+ appFilePath = fullPath;
621
+ break;
622
+ }
623
+ }
624
+ if (!appFilePath) {
625
+ return {
626
+ success: false,
627
+ filePath: "",
628
+ message: "Could not find App entry point. Please integrate manually."
629
+ };
630
+ }
631
+ try {
632
+ const content = await readFile(appFilePath);
633
+ if (content.includes("hale-commenting-system") || content.includes("GitHubAuthProvider")) {
634
+ return {
635
+ success: false,
636
+ filePath: appFilePath,
637
+ message: "Providers already integrated or commenting system imports found."
638
+ };
639
+ }
640
+ const modifiedContent = injectProviders(content);
641
+ if (modifiedContent === content) {
642
+ return {
643
+ success: false,
644
+ filePath: appFilePath,
645
+ message: "Could not automatically integrate. File structure not recognized."
646
+ };
647
+ }
648
+ await writeFile(appFilePath, modifiedContent);
649
+ return {
650
+ success: true,
651
+ filePath: appFilePath,
652
+ message: `Successfully integrated providers into ${path5.relative(projectRoot, appFilePath)}`
653
+ };
654
+ } catch (error) {
655
+ return {
656
+ success: false,
657
+ filePath: appFilePath,
658
+ message: `Error: ${error.message}`
659
+ };
660
+ }
661
+ }
662
+ function injectProviders(content) {
663
+ const imports = `import {
664
+ CommentProvider,
665
+ VersionProvider,
666
+ GitHubAuthProvider,
667
+ CommentOverlay,
668
+ CommentDrawer
669
+ } from 'hale-commenting-system';
670
+ import apolloCommentsConfig from './apollo-comments.config.json';`;
671
+ const importRegex = /import\s+.*?from\s+['"].*?['"];?/g;
672
+ const matches = content.match(importRegex);
673
+ if (!matches || matches.length === 0) {
674
+ content = imports + "\n\n" + content;
675
+ } else {
676
+ const lastImport = matches[matches.length - 1];
677
+ const lastImportIndex = content.lastIndexOf(lastImport);
678
+ const insertPosition = lastImportIndex + lastImport.length;
679
+ content = content.slice(0, insertPosition) + "\n\n" + imports + content.slice(insertPosition);
680
+ }
681
+ const returnMatch = content.match(/return\s*\(?[\s\n]*<(\w+)/);
682
+ if (!returnMatch) {
683
+ return content;
684
+ }
685
+ const componentName = returnMatch[1];
686
+ const closingTag = `</${componentName}>`;
687
+ const closingIndex = content.indexOf(closingTag);
688
+ if (closingIndex === -1) {
689
+ return content;
690
+ }
691
+ const stateHook = ` const [selectedThreadId, setSelectedThreadId] = React.useState<string | null>(null);
692
+
693
+ `;
694
+ const functionMatch = content.match(/const\s+\w+.*?=.*?\(\).*?=>\s*\{/);
695
+ if (functionMatch) {
696
+ const insertPos = functionMatch.index + functionMatch[0].length;
697
+ content = content.slice(0, insertPos) + "\n" + stateHook + content.slice(insertPos);
698
+ }
699
+ const returnStartMatch = content.match(/return\s*\(/);
700
+ if (returnStartMatch) {
701
+ const returnStart = returnStartMatch.index + returnStartMatch[0].length;
702
+ const returnEnd = content.indexOf(closingTag, returnStart) + closingTag.length;
703
+ const originalReturn = content.slice(returnStart, returnEnd);
704
+ const wrappedReturn = `
705
+ <GitHubAuthProvider config={apolloCommentsConfig}>
706
+ <VersionProvider>
707
+ <CommentProvider>
708
+ <CommentDrawer
709
+ selectedThreadId={selectedThreadId}
710
+ onThreadSelect={setSelectedThreadId}
711
+ >
712
+ <CommentOverlay
713
+ selectedThreadId={selectedThreadId}
714
+ onThreadSelect={setSelectedThreadId}
715
+ />
716
+ ${originalReturn.trim()}
717
+ </CommentDrawer>
718
+ </CommentProvider>
719
+ </VersionProvider>
720
+ </GitHubAuthProvider>
721
+ `;
722
+ content = content.slice(0, returnStart) + wrappedReturn + content.slice(returnEnd);
723
+ }
724
+ return content;
725
+ }
726
+ function showIntegrationDiff(filePath) {
727
+ console.log(chalk7.cyan("\nChanges made to your App file:"));
728
+ console.log(chalk7.white("\u2022 Added commenting system imports"));
729
+ console.log(chalk7.white("\u2022 Added state hook for comment thread selection"));
730
+ console.log(chalk7.white("\u2022 Wrapped app with GitHubAuthProvider, VersionProvider, and CommentProvider"));
731
+ console.log(chalk7.white("\u2022 Added CommentDrawer and CommentOverlay components\n"));
732
+ console.log(chalk7.dim(`Modified: ${filePath}
733
+ `));
734
+ }
735
+
605
736
  // src/validators/github.ts
606
737
  import axios from "axios";
607
738
  async function validateGitHubConnection(config) {
@@ -621,7 +752,7 @@ async function validateGitHubConnection(config) {
621
752
 
622
753
  // src/validators/repo.ts
623
754
  import axios2 from "axios";
624
- import chalk7 from "chalk";
755
+ import chalk8 from "chalk";
625
756
  async function validateRepoAccess(config) {
626
757
  try {
627
758
  const response = await axios2.get(
@@ -636,8 +767,8 @@ async function validateRepoAccess(config) {
636
767
  return response.status === 200;
637
768
  } catch (error) {
638
769
  if (error.response?.status === 404) {
639
- console.log(chalk7.yellow(` Repository ${config.owner}/${config.repo} not found or is private`));
640
- console.log(chalk7.yellow(" Note: Private repos require authentication at runtime"));
770
+ console.log(chalk8.yellow(` Repository ${config.owner}/${config.repo} not found or is private`));
771
+ console.log(chalk8.yellow(" Note: Private repos require authentication at runtime"));
641
772
  return true;
642
773
  }
643
774
  console.error(" Repo access error:", error.message);
@@ -646,18 +777,18 @@ async function validateRepoAccess(config) {
646
777
  }
647
778
 
648
779
  // src/validators/labels.ts
649
- import chalk8 from "chalk";
780
+ import chalk9 from "chalk";
650
781
  var REQUIRED_LABELS = [
651
782
  { name: "comment", color: "0075ca", description: "User feedback comment" },
652
783
  { name: "prototype-feedback", color: "d93f0b", description: "Prototype feedback" },
653
784
  { name: "needs-review", color: "fbca04", description: "Needs team review" }
654
785
  ];
655
786
  async function ensureLabels(config) {
656
- console.log(chalk8.dim("\n Required labels for GitHub issues:"));
787
+ console.log(chalk9.dim("\n Required labels for GitHub issues:"));
657
788
  REQUIRED_LABELS.forEach((label) => {
658
- console.log(chalk8.dim(` - ${label.name} (#${label.color}): ${label.description}`));
789
+ console.log(chalk9.dim(` - ${label.name} (#${label.color}): ${label.description}`));
659
790
  });
660
- console.log(chalk8.dim(" These will be created automatically at runtime with proper authentication.\n"));
791
+ console.log(chalk9.dim(" These will be created automatically at runtime with proper authentication.\n"));
661
792
  }
662
793
 
663
794
  // src/commands/init.ts
@@ -674,7 +805,7 @@ async function initCommand(options) {
674
805
  }
675
806
  if (!project.isReact) {
676
807
  spinner.fail("This package requires a React project");
677
- console.log(chalk9.red("\n\u2717 Apollo Commenting System requires React.\n"));
808
+ console.log(chalk10.red("\n\u2717 Apollo Commenting System requires React.\n"));
678
809
  process.exit(1);
679
810
  }
680
811
  if (!project.hasPatternFly) {
@@ -689,7 +820,7 @@ async function initCommand(options) {
689
820
  }
690
821
  ]);
691
822
  if (!continueAnyway) {
692
- console.log(chalk9.dim("\nSetup cancelled.\n"));
823
+ console.log(chalk10.dim("\nSetup cancelled.\n"));
693
824
  process.exit(0);
694
825
  }
695
826
  }
@@ -738,24 +869,56 @@ async function initCommand(options) {
738
869
  process.exit(1);
739
870
  }
740
871
  printSuccess();
741
- printSetupInstructions(platform, project);
742
- printNextSteps();
872
+ if (!options.yes) {
873
+ const { autoIntegrate } = await inquirer3.prompt([
874
+ {
875
+ type: "confirm",
876
+ name: "autoIntegrate",
877
+ message: "Automatically integrate providers into your App file?",
878
+ default: true
879
+ }
880
+ ]);
881
+ if (autoIntegrate) {
882
+ spinner.start("Integrating providers...");
883
+ const result = await integrateProviders(project.root);
884
+ if (result.success) {
885
+ spinner.succeed("Providers integrated!");
886
+ showIntegrationDiff(result.filePath);
887
+ console.log(chalk10.green("\u2713 Your app is ready to use the commenting system!\n"));
888
+ console.log(chalk10.cyan("Next steps:"));
889
+ console.log(chalk10.white("1. Review the changes in your App file"));
890
+ console.log(chalk10.white("2. Start your dev server: npm run start:dev"));
891
+ console.log(chalk10.white("3. Open http://localhost:9000\n"));
892
+ } else {
893
+ spinner.warn(result.message);
894
+ console.log(chalk10.yellow("\nFalling back to manual integration:\n"));
895
+ printSetupInstructions(platform, project);
896
+ printNextSteps();
897
+ }
898
+ } else {
899
+ printSetupInstructions(platform, project);
900
+ printNextSteps();
901
+ }
902
+ } else {
903
+ printSetupInstructions(platform, project);
904
+ printNextSteps();
905
+ }
743
906
  }
744
907
 
745
908
  // src/commands/validate.ts
746
- import chalk10 from "chalk";
909
+ import chalk11 from "chalk";
747
910
  import ora2 from "ora";
748
- import path5 from "path";
911
+ import path6 from "path";
749
912
  async function validateCommand() {
750
- console.log(chalk10.bold.cyan("\n\u{1F50D} Validating Apollo Commenting System Setup\n"));
913
+ console.log(chalk11.bold.cyan("\n\u{1F50D} Validating Apollo Commenting System Setup\n"));
751
914
  const spinner = ora2("Checking configuration files...").start();
752
915
  const cwd = process.cwd();
753
- const configPath = path5.join(cwd, "apollo-comments.config.json");
916
+ const configPath = path6.join(cwd, "apollo-comments.config.json");
754
917
  const hasConfig = await fileExists(configPath);
755
918
  if (!hasConfig) {
756
919
  spinner.fail("Configuration file not found");
757
- console.log(chalk10.red("\n\u2717 apollo-comments.config.json not found"));
758
- console.log(chalk10.dim(" Run: apollo-comments init\n"));
920
+ console.log(chalk11.red("\n\u2717 apollo-comments.config.json not found"));
921
+ console.log(chalk11.dim(" Run: apollo-comments init\n"));
759
922
  process.exit(1);
760
923
  }
761
924
  let config;
@@ -765,11 +928,11 @@ async function validateCommand() {
765
928
  spinner.succeed("Configuration file found");
766
929
  } catch (error) {
767
930
  spinner.fail("Invalid configuration file");
768
- console.log(chalk10.red("\n\u2717 Could not parse apollo-comments.config.json\n"));
931
+ console.log(chalk11.red("\n\u2717 Could not parse apollo-comments.config.json\n"));
769
932
  process.exit(1);
770
933
  }
771
934
  spinner.start("Checking environment files...");
772
- const envPath = path5.join(cwd, ".env.local");
935
+ const envPath = path6.join(cwd, ".env.local");
773
936
  const hasEnv = await fileExists(envPath);
774
937
  if (!hasEnv) {
775
938
  spinner.warn("Environment file not found (.env.local)");
@@ -779,14 +942,14 @@ async function validateCommand() {
779
942
  spinner.start("Checking serverless functions...");
780
943
  let hasServerless = false;
781
944
  if (config.platform === "vercel") {
782
- const apiDir = path5.join(cwd, "api");
783
- const loginPath = path5.join(apiDir, "github-oauth-login.ts");
784
- const callbackPath = path5.join(apiDir, "github-oauth-callback.ts");
945
+ const apiDir = path6.join(cwd, "api");
946
+ const loginPath = path6.join(apiDir, "github-oauth-login.ts");
947
+ const callbackPath = path6.join(apiDir, "github-oauth-callback.ts");
785
948
  hasServerless = await fileExists(loginPath) && await fileExists(callbackPath);
786
949
  } else if (config.platform === "netlify") {
787
- const functionsDir = path5.join(cwd, "netlify", "functions");
788
- const loginPath = path5.join(functionsDir, "github-oauth-login.ts");
789
- const callbackPath = path5.join(functionsDir, "github-oauth-callback.ts");
950
+ const functionsDir = path6.join(cwd, "netlify", "functions");
951
+ const loginPath = path6.join(functionsDir, "github-oauth-login.ts");
952
+ const callbackPath = path6.join(functionsDir, "github-oauth-callback.ts");
790
953
  hasServerless = await fileExists(loginPath) && await fileExists(callbackPath);
791
954
  }
792
955
  if (!hasServerless && config.platform !== "manual") {
@@ -798,7 +961,7 @@ async function validateCommand() {
798
961
  const isValid = await validateGitHubConnection(config.github);
799
962
  if (!isValid) {
800
963
  spinner.fail("GitHub connection failed");
801
- console.log(chalk10.red("\n\u2717 Could not connect to GitHub API\n"));
964
+ console.log(chalk11.red("\n\u2717 Could not connect to GitHub API\n"));
802
965
  process.exit(1);
803
966
  }
804
967
  spinner.succeed("GitHub connection validated");
@@ -809,8 +972,8 @@ async function validateCommand() {
809
972
  } else {
810
973
  spinner.succeed("Repository access confirmed");
811
974
  }
812
- console.log(chalk10.green.bold("\n\u2713 Validation complete!\n"));
813
- console.log(chalk10.white("Your Apollo Commenting System setup looks good.\n"));
975
+ console.log(chalk11.green.bold("\n\u2713 Validation complete!\n"));
976
+ console.log(chalk11.white("Your Apollo Commenting System setup looks good.\n"));
814
977
  }
815
978
 
816
979
  // src/index.ts
@@ -820,7 +983,7 @@ program.command("init").description("Initialize Apollo Commenting System in your
820
983
  try {
821
984
  await initCommand(options);
822
985
  } catch (error) {
823
- console.error(chalk11.red("\n\u2717 Error:"), error.message);
986
+ console.error(chalk12.red("\n\u2717 Error:"), error.message);
824
987
  process.exit(1);
825
988
  }
826
989
  });
@@ -828,13 +991,13 @@ program.command("validate").description("Validate your commenting system setup")
828
991
  try {
829
992
  await validateCommand();
830
993
  } catch (error) {
831
- console.error(chalk11.red("\n\u2717 Error:"), error.message);
994
+ console.error(chalk12.red("\n\u2717 Error:"), error.message);
832
995
  process.exit(1);
833
996
  }
834
997
  });
835
998
  program.command("update").description("Update existing configuration").action(() => {
836
- console.log(chalk11.yellow("\n\u26A0\uFE0F Coming soon: Update configuration\n"));
837
- console.log(chalk11.dim("For now, you can manually edit apollo-comments.config.json\n"));
999
+ console.log(chalk12.yellow("\n\u26A0\uFE0F Coming soon: Update configuration\n"));
1000
+ console.log(chalk12.dim("For now, you can manually edit apollo-comments.config.json\n"));
838
1001
  });
839
1002
  if (!process.argv.slice(2).length) {
840
1003
  program.help();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/commands/init.ts","../src/utils/detect.ts","../src/utils/logger.ts","../src/prompts/platform.ts","../src/prompts/github.ts","../src/generators/serverless.ts","../src/utils/fs.ts","../src/templates/vercel-auth.ts","../src/templates/netlify-auth.ts","../src/generators/env.ts","../src/generators/config.ts","../src/validators/github.ts","../src/validators/repo.ts","../src/validators/labels.ts","../src/commands/validate.ts"],"sourcesContent":["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { initCommand } from './commands/init.js';\nimport { validateCommand } from './commands/validate.js';\n\nconst program = new Command();\n\nprogram\n .name('hale-commenting-system')\n .description('Hale Commenting System CLI - Setup wizard and tooling')\n .version('1.0.0');\n\nprogram\n .command('init')\n .description('Initialize Apollo Commenting System in your project')\n .option('-y, --yes', 'Skip prompts and use defaults')\n .option('--platform <platform>', 'Target platform (vercel, netlify, manual)')\n .action(async (options) => {\n try {\n await initCommand(options);\n } catch (error: any) {\n console.error(chalk.red('\\n✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\nprogram\n .command('validate')\n .description('Validate your commenting system setup')\n .action(async () => {\n try {\n await validateCommand();\n } catch (error: any) {\n console.error(chalk.red('\\n✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\nprogram\n .command('update')\n .description('Update existing configuration')\n .action(() => {\n console.log(chalk.yellow('\\n⚠️ Coming soon: Update configuration\\n'));\n console.log(chalk.dim('For now, you can manually edit apollo-comments.config.json\\n'));\n });\n\n// Show help if no command provided\nif (!process.argv.slice(2).length) {\n program.help();\n}\n\nprogram.parse();\n\n","import chalk from 'chalk';\nimport ora from 'ora';\nimport inquirer from 'inquirer';\nimport { detectProject } from '../utils/detect.js';\nimport { printWelcome, printSetupInstructions, printSuccess, printNextSteps, printWarning } from '../utils/logger.js';\nimport { promptPlatform } from '../prompts/platform.js';\nimport { promptGitHubConfig } from '../prompts/github.js';\nimport { generateServerless } from '../generators/serverless.js';\nimport { generateEnvFiles } from '../generators/env.js';\nimport { generateConfig } from '../generators/config.js';\nimport { validateGitHubConnection } from '../validators/github.js';\nimport { validateRepoAccess } from '../validators/repo.js';\nimport { ensureLabels } from '../validators/labels.js';\n\ninterface InitOptions {\n yes?: boolean;\n platform?: string;\n}\n\nexport async function initCommand(options: InitOptions) {\n printWelcome();\n\n const spinner = ora('Detecting project...').start();\n\n // Step 1: Detect project type\n let project;\n try {\n project = await detectProject(process.cwd());\n spinner.succeed(`Detected: ${project.framework} with ${project.buildTool}`);\n } catch (error: any) {\n spinner.fail(error.message);\n process.exit(1);\n }\n\n if (!project.isReact) {\n spinner.fail('This package requires a React project');\n console.log(chalk.red('\\n✗ Apollo Commenting System requires React.\\n'));\n process.exit(1);\n }\n\n if (!project.hasPatternFly) {\n printWarning('PatternFly not detected. This package is optimized for PatternFly projects.');\n if (!options.yes) {\n const { continueAnyway } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'continueAnyway',\n message: 'Continue anyway?',\n default: false\n }\n ]);\n if (!continueAnyway) {\n console.log(chalk.dim('\\nSetup cancelled.\\n'));\n process.exit(0);\n }\n }\n }\n\n // Step 2: Select platform\n const platform = options.platform || await promptPlatform(project.root);\n\n // Step 3: Prompt for GitHub OAuth settings\n const githubConfig = await promptGitHubConfig(options.yes || false);\n\n // Step 4: Validate GitHub connection\n spinner.start('Validating GitHub connection...');\n const isValid = await validateGitHubConnection(githubConfig);\n if (!isValid) {\n spinner.fail('GitHub connection failed. Please check your internet connection.');\n process.exit(1);\n }\n spinner.succeed('GitHub connection validated');\n\n // Step 5: Validate repo access\n spinner.start('Checking repository access...');\n const hasAccess = await validateRepoAccess(githubConfig);\n if (!hasAccess) {\n spinner.fail('Cannot access repository. Check the owner/repo name.');\n process.exit(1);\n }\n spinner.succeed('Repository access confirmed');\n\n // Step 6: Ensure labels exist\n spinner.start('Checking issue labels...');\n await ensureLabels(githubConfig);\n spinner.succeed('Issue labels documented');\n\n // Step 7: Generate serverless functions\n spinner.start('Generating serverless functions...');\n try {\n await generateServerless(platform, project.root);\n spinner.succeed('Serverless functions created');\n } catch (error: any) {\n spinner.fail(`Failed to generate serverless functions: ${error.message}`);\n process.exit(1);\n }\n\n // Step 8: Generate environment files\n spinner.start('Creating environment files...');\n try {\n await generateEnvFiles(githubConfig, platform, project.root);\n spinner.succeed('Environment files created');\n } catch (error: any) {\n spinner.fail(`Failed to create environment files: ${error.message}`);\n process.exit(1);\n }\n\n // Step 9: Generate config file\n spinner.start('Creating apollo-comments.config.json...');\n try {\n await generateConfig(githubConfig, platform, project.root);\n spinner.succeed('Configuration file created');\n } catch (error: any) {\n spinner.fail(`Failed to create config file: ${error.message}`);\n process.exit(1);\n }\n\n // Step 10: Print setup instructions\n printSuccess();\n printSetupInstructions(platform, project);\n printNextSteps();\n}\n\n","import fs from 'fs/promises';\nimport path from 'path';\n\nexport interface ProjectInfo {\n root: string;\n framework: string;\n buildTool: string;\n isReact: boolean;\n hasPatternFly: boolean;\n hasTypeScript: boolean;\n packageJson: any;\n}\n\nexport async function detectProject(cwd: string): Promise<ProjectInfo> {\n const packageJsonPath = path.join(cwd, 'package.json');\n \n let packageJson: any = {};\n try {\n const content = await fs.readFile(packageJsonPath, 'utf-8');\n packageJson = JSON.parse(content);\n } catch (error) {\n throw new Error('No package.json found. Are you in a Node.js project?');\n }\n\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies\n };\n\n const buildTool = await detectBuildTool(cwd, deps);\n\n return {\n root: cwd,\n framework: detectFramework(deps),\n buildTool,\n isReact: !!deps['react'],\n hasPatternFly: !!deps['@patternfly/react-core'],\n hasTypeScript: !!deps['typescript'],\n packageJson\n };\n}\n\nfunction detectFramework(deps: any): string {\n if (deps['react']) return 'React';\n if (deps['vue']) return 'Vue';\n if (deps['@angular/core']) return 'Angular';\n return 'Unknown';\n}\n\nasync function detectBuildTool(cwd: string, deps: any): Promise<string> {\n if (deps['vite']) return 'Vite';\n if (deps['webpack']) return 'Webpack';\n \n try {\n await fs.access(path.join(cwd, 'next.config.js'));\n return 'Next.js';\n } catch {\n // Next.js config not found\n }\n\n return 'Unknown';\n}\n\nexport async function detectPlatform(cwd: string): Promise<string | null> {\n try {\n await fs.access(path.join(cwd, 'vercel.json'));\n return 'vercel';\n } catch {\n // Not Vercel\n }\n\n try {\n await fs.access(path.join(cwd, 'netlify.toml'));\n return 'netlify';\n } catch {\n // Not Netlify\n }\n\n return null;\n}\n\n","import chalk from 'chalk';\n\nexport function printWelcome() {\n console.log(chalk.bold.cyan('\\n🚀 Hale Commenting System Setup Wizard\\n'));\n}\n\nexport function printSetupInstructions(platform: string, project: any) {\n console.log(chalk.bold('\\n📝 Manual Setup Required:\\n'));\n\n console.log(chalk.cyan('1. Add the CommentProvider to your App.tsx:\\n'));\n \n console.log(chalk.white(`import {\n CommentProvider,\n VersionProvider,\n GitHubAuthProvider,\n CommentOverlay,\n CommentDrawer\n} from '@apollo/commenting-system';\nimport apolloCommentsConfig from './apollo-comments.config.json';\nimport React from 'react';\n\nfunction App() {\n const [selectedThreadId, setSelectedThreadId] = React.useState<string | null>(null);\n\n return (\n <GitHubAuthProvider config={apolloCommentsConfig}>\n <VersionProvider>\n <CommentProvider>\n <CommentDrawer \n selectedThreadId={selectedThreadId} \n onThreadSelect={setSelectedThreadId}\n >\n <CommentOverlay \n selectedThreadId={selectedThreadId} \n onThreadSelect={setSelectedThreadId}\n />\n {/* Your app content */}\n </CommentDrawer>\n </CommentProvider>\n </VersionProvider>\n </GitHubAuthProvider>\n );\n}\n`));\n\n console.log(chalk.cyan('\\n2. Deploy your serverless functions:\\n'));\n\n if (platform === 'vercel') {\n console.log(chalk.white(' vercel --prod'));\n } else if (platform === 'netlify') {\n console.log(chalk.white(' netlify deploy --prod'));\n } else {\n console.log(chalk.white(' Follow your platform\\'s deployment guide'));\n }\n\n console.log(chalk.cyan('\\n3. Update your GitHub OAuth App callback URL:\\n'));\n console.log(chalk.white(' https://your-domain.com/api/github-oauth-callback\\n'));\n}\n\nexport function printSuccess() {\n console.log(chalk.green.bold('\\n✓ Setup complete!\\n'));\n}\n\nexport function printNextSteps() {\n console.log(chalk.cyan('\\nNext steps:'));\n console.log(chalk.white('1. Review generated files in your project'));\n console.log(chalk.white('2. Add the CommentProvider to your App.tsx (see instructions above)'));\n console.log(chalk.white('3. Deploy your serverless functions'));\n console.log(chalk.white('4. Run: npm run dev\\n'));\n\n console.log(chalk.dim('Run \"hale-commenting-system validate\" to verify your setup.\\n'));\n}\n\nexport function printError(message: string) {\n console.log(chalk.red.bold(`\\n✗ Error: ${message}\\n`));\n}\n\nexport function printWarning(message: string) {\n console.log(chalk.yellow(`⚠️ ${message}`));\n}\n\n","import inquirer from 'inquirer';\nimport chalk from 'chalk';\nimport { detectPlatform } from '../utils/detect.js';\n\nexport async function promptPlatform(projectRoot: string): Promise<string> {\n // Auto-detect platform\n const detectedPlatform = await detectPlatform(projectRoot);\n\n if (detectedPlatform) {\n console.log(chalk.green(`✓ Detected ${detectedPlatform} configuration`));\n \n const { usePlatform } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'usePlatform',\n message: `Use ${detectedPlatform} for serverless functions?`,\n default: true\n }\n ]);\n\n if (usePlatform) {\n return detectedPlatform;\n }\n }\n\n const { platform } = await inquirer.prompt([\n {\n type: 'list',\n name: 'platform',\n message: 'Select your deployment platform:',\n choices: [\n { name: 'Vercel', value: 'vercel' },\n { name: 'Netlify', value: 'netlify' },\n { name: 'Manual (I will configure myself)', value: 'manual' }\n ]\n }\n ]);\n\n return platform;\n}\n\n","import inquirer from 'inquirer';\nimport chalk from 'chalk';\n\nexport interface GitHubConfig {\n clientId: string;\n clientSecret: string;\n owner: string;\n repo: string;\n}\n\nexport async function promptGitHubConfig(skipPrompts: boolean = false): Promise<GitHubConfig> {\n if (skipPrompts) {\n console.log(chalk.yellow('Using default/environment values...'));\n return {\n clientId: process.env.GITHUB_CLIENT_ID || '',\n clientSecret: process.env.GITHUB_CLIENT_SECRET || '',\n owner: process.env.GITHUB_OWNER || '',\n repo: process.env.GITHUB_REPO || ''\n };\n }\n\n console.log(chalk.bold('\\n📋 GitHub OAuth Configuration\\n'));\n console.log(chalk.dim('You need to create a GitHub OAuth App:'));\n console.log(chalk.dim('https://github.com/settings/developers\\n'));\n\n const answers = await inquirer.prompt<GitHubConfig>([\n {\n type: 'input',\n name: 'clientId',\n message: 'GitHub OAuth Client ID:',\n validate: (input: string) => input.length > 0 || 'Client ID is required'\n },\n {\n type: 'password',\n name: 'clientSecret',\n message: 'GitHub OAuth Client Secret:',\n mask: '*',\n validate: (input: string) => input.length > 0 || 'Client Secret is required'\n },\n {\n type: 'input',\n name: 'owner',\n message: 'GitHub Repository Owner (user or org):',\n validate: (input: string) => input.length > 0 || 'Owner is required'\n },\n {\n type: 'input',\n name: 'repo',\n message: 'GitHub Repository Name:',\n validate: (input: string) => input.length > 0 || 'Repository name is required'\n }\n ]);\n\n return answers;\n}\n\n","import path from 'path';\nimport chalk from 'chalk';\nimport { ensureDir, writeFile } from '../utils/fs.js';\nimport { vercelAuthLoginTemplate, vercelAuthCallbackTemplate } from '../templates/vercel-auth.js';\nimport { netlifyAuthLoginTemplate, netlifyAuthCallbackTemplate } from '../templates/netlify-auth.js';\n\nexport async function generateServerless(platform: string, projectRoot: string): Promise<void> {\n if (platform === 'vercel') {\n const apiDir = path.join(projectRoot, 'api');\n await ensureDir(apiDir);\n\n await writeFile(\n path.join(apiDir, 'github-oauth-login.ts'),\n vercelAuthLoginTemplate\n );\n\n await writeFile(\n path.join(apiDir, 'github-oauth-callback.ts'),\n vercelAuthCallbackTemplate\n );\n\n console.log(chalk.dim(' → Created api/github-oauth-login.ts'));\n console.log(chalk.dim(' → Created api/github-oauth-callback.ts'));\n } else if (platform === 'netlify') {\n const functionsDir = path.join(projectRoot, 'netlify', 'functions');\n await ensureDir(functionsDir);\n\n await writeFile(\n path.join(functionsDir, 'github-oauth-login.ts'),\n netlifyAuthLoginTemplate\n );\n\n await writeFile(\n path.join(functionsDir, 'github-oauth-callback.ts'),\n netlifyAuthCallbackTemplate\n );\n\n console.log(chalk.dim(' → Created netlify/functions/github-oauth-login.ts'));\n console.log(chalk.dim(' → Created netlify/functions/github-oauth-callback.ts'));\n } else {\n console.log(chalk.yellow(' Manual platform selected. You must create serverless functions yourself.'));\n console.log(chalk.dim(' See: https://github.com/apollo/commenting-system/blob/main/docs/manual-setup.md'));\n }\n}\n\n","import fs from 'fs/promises';\nimport path from 'path';\n\nexport async function fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function ensureDir(dirPath: string): Promise<void> {\n await fs.mkdir(dirPath, { recursive: true });\n}\n\nexport async function writeFileIfNotExists(filePath: string, content: string): Promise<boolean> {\n const exists = await fileExists(filePath);\n if (exists) {\n return false;\n }\n \n await fs.writeFile(filePath, content, 'utf-8');\n return true;\n}\n\nexport async function appendToFile(filePath: string, content: string): Promise<void> {\n await fs.appendFile(filePath, content, 'utf-8');\n}\n\nexport async function readFile(filePath: string): Promise<string> {\n return fs.readFile(filePath, 'utf-8');\n}\n\nexport async function writeFile(filePath: string, content: string): Promise<void> {\n await fs.writeFile(filePath, content, 'utf-8');\n}\n\nexport function getRelativePath(from: string, to: string): string {\n return path.relative(from, to);\n}\n\n","export const vercelAuthLoginTemplate = `import { VercelRequest, VercelResponse } from '@vercel/node';\n\nexport default async function handler(req: VercelRequest, res: VercelResponse): Promise<void> {\n try {\n const clientId = process.env.GITHUB_CLIENT_ID || process.env.VITE_GITHUB_CLIENT_ID;\n \n if (!clientId) {\n res.status(500).json({ error: 'GitHub OAuth not configured - missing client ID' });\n return;\n }\n\n // Get the base URL from the request\n const protocol = (req.headers['x-forwarded-proto'] as string) || 'https';\n const host = (req.headers.host || req.headers['x-forwarded-host']) as string;\n \n if (!host) {\n res.status(500).json({ error: 'Could not determine host' });\n return;\n }\n \n const baseUrl = \\`\\${protocol}://\\${host}\\`;\n const redirectUri = \\`\\${baseUrl}/api/github-oauth-callback\\`;\n\n // Redirect to GitHub OAuth\n // Scope: public_repo allows read/write access to public repositories only\n const githubAuthUrl = \\`https://github.com/login/oauth/authorize?client_id=\\${clientId}&redirect_uri=\\${encodeURIComponent(redirectUri)}&scope=public_repo\\`;\n\n res.redirect(302, githubAuthUrl);\n } catch (error: any) {\n res.status(500).json({ \n error: 'Internal server error', \n details: error.message\n });\n }\n}\n`;\n\nexport const vercelAuthCallbackTemplate = `import { VercelRequest, VercelResponse } from '@vercel/node';\nimport axios from 'axios';\n\nexport default async function handler(req: VercelRequest, res: VercelResponse): Promise<void> {\n try {\n const code = req.query.code as string;\n const clientId = process.env.GITHUB_CLIENT_ID || process.env.VITE_GITHUB_CLIENT_ID;\n const clientSecret = process.env.GITHUB_CLIENT_SECRET;\n\n if (!code) {\n res.status(400).json({ error: 'No code provided' });\n return;\n }\n\n if (!clientId || !clientSecret) {\n res.status(500).json({ error: 'GitHub OAuth not configured properly' });\n return;\n }\n\n // Exchange code for access token\n const tokenResponse = await axios.post(\n 'https://github.com/login/oauth/access_token',\n {\n client_id: clientId,\n client_secret: clientSecret,\n code,\n },\n {\n headers: {\n Accept: 'application/json',\n },\n }\n );\n\n const accessToken = tokenResponse.data.access_token;\n\n if (!accessToken) {\n throw new Error('No access token received');\n }\n\n // Get user info\n const userResponse = await axios.get('https://api.github.com/user', {\n headers: {\n Authorization: \\`token \\${accessToken}\\`,\n },\n });\n\n const user = userResponse.data;\n\n // Redirect back to the app with token in URL fragment (client-side only)\n const protocol = req.headers['x-forwarded-proto'] || 'https';\n const host = req.headers.host || req.headers['x-forwarded-host'];\n const baseUrl = \\`\\${protocol}://\\${host}\\`;\n const redirectUrl = \\`\\${baseUrl}/#/auth-callback?token=\\${accessToken}&login=\\${user.login}&avatar=\\${encodeURIComponent(user.avatar_url)}\\`;\n\n res.redirect(302, redirectUrl);\n } catch (error: any) {\n res.status(500).json({\n error: 'Failed to exchange code for token',\n details: error.message,\n });\n }\n}\n`;\n\n","export const netlifyAuthLoginTemplate = `import { Handler, HandlerEvent, HandlerContext } from '@netlify/functions';\nimport axios from 'axios';\n\nconst handler: Handler = async (event: HandlerEvent, context: HandlerContext) => {\n try {\n const clientId = process.env.GITHUB_CLIENT_ID || process.env.VITE_GITHUB_CLIENT_ID;\n \n if (!clientId) {\n return {\n statusCode: 500,\n body: JSON.stringify({ error: 'GitHub OAuth not configured - missing client ID' })\n };\n }\n\n // Get the base URL from the request\n const protocol = event.headers['x-forwarded-proto'] || 'https';\n const host = event.headers.host;\n \n if (!host) {\n return {\n statusCode: 500,\n body: JSON.stringify({ error: 'Could not determine host' })\n };\n }\n \n const baseUrl = \\`\\${protocol}://\\${host}\\`;\n const redirectUri = \\`\\${baseUrl}/.netlify/functions/github-oauth-callback\\`;\n\n // Redirect to GitHub OAuth\n const githubAuthUrl = \\`https://github.com/login/oauth/authorize?client_id=\\${clientId}&redirect_uri=\\${encodeURIComponent(redirectUri)}&scope=public_repo\\`;\n\n return {\n statusCode: 302,\n headers: {\n Location: githubAuthUrl\n },\n body: ''\n };\n } catch (error: any) {\n return {\n statusCode: 500,\n body: JSON.stringify({ \n error: 'Internal server error', \n details: error.message\n })\n };\n }\n};\n\nexport { handler };\n`;\n\nexport const netlifyAuthCallbackTemplate = `import { Handler, HandlerEvent, HandlerContext } from '@netlify/functions';\nimport axios from 'axios';\n\nconst handler: Handler = async (event: HandlerEvent, context: HandlerContext) => {\n try {\n const code = event.queryStringParameters?.code;\n const clientId = process.env.GITHUB_CLIENT_ID || process.env.VITE_GITHUB_CLIENT_ID;\n const clientSecret = process.env.GITHUB_CLIENT_SECRET;\n\n if (!code) {\n return {\n statusCode: 400,\n body: JSON.stringify({ error: 'No code provided' })\n };\n }\n\n if (!clientId || !clientSecret) {\n return {\n statusCode: 500,\n body: JSON.stringify({ error: 'GitHub OAuth not configured properly' })\n };\n }\n\n // Exchange code for access token\n const tokenResponse = await axios.post(\n 'https://github.com/login/oauth/access_token',\n {\n client_id: clientId,\n client_secret: clientSecret,\n code,\n },\n {\n headers: {\n Accept: 'application/json',\n },\n }\n );\n\n const accessToken = tokenResponse.data.access_token;\n\n if (!accessToken) {\n throw new Error('No access token received');\n }\n\n // Get user info\n const userResponse = await axios.get('https://api.github.com/user', {\n headers: {\n Authorization: \\`token \\${accessToken}\\`,\n },\n });\n\n const user = userResponse.data;\n\n // Redirect back to the app with token in URL fragment\n const protocol = event.headers['x-forwarded-proto'] || 'https';\n const host = event.headers.host;\n const baseUrl = \\`\\${protocol}://\\${host}\\`;\n const redirectUrl = \\`\\${baseUrl}/#/auth-callback?token=\\${accessToken}&login=\\${user.login}&avatar=\\${encodeURIComponent(user.avatar_url)}\\`;\n\n return {\n statusCode: 302,\n headers: {\n Location: redirectUrl\n },\n body: ''\n };\n } catch (error: any) {\n return {\n statusCode: 500,\n body: JSON.stringify({\n error: 'Failed to exchange code for token',\n details: error.message,\n })\n };\n }\n};\n\nexport { handler };\n`;\n\n","import path from 'path';\nimport chalk from 'chalk';\nimport { fileExists, appendToFile, writeFile, readFile } from '../utils/fs.js';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nexport async function generateEnvFiles(\n githubConfig: GitHubConfig, \n platform: string, \n projectRoot: string\n): Promise<void> {\n const envContent = `\n# Apollo Commenting System Configuration\n# Generated by apollo-comments CLI\n\n# GitHub OAuth\nGITHUB_CLIENT_ID=${githubConfig.clientId}\nGITHUB_CLIENT_SECRET=${githubConfig.clientSecret}\nGITHUB_OWNER=${githubConfig.owner}\nGITHUB_REPO=${githubConfig.repo}\n\n# Vite (if using Vite)\nVITE_GITHUB_CLIENT_ID=${githubConfig.clientId}\nVITE_GITHUB_OWNER=${githubConfig.owner}\nVITE_GITHUB_REPO=${githubConfig.repo}\n`;\n\n const envLocalPath = path.join(projectRoot, '.env.local');\n const envPath = path.join(projectRoot, '.env');\n\n // Check if .env.local exists and already contains GitHub config\n const envLocalExists = await fileExists(envLocalPath);\n \n if (envLocalExists) {\n const existingEnv = await readFile(envLocalPath);\n if (existingEnv.includes('GITHUB_CLIENT_ID')) {\n console.log(chalk.yellow(' .env.local already contains GitHub config. Skipping...'));\n } else {\n await appendToFile(envLocalPath, envContent);\n console.log(chalk.dim(' → Updated .env.local'));\n }\n } else {\n await writeFile(envLocalPath, envContent.trim());\n console.log(chalk.dim(' → Created .env.local'));\n }\n\n // Create .env.example without secrets\n const envExampleContent = `# Apollo Commenting System Configuration\n\n# GitHub OAuth (get from https://github.com/settings/developers)\nGITHUB_CLIENT_ID=your_client_id_here\nGITHUB_CLIENT_SECRET=your_client_secret_here\nGITHUB_OWNER=your_github_org\nGITHUB_REPO=your_repo_name\n\n# Vite (if using Vite)\nVITE_GITHUB_CLIENT_ID=your_client_id_here\nVITE_GITHUB_OWNER=your_github_org\nVITE_GITHUB_REPO=your_repo_name\n`;\n\n await writeFile(path.join(projectRoot, '.env.example'), envExampleContent);\n console.log(chalk.dim(' → Created .env.example'));\n\n // Add .env.local to .gitignore if not already present\n const gitignorePath = path.join(projectRoot, '.gitignore');\n if (await fileExists(gitignorePath)) {\n const gitignoreContent = await readFile(gitignorePath);\n if (!gitignoreContent.includes('.env.local')) {\n await appendToFile(gitignorePath, '\\n# Apollo Commenting System\\n.env.local\\n');\n console.log(chalk.dim(' → Updated .gitignore'));\n }\n }\n}\n\n","import path from 'path';\nimport chalk from 'chalk';\nimport { writeFile } from '../utils/fs.js';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nexport async function generateConfig(\n githubConfig: GitHubConfig,\n platform: string,\n projectRoot: string\n): Promise<void> {\n // Build redirect URI based on platform\n let redirectUri = 'http://localhost:9000/api/github-oauth-callback';\n \n if (platform === 'netlify') {\n redirectUri = 'https://your-domain.com/.netlify/functions/github-oauth-callback';\n } else if (platform === 'vercel') {\n redirectUri = 'https://your-domain.com/api/github-oauth-callback';\n }\n\n const config = {\n version: '1.0.0',\n platform,\n github: {\n owner: githubConfig.owner,\n repo: githubConfig.repo,\n clientId: githubConfig.clientId\n },\n redirectUri,\n features: {\n aiSummarization: true,\n versionTracking: true,\n gitlabIntegration: false\n },\n labels: [\n { name: 'comment', color: '0075ca', description: 'User feedback comment' },\n { name: 'prototype-feedback', color: 'd93f0b', description: 'Prototype feedback' },\n { name: 'needs-review', color: 'fbca04', description: 'Needs team review' }\n ]\n };\n\n const configPath = path.join(projectRoot, 'apollo-comments.config.json');\n await writeFile(configPath, JSON.stringify(config, null, 2));\n console.log(chalk.dim(' → Created apollo-comments.config.json'));\n}\n\n","import axios from 'axios';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nexport async function validateGitHubConnection(config: GitHubConfig): Promise<boolean> {\n try {\n // Test basic GitHub API connectivity\n const response = await axios.get('https://api.github.com/rate_limit', {\n headers: {\n 'Accept': 'application/vnd.github.v3+json'\n },\n timeout: 5000\n });\n return response.status === 200;\n } catch (error) {\n console.error('GitHub connection error:', error);\n return false;\n }\n}\n\n","import axios from 'axios';\nimport chalk from 'chalk';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nexport async function validateRepoAccess(config: GitHubConfig): Promise<boolean> {\n try {\n // Note: This checks if the repo exists publicly\n // Private repos would need authentication\n const response = await axios.get(\n `https://api.github.com/repos/${config.owner}/${config.repo}`,\n {\n headers: {\n 'Accept': 'application/vnd.github.v3+json'\n },\n timeout: 5000\n }\n );\n return response.status === 200;\n } catch (error: any) {\n if (error.response?.status === 404) {\n console.log(chalk.yellow(` Repository ${config.owner}/${config.repo} not found or is private`));\n console.log(chalk.yellow(' Note: Private repos require authentication at runtime'));\n // We'll allow this to proceed since private repos are valid\n return true;\n }\n console.error(' Repo access error:', error.message);\n return false;\n }\n}\n\n","import chalk from 'chalk';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nconst REQUIRED_LABELS = [\n { name: 'comment', color: '0075ca', description: 'User feedback comment' },\n { name: 'prototype-feedback', color: 'd93f0b', description: 'Prototype feedback' },\n { name: 'needs-review', color: 'fbca04', description: 'Needs team review' }\n];\n\nexport async function ensureLabels(config: GitHubConfig): Promise<void> {\n // Note: Creating labels requires authentication\n // For now, just inform the user about required labels\n console.log(chalk.dim('\\n Required labels for GitHub issues:'));\n REQUIRED_LABELS.forEach(label => {\n console.log(chalk.dim(` - ${label.name} (#${label.color}): ${label.description}`));\n });\n console.log(chalk.dim(' These will be created automatically at runtime with proper authentication.\\n'));\n}\n\nexport function getRequiredLabels() {\n return REQUIRED_LABELS;\n}\n\n","import chalk from 'chalk';\nimport ora from 'ora';\nimport path from 'path';\nimport { fileExists, readFile } from '../utils/fs.js';\nimport { validateGitHubConnection } from '../validators/github.js';\nimport { validateRepoAccess } from '../validators/repo.js';\n\nexport async function validateCommand() {\n console.log(chalk.bold.cyan('\\n🔍 Validating Apollo Commenting System Setup\\n'));\n\n const spinner = ora('Checking configuration files...').start();\n const cwd = process.cwd();\n\n // Check for config file\n const configPath = path.join(cwd, 'apollo-comments.config.json');\n const hasConfig = await fileExists(configPath);\n \n if (!hasConfig) {\n spinner.fail('Configuration file not found');\n console.log(chalk.red('\\n✗ apollo-comments.config.json not found'));\n console.log(chalk.dim(' Run: apollo-comments init\\n'));\n process.exit(1);\n }\n\n let config: any;\n try {\n const configContent = await readFile(configPath);\n config = JSON.parse(configContent);\n spinner.succeed('Configuration file found');\n } catch (error) {\n spinner.fail('Invalid configuration file');\n console.log(chalk.red('\\n✗ Could not parse apollo-comments.config.json\\n'));\n process.exit(1);\n }\n\n // Check for .env.local\n spinner.start('Checking environment files...');\n const envPath = path.join(cwd, '.env.local');\n const hasEnv = await fileExists(envPath);\n \n if (!hasEnv) {\n spinner.warn('Environment file not found (.env.local)');\n } else {\n spinner.succeed('Environment file found');\n }\n\n // Check for serverless functions\n spinner.start('Checking serverless functions...');\n let hasServerless = false;\n \n if (config.platform === 'vercel') {\n const apiDir = path.join(cwd, 'api');\n const loginPath = path.join(apiDir, 'github-oauth-login.ts');\n const callbackPath = path.join(apiDir, 'github-oauth-callback.ts');\n hasServerless = await fileExists(loginPath) && await fileExists(callbackPath);\n } else if (config.platform === 'netlify') {\n const functionsDir = path.join(cwd, 'netlify', 'functions');\n const loginPath = path.join(functionsDir, 'github-oauth-login.ts');\n const callbackPath = path.join(functionsDir, 'github-oauth-callback.ts');\n hasServerless = await fileExists(loginPath) && await fileExists(callbackPath);\n }\n\n if (!hasServerless && config.platform !== 'manual') {\n spinner.warn('Serverless functions not found');\n } else {\n spinner.succeed('Serverless functions found');\n }\n\n // Validate GitHub connection\n spinner.start('Validating GitHub connection...');\n const isValid = await validateGitHubConnection(config.github);\n if (!isValid) {\n spinner.fail('GitHub connection failed');\n console.log(chalk.red('\\n✗ Could not connect to GitHub API\\n'));\n process.exit(1);\n }\n spinner.succeed('GitHub connection validated');\n\n // Validate repo access\n spinner.start('Validating repository access...');\n const hasAccess = await validateRepoAccess(config.github);\n if (!hasAccess) {\n spinner.warn('Repository access could not be confirmed');\n } else {\n spinner.succeed('Repository access confirmed');\n }\n\n console.log(chalk.green.bold('\\n✓ Validation complete!\\n'));\n console.log(chalk.white('Your Apollo Commenting System setup looks good.\\n'));\n}\n\n"],"mappings":";;;AAAA,SAAS,eAAe;AACxB,OAAOA,aAAW;;;ACDlB,OAAOC,YAAW;AAClB,OAAO,SAAS;AAChB,OAAOC,eAAc;;;ACFrB,OAAO,QAAQ;AACf,OAAO,UAAU;AAYjB,eAAsB,cAAc,KAAmC;AACrE,QAAM,kBAAkB,KAAK,KAAK,KAAK,cAAc;AAErD,MAAI,cAAmB,CAAC;AACxB,MAAI;AACF,UAAM,UAAU,MAAM,GAAG,SAAS,iBAAiB,OAAO;AAC1D,kBAAc,KAAK,MAAM,OAAO;AAAA,EAClC,SAAS,OAAO;AACd,U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;AAElB,QACG,QAAQ,MAAM,EACd,YAAY,qDAAqD,EACjE,OAAO,aAAa,+BAA+B,EACnD,OAAO,yBAAyB,2CAA2C,EAC3E,OAAO,OAAO,YAAY;AACzB,MAAI;AACF,UAAM,YAAY,OAAO;AAAA,EAC3B,SAAS,OAAY;AACnB,YAAQ,MAAMG,QAAM,IAAI,iBAAY,GAAG,MAAM,OAAO;AACpD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAEH,QACG,QAAQ,UAAU,EAClB,YAAY,uCAAuC,EACnD,OAAO,YAAY;AAClB,MAAI;AACF,UAAM,gBAAgB;AAAA,EACxB,SAAS,OAAY;AACnB,YAAQ,MAAMA,QAAM,IAAI,iBAAY,GAAG,MAAM,OAAO;AACpD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAEH,QACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,MAAM;AACZ,UAAQ,IAAIA,QAAM,OAAO,qDAA2C,CAAC;AACrE,UAAQ,IAAIA,QAAM,IAAI,8DAA8D,CAAC;AACvF,CAAC;AAGH,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,KAAK;AACf;AAEA,QAAQ,MAAM;","names":["chalk","chalk","inquirer","chalk","chalk","inquirer","chalk","path","chalk","fs","fs","fs","path","chalk","path","chalk","path","chalk","path","chalk","path","chalk","axios","chalk","chalk","chalk","inquirer","chalk","ora","path","chalk","ora","path","chalk"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/init.ts","../src/utils/detect.ts","../src/utils/logger.ts","../src/prompts/platform.ts","../src/prompts/github.ts","../src/generators/serverless.ts","../src/utils/fs.ts","../src/templates/vercel-auth.ts","../src/templates/netlify-auth.ts","../src/generators/env.ts","../src/generators/config.ts","../src/generators/code.ts","../src/validators/github.ts","../src/validators/repo.ts","../src/validators/labels.ts","../src/commands/validate.ts"],"sourcesContent":["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { initCommand } from './commands/init.js';\nimport { validateCommand } from './commands/validate.js';\n\nconst program = new Command();\n\nprogram\n .name('hale-commenting-system')\n .description('Hale Commenting System CLI - Setup wizard and tooling')\n .version('1.0.0');\n\nprogram\n .command('init')\n .description('Initialize Apollo Commenting System in your project')\n .option('-y, --yes', 'Skip prompts and use defaults')\n .option('--platform <platform>', 'Target platform (vercel, netlify, manual)')\n .action(async (options) => {\n try {\n await initCommand(options);\n } catch (error: any) {\n console.error(chalk.red('\\n✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\nprogram\n .command('validate')\n .description('Validate your commenting system setup')\n .action(async () => {\n try {\n await validateCommand();\n } catch (error: any) {\n console.error(chalk.red('\\n✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\nprogram\n .command('update')\n .description('Update existing configuration')\n .action(() => {\n console.log(chalk.yellow('\\n⚠️ Coming soon: Update configuration\\n'));\n console.log(chalk.dim('For now, you can manually edit apollo-comments.config.json\\n'));\n });\n\n// Show help if no command provided\nif (!process.argv.slice(2).length) {\n program.help();\n}\n\nprogram.parse();\n\n","import chalk from 'chalk';\nimport ora from 'ora';\nimport inquirer from 'inquirer';\nimport { detectProject } from '../utils/detect.js';\nimport { printWelcome, printSetupInstructions, printSuccess, printNextSteps, printWarning } from '../utils/logger.js';\nimport { promptPlatform } from '../prompts/platform.js';\nimport { promptGitHubConfig } from '../prompts/github.js';\nimport { generateServerless } from '../generators/serverless.js';\nimport { generateEnvFiles } from '../generators/env.js';\nimport { generateConfig } from '../generators/config.js';\nimport { integrateProviders, showIntegrationDiff } from '../generators/code.js';\nimport { validateGitHubConnection } from '../validators/github.js';\nimport { validateRepoAccess } from '../validators/repo.js';\nimport { ensureLabels } from '../validators/labels.js';\n\ninterface InitOptions {\n yes?: boolean;\n platform?: string;\n}\n\nexport async function initCommand(options: InitOptions) {\n printWelcome();\n\n const spinner = ora('Detecting project...').start();\n\n // Step 1: Detect project type\n let project;\n try {\n project = await detectProject(process.cwd());\n spinner.succeed(`Detected: ${project.framework} with ${project.buildTool}`);\n } catch (error: any) {\n spinner.fail(error.message);\n process.exit(1);\n }\n\n if (!project.isReact) {\n spinner.fail('This package requires a React project');\n console.log(chalk.red('\\n✗ Apollo Commenting System requires React.\\n'));\n process.exit(1);\n }\n\n if (!project.hasPatternFly) {\n printWarning('PatternFly not detected. This package is optimized for PatternFly projects.');\n if (!options.yes) {\n const { continueAnyway } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'continueAnyway',\n message: 'Continue anyway?',\n default: false\n }\n ]);\n if (!continueAnyway) {\n console.log(chalk.dim('\\nSetup cancelled.\\n'));\n process.exit(0);\n }\n }\n }\n\n // Step 2: Select platform\n const platform = options.platform || await promptPlatform(project.root);\n\n // Step 3: Prompt for GitHub OAuth settings\n const githubConfig = await promptGitHubConfig(options.yes || false);\n\n // Step 4: Validate GitHub connection\n spinner.start('Validating GitHub connection...');\n const isValid = await validateGitHubConnection(githubConfig);\n if (!isValid) {\n spinner.fail('GitHub connection failed. Please check your internet connection.');\n process.exit(1);\n }\n spinner.succeed('GitHub connection validated');\n\n // Step 5: Validate repo access\n spinner.start('Checking repository access...');\n const hasAccess = await validateRepoAccess(githubConfig);\n if (!hasAccess) {\n spinner.fail('Cannot access repository. Check the owner/repo name.');\n process.exit(1);\n }\n spinner.succeed('Repository access confirmed');\n\n // Step 6: Ensure labels exist\n spinner.start('Checking issue labels...');\n await ensureLabels(githubConfig);\n spinner.succeed('Issue labels documented');\n\n // Step 7: Generate serverless functions\n spinner.start('Generating serverless functions...');\n try {\n await generateServerless(platform, project.root);\n spinner.succeed('Serverless functions created');\n } catch (error: any) {\n spinner.fail(`Failed to generate serverless functions: ${error.message}`);\n process.exit(1);\n }\n\n // Step 8: Generate environment files\n spinner.start('Creating environment files...');\n try {\n await generateEnvFiles(githubConfig, platform, project.root);\n spinner.succeed('Environment files created');\n } catch (error: any) {\n spinner.fail(`Failed to create environment files: ${error.message}`);\n process.exit(1);\n }\n\n // Step 9: Generate config file\n spinner.start('Creating apollo-comments.config.json...');\n try {\n await generateConfig(githubConfig, platform, project.root);\n spinner.succeed('Configuration file created');\n } catch (error: any) {\n spinner.fail(`Failed to create config file: ${error.message}`);\n process.exit(1);\n }\n\n // Step 10: Offer auto-integration\n printSuccess();\n \n if (!options.yes) {\n const { autoIntegrate } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'autoIntegrate',\n message: 'Automatically integrate providers into your App file?',\n default: true\n }\n ]);\n\n if (autoIntegrate) {\n spinner.start('Integrating providers...');\n const result = await integrateProviders(project.root);\n \n if (result.success) {\n spinner.succeed('Providers integrated!');\n showIntegrationDiff(result.filePath);\n console.log(chalk.green('✓ Your app is ready to use the commenting system!\\n'));\n console.log(chalk.cyan('Next steps:'));\n console.log(chalk.white('1. Review the changes in your App file'));\n console.log(chalk.white('2. Start your dev server: npm run start:dev'));\n console.log(chalk.white('3. Open http://localhost:9000\\n'));\n } else {\n spinner.warn(result.message);\n console.log(chalk.yellow('\\nFalling back to manual integration:\\n'));\n printSetupInstructions(platform, project);\n printNextSteps();\n }\n } else {\n printSetupInstructions(platform, project);\n printNextSteps();\n }\n } else {\n // If --yes flag, skip integration and show manual instructions\n printSetupInstructions(platform, project);\n printNextSteps();\n }\n}\n\n","import fs from 'fs/promises';\nimport path from 'path';\n\nexport interface ProjectInfo {\n root: string;\n framework: string;\n buildTool: string;\n isReact: boolean;\n hasPatternFly: boolean;\n hasTypeScript: boolean;\n packageJson: any;\n}\n\nexport async function detectProject(cwd: string): Promise<ProjectInfo> {\n const packageJsonPath = path.join(cwd, 'package.json');\n \n let packageJson: any = {};\n try {\n const content = await fs.readFile(packageJsonPath, 'utf-8');\n packageJson = JSON.parse(content);\n } catch (error) {\n throw new Error('No package.json found. Are you in a Node.js project?');\n }\n\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies\n };\n\n const buildTool = await detectBuildTool(cwd, deps);\n\n return {\n root: cwd,\n framework: detectFramework(deps),\n buildTool,\n isReact: !!deps['react'],\n hasPatternFly: !!deps['@patternfly/react-core'],\n hasTypeScript: !!deps['typescript'],\n packageJson\n };\n}\n\nfunction detectFramework(deps: any): string {\n if (deps['react']) return 'React';\n if (deps['vue']) return 'Vue';\n if (deps['@angular/core']) return 'Angular';\n return 'Unknown';\n}\n\nasync function detectBuildTool(cwd: string, deps: any): Promise<string> {\n if (deps['vite']) return 'Vite';\n if (deps['webpack']) return 'Webpack';\n \n try {\n await fs.access(path.join(cwd, 'next.config.js'));\n return 'Next.js';\n } catch {\n // Next.js config not found\n }\n\n return 'Unknown';\n}\n\nexport async function detectPlatform(cwd: string): Promise<string | null> {\n try {\n await fs.access(path.join(cwd, 'vercel.json'));\n return 'vercel';\n } catch {\n // Not Vercel\n }\n\n try {\n await fs.access(path.join(cwd, 'netlify.toml'));\n return 'netlify';\n } catch {\n // Not Netlify\n }\n\n return null;\n}\n\n","import chalk from 'chalk';\n\nexport function printWelcome() {\n console.log(chalk.bold.cyan('\\n🚀 Hale Commenting System Setup Wizard\\n'));\n}\n\nexport function printSetupInstructions(platform: string, project: any) {\n console.log(chalk.bold('\\n📝 Manual Setup Required:\\n'));\n\n console.log(chalk.cyan('1. Add the CommentProvider to your App.tsx:\\n'));\n \n console.log(chalk.white(`import {\n CommentProvider,\n VersionProvider,\n GitHubAuthProvider,\n CommentOverlay,\n CommentDrawer\n} from '@apollo/commenting-system';\nimport apolloCommentsConfig from './apollo-comments.config.json';\nimport React from 'react';\n\nfunction App() {\n const [selectedThreadId, setSelectedThreadId] = React.useState<string | null>(null);\n\n return (\n <GitHubAuthProvider config={apolloCommentsConfig}>\n <VersionProvider>\n <CommentProvider>\n <CommentDrawer \n selectedThreadId={selectedThreadId} \n onThreadSelect={setSelectedThreadId}\n >\n <CommentOverlay \n selectedThreadId={selectedThreadId} \n onThreadSelect={setSelectedThreadId}\n />\n {/* Your app content */}\n </CommentDrawer>\n </CommentProvider>\n </VersionProvider>\n </GitHubAuthProvider>\n );\n}\n`));\n\n console.log(chalk.cyan('\\n2. Deploy your serverless functions:\\n'));\n\n if (platform === 'vercel') {\n console.log(chalk.white(' vercel --prod'));\n } else if (platform === 'netlify') {\n console.log(chalk.white(' netlify deploy --prod'));\n } else {\n console.log(chalk.white(' Follow your platform\\'s deployment guide'));\n }\n\n console.log(chalk.cyan('\\n3. Update your GitHub OAuth App callback URL:\\n'));\n console.log(chalk.white(' https://your-domain.com/api/github-oauth-callback\\n'));\n}\n\nexport function printSuccess() {\n console.log(chalk.green.bold('\\n✓ Setup complete!\\n'));\n}\n\nexport function printNextSteps() {\n console.log(chalk.cyan('\\nNext steps:'));\n console.log(chalk.white('1. Review generated files in your project'));\n console.log(chalk.white('2. Add the CommentProvider to your App.tsx (see instructions above)'));\n console.log(chalk.white('3. Deploy your serverless functions'));\n console.log(chalk.white('4. Run: npm run dev\\n'));\n\n console.log(chalk.dim('Run \"hale-commenting-system validate\" to verify your setup.\\n'));\n}\n\nexport function printError(message: string) {\n console.log(chalk.red.bold(`\\n✗ Error: ${message}\\n`));\n}\n\nexport function printWarning(message: string) {\n console.log(chalk.yellow(`⚠️ ${message}`));\n}\n\n","import inquirer from 'inquirer';\nimport chalk from 'chalk';\nimport { detectPlatform } from '../utils/detect.js';\n\nexport async function promptPlatform(projectRoot: string): Promise<string> {\n // Auto-detect platform\n const detectedPlatform = await detectPlatform(projectRoot);\n\n if (detectedPlatform) {\n console.log(chalk.green(`✓ Detected ${detectedPlatform} configuration`));\n \n const { usePlatform } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'usePlatform',\n message: `Use ${detectedPlatform} for serverless functions?`,\n default: true\n }\n ]);\n\n if (usePlatform) {\n return detectedPlatform;\n }\n }\n\n const { platform } = await inquirer.prompt([\n {\n type: 'list',\n name: 'platform',\n message: 'Select your deployment platform:',\n choices: [\n { name: 'Local development (runs locally only)', value: 'local' },\n { name: 'Vercel', value: 'vercel' },\n { name: 'Netlify', value: 'netlify' },\n { name: 'Manual (I will configure myself)', value: 'manual' }\n ]\n }\n ]);\n\n return platform;\n}\n\n","import inquirer from 'inquirer';\nimport chalk from 'chalk';\n\nexport interface GitHubConfig {\n clientId: string;\n clientSecret: string;\n owner: string;\n repo: string;\n}\n\nexport async function promptGitHubConfig(skipPrompts: boolean = false): Promise<GitHubConfig> {\n if (skipPrompts) {\n console.log(chalk.yellow('Using default/environment values...'));\n return {\n clientId: process.env.GITHUB_CLIENT_ID || '',\n clientSecret: process.env.GITHUB_CLIENT_SECRET || '',\n owner: process.env.GITHUB_OWNER || '',\n repo: process.env.GITHUB_REPO || ''\n };\n }\n\n console.log(chalk.bold('\\n📋 GitHub OAuth Configuration\\n'));\n console.log(chalk.dim('You need to create a GitHub OAuth App:'));\n console.log(chalk.dim('https://github.com/settings/developers\\n'));\n\n const answers = await inquirer.prompt<GitHubConfig>([\n {\n type: 'input',\n name: 'clientId',\n message: 'GitHub OAuth Client ID:',\n validate: (input: string) => input.length > 0 || 'Client ID is required'\n },\n {\n type: 'password',\n name: 'clientSecret',\n message: 'GitHub OAuth Client Secret:',\n mask: '*',\n validate: (input: string) => input.length > 0 || 'Client Secret is required'\n },\n {\n type: 'input',\n name: 'owner',\n message: 'GitHub Repository Owner (user or org):',\n validate: (input: string) => input.length > 0 || 'Owner is required'\n },\n {\n type: 'input',\n name: 'repo',\n message: 'GitHub Repository Name:',\n validate: (input: string) => input.length > 0 || 'Repository name is required'\n }\n ]);\n\n return answers;\n}\n\n","import path from 'path';\nimport chalk from 'chalk';\nimport { ensureDir, writeFile } from '../utils/fs.js';\nimport { vercelAuthLoginTemplate, vercelAuthCallbackTemplate } from '../templates/vercel-auth.js';\nimport { netlifyAuthLoginTemplate, netlifyAuthCallbackTemplate } from '../templates/netlify-auth.js';\n\nexport async function generateServerless(platform: string, projectRoot: string): Promise<void> {\n if (platform === 'vercel' || platform === 'local') {\n const apiDir = path.join(projectRoot, 'api');\n await ensureDir(apiDir);\n\n await writeFile(\n path.join(apiDir, 'github-oauth-login.ts'),\n vercelAuthLoginTemplate\n );\n\n await writeFile(\n path.join(apiDir, 'github-oauth-callback.ts'),\n vercelAuthCallbackTemplate\n );\n\n console.log(chalk.dim(' → Created api/github-oauth-login.ts'));\n console.log(chalk.dim(' → Created api/github-oauth-callback.ts'));\n } else if (platform === 'netlify') {\n const functionsDir = path.join(projectRoot, 'netlify', 'functions');\n await ensureDir(functionsDir);\n\n await writeFile(\n path.join(functionsDir, 'github-oauth-login.ts'),\n netlifyAuthLoginTemplate\n );\n\n await writeFile(\n path.join(functionsDir, 'github-oauth-callback.ts'),\n netlifyAuthCallbackTemplate\n );\n\n console.log(chalk.dim(' → Created netlify/functions/github-oauth-login.ts'));\n console.log(chalk.dim(' → Created netlify/functions/github-oauth-callback.ts'));\n } else {\n console.log(chalk.yellow(' Manual platform selected. You must create serverless functions yourself.'));\n console.log(chalk.dim(' See: https://github.com/apollo/commenting-system/blob/main/docs/manual-setup.md'));\n }\n}\n\n","import fs from 'fs/promises';\nimport path from 'path';\n\nexport async function fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function ensureDir(dirPath: string): Promise<void> {\n await fs.mkdir(dirPath, { recursive: true });\n}\n\nexport async function writeFileIfNotExists(filePath: string, content: string): Promise<boolean> {\n const exists = await fileExists(filePath);\n if (exists) {\n return false;\n }\n \n await fs.writeFile(filePath, content, 'utf-8');\n return true;\n}\n\nexport async function appendToFile(filePath: string, content: string): Promise<void> {\n await fs.appendFile(filePath, content, 'utf-8');\n}\n\nexport async function readFile(filePath: string): Promise<string> {\n return fs.readFile(filePath, 'utf-8');\n}\n\nexport async function writeFile(filePath: string, content: string): Promise<void> {\n await fs.writeFile(filePath, content, 'utf-8');\n}\n\nexport function getRelativePath(from: string, to: string): string {\n return path.relative(from, to);\n}\n\n","export const vercelAuthLoginTemplate = `import { VercelRequest, VercelResponse } from '@vercel/node';\n\nexport default async function handler(req: VercelRequest, res: VercelResponse): Promise<void> {\n try {\n const clientId = process.env.GITHUB_CLIENT_ID || process.env.VITE_GITHUB_CLIENT_ID;\n \n if (!clientId) {\n res.status(500).json({ error: 'GitHub OAuth not configured - missing client ID' });\n return;\n }\n\n // Get the base URL from the request\n const protocol = (req.headers['x-forwarded-proto'] as string) || 'https';\n const host = (req.headers.host || req.headers['x-forwarded-host']) as string;\n \n if (!host) {\n res.status(500).json({ error: 'Could not determine host' });\n return;\n }\n \n const baseUrl = \\`\\${protocol}://\\${host}\\`;\n const redirectUri = \\`\\${baseUrl}/api/github-oauth-callback\\`;\n\n // Redirect to GitHub OAuth\n // Scope: public_repo allows read/write access to public repositories only\n const githubAuthUrl = \\`https://github.com/login/oauth/authorize?client_id=\\${clientId}&redirect_uri=\\${encodeURIComponent(redirectUri)}&scope=public_repo\\`;\n\n res.redirect(302, githubAuthUrl);\n } catch (error: any) {\n res.status(500).json({ \n error: 'Internal server error', \n details: error.message\n });\n }\n}\n`;\n\nexport const vercelAuthCallbackTemplate = `import { VercelRequest, VercelResponse } from '@vercel/node';\nimport axios from 'axios';\n\nexport default async function handler(req: VercelRequest, res: VercelResponse): Promise<void> {\n try {\n const code = req.query.code as string;\n const clientId = process.env.GITHUB_CLIENT_ID || process.env.VITE_GITHUB_CLIENT_ID;\n const clientSecret = process.env.GITHUB_CLIENT_SECRET;\n\n if (!code) {\n res.status(400).json({ error: 'No code provided' });\n return;\n }\n\n if (!clientId || !clientSecret) {\n res.status(500).json({ error: 'GitHub OAuth not configured properly' });\n return;\n }\n\n // Exchange code for access token\n const tokenResponse = await axios.post(\n 'https://github.com/login/oauth/access_token',\n {\n client_id: clientId,\n client_secret: clientSecret,\n code,\n },\n {\n headers: {\n Accept: 'application/json',\n },\n }\n );\n\n const accessToken = tokenResponse.data.access_token;\n\n if (!accessToken) {\n throw new Error('No access token received');\n }\n\n // Get user info\n const userResponse = await axios.get('https://api.github.com/user', {\n headers: {\n Authorization: \\`token \\${accessToken}\\`,\n },\n });\n\n const user = userResponse.data;\n\n // Redirect back to the app with token in URL fragment (client-side only)\n const protocol = req.headers['x-forwarded-proto'] || 'https';\n const host = req.headers.host || req.headers['x-forwarded-host'];\n const baseUrl = \\`\\${protocol}://\\${host}\\`;\n const redirectUrl = \\`\\${baseUrl}/#/auth-callback?token=\\${accessToken}&login=\\${user.login}&avatar=\\${encodeURIComponent(user.avatar_url)}\\`;\n\n res.redirect(302, redirectUrl);\n } catch (error: any) {\n res.status(500).json({\n error: 'Failed to exchange code for token',\n details: error.message,\n });\n }\n}\n`;\n\n","export const netlifyAuthLoginTemplate = `import { Handler, HandlerEvent, HandlerContext } from '@netlify/functions';\nimport axios from 'axios';\n\nconst handler: Handler = async (event: HandlerEvent, context: HandlerContext) => {\n try {\n const clientId = process.env.GITHUB_CLIENT_ID || process.env.VITE_GITHUB_CLIENT_ID;\n \n if (!clientId) {\n return {\n statusCode: 500,\n body: JSON.stringify({ error: 'GitHub OAuth not configured - missing client ID' })\n };\n }\n\n // Get the base URL from the request\n const protocol = event.headers['x-forwarded-proto'] || 'https';\n const host = event.headers.host;\n \n if (!host) {\n return {\n statusCode: 500,\n body: JSON.stringify({ error: 'Could not determine host' })\n };\n }\n \n const baseUrl = \\`\\${protocol}://\\${host}\\`;\n const redirectUri = \\`\\${baseUrl}/.netlify/functions/github-oauth-callback\\`;\n\n // Redirect to GitHub OAuth\n const githubAuthUrl = \\`https://github.com/login/oauth/authorize?client_id=\\${clientId}&redirect_uri=\\${encodeURIComponent(redirectUri)}&scope=public_repo\\`;\n\n return {\n statusCode: 302,\n headers: {\n Location: githubAuthUrl\n },\n body: ''\n };\n } catch (error: any) {\n return {\n statusCode: 500,\n body: JSON.stringify({ \n error: 'Internal server error', \n details: error.message\n })\n };\n }\n};\n\nexport { handler };\n`;\n\nexport const netlifyAuthCallbackTemplate = `import { Handler, HandlerEvent, HandlerContext } from '@netlify/functions';\nimport axios from 'axios';\n\nconst handler: Handler = async (event: HandlerEvent, context: HandlerContext) => {\n try {\n const code = event.queryStringParameters?.code;\n const clientId = process.env.GITHUB_CLIENT_ID || process.env.VITE_GITHUB_CLIENT_ID;\n const clientSecret = process.env.GITHUB_CLIENT_SECRET;\n\n if (!code) {\n return {\n statusCode: 400,\n body: JSON.stringify({ error: 'No code provided' })\n };\n }\n\n if (!clientId || !clientSecret) {\n return {\n statusCode: 500,\n body: JSON.stringify({ error: 'GitHub OAuth not configured properly' })\n };\n }\n\n // Exchange code for access token\n const tokenResponse = await axios.post(\n 'https://github.com/login/oauth/access_token',\n {\n client_id: clientId,\n client_secret: clientSecret,\n code,\n },\n {\n headers: {\n Accept: 'application/json',\n },\n }\n );\n\n const accessToken = tokenResponse.data.access_token;\n\n if (!accessToken) {\n throw new Error('No access token received');\n }\n\n // Get user info\n const userResponse = await axios.get('https://api.github.com/user', {\n headers: {\n Authorization: \\`token \\${accessToken}\\`,\n },\n });\n\n const user = userResponse.data;\n\n // Redirect back to the app with token in URL fragment\n const protocol = event.headers['x-forwarded-proto'] || 'https';\n const host = event.headers.host;\n const baseUrl = \\`\\${protocol}://\\${host}\\`;\n const redirectUrl = \\`\\${baseUrl}/#/auth-callback?token=\\${accessToken}&login=\\${user.login}&avatar=\\${encodeURIComponent(user.avatar_url)}\\`;\n\n return {\n statusCode: 302,\n headers: {\n Location: redirectUrl\n },\n body: ''\n };\n } catch (error: any) {\n return {\n statusCode: 500,\n body: JSON.stringify({\n error: 'Failed to exchange code for token',\n details: error.message,\n })\n };\n }\n};\n\nexport { handler };\n`;\n\n","import path from 'path';\nimport chalk from 'chalk';\nimport { fileExists, appendToFile, writeFile, readFile } from '../utils/fs.js';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nexport async function generateEnvFiles(\n githubConfig: GitHubConfig, \n platform: string, \n projectRoot: string\n): Promise<void> {\n const envContent = `\n# Apollo Commenting System Configuration\n# Generated by apollo-comments CLI\n\n# GitHub OAuth\nGITHUB_CLIENT_ID=${githubConfig.clientId}\nGITHUB_CLIENT_SECRET=${githubConfig.clientSecret}\nGITHUB_OWNER=${githubConfig.owner}\nGITHUB_REPO=${githubConfig.repo}\n\n# Vite (if using Vite)\nVITE_GITHUB_CLIENT_ID=${githubConfig.clientId}\nVITE_GITHUB_OWNER=${githubConfig.owner}\nVITE_GITHUB_REPO=${githubConfig.repo}\n`;\n\n const envLocalPath = path.join(projectRoot, '.env.local');\n const envPath = path.join(projectRoot, '.env');\n\n // Check if .env.local exists and already contains GitHub config\n const envLocalExists = await fileExists(envLocalPath);\n \n if (envLocalExists) {\n const existingEnv = await readFile(envLocalPath);\n if (existingEnv.includes('GITHUB_CLIENT_ID')) {\n console.log(chalk.yellow(' .env.local already contains GitHub config. Skipping...'));\n } else {\n await appendToFile(envLocalPath, envContent);\n console.log(chalk.dim(' → Updated .env.local'));\n }\n } else {\n await writeFile(envLocalPath, envContent.trim());\n console.log(chalk.dim(' → Created .env.local'));\n }\n\n // Create .env.example without secrets\n const envExampleContent = `# Apollo Commenting System Configuration\n\n# GitHub OAuth (get from https://github.com/settings/developers)\nGITHUB_CLIENT_ID=your_client_id_here\nGITHUB_CLIENT_SECRET=your_client_secret_here\nGITHUB_OWNER=your_github_org\nGITHUB_REPO=your_repo_name\n\n# Vite (if using Vite)\nVITE_GITHUB_CLIENT_ID=your_client_id_here\nVITE_GITHUB_OWNER=your_github_org\nVITE_GITHUB_REPO=your_repo_name\n`;\n\n await writeFile(path.join(projectRoot, '.env.example'), envExampleContent);\n console.log(chalk.dim(' → Created .env.example'));\n\n // Add .env.local to .gitignore if not already present\n const gitignorePath = path.join(projectRoot, '.gitignore');\n if (await fileExists(gitignorePath)) {\n const gitignoreContent = await readFile(gitignorePath);\n if (!gitignoreContent.includes('.env.local')) {\n await appendToFile(gitignorePath, '\\n# Apollo Commenting System\\n.env.local\\n');\n console.log(chalk.dim(' → Updated .gitignore'));\n }\n }\n}\n\n","import path from 'path';\nimport chalk from 'chalk';\nimport { writeFile } from '../utils/fs.js';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nexport async function generateConfig(\n githubConfig: GitHubConfig,\n platform: string,\n projectRoot: string\n): Promise<void> {\n // Build redirect URI based on platform\n let redirectUri = 'http://localhost:9000/api/github-oauth-callback';\n \n if (platform === 'netlify') {\n redirectUri = 'https://your-domain.com/.netlify/functions/github-oauth-callback';\n } else if (platform === 'vercel') {\n redirectUri = 'https://your-domain.com/api/github-oauth-callback';\n }\n\n const config = {\n version: '1.0.0',\n platform,\n github: {\n owner: githubConfig.owner,\n repo: githubConfig.repo,\n clientId: githubConfig.clientId\n },\n redirectUri,\n features: {\n aiSummarization: true,\n versionTracking: true,\n gitlabIntegration: false\n },\n labels: [\n { name: 'comment', color: '0075ca', description: 'User feedback comment' },\n { name: 'prototype-feedback', color: 'd93f0b', description: 'Prototype feedback' },\n { name: 'needs-review', color: 'fbca04', description: 'Needs team review' }\n ]\n };\n\n const configPath = path.join(projectRoot, 'apollo-comments.config.json');\n await writeFile(configPath, JSON.stringify(config, null, 2));\n console.log(chalk.dim(' → Created apollo-comments.config.json'));\n}\n\n","import path from 'path';\nimport chalk from 'chalk';\nimport { readFile, writeFile, fileExists } from '../utils/fs.js';\n\ninterface IntegrationResult {\n success: boolean;\n filePath: string;\n message: string;\n}\n\nexport async function integrateProviders(projectRoot: string): Promise<IntegrationResult> {\n // Find the App entry point - try common locations\n const possiblePaths = [\n 'src/app/index.tsx',\n 'src/app/App.tsx',\n 'src/App.tsx',\n 'src/index.tsx'\n ];\n\n let appFilePath: string | null = null;\n \n for (const p of possiblePaths) {\n const fullPath = path.join(projectRoot, p);\n if (await fileExists(fullPath)) {\n appFilePath = fullPath;\n break;\n }\n }\n\n if (!appFilePath) {\n return {\n success: false,\n filePath: '',\n message: 'Could not find App entry point. Please integrate manually.'\n };\n }\n\n try {\n const content = await readFile(appFilePath);\n \n // Check if already integrated\n if (content.includes('hale-commenting-system') || content.includes('GitHubAuthProvider')) {\n return {\n success: false,\n filePath: appFilePath,\n message: 'Providers already integrated or commenting system imports found.'\n };\n }\n\n const modifiedContent = injectProviders(content);\n \n if (modifiedContent === content) {\n return {\n success: false,\n filePath: appFilePath,\n message: 'Could not automatically integrate. File structure not recognized.'\n };\n }\n\n await writeFile(appFilePath, modifiedContent);\n\n return {\n success: true,\n filePath: appFilePath,\n message: `Successfully integrated providers into ${path.relative(projectRoot, appFilePath)}`\n };\n } catch (error: any) {\n return {\n success: false,\n filePath: appFilePath,\n message: `Error: ${error.message}`\n };\n }\n}\n\nfunction injectProviders(content: string): string {\n // Add imports at the top (after existing imports)\n const imports = `import {\n CommentProvider,\n VersionProvider,\n GitHubAuthProvider,\n CommentOverlay,\n CommentDrawer\n} from 'hale-commenting-system';\nimport apolloCommentsConfig from './apollo-comments.config.json';`;\n\n // Find the last import statement\n const importRegex = /import\\s+.*?from\\s+['\"].*?['\"];?/g;\n const matches = content.match(importRegex);\n \n if (!matches || matches.length === 0) {\n // No imports found, add at the beginning\n content = imports + '\\n\\n' + content;\n } else {\n const lastImport = matches[matches.length - 1];\n const lastImportIndex = content.lastIndexOf(lastImport);\n const insertPosition = lastImportIndex + lastImport.length;\n content = content.slice(0, insertPosition) + '\\n\\n' + imports + content.slice(insertPosition);\n }\n\n // Find the return statement with Router/App structure\n // Look for patterns like: return ( <Router> or return <Router>\n const returnMatch = content.match(/return\\s*\\(?[\\s\\n]*<(\\w+)/);\n \n if (!returnMatch) {\n return content; // Can't find return statement\n }\n\n const componentName = returnMatch[1]; // Router, Fragment, etc.\n \n // Find the closing tag\n const closingTag = `</${componentName}>`;\n const closingIndex = content.indexOf(closingTag);\n \n if (closingIndex === -1) {\n return content; // Can't find closing tag\n }\n\n // Add state hook before return\n const stateHook = ` const [selectedThreadId, setSelectedThreadId] = React.useState<string | null>(null);\\n\\n`;\n \n // Find the function body (after function declaration)\n const functionMatch = content.match(/const\\s+\\w+.*?=.*?\\(\\).*?=>\\s*\\{/);\n if (functionMatch) {\n const insertPos = functionMatch.index! + functionMatch[0].length;\n content = content.slice(0, insertPos) + '\\n' + stateHook + content.slice(insertPos);\n }\n\n // Wrap the return content with providers\n const returnStartMatch = content.match(/return\\s*\\(/);\n if (returnStartMatch) {\n const returnStart = returnStartMatch.index! + returnStartMatch[0].length;\n const returnEnd = content.indexOf(closingTag, returnStart) + closingTag.length;\n \n const originalReturn = content.slice(returnStart, returnEnd);\n \n const wrappedReturn = `\n <GitHubAuthProvider config={apolloCommentsConfig}>\n <VersionProvider>\n <CommentProvider>\n <CommentDrawer \n selectedThreadId={selectedThreadId} \n onThreadSelect={setSelectedThreadId}\n >\n <CommentOverlay \n selectedThreadId={selectedThreadId} \n onThreadSelect={setSelectedThreadId}\n />\n ${originalReturn.trim()}\n </CommentDrawer>\n </CommentProvider>\n </VersionProvider>\n </GitHubAuthProvider>\n `;\n \n content = content.slice(0, returnStart) + wrappedReturn + content.slice(returnEnd);\n }\n\n return content;\n}\n\nexport function showIntegrationDiff(filePath: string) {\n console.log(chalk.cyan('\\nChanges made to your App file:'));\n console.log(chalk.white('• Added commenting system imports'));\n console.log(chalk.white('• Added state hook for comment thread selection'));\n console.log(chalk.white('• Wrapped app with GitHubAuthProvider, VersionProvider, and CommentProvider'));\n console.log(chalk.white('• Added CommentDrawer and CommentOverlay components\\n'));\n console.log(chalk.dim(`Modified: ${filePath}\\n`));\n}\n\n","import axios from 'axios';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nexport async function validateGitHubConnection(config: GitHubConfig): Promise<boolean> {\n try {\n // Test basic GitHub API connectivity\n const response = await axios.get('https://api.github.com/rate_limit', {\n headers: {\n 'Accept': 'application/vnd.github.v3+json'\n },\n timeout: 5000\n });\n return response.status === 200;\n } catch (error) {\n console.error('GitHub connection error:', error);\n return false;\n }\n}\n\n","import axios from 'axios';\nimport chalk from 'chalk';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nexport async function validateRepoAccess(config: GitHubConfig): Promise<boolean> {\n try {\n // Note: This checks if the repo exists publicly\n // Private repos would need authentication\n const response = await axios.get(\n `https://api.github.com/repos/${config.owner}/${config.repo}`,\n {\n headers: {\n 'Accept': 'application/vnd.github.v3+json'\n },\n timeout: 5000\n }\n );\n return response.status === 200;\n } catch (error: any) {\n if (error.response?.status === 404) {\n console.log(chalk.yellow(` Repository ${config.owner}/${config.repo} not found or is private`));\n console.log(chalk.yellow(' Note: Private repos require authentication at runtime'));\n // We'll allow this to proceed since private repos are valid\n return true;\n }\n console.error(' Repo access error:', error.message);\n return false;\n }\n}\n\n","import chalk from 'chalk';\nimport type { GitHubConfig } from '../prompts/github.js';\n\nconst REQUIRED_LABELS = [\n { name: 'comment', color: '0075ca', description: 'User feedback comment' },\n { name: 'prototype-feedback', color: 'd93f0b', description: 'Prototype feedback' },\n { name: 'needs-review', color: 'fbca04', description: 'Needs team review' }\n];\n\nexport async function ensureLabels(config: GitHubConfig): Promise<void> {\n // Note: Creating labels requires authentication\n // For now, just inform the user about required labels\n console.log(chalk.dim('\\n Required labels for GitHub issues:'));\n REQUIRED_LABELS.forEach(label => {\n console.log(chalk.dim(` - ${label.name} (#${label.color}): ${label.description}`));\n });\n console.log(chalk.dim(' These will be created automatically at runtime with proper authentication.\\n'));\n}\n\nexport function getRequiredLabels() {\n return REQUIRED_LABELS;\n}\n\n","import chalk from 'chalk';\nimport ora from 'ora';\nimport path from 'path';\nimport { fileExists, readFile } from '../utils/fs.js';\nimport { validateGitHubConnection } from '../validators/github.js';\nimport { validateRepoAccess } from '../validators/repo.js';\n\nexport async function validateCommand() {\n console.log(chalk.bold.cyan('\\n🔍 Validating Apollo Commenting System Setup\\n'));\n\n const spinner = ora('Checking configuration files...').start();\n const cwd = process.cwd();\n\n // Check for config file\n const configPath = path.join(cwd, 'apollo-comments.config.json');\n const hasConfig = await fileExists(configPath);\n \n if (!hasConfig) {\n spinner.fail('Configuration file not found');\n console.log(chalk.red('\\n✗ apollo-comments.config.json not found'));\n console.log(chalk.dim(' Run: apollo-comments init\\n'));\n process.exit(1);\n }\n\n let config: any;\n try {\n const configContent = await readFile(configPath);\n config = JSON.parse(configContent);\n spinner.succeed('Configuration file found');\n } catch (error) {\n spinner.fail('Invalid configuration file');\n console.log(chalk.red('\\n✗ Could not parse apollo-comments.config.json\\n'));\n process.exit(1);\n }\n\n // Check for .env.local\n spinner.start('Checking environment files...');\n const envPath = path.join(cwd, '.env.local');\n const hasEnv = await fileExists(envPath);\n \n if (!hasEnv) {\n spinner.warn('Environment file not found (.env.local)');\n } else {\n spinner.succeed('Environment file found');\n }\n\n // Check for serverless functions\n spinner.start('Checking serverless functions...');\n let hasServerless = false;\n \n if (config.platform === 'vercel') {\n const apiDir = path.join(cwd, 'api');\n const loginPath = path.join(apiDir, 'github-oauth-login.ts');\n const callbackPath = path.join(apiDir, 'github-oauth-callback.ts');\n hasServerless = await fileExists(loginPath) && await fileExists(callbackPath);\n } else if (config.platform === 'netlify') {\n const functionsDir = path.join(cwd, 'netlify', 'functions');\n const loginPath = path.join(functionsDir, 'github-oauth-login.ts');\n const callbackPath = path.join(functionsDir, 'github-oauth-callback.ts');\n hasServerless = await fileExists(loginPath) && await fileExists(callbackPath);\n }\n\n if (!hasServerless && config.platform !== 'manual') {\n spinner.warn('Serverless functions not found');\n } else {\n spinner.succeed('Serverless functions found');\n }\n\n // Validate GitHub connection\n spinner.start('Validating GitHub connection...');\n const isValid = await validateGitHubConnection(config.github);\n if (!isValid) {\n spinner.fail('GitHub connection failed');\n console.log(chalk.red('\\n✗ Could not connect to GitHub API\\n'));\n process.exit(1);\n }\n spinner.succeed('GitHub connection validated');\n\n // Validate repo access\n spinner.start('Validating repository access...');\n const hasAccess = await validateRepoAccess(config.github);\n if (!hasAccess) {\n spinner.warn('Repository access could not be confirmed');\n } else {\n spinner.succeed('Repository access confirmed');\n }\n\n console.log(chalk.green.bold('\\n✓ Validation complete!\\n'));\n console.log(chalk.white('Your Apollo Commenting System setup looks good.\\n'));\n}\n\n"],"mappings":";;;AAAA,SAAS,eAAe;AACxB,OAAOA,aAAW;;;ACDlB,OAAOC,aAAW;AAClB,OAAO,SAAS;AAChB,OAAOC,eAAc;;;ACFrB,OAAO,QAAQ;AACf,OAAO,UA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IAAIA,QAAM,MAAM,KAAK,iCAA4B,CAAC;AAC1D,UAAQ,IAAIA,QAAM,MAAM,mDAAmD,CAAC;AAC9E;;;AhBpFA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,wBAAwB,EAC7B,YAAY,uDAAuD,EACnE,QAAQ,OAAO;AAElB,QACG,QAAQ,MAAM,EACd,YAAY,qDAAqD,EACjE,OAAO,aAAa,+BAA+B,EACnD,OAAO,yBAAyB,2CAA2C,EAC3E,OAAO,OAAO,YAAY;AACzB,MAAI;AACF,UAAM,YAAY,OAAO;AAAA,EAC3B,SAAS,OAAY;AACnB,YAAQ,MAAMG,QAAM,IAAI,iBAAY,GAAG,MAAM,OAAO;AACpD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAEH,QACG,QAAQ,UAAU,EAClB,YAAY,uCAAuC,EACnD,OAAO,YAAY;AAClB,MAAI;AACF,UAAM,gBAAgB;AAAA,EACxB,SAAS,OAAY;AACnB,YAAQ,MAAMA,QAAM,IAAI,iBAAY,GAAG,MAAM,OAAO;AACpD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAEH,QACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,MAAM;AACZ,UAAQ,IAAIA,QAAM,OAAO,qDAA2C,CAAC;AACrE,UAAQ,IAAIA,QAAM,IAAI,8DAA8D,CAAC;AACvF,CAAC;AAGH,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,KAAK;AACf;AAEA,QAAQ,MAAM;","names":["chalk","chalk","inquirer","chalk","chalk","inquirer","chalk","path","chalk","fs","fs","fs","path","chalk","path","chalk","path","chalk","path","chalk","path","chalk","path","chalk","path","chalk","axios","chalk","chalk","chalk","inquirer","chalk","ora","path","chalk","ora","path","chalk"]}