copilotkit 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/commands/base-command.js +1 -1
  2. package/dist/commands/base-command.js.map +1 -1
  3. package/dist/commands/dev.js +2 -5
  4. package/dist/commands/dev.js.map +1 -1
  5. package/dist/commands/init.d.ts +1 -0
  6. package/dist/commands/init.js +228 -155
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/login.js +2 -5
  9. package/dist/commands/login.js.map +1 -1
  10. package/dist/commands/logout.js +2 -5
  11. package/dist/commands/logout.js.map +1 -1
  12. package/dist/lib/init/index.d.ts +3 -2
  13. package/dist/lib/init/index.js +178 -99
  14. package/dist/lib/init/index.js.map +1 -1
  15. package/dist/lib/init/questions.js +92 -47
  16. package/dist/lib/init/questions.js.map +1 -1
  17. package/dist/lib/init/scaffold/agent.d.ts +19 -0
  18. package/dist/lib/init/scaffold/agent.js +161 -0
  19. package/dist/lib/init/scaffold/agent.js.map +1 -0
  20. package/dist/lib/init/scaffold/env.js +4 -2
  21. package/dist/lib/init/scaffold/env.js.map +1 -1
  22. package/dist/lib/init/scaffold/github.d.ts +1 -4
  23. package/dist/lib/init/scaffold/github.js +1 -46
  24. package/dist/lib/init/scaffold/github.js.map +1 -1
  25. package/dist/lib/init/scaffold/index.d.ts +2 -1
  26. package/dist/lib/init/scaffold/index.js +96 -54
  27. package/dist/lib/init/scaffold/index.js.map +1 -1
  28. package/dist/lib/init/scaffold/shadcn.js +15 -6
  29. package/dist/lib/init/scaffold/shadcn.js.map +1 -1
  30. package/dist/lib/init/types/index.d.ts +1 -1
  31. package/dist/lib/init/types/index.js +12 -2
  32. package/dist/lib/init/types/index.js.map +1 -1
  33. package/dist/lib/init/types/questions.d.ts +7 -2
  34. package/dist/lib/init/types/questions.js +4 -1
  35. package/dist/lib/init/types/questions.js.map +1 -1
  36. package/dist/lib/init/types/templates.d.ts +11 -2
  37. package/dist/lib/init/types/templates.js +8 -1
  38. package/dist/lib/init/types/templates.js.map +1 -1
  39. package/dist/services/auth.service.js +1 -4
  40. package/dist/services/auth.service.js.map +1 -1
  41. package/dist/utils/version.d.ts +1 -1
  42. package/dist/utils/version.js +1 -1
  43. package/dist/utils/version.js.map +1 -1
  44. package/oclif.manifest.json +12 -1
  45. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  // src/commands/init.ts
2
2
  import { Flags as Flags2 } from "@oclif/core";
3
3
  import inquirer2 from "inquirer";
4
- import path3 from "path";
5
- import fs3 from "fs";
4
+ import path4 from "path";
5
+ import fs4 from "fs";
6
6
 
7
7
  // src/services/auth.service.ts
8
8
  import Conf2 from "conf";
@@ -144,8 +144,6 @@ var AuthService = class {
144
144
  if (shouldLogin) {
145
145
  const loginResult = await this.login({ exitAfterLogin: false });
146
146
  cliToken = loginResult.cliToken;
147
- cmd.log(`\u{1FA81} Logged in as ${chalk.hex("#7553fc")(loginResult.user.email)}
148
- `);
149
147
  return loginResult;
150
148
  } else {
151
149
  cmd.error("Authentication required to proceed.");
@@ -205,8 +203,7 @@ var AuthService = class {
205
203
  }
206
204
  this.config.set("cliToken", cliToken);
207
205
  res.status(200).json({ message: "Callback called" });
208
- spinner.succeed(`\u{1FA81} Successfully logged in as ${chalk.hex("#7553fc")(user.email)}
209
- `);
206
+ spinner.succeed(`\u{1FA81} Successfully logged in as ${chalk.hex("#7553fc")(user.email)}`);
210
207
  if (exitAfterLogin) {
211
208
  process.exit(0);
212
209
  } else {
@@ -224,7 +221,7 @@ import { Command } from "@oclif/core";
224
221
  import Sentry, { consoleIntegration } from "@sentry/node";
225
222
 
226
223
  // src/utils/version.ts
227
- var LIB_VERSION = "0.0.14";
224
+ var LIB_VERSION = "0.0.16";
228
225
 
229
226
  // src/commands/base-command.ts
230
227
  import chalk2 from "chalk";
@@ -292,6 +289,7 @@ var AGENT_FRAMEWORKS = ["CrewAI", "LangGraph", "None"];
292
289
  var CREW_TYPES = ["Crews", "Flows"];
293
290
  var CHAT_COMPONENTS = ["CopilotChat", "CopilotSidebar", "Headless", "CopilotPopup"];
294
291
  var LANGGRAPH_AGENTS = ["Python Starter", "TypeScript Starter", "None"];
292
+ var CREW_FLOW_TEMPLATES = ["Starter", "None"];
295
293
  var ConfigFlags = {
296
294
  copilotKitVersion: Flags.string({ description: "CopilotKit version to use (e.g. 1.7.0)" }),
297
295
  agentFramework: Flags.string({ description: "Agent framework to power your copilot", options: AGENT_FRAMEWORKS }),
@@ -304,7 +302,8 @@ var ConfigFlags = {
304
302
  crewUrl: Flags.string({ description: "URL endpoint for your CrewAI agent" }),
305
303
  crewBearerToken: Flags.string({ description: "Bearer token for CrewAI authentication" }),
306
304
  langSmithApiKey: Flags.string({ description: "LangSmith API key for LangGraph observability" }),
307
- llmToken: Flags.string({ description: "API key for your preferred LLM provider" })
305
+ llmToken: Flags.string({ description: "API key for your preferred LLM provider" }),
306
+ crewFlowAgent: Flags.string({ description: "CrewAI Flow template to use", options: CREW_FLOW_TEMPLATES })
308
307
  };
309
308
 
310
309
  // src/lib/init/types/templates.ts
@@ -312,7 +311,14 @@ var BASE_URL = "http://registry.copilotkit.ai/r";
312
311
  var templateMapping = {
313
312
  "LangGraphPlatform": `${BASE_URL}/langgraph-platform-starter.json`,
314
313
  "RemoteEndpoint": `${BASE_URL}/remote-endpoint-starter.json`,
315
- "CrewEnterprise": `${BASE_URL}/agent-layout.json`,
314
+ "CrewEnterprise": [
315
+ `${BASE_URL}/coagents-crew-starter.json`
316
+ ],
317
+ "CrewFlowsStarter": [
318
+ `${BASE_URL}/coagents-starter-ui.json`,
319
+ `${BASE_URL}/agent-layout.json`,
320
+ `${BASE_URL}/remote-endpoint.json`
321
+ ],
316
322
  "Standard": `${BASE_URL}/standard-starter.json`,
317
323
  "CopilotChat": `${BASE_URL}/chat.json`,
318
324
  "CopilotPopup": `${BASE_URL}/popup.json`,
@@ -336,10 +342,11 @@ var questions = [
336
342
  choices: Array.from(CREW_TYPES),
337
343
  when: (answers) => answers.agentFramework === "CrewAI"
338
344
  },
345
+ // CrewAI Crews specific questions - shown when CrewAI Crews selected
339
346
  {
340
347
  type: "input",
341
348
  name: "crewName",
342
- message: "\u{1F465} What would you like to name your crew?",
349
+ message: "\u{1F465} What would you like to name your crew? (can be anything)",
343
350
  when: (answers) => answers.agentFramework === "CrewAI" && answers.crewType === "Crews",
344
351
  default: "MyCopilotCrew"
345
352
  },
@@ -353,66 +360,101 @@ var questions = [
353
360
  type: "input",
354
361
  name: "crewBearerToken",
355
362
  message: "\u{1F511} Enter your Crew authentication token:",
356
- when: (answers) => answers.agentFramework === "CrewAI" && answers.crewType === "Crews"
357
- },
358
- // LangGraph specific questions - shown when LangGraph selected
359
- {
360
- type: "yes/no",
361
- name: "alreadyDeployed",
362
- message: "\u{1F680} Is your LangGraph agent already deployed?",
363
- when: (answers) => answers.agentFramework === "LangGraph"
364
- },
365
- {
366
- type: "yes/no",
367
- name: "langGraphPlatform",
368
- message: "\u{1F99C}\u{1F517} Is it hosted on LangGraph Platform?",
369
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "Yes"
370
- },
371
- {
372
- type: "input",
373
- name: "langGraphPlatformUrl",
374
- message: "\u{1F99C}\u{1F517} Enter your LangGraph platform URL:",
375
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "Yes" && answers.langGraphPlatform === "Yes"
376
- },
377
- {
378
- type: "input",
379
- name: "langGraphRemoteEndpointURL",
380
- message: "\u{1F50C} Enter your LangGraph endpoint URL:",
381
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "Yes" && answers.langGraphPlatform === "No"
363
+ when: (answers) => answers.agentFramework === "CrewAI" && answers.crewType === "Crews",
364
+ sensitive: true
382
365
  },
366
+ // CrewAI Flows specific questions - shown when CrewAI Flows selected
383
367
  {
384
368
  type: "select",
385
- name: "langGraphAgent",
386
- message: "\u{1F4E6} Choose a LangGraph starter template:",
387
- choices: Array.from(LANGGRAPH_AGENTS),
388
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "No"
389
- },
390
- {
391
- type: "input",
392
- name: "langSmithApiKey",
393
- message: "\u{1F99C}\u{1F517} Enter your LangSmith API key (required by LangGraph Platform) :",
394
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "No"
369
+ name: "crewFlowAgent",
370
+ message: "\u{1F4E6} Choose a CrewAI Flow Template",
371
+ choices: Array.from(CREW_FLOW_TEMPLATES),
372
+ when: (answers) => answers.agentFramework === "CrewAI" && answers.crewType === "Flows"
395
373
  },
374
+ // LangGraph specific questions - shown when LangGraph selected
375
+ // {
376
+ // type: 'yes/no',
377
+ // name: 'alreadyDeployed',
378
+ // message: '🚀 Is your LangGraph agent already deployed?',
379
+ // when: (answers) => answers.agentFramework === 'LangGraph',
380
+ // },
381
+ // {
382
+ // type: 'yes/no',
383
+ // name: 'langGraphPlatform',
384
+ // message: '🦜🔗 Is it hosted on LangGraph Platform?',
385
+ // when: (answers) =>
386
+ // answers.agentFramework === 'LangGraph' &&
387
+ // answers.alreadyDeployed === 'Yes',
388
+ // },
389
+ // {
390
+ // type: 'input',
391
+ // name: 'langGraphPlatformUrl',
392
+ // message: '🦜🔗 Enter your LangGraph platform URL:',
393
+ // when: (answers) =>
394
+ // answers.agentFramework === 'LangGraph' &&
395
+ // answers.alreadyDeployed === 'Yes' &&
396
+ // answers.langGraphPlatform === 'Yes',
397
+ // },
398
+ // {
399
+ // type: 'input',
400
+ // name: 'langGraphRemoteEndpointURL',
401
+ // message: '🔌 Enter your LangGraph endpoint URL:',
402
+ // when: (answers) =>
403
+ // answers.agentFramework === 'LangGraph' &&
404
+ // answers.alreadyDeployed === 'Yes' &&
405
+ // answers.langGraphPlatform === 'No',
406
+ // },
407
+ // {
408
+ // type: 'select',
409
+ // name: 'langGraphAgent',
410
+ // message: '📦 Choose a LangGraph starter template:',
411
+ // choices: Array.from(LANGGRAPH_AGENTS),
412
+ // when: (answers) =>
413
+ // answers.agentFramework === 'LangGraph' &&
414
+ // answers.alreadyDeployed === 'No',
415
+ // },
416
+ // {
417
+ // type: 'input',
418
+ // name: 'langSmithApiKey',
419
+ // message: '🦜🔗 Enter your LangSmith API key (required by LangGraph Platform) :',
420
+ // when: (answers) =>
421
+ // answers.agentFramework === 'LangGraph' &&
422
+ // answers.alreadyDeployed === 'No',
423
+ // sensitive: true,
424
+ // },
396
425
  // Deployment options
397
426
  {
398
427
  type: "yes/no",
399
428
  name: "useCopilotCloud",
400
429
  message: "\u{1FA81} Deploy with Copilot Cloud? (recommended for production)",
401
- when: (answers) => !(answers.agentFramework === "CrewAI" && answers.crewType === "Crews")
402
- },
403
- {
404
- type: "yes/no",
405
- name: "fastApiEnabled",
406
- message: "\u26A1 Set up a FastAPI server for local development?",
407
- when: (answers) => answers.agentFramework === "LangGraph" && answers.alreadyDeployed === "No" && answers.langGraphAgent === "Python Starter" && answers.useCopilotCloud !== "Yes"
430
+ when: (answers) => !(answers.agentFramework === "CrewAI" && answers.crewType === "Crews") && answers.agentFramework !== "LangGraph"
408
431
  },
432
+ // {
433
+ // type: 'yes/no',
434
+ // name: 'fastApiEnabled',
435
+ // message: '⚡ Set up a FastAPI server for local development?',
436
+ // when: (answers) =>
437
+ // answers.agentFramework === 'LangGraph' &&
438
+ // answers.alreadyDeployed === 'No' &&
439
+ // answers.langGraphAgent === 'Python Starter' &&
440
+ // answers.useCopilotCloud !== 'Yes',
441
+ // },
409
442
  // UI components - always shown last
410
443
  {
411
444
  type: "select",
412
445
  name: "chatUi",
413
446
  message: "\u{1F4AC} Select a UI component for your copilot:",
414
447
  choices: Array.from(CHAT_COMPONENTS),
415
- default: "CopilotChat"
448
+ default: "CopilotChat",
449
+ when: (answers) => answers.agentFramework === "None"
450
+ },
451
+ {
452
+ type: "input",
453
+ name: "llmToken",
454
+ message: "\u{1F511} Enter your OpenAI API key (required for agent functionality):",
455
+ when: (answers) => answers.agentFramework !== "LangGraph" && // (answers.agentFramework === 'LangGraph' && answers.alreadyDeployed === 'No') ||
456
+ (answers.agentFramework === "CrewAI" && answers.crewType === "Flows"),
457
+ sensitive: true
416
458
  }
417
459
  ];
418
460
 
@@ -420,9 +462,7 @@ var questions = [
420
462
  import spawn from "cross-spawn";
421
463
  async function scaffoldShadCN(userAnswers) {
422
464
  try {
423
- const components = [
424
- templateMapping[userAnswers.chatUi]
425
- ];
465
+ const components = [];
426
466
  if (userAnswers.agentFramework !== "None") {
427
467
  switch (userAnswers.agentFramework) {
428
468
  case "LangGraph":
@@ -430,7 +470,9 @@ async function scaffoldShadCN(userAnswers) {
430
470
  break;
431
471
  case "CrewAI":
432
472
  if (userAnswers.crewType === "Crews") {
433
- components.push(templateMapping.CrewEnterprise);
473
+ components.push(...templateMapping.CrewEnterprise);
474
+ } else if (userAnswers.crewFlowAgent) {
475
+ components.push(...templateMapping.CrewFlowsStarter);
434
476
  } else {
435
477
  components.push(templateMapping.RemoteEndpoint);
436
478
  }
@@ -484,7 +526,7 @@ async function scaffoldEnv(flags, userAnswers) {
484
526
  varsAdded = true;
485
527
  }
486
528
  if (userAnswers.langSmithApiKey) {
487
- newEnvValues += `LANG_SMITH_API_KEY=${userAnswers.langSmithApiKey}
529
+ newEnvValues += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}
488
530
  `;
489
531
  spinner.text = chalk3.cyan("Adding LangSmith API key...");
490
532
  varsAdded = true;
@@ -492,7 +534,9 @@ async function scaffoldEnv(flags, userAnswers) {
492
534
  if (userAnswers.llmToken) {
493
535
  newEnvValues += `LLM_TOKEN=${userAnswers.llmToken}
494
536
  `;
495
- spinner.text = chalk3.cyan("Adding LLM token...");
537
+ newEnvValues += `OPENAI_API_KEY=${userAnswers.llmToken}
538
+ `;
539
+ spinner.text = chalk3.cyan("Adding OpenAI API key...");
496
540
  varsAdded = true;
497
541
  }
498
542
  if (userAnswers.crewName) {
@@ -528,50 +572,6 @@ import * as fs2 from "fs";
528
572
  import * as path2 from "path";
529
573
  import * as os from "os";
530
574
  import chalk4 from "chalk";
531
- import ora3 from "ora";
532
- async function scaffoldAgent(userAnswers) {
533
- if (userAnswers.agentFramework === "None" || userAnswers.agentFramework === "CrewAI" && userAnswers.crewType === "Crews" || userAnswers.agentFramework === "LangGraph" && (!userAnswers.langGraphAgent || userAnswers.langGraphAgent === "None")) {
534
- return;
535
- }
536
- const spinner = ora3({
537
- text: chalk4.cyan("Setting up AI agent..."),
538
- color: "cyan"
539
- }).start();
540
- try {
541
- if (userAnswers.agentFramework === "LangGraph") {
542
- switch (userAnswers.langGraphAgent) {
543
- case "Python Starter":
544
- spinner.text = chalk4.cyan("Setting up Python LangGraph agent...");
545
- await new Promise((resolve) => setTimeout(resolve, 50));
546
- await cloneGitHubSubdirectory(
547
- "https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-starter/agent-py",
548
- path2.join(process.cwd(), "agent"),
549
- spinner
550
- );
551
- break;
552
- case "TypeScript Starter":
553
- spinner.text = chalk4.cyan("Setting up TypeScript LangGraph agent...");
554
- await new Promise((resolve) => setTimeout(resolve, 50));
555
- await cloneGitHubSubdirectory(
556
- "https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-starter/agent-js",
557
- path2.join(process.cwd(), "agent"),
558
- spinner
559
- );
560
- break;
561
- default:
562
- break;
563
- }
564
- } else if (userAnswers.agentFramework === "CrewAI" && userAnswers.crewType === "Flows") {
565
- spinner.text = chalk4.cyan("Setting up CrewAI Flows agent...");
566
- await new Promise((resolve) => setTimeout(resolve, 50));
567
- spinner.info(chalk4.yellow("CrewAI Flows support is coming soon..."));
568
- }
569
- spinner.succeed(chalk4.green("AI agent setup complete"));
570
- } catch (error) {
571
- spinner.fail(chalk4.red("Failed to set up AI agent"));
572
- throw error;
573
- }
574
- }
575
575
  async function cloneGitHubSubdirectory(githubUrl, destinationPath, spinner) {
576
576
  try {
577
577
  const { owner, repo, branch, subdirectoryPath } = parseGitHubUrl(githubUrl);
@@ -650,10 +650,84 @@ function parseGitHubUrl(githubUrl) {
650
650
  // src/lib/init/scaffold/packages.ts
651
651
  import spawn2 from "cross-spawn";
652
652
  import chalk5 from "chalk";
653
+ import ora3 from "ora";
654
+
655
+ // src/lib/init/scaffold/agent.ts
653
656
  import ora4 from "ora";
657
+ import chalk6 from "chalk";
658
+ import path3 from "path";
659
+ import fs3 from "fs";
660
+ async function scaffoldAgent(userAnswers) {
661
+ if (userAnswers.agentFramework === "None" || userAnswers.agentFramework === "CrewAI" && userAnswers.crewType === "Crews" || userAnswers.agentFramework === "LangGraph" && (!userAnswers.langGraphAgent || userAnswers.langGraphAgent === "None")) {
662
+ return;
663
+ }
664
+ const spinner = ora4({
665
+ text: chalk6.cyan("Setting up AI agent..."),
666
+ color: "cyan"
667
+ }).start();
668
+ let template = "";
669
+ switch (userAnswers.agentFramework) {
670
+ case "LangGraph":
671
+ if (userAnswers.langGraphAgent === "Python Starter") {
672
+ template = AgentTemplates.LangGraph.Starter.Python;
673
+ } else {
674
+ template = AgentTemplates.LangGraph.Starter.TypeScript;
675
+ }
676
+ break;
677
+ case "CrewAI":
678
+ if (userAnswers.crewFlowAgent === "Starter") {
679
+ template = AgentTemplates.CrewAI.Flows.Starter;
680
+ }
681
+ break;
682
+ }
683
+ if (!template) {
684
+ spinner.fail(chalk6.red("Failed to determine agent template"));
685
+ throw new Error("Failed to determine agent template");
686
+ }
687
+ const agentDir = path3.join(process.cwd(), "agent");
688
+ try {
689
+ await cloneGitHubSubdirectory(
690
+ template,
691
+ agentDir,
692
+ spinner
693
+ );
694
+ spinner.text = chalk6.cyan("Creating agent environment variables...");
695
+ let envContent = "";
696
+ if (userAnswers.llmToken) {
697
+ envContent += `OPENAI_API_KEY=${userAnswers.llmToken}
698
+ `;
699
+ }
700
+ if (userAnswers.agentFramework === "LangGraph" && userAnswers.langSmithApiKey) {
701
+ envContent += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}
702
+ `;
703
+ }
704
+ if (envContent) {
705
+ const agentEnvFile = path3.join(agentDir, ".env");
706
+ fs3.writeFileSync(agentEnvFile, envContent, "utf8");
707
+ spinner.text = chalk6.cyan("Added API keys to agent .env file");
708
+ }
709
+ } catch (error) {
710
+ spinner.fail(chalk6.red("Failed to clone agent template"));
711
+ throw error;
712
+ }
713
+ spinner.succeed(chalk6.green(`${userAnswers.agentFramework} agent cloned successfully`));
714
+ }
715
+ var AgentTemplates = {
716
+ LangGraph: {
717
+ Starter: {
718
+ Python: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-starter/agent-py",
719
+ TypeScript: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-starter/agent-js"
720
+ }
721
+ },
722
+ CrewAI: {
723
+ Flows: {
724
+ Starter: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-starter-crewai-flows/agent-py"
725
+ }
726
+ }
727
+ };
654
728
 
655
729
  // src/commands/init.ts
656
- import chalk6 from "chalk";
730
+ import chalk7 from "chalk";
657
731
  import ora5 from "ora";
658
732
  var CloudInit = class _CloudInit extends BaseCommand {
659
733
  constructor(argv, config, authService = new AuthService()) {
@@ -675,14 +749,18 @@ var CloudInit = class _CloudInit extends BaseCommand {
675
749
  async run() {
676
750
  const { flags } = await this.parse(_CloudInit);
677
751
  try {
678
- this.log(chalk6.bold(chalk6.cyan("\n\u{1FA81} Welcome to CopilotKit")));
679
- this.log(chalk6.gray("Let's power up your Next.js project with AI capabilities\n"));
752
+ this.log(chalk7.bold(chalk7.cyan("\n\u{1FA81} Welcome to CopilotKit")));
753
+ this.log(chalk7.gray("Let's power up your Next.js project with AI capabilities\n"));
680
754
  this.validateProjectCompatibility(flags);
681
755
  const userAnswers = await this.getUserAnswers();
682
- const needsCloudSetup = userAnswers.useCopilotCloud === "Yes" || userAnswers.agentFramework === "CrewAI" && userAnswers.crewType === "Crews";
683
- if (needsCloudSetup) {
684
- await this.setupCloud(flags, userAnswers);
756
+ if (userAnswers.agentFramework === "LangGraph") {
757
+ this.log(chalk7.cyan("\n\u{1F99C}\u{1F517} LangGraph Integration"));
758
+ this.log(chalk7.gray("For detailed LangGraph setup instructions, please refer to:"));
759
+ this.log(chalk7.blue("https://docs.copilotkit.ai/coagents\n"));
760
+ process.exit(0);
685
761
  }
762
+ const needsCloudSetup = userAnswers.useCopilotCloud === "Yes" || userAnswers.agentFramework === "CrewAI" && userAnswers.crewType === "Crews";
763
+ if (needsCloudSetup) await this.setupCloud(flags, userAnswers);
686
764
  await scaffoldShadCN(userAnswers);
687
765
  await scaffoldAgent(userAnswers);
688
766
  await scaffoldEnv(flags, userAnswers);
@@ -716,21 +794,17 @@ var CloudInit = class _CloudInit extends BaseCommand {
716
794
  default:
717
795
  return {
718
796
  ...baseQuestion,
719
- type: "input"
797
+ type: q.sensitive ? "password" : "input",
798
+ mask: q.sensitive ? "*" : void 0
720
799
  };
721
800
  }
722
801
  });
723
802
  const answers = await inquirer2.prompt(inquirerQuestions);
724
- return answers;
803
+ return { ...answers };
725
804
  }
726
805
  async setupCloud(flags, userAnswers) {
727
- const spinner = ora5({
728
- text: chalk6("\u{1F511} Authenticating for Copilot Cloud..."),
729
- color: "cyan"
730
- }).start();
731
806
  const { cliToken, organization, user } = await this.authService.requireLogin(this);
732
807
  const analytics = new AnalyticsService({ userId: user.id, organizationId: organization.id, email: user.email });
733
- spinner.succeed(chalk6("\u{1F511} Authenticated for Copilot Cloud"));
734
808
  await analytics.track({
735
809
  event: "cli.init.cloud_used",
736
810
  properties: { userId: user.id }
@@ -740,11 +814,11 @@ var CloudInit = class _CloudInit extends BaseCommand {
740
814
  let selectedProjectId;
741
815
  if (flags.project) {
742
816
  if (!availableProjects.some((project) => project.id === flags.project)) {
743
- this.log(chalk6.red(`\u{1F4C1} Project with ID ${flags.project} not found`));
817
+ this.log(chalk7.red(`\u{1F4C1} Project with ID ${flags.project} not found`));
744
818
  process.exit(1);
745
819
  }
746
820
  selectedProjectId = flags.project;
747
- this.log(chalk6.green(`\u{1F4C1} Selected project ${selectedProjectId}`));
821
+ this.log(chalk7.green(`\u{1F4C1} Selected project ${selectedProjectId}`));
748
822
  } else {
749
823
  const { projectId } = await inquirer2.prompt([
750
824
  {
@@ -763,7 +837,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
763
837
  userAnswers.copilotCloudPublicApiKey = copilotCloudPublicApiKey?.key;
764
838
  if (userAnswers.crewUrl && userAnswers.crewName && userAnswers.crewBearerToken) {
765
839
  const crewSpinner = ora5({
766
- text: chalk6("\u{1F465} Adding Crew to Copilot Cloud..."),
840
+ text: chalk7("\u{1F465} Adding Crew to Copilot Cloud..."),
767
841
  color: "cyan"
768
842
  }).start();
769
843
  await this.trpcClient.createRemoteEndpoint.mutate({
@@ -777,26 +851,26 @@ var CloudInit = class _CloudInit extends BaseCommand {
777
851
  crewApiBearerToken: userAnswers.crewBearerToken
778
852
  }
779
853
  });
780
- crewSpinner.succeed(chalk6("\u{1F465} Crew added to Copilot Cloud"));
854
+ crewSpinner.succeed(chalk7("\u{1F465} Crew added to Copilot Cloud"));
781
855
  }
782
856
  }
783
857
  validateProjectCompatibility(flags) {
784
- const projectPath = path3.resolve(process.cwd(), flags.dir);
785
- if (!fs3.existsSync(projectPath)) {
858
+ const projectPath = path4.resolve(process.cwd(), flags.dir);
859
+ if (!fs4.existsSync(projectPath)) {
786
860
  this.gracefulError(`Directory ${flags.dir} does not exist. Please provide a valid Next.js project directory.`);
787
861
  return;
788
862
  }
789
- const packageJsonPath = path3.join(projectPath, "package.json");
790
- if (!fs3.existsSync(packageJsonPath)) {
863
+ const packageJsonPath = path4.join(projectPath, "package.json");
864
+ if (!fs4.existsSync(packageJsonPath)) {
791
865
  this.gracefulError(`Directory ${projectPath} does not contain a package.json file. Please provide a valid Next.js project.`);
792
866
  process.exit(1);
793
867
  }
794
- const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
868
+ const packageJson = JSON.parse(fs4.readFileSync(packageJsonPath, "utf8"));
795
869
  if (!packageJson.dependencies?.next && !packageJson.devDependencies?.next) {
796
870
  this.gracefulError(`Directory ${projectPath} does not appear to be a Next.js project. Make sure it has next in dependencies.`);
797
871
  process.exit(1);
798
872
  }
799
- this.log(chalk6.green(`Valid Next.js project detected
873
+ this.log(chalk7.green(`Valid Next.js project detected
800
874
  `));
801
875
  return true;
802
876
  }
@@ -804,49 +878,48 @@ var CloudInit = class _CloudInit extends BaseCommand {
804
878
  let agentDevInstructions = "";
805
879
  let agentType = "";
806
880
  let agentSetupMessage = "";
881
+ let uiNavigateInstructions = "";
807
882
  if (userAnswers.agentFramework !== "None") {
808
883
  if (userAnswers.agentFramework === "LangGraph") {
809
884
  agentType = "LangGraph agent";
810
- if (userAnswers.alreadyDeployed === "Yes") {
811
- agentSetupMessage = `Using your existing deployed agent.`;
812
- } else if (userAnswers.langGraphAgent && userAnswers.langGraphAgent !== "None") {
813
- agentSetupMessage = `We've scaffolded a ${chalk6.cyan(userAnswers.langGraphAgent)} agent in the ${chalk6.cyan("./agent")} directory.`;
814
- if (userAnswers.langGraphAgent === "Python Starter") {
815
- if (userAnswers.fastApiEnabled === "Yes") {
816
- agentDevInstructions = "poetry install && poetry run demo";
817
- } else {
818
- agentDevInstructions = "npx @langchain/langgraph-cli dev --port 8123";
819
- }
820
- } else if (userAnswers.langGraphAgent === "TypeScript Starter") {
821
- agentDevInstructions = "npm i && npm run dev";
822
- }
823
- }
885
+ agentSetupMessage = `Please refer to the documentation at ${chalk7.blue("https://docs.copilotkit.ai/coagents")} for LangGraph setup instructions.`;
824
886
  } else if (userAnswers.agentFramework === "CrewAI") {
825
887
  agentType = "CrewAI";
826
888
  if (userAnswers.crewType === "Crews") {
827
- agentSetupMessage = `Using your Crew from ${chalk6.cyan(userAnswers.crewUrl || "the provided URL")}.`;
889
+ agentSetupMessage = `Using your Crew from ${chalk7.cyan(userAnswers.crewUrl || "the provided URL")}.`;
828
890
  } else if (userAnswers.crewType === "Flows") {
829
- agentSetupMessage = "CrewAI Flows support is coming soon.";
891
+ agentSetupMessage = `We've scaffolded a ${chalk7.cyan(userAnswers.crewFlowAgent || "CrewAI")} agent in the ${chalk7.cyan("./agent")} directory.`;
892
+ agentDevInstructions = "poetry install && poetry run python app.py";
830
893
  }
831
894
  }
832
895
  }
833
- this.log(chalk6.bold(chalk6.cyan("\n\u{1F389} Your CopilotKit setup is complete!\n")));
834
- this.log(chalk6.bold("\u{1F4AC} User Interface:"));
835
- this.log(chalk6.gray(`We've set up the ${chalk6.cyan(userAnswers.chatUi)} component in your Next.js app.`));
896
+ if (userAnswers.chatUi === "CopilotChat") {
897
+ uiNavigateInstructions = `Navigate to ${chalk7.cyan("http://localhost:3000")} to see your CopilotKit chat interface.`;
898
+ } else if (userAnswers.chatUi === "CopilotSidebar") {
899
+ uiNavigateInstructions = `Navigate to ${chalk7.cyan("http://localhost:3000")} and click on the sidebar icon to open the CopilotKit sidebar.`;
900
+ } else if (userAnswers.chatUi === "CopilotPopup") {
901
+ uiNavigateInstructions = `Navigate to ${chalk7.cyan("http://localhost:3000")} and click on the popup button to open the CopilotKit popup.`;
902
+ } else {
903
+ uiNavigateInstructions = `Navigate to ${chalk7.cyan("http://localhost:3000")} to see your CopilotKit interface.`;
904
+ }
905
+ this.log(chalk7.bold(chalk7.cyan("\n\u{1F389} Your CopilotKit setup is complete!\n")));
906
+ this.log(chalk7.bold("\u{1F4AC} User Interface:"));
907
+ this.log(chalk7.gray(`We've set up the ${chalk7.cyan(userAnswers.chatUi)} component in your Next.js app.`));
908
+ this.log(chalk7.gray(uiNavigateInstructions));
836
909
  if (agentType) {
837
- this.log(chalk6.bold(`
910
+ this.log(chalk7.bold(`
838
911
  \u{1F916} ${agentType}:`));
839
- this.log(chalk6.gray(agentSetupMessage));
912
+ this.log(chalk7.gray(agentSetupMessage));
840
913
  }
841
- this.log(chalk6.bold("\n\u{1F4CB} Next steps:"));
842
- this.log(` ${chalk6.cyan("1.")} Start your Next.js app:`);
843
- this.log(` ${chalk6.gray("$")} ${chalk6.yellow("npm run dev")}`);
914
+ this.log(chalk7.bold("\n\u{1F4CB} Next steps:"));
915
+ this.log(` ${chalk7.cyan("1.")} Start your Next.js app:`);
916
+ this.log(` ${chalk7.gray("$")} ${chalk7.yellow("npm run dev")}`);
844
917
  if (agentDevInstructions) {
845
- this.log(` ${chalk6.cyan("2.")} Start your agent:`);
846
- this.log(` ${chalk6.gray("$")} ${chalk6.yellow(`cd agent && ${agentDevInstructions}`)}`);
918
+ this.log(` ${chalk7.cyan("2.")} Start your agent:`);
919
+ this.log(` ${chalk7.gray("$")} ${chalk7.yellow(`cd agent && ${agentDevInstructions}`)}`);
847
920
  }
848
- this.log(chalk6.bold("\n\u{1F4DA} Documentation:"));
849
- this.log(` ${chalk6.blue("https://docs.copilotkit.ai")}`);
921
+ this.log(chalk7.bold("\n\u{1F4DA} Documentation:"));
922
+ this.log(` ${chalk7.blue("https://docs.copilotkit.ai")}`);
850
923
  this.log("");
851
924
  }
852
925
  };