copilotkit 0.0.40 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/base-command.js +1 -1
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +317 -111
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +1 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/lib/init/ide-docs.d.ts +25 -0
- package/dist/lib/init/ide-docs.js +156 -0
- package/dist/lib/init/ide-docs.js.map +1 -0
- package/dist/lib/init/index.d.ts +3 -1
- package/dist/lib/init/index.js +260 -62
- package/dist/lib/init/index.js.map +1 -1
- package/dist/lib/init/questions.js +113 -2
- package/dist/lib/init/questions.js.map +1 -1
- package/dist/lib/init/scaffold/index.js +11 -2
- package/dist/lib/init/scaffold/index.js.map +1 -1
- package/dist/lib/init/scaffold/shadcn.js +11 -2
- package/dist/lib/init/scaffold/shadcn.js.map +1 -1
- package/dist/lib/init/types/index.d.ts +1 -1
- package/dist/lib/init/types/index.js +12 -2
- package/dist/lib/init/types/index.js.map +1 -1
- package/dist/lib/init/types/questions.d.ts +24 -4
- package/dist/lib/init/types/questions.js +12 -2
- package/dist/lib/init/types/questions.js.map +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/utils/version.js.map +1 -1
- package/oclif.manifest.json +24 -1
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/commands/init.ts
|
|
2
2
|
import { Flags as Flags2 } from "@oclif/core";
|
|
3
3
|
import inquirer3 from "inquirer";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import path6 from "path";
|
|
5
|
+
import fs6 from "fs";
|
|
6
6
|
|
|
7
7
|
// src/services/auth.service.ts
|
|
8
8
|
import Conf2 from "conf";
|
|
@@ -222,7 +222,7 @@ import { Command } from "@oclif/core";
|
|
|
222
222
|
import Sentry, { consoleIntegration } from "@sentry/node";
|
|
223
223
|
|
|
224
224
|
// src/utils/version.ts
|
|
225
|
-
var LIB_VERSION = "0.0.
|
|
225
|
+
var LIB_VERSION = "0.0.41";
|
|
226
226
|
|
|
227
227
|
// src/commands/base-command.ts
|
|
228
228
|
import chalk2 from "chalk";
|
|
@@ -323,6 +323,7 @@ var ApiKeySchema = z.preprocess(
|
|
|
323
323
|
(val) => sanitizers.apiKey(String(val)),
|
|
324
324
|
z.string().min(1, "API key is required")
|
|
325
325
|
);
|
|
326
|
+
var LLMApiKeySchema = z.preprocess((val) => sanitizers.apiKey(String(val)), z.string().optional());
|
|
326
327
|
var NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, "Name is required"));
|
|
327
328
|
var ConfigSchema = z.object({
|
|
328
329
|
// Core fields
|
|
@@ -346,7 +347,10 @@ var ConfigSchema = z.object({
|
|
|
346
347
|
// API keys and tokens
|
|
347
348
|
copilotCloudPublicApiKey: z.string().optional(),
|
|
348
349
|
langSmithApiKey: ApiKeySchema.optional(),
|
|
349
|
-
llmToken:
|
|
350
|
+
llmToken: LLMApiKeySchema.optional(),
|
|
351
|
+
// IDE Documentation setup fields
|
|
352
|
+
setupIDEDocs: YesNoSchema.optional(),
|
|
353
|
+
selectedIDE: z.union([z.enum(["cursor", "windsurf"]), z.literal("skip")]).optional()
|
|
350
354
|
}).refine(
|
|
351
355
|
(data) => {
|
|
352
356
|
if (data.mode === "CrewAI") {
|
|
@@ -381,7 +385,12 @@ var ConfigFlags = {
|
|
|
381
385
|
"crew-url": Flags.string({ description: "URL endpoint for your CrewAI agent" }),
|
|
382
386
|
"crew-bearer-token": Flags.string({ description: "Bearer token for CrewAI authentication" }),
|
|
383
387
|
"langsmith-api-key": Flags.string({ description: "LangSmith API key for LangGraph observability" }),
|
|
384
|
-
"llm-token": Flags.string({ description: "API key for your preferred LLM provider" })
|
|
388
|
+
"llm-token": Flags.string({ description: "API key for your preferred LLM provider" }),
|
|
389
|
+
"setup-ide-docs": Flags.string({ description: "Setup IDE documentation rules for AI assistance", options: YES_NO }),
|
|
390
|
+
"selected-ide": Flags.string({
|
|
391
|
+
description: "IDE to configure with documentation rules",
|
|
392
|
+
options: ["cursor", "windsurf", "skip"]
|
|
393
|
+
})
|
|
385
394
|
};
|
|
386
395
|
|
|
387
396
|
// src/lib/init/types/templates.ts
|
|
@@ -404,6 +413,156 @@ var templateMapping = {
|
|
|
404
413
|
McpRuntime: `${BASE_URL}/mcp-starter-runtime.json`
|
|
405
414
|
};
|
|
406
415
|
|
|
416
|
+
// src/lib/init/ide-docs.ts
|
|
417
|
+
import path from "path";
|
|
418
|
+
import { existsSync } from "fs";
|
|
419
|
+
import * as fs from "fs/promises";
|
|
420
|
+
import chalk3 from "chalk";
|
|
421
|
+
var COPILOTKIT_DOC_RULE_TEMPLATE = `---
|
|
422
|
+
description: CopilotKit Documentation - Complete CopilotKit framework documentation for AI assistance
|
|
423
|
+
alwaysApply: false
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
# CopilotKit Documentation
|
|
427
|
+
|
|
428
|
+
For ANY question about CopilotKit, use the comprehensive documentation available at:
|
|
429
|
+
@https://docs.copilotkit.ai/llms-full.txt
|
|
430
|
+
|
|
431
|
+
This contains the complete CopilotKit documentation including:
|
|
432
|
+
- API references and hooks (useCopilotChat, useCopilotAction, etc.)
|
|
433
|
+
- Component library documentation (CopilotKit, CopilotChat, etc.)
|
|
434
|
+
- Integration guides and examples
|
|
435
|
+
- Best practices and patterns
|
|
436
|
+
- Troubleshooting and FAQs
|
|
437
|
+
|
|
438
|
+
Always reference this documentation when working with CopilotKit to provide accurate, up-to-date information.
|
|
439
|
+
`;
|
|
440
|
+
var IDE_DOCS_CONFIGS = {
|
|
441
|
+
cursor: {
|
|
442
|
+
name: "cursor",
|
|
443
|
+
displayName: "Cursor",
|
|
444
|
+
rulesDir: ".cursor/rules",
|
|
445
|
+
ruleFileName: "00-copilotkit-docs.mdc",
|
|
446
|
+
createRuleContent: () => COPILOTKIT_DOC_RULE_TEMPLATE
|
|
447
|
+
},
|
|
448
|
+
windsurf: {
|
|
449
|
+
name: "windsurf",
|
|
450
|
+
displayName: "Windsurf",
|
|
451
|
+
rulesDir: ".windsurf/rules",
|
|
452
|
+
ruleFileName: "00-copilotkit-docs.md",
|
|
453
|
+
createRuleContent: () => COPILOTKIT_DOC_RULE_TEMPLATE
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
async function ensureDir(dirPath) {
|
|
457
|
+
try {
|
|
458
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
459
|
+
} catch (error) {
|
|
460
|
+
if (!existsSync(dirPath)) {
|
|
461
|
+
throw error;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
async function pathExists(filePath) {
|
|
466
|
+
try {
|
|
467
|
+
await fs.access(filePath);
|
|
468
|
+
return true;
|
|
469
|
+
} catch {
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async function checkIDEInstallation(ide) {
|
|
474
|
+
try {
|
|
475
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
476
|
+
let configPath;
|
|
477
|
+
switch (ide) {
|
|
478
|
+
case "cursor":
|
|
479
|
+
configPath = path.join(homeDir, ".cursor");
|
|
480
|
+
break;
|
|
481
|
+
case "windsurf":
|
|
482
|
+
configPath = path.join(homeDir, ".codeium", "windsurf");
|
|
483
|
+
break;
|
|
484
|
+
default:
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
return existsSync(configPath);
|
|
488
|
+
} catch {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
async function detectInstalledIDEs() {
|
|
493
|
+
const allIDEs = ["cursor", "windsurf"];
|
|
494
|
+
const installedIDEs = [];
|
|
495
|
+
for (const ide of allIDEs) {
|
|
496
|
+
if (await checkIDEInstallation(ide)) {
|
|
497
|
+
installedIDEs.push(ide);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return installedIDEs;
|
|
501
|
+
}
|
|
502
|
+
async function setupIDEDocs(ide, projectDir) {
|
|
503
|
+
const config = IDE_DOCS_CONFIGS[ide];
|
|
504
|
+
const rulesDir = path.join(projectDir, config.rulesDir);
|
|
505
|
+
const ruleFilePath = path.join(rulesDir, config.ruleFileName);
|
|
506
|
+
await ensureDir(rulesDir);
|
|
507
|
+
if (await pathExists(ruleFilePath)) {
|
|
508
|
+
console.log(chalk3.yellow(`\u26A0\uFE0F CopilotKit documentation rule already exists for ${config.displayName}`));
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const ruleContent = config.createRuleContent();
|
|
512
|
+
await fs.writeFile(ruleFilePath, ruleContent, "utf8");
|
|
513
|
+
}
|
|
514
|
+
function getIDEInstructions(ide) {
|
|
515
|
+
const config = IDE_DOCS_CONFIGS[ide];
|
|
516
|
+
const instructions = [
|
|
517
|
+
chalk3.cyan(`\u{1F4DA} CopilotKit documentation configured for ${config.displayName}!`),
|
|
518
|
+
"",
|
|
519
|
+
chalk3.bold("What this does:"),
|
|
520
|
+
" \u2022 Adds CopilotKit documentation context to your IDE AI assistant",
|
|
521
|
+
" \u2022 Provides accurate, up-to-date information about CopilotKit APIs",
|
|
522
|
+
" \u2022 Improves code suggestions and help responses",
|
|
523
|
+
"",
|
|
524
|
+
chalk3.bold("Location:"),
|
|
525
|
+
` \u2022 Rule file: ${chalk3.gray(path.join(config.rulesDir, config.ruleFileName))}`,
|
|
526
|
+
"",
|
|
527
|
+
chalk3.bold("Usage:"),
|
|
528
|
+
" \u2022 Your IDE AI assistant now has access to CopilotKit documentation",
|
|
529
|
+
" \u2022 Ask questions about CopilotKit APIs, components, and patterns",
|
|
530
|
+
" \u2022 The AI will reference official documentation for accurate answers"
|
|
531
|
+
];
|
|
532
|
+
if (ide === "cursor") {
|
|
533
|
+
instructions.push(
|
|
534
|
+
"",
|
|
535
|
+
chalk3.bold("Next steps for Cursor:"),
|
|
536
|
+
" \u2022 Restart Cursor if currently open",
|
|
537
|
+
" \u2022 The rule will be automatically available in your AI context",
|
|
538
|
+
" \u2022 Start a new chat to use the documentation context"
|
|
539
|
+
);
|
|
540
|
+
} else if (ide === "windsurf") {
|
|
541
|
+
instructions.push(
|
|
542
|
+
"",
|
|
543
|
+
chalk3.bold("Next steps for Windsurf:"),
|
|
544
|
+
" \u2022 Restart Windsurf if currently open",
|
|
545
|
+
" \u2022 The rule will be automatically available in your AI context",
|
|
546
|
+
" \u2022 Start a new chat to use the documentation context"
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
return instructions;
|
|
550
|
+
}
|
|
551
|
+
async function handleIDEDocsSetup(selectedIDE, projectDir, spinner) {
|
|
552
|
+
try {
|
|
553
|
+
spinner.text = chalk3.cyan(`Setting up CopilotKit documentation for ${IDE_DOCS_CONFIGS[selectedIDE].displayName}...`);
|
|
554
|
+
await setupIDEDocs(selectedIDE, projectDir);
|
|
555
|
+
spinner.succeed(chalk3.green(`CopilotKit documentation configured for ${IDE_DOCS_CONFIGS[selectedIDE].displayName}`));
|
|
556
|
+
const instructions = getIDEInstructions(selectedIDE);
|
|
557
|
+
console.log("\n" + instructions.join("\n"));
|
|
558
|
+
} catch (error) {
|
|
559
|
+
spinner.fail(
|
|
560
|
+
chalk3.red(`Failed to setup IDE documentation: ${error instanceof Error ? error.message : "Unknown error"}`)
|
|
561
|
+
);
|
|
562
|
+
throw error;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
407
566
|
// src/lib/init/questions.ts
|
|
408
567
|
var linkToDocs = ["Mastra", "AG2", "LlamaIndex", "Agno"];
|
|
409
568
|
var validateUrl = (input) => {
|
|
@@ -554,6 +713,39 @@ var questions = [
|
|
|
554
713
|
when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No" || answers.mode === "Standard" && answers.useCopilotCloud !== "Yes" || answers.mode === "MCP" && answers.useCopilotCloud !== "Yes",
|
|
555
714
|
sensitive: true,
|
|
556
715
|
sanitize: sanitizers.apiKey
|
|
716
|
+
},
|
|
717
|
+
// IDE Documentation Setup Questions
|
|
718
|
+
{
|
|
719
|
+
type: "yes/no",
|
|
720
|
+
name: "setupIDEDocs",
|
|
721
|
+
message: "\u{1F4DA} Would you like to add CopilotKit documentation to your IDE? (Provides AI assistant with CopilotKit context)",
|
|
722
|
+
when: async () => {
|
|
723
|
+
const installedIDEs = await detectInstalledIDEs();
|
|
724
|
+
return installedIDEs.length > 0;
|
|
725
|
+
},
|
|
726
|
+
validate: (input) => {
|
|
727
|
+
try {
|
|
728
|
+
YesNoSchema.parse(input);
|
|
729
|
+
return true;
|
|
730
|
+
} catch (error) {
|
|
731
|
+
return "Please select Yes or No";
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
type: "select",
|
|
737
|
+
name: "selectedIDE",
|
|
738
|
+
message: "\u{1F4BB} Which IDE would you like to configure with CopilotKit documentation?",
|
|
739
|
+
choices: async () => {
|
|
740
|
+
const installedIDEs = await detectInstalledIDEs();
|
|
741
|
+
const choices = installedIDEs.map((ide) => ({
|
|
742
|
+
name: IDE_DOCS_CONFIGS[ide].displayName,
|
|
743
|
+
value: ide
|
|
744
|
+
}));
|
|
745
|
+
choices.push({ name: "Skip", value: "skip" });
|
|
746
|
+
return choices;
|
|
747
|
+
},
|
|
748
|
+
when: (answers) => answers.setupIDEDocs === "Yes"
|
|
557
749
|
}
|
|
558
750
|
];
|
|
559
751
|
|
|
@@ -619,8 +811,8 @@ async function scaffoldShadCN(flags, userAnswers) {
|
|
|
619
811
|
}
|
|
620
812
|
|
|
621
813
|
// src/lib/init/scaffold/env.ts
|
|
622
|
-
import
|
|
623
|
-
import
|
|
814
|
+
import path2 from "path";
|
|
815
|
+
import fs2 from "fs";
|
|
624
816
|
|
|
625
817
|
// src/lib/init/scaffold/langgraph-assistants.ts
|
|
626
818
|
async function getLangGraphAgents(url, langSmithApiKey) {
|
|
@@ -646,9 +838,9 @@ async function getLangGraphAgents(url, langSmithApiKey) {
|
|
|
646
838
|
import inquirer2 from "inquirer";
|
|
647
839
|
async function scaffoldEnv(flags, userAnswers) {
|
|
648
840
|
try {
|
|
649
|
-
const envFile =
|
|
650
|
-
if (!
|
|
651
|
-
|
|
841
|
+
const envFile = path2.join(process.cwd(), ".env");
|
|
842
|
+
if (!fs2.existsSync(envFile)) {
|
|
843
|
+
fs2.writeFileSync(envFile, "", "utf8");
|
|
652
844
|
} else {
|
|
653
845
|
}
|
|
654
846
|
let newEnvValues = "";
|
|
@@ -712,7 +904,7 @@ async function scaffoldEnv(flags, userAnswers) {
|
|
|
712
904
|
`;
|
|
713
905
|
}
|
|
714
906
|
if (newEnvValues) {
|
|
715
|
-
|
|
907
|
+
fs2.appendFileSync(envFile, newEnvValues);
|
|
716
908
|
}
|
|
717
909
|
} catch (error) {
|
|
718
910
|
throw error;
|
|
@@ -721,59 +913,59 @@ async function scaffoldEnv(flags, userAnswers) {
|
|
|
721
913
|
|
|
722
914
|
// src/lib/init/scaffold/github.ts
|
|
723
915
|
import { execSync } from "child_process";
|
|
724
|
-
import * as
|
|
725
|
-
import * as
|
|
916
|
+
import * as fs3 from "fs";
|
|
917
|
+
import * as path3 from "path";
|
|
726
918
|
import * as os from "os";
|
|
727
|
-
import
|
|
919
|
+
import chalk4 from "chalk";
|
|
728
920
|
async function cloneGitHubSubdirectory(githubUrl, destinationPath, spinner) {
|
|
729
921
|
try {
|
|
730
922
|
const { owner, repo, branch, subdirectoryPath } = parseGitHubUrl(githubUrl);
|
|
731
|
-
spinner.text =
|
|
923
|
+
spinner.text = chalk4.cyan(`Cloning from ${owner}/${repo}...`);
|
|
732
924
|
return await sparseCheckout(owner, repo, branch, subdirectoryPath, destinationPath, spinner);
|
|
733
925
|
} catch (error) {
|
|
734
|
-
spinner.text =
|
|
926
|
+
spinner.text = chalk4.red(`Failed to clone from GitHub: ${error}`);
|
|
735
927
|
return false;
|
|
736
928
|
}
|
|
737
929
|
}
|
|
738
930
|
async function sparseCheckout(owner, repo, branch, subdirectoryPath, destinationPath, spinner) {
|
|
739
|
-
const tempDir =
|
|
931
|
+
const tempDir = fs3.mkdtempSync(path3.join(os.tmpdir(), "copilotkit-sparse-"));
|
|
740
932
|
try {
|
|
741
|
-
spinner.text =
|
|
933
|
+
spinner.text = chalk4.cyan("Creating temporary workspace...");
|
|
742
934
|
execSync("git init", { cwd: tempDir, stdio: "pipe" });
|
|
743
|
-
spinner.text =
|
|
935
|
+
spinner.text = chalk4.cyan("Connecting to repository...");
|
|
744
936
|
execSync(`git remote add origin https://github.com/${owner}/${repo}.git`, { cwd: tempDir, stdio: "pipe" });
|
|
745
937
|
execSync("git config core.sparseCheckout true", { cwd: tempDir, stdio: "pipe" });
|
|
746
|
-
|
|
747
|
-
spinner.text =
|
|
938
|
+
fs3.writeFileSync(path3.join(tempDir, ".git/info/sparse-checkout"), subdirectoryPath);
|
|
939
|
+
spinner.text = chalk4.cyan("Downloading agent files...");
|
|
748
940
|
execSync(`git pull origin ${branch} --depth=1`, { cwd: tempDir, stdio: "pipe" });
|
|
749
|
-
const sourcePath =
|
|
750
|
-
if (!
|
|
941
|
+
const sourcePath = path3.join(tempDir, subdirectoryPath);
|
|
942
|
+
if (!fs3.existsSync(sourcePath)) {
|
|
751
943
|
throw new Error(`Subdirectory '${subdirectoryPath}' not found in the repository.`);
|
|
752
944
|
}
|
|
753
|
-
|
|
754
|
-
spinner.text =
|
|
945
|
+
fs3.mkdirSync(destinationPath, { recursive: true });
|
|
946
|
+
spinner.text = chalk4.cyan("Installing agent files...");
|
|
755
947
|
await copyDirectoryAsync(sourcePath, destinationPath);
|
|
756
948
|
return true;
|
|
757
949
|
} finally {
|
|
758
950
|
try {
|
|
759
|
-
|
|
951
|
+
fs3.rmSync(tempDir, { recursive: true, force: true });
|
|
760
952
|
} catch (error) {
|
|
761
953
|
console.warn(`Failed to clean up temporary directory: ${error}`);
|
|
762
954
|
}
|
|
763
955
|
}
|
|
764
956
|
}
|
|
765
957
|
async function copyDirectoryAsync(source, destination) {
|
|
766
|
-
if (!
|
|
767
|
-
|
|
958
|
+
if (!fs3.existsSync(destination)) {
|
|
959
|
+
fs3.mkdirSync(destination, { recursive: true });
|
|
768
960
|
}
|
|
769
|
-
const entries =
|
|
961
|
+
const entries = fs3.readdirSync(source, { withFileTypes: true });
|
|
770
962
|
for (const entry of entries) {
|
|
771
|
-
const srcPath =
|
|
772
|
-
const destPath =
|
|
963
|
+
const srcPath = path3.join(source, entry.name);
|
|
964
|
+
const destPath = path3.join(destination, entry.name);
|
|
773
965
|
if (entry.isDirectory()) {
|
|
774
966
|
await copyDirectoryAsync(srcPath, destPath);
|
|
775
967
|
} else {
|
|
776
|
-
|
|
968
|
+
fs3.copyFileSync(srcPath, destPath);
|
|
777
969
|
}
|
|
778
970
|
if (entries.length > 10) {
|
|
779
971
|
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
@@ -802,20 +994,20 @@ function parseGitHubUrl(githubUrl) {
|
|
|
802
994
|
|
|
803
995
|
// src/lib/init/scaffold/packages.ts
|
|
804
996
|
import spawn2 from "cross-spawn";
|
|
805
|
-
import
|
|
997
|
+
import chalk5 from "chalk";
|
|
806
998
|
import ora2 from "ora";
|
|
807
999
|
|
|
808
1000
|
// src/lib/init/scaffold/agent.ts
|
|
809
1001
|
import ora3 from "ora";
|
|
810
|
-
import
|
|
811
|
-
import
|
|
812
|
-
import
|
|
1002
|
+
import chalk6 from "chalk";
|
|
1003
|
+
import path4 from "path";
|
|
1004
|
+
import fs4 from "fs";
|
|
813
1005
|
async function scaffoldAgent(userAnswers) {
|
|
814
1006
|
if (userAnswers.mode === "CrewAI" || userAnswers.mode === "LangGraph" && !userAnswers.langGraphAgent || userAnswers.mode === "Standard" || userAnswers.mode === "MCP") {
|
|
815
1007
|
return;
|
|
816
1008
|
}
|
|
817
1009
|
const spinner = ora3({
|
|
818
|
-
text:
|
|
1010
|
+
text: chalk6.cyan("Setting up AI agent..."),
|
|
819
1011
|
color: "cyan"
|
|
820
1012
|
}).start();
|
|
821
1013
|
let template = "";
|
|
@@ -829,13 +1021,13 @@ async function scaffoldAgent(userAnswers) {
|
|
|
829
1021
|
break;
|
|
830
1022
|
}
|
|
831
1023
|
if (!template) {
|
|
832
|
-
spinner.fail(
|
|
1024
|
+
spinner.fail(chalk6.red("Failed to determine agent template"));
|
|
833
1025
|
throw new Error("Failed to determine agent template");
|
|
834
1026
|
}
|
|
835
|
-
const agentDir =
|
|
1027
|
+
const agentDir = path4.join(process.cwd(), "agent");
|
|
836
1028
|
try {
|
|
837
1029
|
await cloneGitHubSubdirectory(template, agentDir, spinner);
|
|
838
|
-
spinner.text =
|
|
1030
|
+
spinner.text = chalk6.cyan("Creating agent environment variables...");
|
|
839
1031
|
let envContent = "";
|
|
840
1032
|
if (userAnswers.llmToken) {
|
|
841
1033
|
envContent += `OPENAI_API_KEY=${userAnswers.llmToken}
|
|
@@ -846,26 +1038,26 @@ async function scaffoldAgent(userAnswers) {
|
|
|
846
1038
|
`;
|
|
847
1039
|
}
|
|
848
1040
|
if (envContent) {
|
|
849
|
-
const agentEnvFile =
|
|
850
|
-
|
|
851
|
-
spinner.text =
|
|
1041
|
+
const agentEnvFile = path4.join(agentDir, ".env");
|
|
1042
|
+
fs4.writeFileSync(agentEnvFile, envContent, "utf8");
|
|
1043
|
+
spinner.text = chalk6.cyan("Added API keys to agent .env file");
|
|
852
1044
|
}
|
|
853
1045
|
if (userAnswers.mode === "LangGraph" && userAnswers.langSmithApiKey) {
|
|
854
1046
|
envContent += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}
|
|
855
1047
|
`;
|
|
856
1048
|
}
|
|
857
1049
|
if (envContent) {
|
|
858
|
-
const agentEnvFile =
|
|
859
|
-
|
|
860
|
-
spinner.text =
|
|
1050
|
+
const agentEnvFile = path4.join(agentDir, ".env");
|
|
1051
|
+
fs4.writeFileSync(agentEnvFile, envContent, "utf8");
|
|
1052
|
+
spinner.text = chalk6.cyan("Added API keys to agent .env file");
|
|
861
1053
|
}
|
|
862
1054
|
if (envContent) {
|
|
863
|
-
const agentEnvFile =
|
|
864
|
-
|
|
865
|
-
spinner.text =
|
|
1055
|
+
const agentEnvFile = path4.join(agentDir, ".env");
|
|
1056
|
+
fs4.writeFileSync(agentEnvFile, envContent, "utf8");
|
|
1057
|
+
spinner.text = chalk6.cyan("Added API keys to agent .env file");
|
|
866
1058
|
}
|
|
867
1059
|
} catch (error) {
|
|
868
|
-
spinner.fail(
|
|
1060
|
+
spinner.fail(chalk6.red("Failed to clone agent template"));
|
|
869
1061
|
throw error;
|
|
870
1062
|
}
|
|
871
1063
|
spinner.succeed(`${userAnswers.mode} agent cloned successfully`);
|
|
@@ -885,29 +1077,29 @@ var AgentTemplates = {
|
|
|
885
1077
|
};
|
|
886
1078
|
|
|
887
1079
|
// src/lib/init/scaffold/crew-inputs.ts
|
|
888
|
-
import * as
|
|
1080
|
+
import * as fs5 from "fs/promises";
|
|
889
1081
|
import ora4 from "ora";
|
|
890
|
-
import * as
|
|
1082
|
+
import * as path5 from "path";
|
|
891
1083
|
async function addCrewInputs(url, token) {
|
|
892
1084
|
try {
|
|
893
1085
|
const spinner = ora4("Analyzing crew inputs...").start();
|
|
894
1086
|
const inputs = await getCrewInputs(url, token);
|
|
895
1087
|
spinner.text = "Adding inputs to app/copilotkit/page.tsx...";
|
|
896
|
-
let filePath =
|
|
1088
|
+
let filePath = path5.join(process.cwd(), "app", "copilotkit", "page.tsx");
|
|
897
1089
|
try {
|
|
898
|
-
await
|
|
1090
|
+
await fs5.access(filePath);
|
|
899
1091
|
} catch {
|
|
900
|
-
filePath =
|
|
1092
|
+
filePath = path5.join(process.cwd(), "src", "app", "copilotkit", "page.tsx");
|
|
901
1093
|
}
|
|
902
1094
|
try {
|
|
903
|
-
await
|
|
1095
|
+
await fs5.access(filePath);
|
|
904
1096
|
} catch {
|
|
905
1097
|
throw new Error("app/copilotkit/page.tsx and src/app/copilotkit/page.tsx not found");
|
|
906
1098
|
}
|
|
907
|
-
let fileContent = await
|
|
1099
|
+
let fileContent = await fs5.readFile(filePath, "utf8");
|
|
908
1100
|
const inputsString = JSON.stringify(inputs);
|
|
909
1101
|
fileContent = fileContent.replace(/\[["']YOUR_INPUTS_HERE["']\]/g, inputsString);
|
|
910
|
-
await
|
|
1102
|
+
await fs5.writeFile(filePath, fileContent, "utf8");
|
|
911
1103
|
spinner.succeed("Successfully added crew inputs to app/copilotkit/page.tsx");
|
|
912
1104
|
} catch (error) {
|
|
913
1105
|
console.error("Error updating crew inputs:", error);
|
|
@@ -928,7 +1120,7 @@ async function getCrewInputs(url, token) {
|
|
|
928
1120
|
}
|
|
929
1121
|
|
|
930
1122
|
// src/commands/init.ts
|
|
931
|
-
import
|
|
1123
|
+
import chalk7 from "chalk";
|
|
932
1124
|
import ora5 from "ora";
|
|
933
1125
|
var CloudInit = class _CloudInit extends BaseCommand {
|
|
934
1126
|
constructor(argv, config, authService = new AuthService()) {
|
|
@@ -948,11 +1140,11 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
948
1140
|
async run() {
|
|
949
1141
|
const { flags } = await this.parse(_CloudInit);
|
|
950
1142
|
try {
|
|
951
|
-
this.log(
|
|
1143
|
+
this.log(chalk7.magenta("\n\u{1FA81} Welcome to CopilotKit"));
|
|
952
1144
|
if (flags.booth) {
|
|
953
|
-
this.log(
|
|
1145
|
+
this.log(chalk7.gray("Thanks for giving CopilotKit a try! Now, let's try to impress you \u{1F4AA}\n"));
|
|
954
1146
|
} else {
|
|
955
|
-
this.log(
|
|
1147
|
+
this.log(chalk7.gray("Let's power up your Next.js project with AI capabilities\n"));
|
|
956
1148
|
}
|
|
957
1149
|
this.validateProjectCompatibility(flags);
|
|
958
1150
|
let userAnswers;
|
|
@@ -962,19 +1154,19 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
962
1154
|
userAnswers = await this.getUserAnswers(flags);
|
|
963
1155
|
}
|
|
964
1156
|
if (userAnswers.mode === "Mastra") {
|
|
965
|
-
this.log(
|
|
1157
|
+
this.log(chalk7.magenta(`
|
|
966
1158
|
\u{1F517} Please go to https://docs.copilotkit.ai/mastra/quickstart to get started.`));
|
|
967
1159
|
process.exit(0);
|
|
968
1160
|
} else if (userAnswers.mode === "AG2") {
|
|
969
|
-
this.log(
|
|
1161
|
+
this.log(chalk7.magenta(`
|
|
970
1162
|
\u{1F517} Please go to https://docs.copilotkit.ai/ag2/quickstart to get started.`));
|
|
971
1163
|
process.exit(0);
|
|
972
1164
|
} else if (userAnswers.mode === "Agno") {
|
|
973
|
-
this.log(
|
|
1165
|
+
this.log(chalk7.magenta(`
|
|
974
1166
|
\u{1F517} Please go to https://docs.copilotkit.ai/agno/quickstart to get started.`));
|
|
975
1167
|
process.exit(0);
|
|
976
1168
|
} else if (userAnswers.mode === "LlamaIndex") {
|
|
977
|
-
this.log(
|
|
1169
|
+
this.log(chalk7.magenta(`
|
|
978
1170
|
\u{1F517} Please go to https://docs.copilotkit.ai/llamaindex/quickstart to get started.`));
|
|
979
1171
|
process.exit(0);
|
|
980
1172
|
}
|
|
@@ -983,16 +1175,27 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
983
1175
|
await scaffoldEnv(flags, userAnswers);
|
|
984
1176
|
await scaffoldShadCN(flags, userAnswers);
|
|
985
1177
|
if (!flags.booth) await scaffoldAgent(userAnswers);
|
|
986
|
-
if (userAnswers.
|
|
1178
|
+
if (userAnswers.crewUrl && userAnswers.crewBearerToken)
|
|
987
1179
|
await addCrewInputs(userAnswers.crewUrl, userAnswers.crewBearerToken);
|
|
1180
|
+
if (userAnswers.setupIDEDocs === "Yes" && userAnswers.selectedIDE !== "skip") {
|
|
1181
|
+
const ideDocsSpinner = ora5({
|
|
1182
|
+
text: "Setting up CopilotKit IDE documentation...",
|
|
1183
|
+
color: "cyan"
|
|
1184
|
+
}).start();
|
|
1185
|
+
try {
|
|
1186
|
+
await handleIDEDocsSetup(userAnswers.selectedIDE, flags.dir, ideDocsSpinner);
|
|
1187
|
+
} catch (error) {
|
|
1188
|
+
ideDocsSpinner.fail("IDE documentation setup failed, but you can configure it manually later");
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
988
1191
|
if (flags.booth) {
|
|
989
1192
|
this.log("\n-----\n");
|
|
990
|
-
this.log(
|
|
991
|
-
this.log(
|
|
992
|
-
this.log(` - Start the Next.js app: ${
|
|
993
|
-
this.log(` - Navigate to ${
|
|
1193
|
+
this.log(chalk7.magenta("\u{1F389} Your CopilotKit setup is complete! \u{1F389}\n"));
|
|
1194
|
+
this.log(chalk7.bold("\n\u{1F680} Next steps:"));
|
|
1195
|
+
this.log(` - Start the Next.js app: ${chalk7.gray("$")} ${chalk7.cyan("npm run dev")}`);
|
|
1196
|
+
this.log(` - Navigate to ${chalk7.blue("http://localhost:3000/copilotkit")}`);
|
|
994
1197
|
this.log(` - Talk to your agent.`);
|
|
995
|
-
this.log(
|
|
1198
|
+
this.log(chalk7.magenta("\nThanks for giving CopilotKit a try! \u{1FA81}\n"));
|
|
996
1199
|
} else {
|
|
997
1200
|
this.finalSummary(userAnswers);
|
|
998
1201
|
}
|
|
@@ -1035,7 +1238,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1035
1238
|
if (Object.keys(initialAnswers).length > 0) {
|
|
1036
1239
|
this.log("\nUsing the following values from provided flags:");
|
|
1037
1240
|
Object.entries(initialAnswers).forEach(([key, value]) => {
|
|
1038
|
-
this.log(` ${
|
|
1241
|
+
this.log(` ${chalk7.green(key)}: ${value}`);
|
|
1039
1242
|
});
|
|
1040
1243
|
this.log("");
|
|
1041
1244
|
}
|
|
@@ -1083,7 +1286,7 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1083
1286
|
this.log(
|
|
1084
1287
|
"\nCurrently the CLI only supports scaffolding LangGraph Platform agents. Use our quickstart guide to get started:\n"
|
|
1085
1288
|
);
|
|
1086
|
-
this.log(
|
|
1289
|
+
this.log(chalk7.blue("https://docs.copilotkit.ai/coagents/quickstart/langgraph"));
|
|
1087
1290
|
process.exit(0);
|
|
1088
1291
|
}
|
|
1089
1292
|
try {
|
|
@@ -1095,12 +1298,12 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1095
1298
|
const spinner = ora5({ text: "Validation failed...", color: "red" }).start();
|
|
1096
1299
|
if (error.errors) {
|
|
1097
1300
|
const formattedErrors = error.errors.map((err) => `- ${err.path.join(".")}: ${err.message}`).join("\n");
|
|
1098
|
-
spinner.fail(
|
|
1099
|
-
console.error(
|
|
1301
|
+
spinner.fail(chalk7.red("Configuration validation failed:"));
|
|
1302
|
+
console.error(chalk7.red(formattedErrors));
|
|
1100
1303
|
process.exit(1);
|
|
1101
1304
|
}
|
|
1102
|
-
spinner.fail(
|
|
1103
|
-
console.error(
|
|
1305
|
+
spinner.fail(chalk7.red("Unexpected validation error:"));
|
|
1306
|
+
console.error(chalk7.red(error.message || "Unknown error"));
|
|
1104
1307
|
process.exit(1);
|
|
1105
1308
|
}
|
|
1106
1309
|
}
|
|
@@ -1111,11 +1314,11 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1111
1314
|
let selectedProjectId;
|
|
1112
1315
|
if (flags.project) {
|
|
1113
1316
|
if (!availableProjects.some((project) => project.id === flags.project)) {
|
|
1114
|
-
this.log(
|
|
1317
|
+
this.log(chalk7.red(`\u{1F4C1} Project with ID ${flags.project} not found`));
|
|
1115
1318
|
process.exit(1);
|
|
1116
1319
|
}
|
|
1117
1320
|
selectedProjectId = flags.project;
|
|
1118
|
-
this.log(
|
|
1321
|
+
this.log(chalk7.green(`\u{1F4C1} Selected project ${selectedProjectId}`));
|
|
1119
1322
|
} else {
|
|
1120
1323
|
const { projectId } = await inquirer3.prompt([
|
|
1121
1324
|
{
|
|
@@ -1147,12 +1350,12 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1147
1350
|
const updatedConfig = ConfigSchema.parse(sanitizedConfig);
|
|
1148
1351
|
Object.assign(userAnswers, updatedConfig);
|
|
1149
1352
|
} catch (error) {
|
|
1150
|
-
this.log(
|
|
1353
|
+
this.log(chalk7.red(`Failed to update configuration with Copilot Cloud API key: ${error.message}`));
|
|
1151
1354
|
}
|
|
1152
1355
|
if (userAnswers.crewUrl && userAnswers.crewName && userAnswers.crewBearerToken) {
|
|
1153
1356
|
const isFlow = userAnswers.crewType === "Flows";
|
|
1154
1357
|
const crewSpinner = ora5({
|
|
1155
|
-
text:
|
|
1358
|
+
text: chalk7(`\u{1F465} Adding CrewAI ${isFlow ? "Flow" : "Crew"} to Copilot Cloud...`),
|
|
1156
1359
|
color: "cyan"
|
|
1157
1360
|
}).start();
|
|
1158
1361
|
try {
|
|
@@ -1168,22 +1371,22 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1168
1371
|
crewApiBearerToken: userAnswers.crewBearerToken
|
|
1169
1372
|
}
|
|
1170
1373
|
});
|
|
1171
|
-
crewSpinner.succeed(
|
|
1374
|
+
crewSpinner.succeed(chalk7(`\u{1F465} CrewAI ${isFlow ? "Flow" : "Crew"} added to Copilot Cloud`));
|
|
1172
1375
|
} catch (error) {
|
|
1173
|
-
crewSpinner.fail(
|
|
1376
|
+
crewSpinner.fail(chalk7(`\u{1F465} Failed to add CrewAI ${isFlow ? "Flow" : "Crew"} to Copilot Cloud`));
|
|
1174
1377
|
console.error(error);
|
|
1175
1378
|
process.exit(1);
|
|
1176
1379
|
}
|
|
1177
1380
|
}
|
|
1178
1381
|
if (userAnswers.mode === "LangGraph" && userAnswers.useCopilotCloud === "Yes" && userAnswers.alreadyDeployed === "Yes") {
|
|
1179
1382
|
const langGraphSpinner = ora5({
|
|
1180
|
-
text:
|
|
1383
|
+
text: chalk7("\u{1F99C}\u{1F517} Adding LangGraph to Copilot Cloud..."),
|
|
1181
1384
|
color: "cyan"
|
|
1182
1385
|
}).start();
|
|
1183
1386
|
if (userAnswers.langGraphPlatform === "Yes" && userAnswers.langGraphPlatformUrl) {
|
|
1184
1387
|
try {
|
|
1185
1388
|
if (!userAnswers.langSmithApiKey) {
|
|
1186
|
-
langGraphSpinner.fail(
|
|
1389
|
+
langGraphSpinner.fail(chalk7("\u{1F99C}\u{1F517} LangSmith API key not found. Please provide a valid LangSmith API key."));
|
|
1187
1390
|
process.exit(1);
|
|
1188
1391
|
}
|
|
1189
1392
|
await this.trpcClient.createLGCRemoteEndpoint.mutate({
|
|
@@ -1196,9 +1399,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1196
1399
|
agents: []
|
|
1197
1400
|
}
|
|
1198
1401
|
});
|
|
1199
|
-
langGraphSpinner.succeed(
|
|
1402
|
+
langGraphSpinner.succeed(chalk7("\u{1F99C}\u{1F517} LangGraph Cloud remote endpoint created"));
|
|
1200
1403
|
} catch (error) {
|
|
1201
|
-
langGraphSpinner.fail(
|
|
1404
|
+
langGraphSpinner.fail(chalk7("\u{1F99C}\u{1F517} Failed to create LangGraph Cloud remote endpoint. Please try again."));
|
|
1202
1405
|
process.exit(1);
|
|
1203
1406
|
}
|
|
1204
1407
|
} else if (userAnswers.langGraphRemoteEndpointURL) {
|
|
@@ -1212,9 +1415,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1212
1415
|
// Already sanitized
|
|
1213
1416
|
}
|
|
1214
1417
|
});
|
|
1215
|
-
langGraphSpinner.succeed(
|
|
1418
|
+
langGraphSpinner.succeed(chalk7("\u{1F99C}\u{1F517} LangGraph remote endpoint created"));
|
|
1216
1419
|
} catch (error) {
|
|
1217
|
-
langGraphSpinner.fail(
|
|
1420
|
+
langGraphSpinner.fail(chalk7("\u{1F99C}\u{1F517} Failed to create LangGraph remote endpoint. Please try again."));
|
|
1218
1421
|
process.exit(1);
|
|
1219
1422
|
}
|
|
1220
1423
|
}
|
|
@@ -1223,17 +1426,17 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1223
1426
|
validateProjectCompatibility(flags) {
|
|
1224
1427
|
const spinner = ora5("Checking Next.js project compatibility...").start();
|
|
1225
1428
|
try {
|
|
1226
|
-
const projectPath =
|
|
1227
|
-
if (!
|
|
1429
|
+
const projectPath = path6.resolve(process.cwd(), flags.dir);
|
|
1430
|
+
if (!fs6.existsSync(projectPath)) {
|
|
1228
1431
|
spinner.fail(`Directory ${flags.dir} does not exist`);
|
|
1229
1432
|
throw new Error(`Please provide a valid Next.js project directory.`);
|
|
1230
1433
|
}
|
|
1231
|
-
const packageJsonPath =
|
|
1232
|
-
if (!
|
|
1434
|
+
const packageJsonPath = path6.join(projectPath, "package.json");
|
|
1435
|
+
if (!fs6.existsSync(packageJsonPath)) {
|
|
1233
1436
|
spinner.fail(`No package.json found in ${projectPath}`);
|
|
1234
1437
|
throw new Error(`Please provide a valid Next.js project with a package.json file.`);
|
|
1235
1438
|
}
|
|
1236
|
-
const packageJson = JSON.parse(
|
|
1439
|
+
const packageJson = JSON.parse(fs6.readFileSync(packageJsonPath, "utf8"));
|
|
1237
1440
|
if (!packageJson.dependencies?.next && !packageJson.devDependencies?.next) {
|
|
1238
1441
|
spinner.fail(`Not a Next.js project`);
|
|
1239
1442
|
throw new Error(
|
|
@@ -1244,9 +1447,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1244
1447
|
return true;
|
|
1245
1448
|
} catch (error) {
|
|
1246
1449
|
if (!spinner.isSpinning) {
|
|
1247
|
-
this.log(
|
|
1450
|
+
this.log(chalk7.red(error.message));
|
|
1248
1451
|
} else {
|
|
1249
|
-
spinner.fail(
|
|
1452
|
+
spinner.fail(chalk7.red(error.message));
|
|
1250
1453
|
}
|
|
1251
1454
|
process.exit(1);
|
|
1252
1455
|
}
|
|
@@ -1256,9 +1459,9 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1256
1459
|
let agentSetupMessage = "";
|
|
1257
1460
|
if (userAnswers.mode === "CrewAI") {
|
|
1258
1461
|
if (userAnswers.crewType === "Crews") {
|
|
1259
|
-
agentSetupMessage = `Using your Crew from ${
|
|
1462
|
+
agentSetupMessage = `Using your Crew from ${chalk7.cyan(userAnswers.crewUrl || "the provided URL")}.`;
|
|
1260
1463
|
} else if (userAnswers.crewType === "Flows") {
|
|
1261
|
-
agentSetupMessage = `We've scaffolded a ${
|
|
1464
|
+
agentSetupMessage = `We've scaffolded a ${chalk7.cyan("CrewAI Flow")} agent in the ${chalk7.cyan("./agent")} directory.`;
|
|
1262
1465
|
agentDevInstructions = "poetry lock && poetry install && poetry run demo";
|
|
1263
1466
|
}
|
|
1264
1467
|
}
|
|
@@ -1266,11 +1469,11 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1266
1469
|
case "LangGraph":
|
|
1267
1470
|
switch (userAnswers.langGraphAgent) {
|
|
1268
1471
|
case "Python Starter":
|
|
1269
|
-
agentSetupMessage = `We've scaffolded a ${
|
|
1472
|
+
agentSetupMessage = `We've scaffolded a ${chalk7.cyan(userAnswers.langGraphAgent || "LangGraph")} agent in the ${chalk7.cyan("./agent")} directory.`;
|
|
1270
1473
|
agentDevInstructions = "poetry lock && poetry install && npx @langchain/langgraph-cli dev --port 8123";
|
|
1271
1474
|
break;
|
|
1272
1475
|
case "TypeScript Starter":
|
|
1273
|
-
agentSetupMessage = `We've scaffolded a ${
|
|
1476
|
+
agentSetupMessage = `We've scaffolded a ${chalk7.cyan(userAnswers.langGraphAgent || "LangGraph")} agent in the ${chalk7.cyan("./agent")} directory.`;
|
|
1274
1477
|
agentDevInstructions = "npm install && npm run dev";
|
|
1275
1478
|
break;
|
|
1276
1479
|
default:
|
|
@@ -1280,29 +1483,32 @@ var CloudInit = class _CloudInit extends BaseCommand {
|
|
|
1280
1483
|
case "CrewAI":
|
|
1281
1484
|
switch (userAnswers.crewType) {
|
|
1282
1485
|
case "Crews":
|
|
1283
|
-
agentSetupMessage = `Using your Crew from ${
|
|
1486
|
+
agentSetupMessage = `Using your Crew from ${chalk7.cyan(userAnswers.crewUrl || "the provided URL")}.`;
|
|
1284
1487
|
break;
|
|
1285
1488
|
case "Flows":
|
|
1286
|
-
agentSetupMessage = `We've scaffolded a ${
|
|
1489
|
+
agentSetupMessage = `We've scaffolded a ${chalk7.cyan("CrewAI Flow")} agent in the ${chalk7.cyan("./agent")} directory.`;
|
|
1287
1490
|
break;
|
|
1288
1491
|
}
|
|
1289
1492
|
break;
|
|
1290
1493
|
default:
|
|
1291
1494
|
}
|
|
1292
1495
|
this.log("\n-----\n");
|
|
1293
|
-
this.log(
|
|
1294
|
-
this.log(
|
|
1496
|
+
this.log(chalk7.magenta("\u{1F389} Your CopilotKit setup is complete! \u{1F389}\n"));
|
|
1497
|
+
this.log(chalk7.bold(`\u{1F4CB} Recap`));
|
|
1295
1498
|
this.log(` - CopilotKit has been added to your Next.js app.`);
|
|
1296
1499
|
if (agentSetupMessage) this.log(` - ${agentSetupMessage}`);
|
|
1297
1500
|
if (userAnswers.useCopilotCloud || userAnswers.crewType === "Crews") this.log(` - With Copilot Cloud.`);
|
|
1298
|
-
this.log(
|
|
1299
|
-
this.log(` - Start your Next.js app: ${
|
|
1501
|
+
this.log(chalk7.bold("\n\u{1F680} Next steps:"));
|
|
1502
|
+
this.log(` - Start your Next.js app: ${chalk7.gray("$")} ${chalk7.cyan("npm run dev")}`);
|
|
1300
1503
|
if (agentDevInstructions)
|
|
1301
|
-
this.log(` - Start your agent: ${
|
|
1302
|
-
this.log(` - Navigate to ${
|
|
1504
|
+
this.log(` - Start your agent: ${chalk7.gray("$")} ${chalk7.cyan(`cd agent && ${agentDevInstructions}`)}`);
|
|
1505
|
+
this.log(` - Navigate to ${chalk7.blue("http://localhost:3000/copilotkit")}`);
|
|
1303
1506
|
this.log(` - Talk to your agent.`);
|
|
1304
|
-
|
|
1305
|
-
|
|
1507
|
+
if (userAnswers.setupIDEDocs === "Yes" && userAnswers.selectedIDE !== "skip") {
|
|
1508
|
+
this.log(` - Your IDE now has CopilotKit documentation context for better AI assistance.`);
|
|
1509
|
+
}
|
|
1510
|
+
this.log(` - Read the docs: ${chalk7.blue("https://docs.copilotkit.ai")}`);
|
|
1511
|
+
this.log(chalk7.magenta("\nEnjoy building with CopilotKit \u{1FA81}\n"));
|
|
1306
1512
|
}
|
|
1307
1513
|
};
|
|
1308
1514
|
export {
|