copilotkit 0.0.0-main-20260402184302
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/LICENSE +21 -0
- package/README.md +83 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +8 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +17 -0
- package/dist/commands/base-command.d.ts +12 -0
- package/dist/commands/base-command.js +65 -0
- package/dist/commands/base-command.js.map +1 -0
- package/dist/commands/create.d.ts +24 -0
- package/dist/commands/create.js +507 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +25 -0
- package/dist/commands/dev.js +776 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/init.d.ts +11 -0
- package/dist/commands/init.js +523 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts +13 -0
- package/dist/commands/login.js +374 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +13 -0
- package/dist/commands/logout.js +375 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/init/ide-docs.d.ts +25 -0
- package/dist/lib/init/ide-docs.js +170 -0
- package/dist/lib/init/ide-docs.js.map +1 -0
- package/dist/lib/init/index.d.ts +14 -0
- package/dist/lib/init/index.js +1104 -0
- package/dist/lib/init/index.js.map +1 -0
- package/dist/lib/init/questions.d.ts +9 -0
- package/dist/lib/init/questions.js +508 -0
- package/dist/lib/init/questions.js.map +1 -0
- package/dist/lib/init/scaffold/agent.d.ts +20 -0
- package/dist/lib/init/scaffold/agent.js +173 -0
- package/dist/lib/init/scaffold/agent.js.map +1 -0
- package/dist/lib/init/scaffold/crew-inputs.d.ts +3 -0
- package/dist/lib/init/scaffold/crew-inputs.js +59 -0
- package/dist/lib/init/scaffold/crew-inputs.js.map +1 -0
- package/dist/lib/init/scaffold/env.d.ts +7 -0
- package/dist/lib/init/scaffold/env.js +124 -0
- package/dist/lib/init/scaffold/env.js.map +1 -0
- package/dist/lib/init/scaffold/github.d.ts +17 -0
- package/dist/lib/init/scaffold/github.js +114 -0
- package/dist/lib/init/scaffold/github.js.map +1 -0
- package/dist/lib/init/scaffold/index.d.ts +10 -0
- package/dist/lib/init/scaffold/index.js +690 -0
- package/dist/lib/init/scaffold/index.js.map +1 -0
- package/dist/lib/init/scaffold/langgraph-assistants.d.ts +18 -0
- package/dist/lib/init/scaffold/langgraph-assistants.js +26 -0
- package/dist/lib/init/scaffold/langgraph-assistants.js.map +1 -0
- package/dist/lib/init/scaffold/packages.d.ts +7 -0
- package/dist/lib/init/scaffold/packages.js +62 -0
- package/dist/lib/init/scaffold/packages.js.map +1 -0
- package/dist/lib/init/scaffold/shadcn.d.ts +7 -0
- package/dist/lib/init/scaffold/shadcn.js +279 -0
- package/dist/lib/init/scaffold/shadcn.js.map +1 -0
- package/dist/lib/init/types/index.d.ts +4 -0
- package/dist/lib/init/types/index.js +238 -0
- package/dist/lib/init/types/index.js.map +1 -0
- package/dist/lib/init/types/questions.d.ts +209 -0
- package/dist/lib/init/types/questions.js +214 -0
- package/dist/lib/init/types/questions.js.map +1 -0
- package/dist/lib/init/types/templates.d.ts +17 -0
- package/dist/lib/init/types/templates.js +26 -0
- package/dist/lib/init/types/templates.js.map +1 -0
- package/dist/lib/init/utils.d.ts +3 -0
- package/dist/lib/init/utils.js +8 -0
- package/dist/lib/init/utils.js.map +1 -0
- package/dist/services/analytics.service.d.ts +38 -0
- package/dist/services/analytics.service.js +134 -0
- package/dist/services/analytics.service.js.map +1 -0
- package/dist/services/auth.service.d.ts +26 -0
- package/dist/services/auth.service.js +299 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/events.d.ts +119 -0
- package/dist/services/events.js +1 -0
- package/dist/services/events.js.map +1 -0
- package/dist/services/tunnel.service.d.ts +15 -0
- package/dist/services/tunnel.service.js +21 -0
- package/dist/services/tunnel.service.js.map +1 -0
- package/dist/utils/detect-endpoint-type.utils.d.ts +15 -0
- package/dist/utils/detect-endpoint-type.utils.js +157 -0
- package/dist/utils/detect-endpoint-type.utils.js.map +1 -0
- package/dist/utils/trpc.d.ts +4 -0
- package/dist/utils/trpc.js +25 -0
- package/dist/utils/trpc.js.map +1 -0
- package/dist/utils/version.d.ts +3 -0
- package/dist/utils/version.js +6 -0
- package/dist/utils/version.js.map +1 -0
- package/oclif.manifest.json +208 -0
- package/package.json +113 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
// src/commands/create.ts
|
|
2
|
+
import { Flags, Args } from "@oclif/core";
|
|
3
|
+
import inquirer from "inquirer";
|
|
4
|
+
import chalk3 from "chalk";
|
|
5
|
+
import fs2 from "fs-extra";
|
|
6
|
+
import path2 from "path";
|
|
7
|
+
import { promisify } from "util";
|
|
8
|
+
import { pipeline } from "stream";
|
|
9
|
+
import { createWriteStream } from "fs";
|
|
10
|
+
import { extract } from "tar";
|
|
11
|
+
import ora from "ora";
|
|
12
|
+
|
|
13
|
+
// src/commands/base-command.ts
|
|
14
|
+
import { Command } from "@oclif/core";
|
|
15
|
+
import Sentry, { consoleIntegration } from "@sentry/node";
|
|
16
|
+
|
|
17
|
+
// src/utils/version.ts
|
|
18
|
+
var LIB_VERSION = "0.0.0-main-20260402184302";
|
|
19
|
+
|
|
20
|
+
// src/utils/trpc.ts
|
|
21
|
+
import { createTRPCClient as trpcClient, httpBatchLink } from "@trpc/client";
|
|
22
|
+
import superjson from "superjson";
|
|
23
|
+
var COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || "https://cloud.copilotkit.ai";
|
|
24
|
+
|
|
25
|
+
// src/commands/base-command.ts
|
|
26
|
+
import chalk from "chalk";
|
|
27
|
+
var BaseCommand = class extends Command {
|
|
28
|
+
async init() {
|
|
29
|
+
await this.checkCLIVersion();
|
|
30
|
+
if (process.env.SENTRY_DISABLED === "true") {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
Sentry.init({
|
|
34
|
+
dsn: process.env.SENTRY_DSN || "https://1eea15d32e2eacb0456a77db5e39aeeb@o4507288195170304.ingest.us.sentry.io/4508581448581120",
|
|
35
|
+
integrations: [consoleIntegration()],
|
|
36
|
+
// Tracing
|
|
37
|
+
tracesSampleRate: 1
|
|
38
|
+
// Capture 100% of the transactions
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async catch(err) {
|
|
42
|
+
if (process.env.SENTRY_DISABLED !== "true") {
|
|
43
|
+
Sentry.captureException(err);
|
|
44
|
+
}
|
|
45
|
+
const message = err?.message ?? "Unknown error";
|
|
46
|
+
this.log("\n" + chalk.red(message) + "\n");
|
|
47
|
+
const exitCode = err?.oclif?.exit ?? 1;
|
|
48
|
+
this.exit(exitCode);
|
|
49
|
+
}
|
|
50
|
+
async finally() {
|
|
51
|
+
if (process.env.SENTRY_DISABLED === "true") {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
Sentry.close();
|
|
55
|
+
}
|
|
56
|
+
async run() {
|
|
57
|
+
}
|
|
58
|
+
async checkCLIVersion() {
|
|
59
|
+
try {
|
|
60
|
+
const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`);
|
|
61
|
+
const data = await response.json();
|
|
62
|
+
const cloudVersion = data.cliVersion;
|
|
63
|
+
if (!cloudVersion || cloudVersion === LIB_VERSION) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async gracefulError(message) {
|
|
70
|
+
this.log("\n" + chalk.red(message));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/lib/init/scaffold/github.ts
|
|
76
|
+
import { execSync } from "child_process";
|
|
77
|
+
import * as fs from "fs";
|
|
78
|
+
import * as path from "path";
|
|
79
|
+
import * as os from "os";
|
|
80
|
+
import chalk2 from "chalk";
|
|
81
|
+
async function cloneGitHubSubdirectory(githubUrl, destinationPath, spinner) {
|
|
82
|
+
try {
|
|
83
|
+
const { owner, repo, branch, subdirectoryPath } = parseGitHubUrl(githubUrl);
|
|
84
|
+
spinner.text = chalk2.cyan(`Cloning from ${owner}/${repo}...`);
|
|
85
|
+
return await sparseCheckout(
|
|
86
|
+
owner,
|
|
87
|
+
repo,
|
|
88
|
+
branch,
|
|
89
|
+
subdirectoryPath,
|
|
90
|
+
destinationPath,
|
|
91
|
+
spinner
|
|
92
|
+
);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
spinner.text = chalk2.red(`Failed to clone from GitHub: ${error}`);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function sparseCheckout(owner, repo, branch, subdirectoryPath, destinationPath, spinner) {
|
|
99
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "copilotkit-sparse-"));
|
|
100
|
+
try {
|
|
101
|
+
spinner.text = chalk2.cyan("Creating temporary workspace...");
|
|
102
|
+
execSync("git init", { cwd: tempDir, stdio: "pipe" });
|
|
103
|
+
spinner.text = chalk2.cyan("Connecting to repository...");
|
|
104
|
+
execSync(`git remote add origin https://github.com/${owner}/${repo}.git`, {
|
|
105
|
+
cwd: tempDir,
|
|
106
|
+
stdio: "pipe"
|
|
107
|
+
});
|
|
108
|
+
execSync("git config core.sparseCheckout true", {
|
|
109
|
+
cwd: tempDir,
|
|
110
|
+
stdio: "pipe"
|
|
111
|
+
});
|
|
112
|
+
fs.writeFileSync(
|
|
113
|
+
path.join(tempDir, ".git/info/sparse-checkout"),
|
|
114
|
+
subdirectoryPath
|
|
115
|
+
);
|
|
116
|
+
spinner.text = chalk2.cyan("Downloading agent files...");
|
|
117
|
+
execSync(`git pull origin ${branch} --depth=1`, {
|
|
118
|
+
cwd: tempDir,
|
|
119
|
+
stdio: "pipe"
|
|
120
|
+
});
|
|
121
|
+
const sourcePath = path.join(tempDir, subdirectoryPath);
|
|
122
|
+
if (!fs.existsSync(sourcePath)) {
|
|
123
|
+
throw new Error(
|
|
124
|
+
`Subdirectory '${subdirectoryPath}' not found in the repository.`
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
fs.mkdirSync(destinationPath, { recursive: true });
|
|
128
|
+
spinner.text = chalk2.cyan("Installing agent files...");
|
|
129
|
+
await copyDirectoryAsync(sourcePath, destinationPath);
|
|
130
|
+
return true;
|
|
131
|
+
} finally {
|
|
132
|
+
try {
|
|
133
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.warn(`Failed to clean up temporary directory: ${error}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async function copyDirectoryAsync(source, destination) {
|
|
140
|
+
if (!fs.existsSync(destination)) {
|
|
141
|
+
fs.mkdirSync(destination, { recursive: true });
|
|
142
|
+
}
|
|
143
|
+
const entries = fs.readdirSync(source, { withFileTypes: true });
|
|
144
|
+
for (const entry of entries) {
|
|
145
|
+
const srcPath = path.join(source, entry.name);
|
|
146
|
+
const destPath = path.join(destination, entry.name);
|
|
147
|
+
if (entry.isDirectory()) {
|
|
148
|
+
await copyDirectoryAsync(srcPath, destPath);
|
|
149
|
+
} else {
|
|
150
|
+
fs.copyFileSync(srcPath, destPath);
|
|
151
|
+
}
|
|
152
|
+
if (entries.length > 10) {
|
|
153
|
+
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function parseGitHubUrl(githubUrl) {
|
|
158
|
+
const url = new URL(githubUrl);
|
|
159
|
+
if (url.hostname !== "github.com") {
|
|
160
|
+
throw new Error("Only GitHub URLs are supported");
|
|
161
|
+
}
|
|
162
|
+
const pathParts = url.pathname.split("/").filter(Boolean);
|
|
163
|
+
if (pathParts.length < 2) {
|
|
164
|
+
throw new Error("Invalid GitHub URL format");
|
|
165
|
+
}
|
|
166
|
+
const owner = pathParts[0];
|
|
167
|
+
const repo = pathParts[1];
|
|
168
|
+
let branch = "main";
|
|
169
|
+
let subdirectoryPath = "";
|
|
170
|
+
if (pathParts.length > 3 && (pathParts[2] === "tree" || pathParts[2] === "blob")) {
|
|
171
|
+
branch = pathParts[3];
|
|
172
|
+
subdirectoryPath = pathParts.slice(4).join("/");
|
|
173
|
+
}
|
|
174
|
+
return { owner, repo, branch, subdirectoryPath };
|
|
175
|
+
}
|
|
176
|
+
function isValidGitHubUrl(url) {
|
|
177
|
+
try {
|
|
178
|
+
const parsedUrl = new URL(url);
|
|
179
|
+
return parsedUrl.hostname === "github.com" && parsedUrl.pathname.split("/").filter(Boolean).length >= 2;
|
|
180
|
+
} catch {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// src/commands/create.ts
|
|
186
|
+
var streamPipeline = promisify(pipeline);
|
|
187
|
+
var theme = {
|
|
188
|
+
primary: chalk3.magenta,
|
|
189
|
+
secondary: chalk3.gray,
|
|
190
|
+
tertiary: chalk3.gray,
|
|
191
|
+
error: chalk3.red,
|
|
192
|
+
command: chalk3.blue,
|
|
193
|
+
success: chalk3.green,
|
|
194
|
+
warning: chalk3.yellow,
|
|
195
|
+
divider: chalk3.gray("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),
|
|
196
|
+
bottomPadding: ""
|
|
197
|
+
};
|
|
198
|
+
var TEMPLATE_REPOS = {
|
|
199
|
+
"langgraph-py": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-python",
|
|
200
|
+
"langgraph-js": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-js",
|
|
201
|
+
mastra: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/mastra",
|
|
202
|
+
flows: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/crewai-flows",
|
|
203
|
+
llamaindex: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/llamaindex",
|
|
204
|
+
agno: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/agno",
|
|
205
|
+
"pydantic-ai": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/pydantic-ai",
|
|
206
|
+
ag2: "ag2ai/ag2-copilotkit-starter",
|
|
207
|
+
adk: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/adk",
|
|
208
|
+
"aws-strands-py": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/strands-python",
|
|
209
|
+
a2a: "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/a2a-middleware",
|
|
210
|
+
"microsoft-agent-framework-dotnet": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/ms-agent-framework-dotnet",
|
|
211
|
+
"microsoft-agent-framework-py": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/ms-agent-framework-python",
|
|
212
|
+
"mcp-apps": "https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/mcp-apps"
|
|
213
|
+
};
|
|
214
|
+
var FRAMEWORK_DOCUMENTATION = {
|
|
215
|
+
"langgraph-py": "https://langchain-ai.github.io/langgraph/concepts/why-langgraph",
|
|
216
|
+
"langgraph-js": "https://langchain-ai.github.io/langgraphjs",
|
|
217
|
+
flows: "https://docs.crewai.com/guides/flows/first-flow",
|
|
218
|
+
mastra: "https://mastra.ai/en/docs",
|
|
219
|
+
"pydantic-ai": "https://ai.pydantic.dev/ag-ui/",
|
|
220
|
+
llamaindex: "https://docs.llamaindex.ai/en/stable",
|
|
221
|
+
agno: "https://docs.agno.com/",
|
|
222
|
+
ag2: "https://docs.ag2.ai/latest/docs/user-guide/basic-concepts/overview",
|
|
223
|
+
adk: "https://google.github.io/adk-docs/",
|
|
224
|
+
"aws-strands-py": "https://strandsagents.com/latest/documentation/docs/",
|
|
225
|
+
a2a: "https://a2a-protocol.org/latest/",
|
|
226
|
+
"microsoft-agent-framework-dotnet": "https://learn.microsoft.com/en-us/agent-framework/",
|
|
227
|
+
"microsoft-agent-framework-py": "https://learn.microsoft.com/en-us/agent-framework/",
|
|
228
|
+
"mcp-apps": "https://modelcontextprotocol.github.io/ext-apps"
|
|
229
|
+
};
|
|
230
|
+
var FRAMEWORK_EMOJI = {
|
|
231
|
+
"langgraph-js": "\u{1F99C}",
|
|
232
|
+
"langgraph-py": "\u{1F99C}",
|
|
233
|
+
flows: "\u{1F465}",
|
|
234
|
+
mastra: "\u{1F311}",
|
|
235
|
+
"pydantic-ai": "\u{1F53C}",
|
|
236
|
+
llamaindex: "\u{1F999}",
|
|
237
|
+
ag2: "\u{1F916}",
|
|
238
|
+
agno: "\u{1F170}\uFE0F",
|
|
239
|
+
adk: "\u{1F916}",
|
|
240
|
+
a2a: "\u{1F916}",
|
|
241
|
+
"aws-strands-py": "\u{1F9EC}",
|
|
242
|
+
"microsoft-agent-framework-dotnet": "\u{1F7E6}",
|
|
243
|
+
"microsoft-agent-framework-py": "\u{1F7E6}",
|
|
244
|
+
"mcp-apps": "\u264D"
|
|
245
|
+
};
|
|
246
|
+
var KITE = `
|
|
247
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
248
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u281F\u2819\u28FF\u285B\u283B\u283F\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
249
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u280B\u2800\u2800\u2808\u28BF\u2844\u2800\u2800\u2800\u2808\u2809\u2819\u28FB\u28FF\u28FF\u28FF
|
|
250
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u281F\u2801\u2800\u2800\u2800\u2800\u2808\u28BF\u2844\u2800\u2880\u28E0\u28F4\u283E\u280B\u28B8\u28FF\u28FF
|
|
251
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u285F\u2801\u2880\u28C0\u28C0\u28C0\u28C0\u28E4\u28E4\u287E\u28BF\u285F\u281B\u2809\u2800\u2800\u2800\u2800\u28FF\u28FF
|
|
252
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u285B\u281B\u281B\u281B\u2809\u2809\u2809\u2801\u2800\u28A0\u287F\u28FF\u2840\u2800\u2800\u2800\u2800\u2800\u28FF\u28FF
|
|
253
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28C6\u2800\u2800\u2800\u2800\u2800\u2800\u28F0\u285F\u2800\u2838\u28E7\u2800\u2800\u2800\u2800\u28A0\u28FF\u28FF
|
|
254
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28F7\u28C4\u2800\u2800\u2880\u28FC\u280F\u2800\u2800\u2800\u28FF\u2840\u2800\u2800\u2800\u28B8\u28FF\u28FF
|
|
255
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u2802\u28E0\u287F\u2801\u2800\u2800\u2800\u2800\u28B8\u2847\u2800\u2800\u2800\u28FF\u28FF\u28FF
|
|
256
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u281F\u28E1\u28FE\u28FF\u28C4\u2800\u2800\u2800\u2800\u2800\u28B8\u2847\u2800\u2800\u28B0\u28FF\u28FF\u28FF
|
|
257
|
+
\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u285F\u281B\u287F\u280B\u28E1\u28FE\u28FF\u28FF\u28FF\u28FF\u28E6\u2840\u2800\u2800\u2800\u28B8\u2847\u2800\u2800\u28FF\u28FF\u28FF\u28FF
|
|
258
|
+
\u28FF\u28FF\u28FF\u28FF\u287F\u283F\u28FF\u2837\u2802\u2840\u2818\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28F7\u2840\u2800\u2800\u28B8\u2847\u2800\u28FC\u28FF\u28FF\u28FF\u28FF
|
|
259
|
+
\u28FF\u28FF\u283B\u28BF\u2877\u2800\u2801\u2834\u28FF\u28F7\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u2844\u2800\u28FE\u2807\u28F4\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
260
|
+
\u287F\u281B\u2800\u2800\u28B4\u28FE\u28F7\u28F6\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28E4\u28FF\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
261
|
+
\u28F7\u28FE\u28FF\u28E4\u28FE\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF\u28FF
|
|
262
|
+
`;
|
|
263
|
+
var Create = class _Create extends BaseCommand {
|
|
264
|
+
static description = "Create a new CopilotKit project";
|
|
265
|
+
static examples = [
|
|
266
|
+
"$ copilotkit create my-app",
|
|
267
|
+
"$ copilotkit create my-app --framework langgraph-js",
|
|
268
|
+
"$ copilotkit create -n my-app -f langgraph-js"
|
|
269
|
+
];
|
|
270
|
+
static flags = {
|
|
271
|
+
...BaseCommand.flags,
|
|
272
|
+
framework: Flags.string({
|
|
273
|
+
char: "f",
|
|
274
|
+
description: "Agent framework to use",
|
|
275
|
+
options: Object.keys(TEMPLATE_REPOS),
|
|
276
|
+
required: false
|
|
277
|
+
}),
|
|
278
|
+
name: Flags.string({
|
|
279
|
+
char: "n",
|
|
280
|
+
description: "Name of the project",
|
|
281
|
+
required: false
|
|
282
|
+
}),
|
|
283
|
+
"no-banner": Flags.boolean({
|
|
284
|
+
char: "q",
|
|
285
|
+
description: "Removes the banner",
|
|
286
|
+
default: false,
|
|
287
|
+
required: false
|
|
288
|
+
}),
|
|
289
|
+
project: Flags.string({
|
|
290
|
+
description: "project ID (deprecated, kept for backwards compatibility)"
|
|
291
|
+
})
|
|
292
|
+
};
|
|
293
|
+
static args = {
|
|
294
|
+
projectName: Args.string({
|
|
295
|
+
description: "Name of the project",
|
|
296
|
+
required: false
|
|
297
|
+
})
|
|
298
|
+
};
|
|
299
|
+
constructor(argv, config) {
|
|
300
|
+
super(argv, config);
|
|
301
|
+
}
|
|
302
|
+
async run() {
|
|
303
|
+
const { args, flags } = await this.parse(_Create);
|
|
304
|
+
if (!flags["no-banner"]) {
|
|
305
|
+
this.log(theme.primary(KITE));
|
|
306
|
+
this.log(theme.primary("~ Welcome to CopilotKit! ~\n"));
|
|
307
|
+
this.log(theme.divider);
|
|
308
|
+
if (!flags.name && !args.projectName && !flags.framework) {
|
|
309
|
+
this.log(
|
|
310
|
+
"\n" + theme.secondary("Just a few questions to get started!\n")
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const projectNameInput = flags.name || args.projectName || await this.promptProjectName();
|
|
315
|
+
const projectName = projectNameInput.trim();
|
|
316
|
+
const usingCurrentDir = projectName === "." || projectName === "./";
|
|
317
|
+
const agentFramework = flags.framework || await this.promptAgentFramework();
|
|
318
|
+
const projectDir = usingCurrentDir ? process.cwd() : path2.resolve(process.cwd(), projectName);
|
|
319
|
+
if (usingCurrentDir) {
|
|
320
|
+
const allowedEntries = /* @__PURE__ */ new Set([".git", ".gitignore", ".DS_Store"]);
|
|
321
|
+
const existingEntries = await fs2.readdir(projectDir);
|
|
322
|
+
const blockingEntries = existingEntries.filter(
|
|
323
|
+
(entry) => !allowedEntries.has(entry)
|
|
324
|
+
);
|
|
325
|
+
if (blockingEntries.length > 0) {
|
|
326
|
+
this.log(theme.error("\nCurrent directory is not empty."));
|
|
327
|
+
this.log(
|
|
328
|
+
theme.secondary(
|
|
329
|
+
"\nPlease run create in an empty directory or specify a new project name."
|
|
330
|
+
)
|
|
331
|
+
);
|
|
332
|
+
this.exit(1);
|
|
333
|
+
}
|
|
334
|
+
} else if (await fs2.pathExists(projectDir)) {
|
|
335
|
+
this.log(theme.error(`
|
|
336
|
+
Directory "${projectName}" already exists.`));
|
|
337
|
+
this.log(theme.secondary("\nYou can:"));
|
|
338
|
+
this.log(theme.secondary(" 1. Choose a different project name"));
|
|
339
|
+
this.log(
|
|
340
|
+
theme.secondary(
|
|
341
|
+
" 2. Remove the existing directory manually if you want to use this name\n"
|
|
342
|
+
)
|
|
343
|
+
);
|
|
344
|
+
this.exit(1);
|
|
345
|
+
}
|
|
346
|
+
const options = {
|
|
347
|
+
projectName,
|
|
348
|
+
agentFramework
|
|
349
|
+
};
|
|
350
|
+
const spinner = ora({
|
|
351
|
+
text: theme.secondary.bold("Creating your project..."),
|
|
352
|
+
color: "cyan",
|
|
353
|
+
spinner: "dots"
|
|
354
|
+
}).start();
|
|
355
|
+
try {
|
|
356
|
+
await fs2.ensureDir(projectDir);
|
|
357
|
+
spinner.text = theme.secondary.bold("Downloading template...");
|
|
358
|
+
await this.downloadTemplate(projectDir, options.agentFramework, spinner);
|
|
359
|
+
const displayName = usingCurrentDir ? "current directory" : `"${projectName}"`;
|
|
360
|
+
spinner.succeed(
|
|
361
|
+
theme.secondary.bold(`Project ${displayName} created successfully!`)
|
|
362
|
+
);
|
|
363
|
+
} catch (error) {
|
|
364
|
+
spinner.fail(theme.error(`Failed to create project: ${error.message}`));
|
|
365
|
+
this.exit(1);
|
|
366
|
+
}
|
|
367
|
+
this.log("\n" + theme.divider);
|
|
368
|
+
this.log(
|
|
369
|
+
"\n" + theme.secondary.bold(
|
|
370
|
+
`\u{1FA81}\u{1F91D}${FRAMEWORK_EMOJI[options.agentFramework]} All set!
|
|
371
|
+
|
|
372
|
+
Your project is ready to explore CopilotKit locally.`
|
|
373
|
+
)
|
|
374
|
+
);
|
|
375
|
+
this.log("\n" + theme.secondary("Next steps:"));
|
|
376
|
+
if (usingCurrentDir) {
|
|
377
|
+
this.log(
|
|
378
|
+
theme.secondary(
|
|
379
|
+
" \u2022 You are already inside your new project directory"
|
|
380
|
+
)
|
|
381
|
+
);
|
|
382
|
+
} else {
|
|
383
|
+
this.log(theme.secondary(` \u2022 ${theme.command(`cd ${projectName}`)}`));
|
|
384
|
+
}
|
|
385
|
+
this.log(
|
|
386
|
+
theme.secondary(" \u2022 Follow the setup instructions in the README.md")
|
|
387
|
+
);
|
|
388
|
+
this.log("\n" + theme.secondary("Documentation:"));
|
|
389
|
+
this.log(
|
|
390
|
+
theme.secondary(" \u2022 ") + theme.command("https://docs.copilotkit.ai")
|
|
391
|
+
);
|
|
392
|
+
this.log(
|
|
393
|
+
theme.secondary(" \u2022 ") + theme.command(FRAMEWORK_DOCUMENTATION[options.agentFramework])
|
|
394
|
+
);
|
|
395
|
+
this.log(theme.bottomPadding);
|
|
396
|
+
}
|
|
397
|
+
async promptProjectName() {
|
|
398
|
+
const { projectName } = await inquirer.prompt([
|
|
399
|
+
{
|
|
400
|
+
type: "input",
|
|
401
|
+
name: "projectName",
|
|
402
|
+
message: theme.secondary("What is your project named?"),
|
|
403
|
+
validate: (input) => {
|
|
404
|
+
if (!input) return theme.error("Project name is required");
|
|
405
|
+
if (!/^[a-z0-9-]+$/.test(input)) {
|
|
406
|
+
return theme.error(
|
|
407
|
+
"Project name can only contain lowercase letters, numbers, and hyphens"
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
if (input.length > 30) {
|
|
411
|
+
return theme.error("Project name must be less than 30 characters");
|
|
412
|
+
}
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
]);
|
|
417
|
+
return projectName;
|
|
418
|
+
}
|
|
419
|
+
async promptAgentFramework() {
|
|
420
|
+
const { framework } = await inquirer.prompt([
|
|
421
|
+
{
|
|
422
|
+
type: "list",
|
|
423
|
+
name: "framework",
|
|
424
|
+
message: theme.secondary(
|
|
425
|
+
"Which agent framework would you like to use?"
|
|
426
|
+
),
|
|
427
|
+
choices: [
|
|
428
|
+
{
|
|
429
|
+
name: `${FRAMEWORK_EMOJI["langgraph-py"]} LangGraph (Python)`,
|
|
430
|
+
value: "langgraph-py"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
name: `${FRAMEWORK_EMOJI["langgraph-js"]} LangGraph (JavaScript)`,
|
|
434
|
+
value: "langgraph-js"
|
|
435
|
+
},
|
|
436
|
+
{ name: `${FRAMEWORK_EMOJI.mastra} Mastra`, value: "mastra" },
|
|
437
|
+
{
|
|
438
|
+
name: `${FRAMEWORK_EMOJI["pydantic-ai"]} Pydantic AI`,
|
|
439
|
+
value: "pydantic-ai"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
name: `${FRAMEWORK_EMOJI["aws-strands-py"]} AWS Strands (Python)`,
|
|
443
|
+
value: "aws-strands-py"
|
|
444
|
+
},
|
|
445
|
+
{ name: `${FRAMEWORK_EMOJI.adk} ADK`, value: "adk" },
|
|
446
|
+
{
|
|
447
|
+
name: `${FRAMEWORK_EMOJI["microsoft-agent-framework-dotnet"]} Microsoft Agent Framework (.NET)`,
|
|
448
|
+
value: "microsoft-agent-framework-dotnet"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
name: `${FRAMEWORK_EMOJI["microsoft-agent-framework-py"]} Microsoft Agent Framework (Python)`,
|
|
452
|
+
value: "microsoft-agent-framework-py"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: `${FRAMEWORK_EMOJI["mcp-apps"]} MCP Apps`,
|
|
456
|
+
value: "mcp-apps"
|
|
457
|
+
},
|
|
458
|
+
{ name: `${FRAMEWORK_EMOJI.flows} CrewAI Flows`, value: "flows" },
|
|
459
|
+
{
|
|
460
|
+
name: `${FRAMEWORK_EMOJI.llamaindex} LlamaIndex`,
|
|
461
|
+
value: "llamaindex"
|
|
462
|
+
},
|
|
463
|
+
{ name: `${FRAMEWORK_EMOJI.agno} Agno`, value: "agno" },
|
|
464
|
+
{ name: `${FRAMEWORK_EMOJI.ag2} AG2`, value: "ag2" },
|
|
465
|
+
{ name: `${FRAMEWORK_EMOJI.a2a} A2A`, value: "a2a" }
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
]);
|
|
469
|
+
return framework;
|
|
470
|
+
}
|
|
471
|
+
async downloadTemplate(projectDir, framework, spinner) {
|
|
472
|
+
const templateRef = TEMPLATE_REPOS[framework];
|
|
473
|
+
if (isValidGitHubUrl(templateRef)) {
|
|
474
|
+
const success = await cloneGitHubSubdirectory(
|
|
475
|
+
templateRef,
|
|
476
|
+
projectDir,
|
|
477
|
+
spinner
|
|
478
|
+
);
|
|
479
|
+
if (!success) {
|
|
480
|
+
throw new Error(`Failed to clone template from ${templateRef}`);
|
|
481
|
+
}
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const url = `https://github.com/${templateRef}/archive/refs/heads/main.tar.gz`;
|
|
485
|
+
try {
|
|
486
|
+
const response = await fetch(url);
|
|
487
|
+
if (!response.ok)
|
|
488
|
+
throw new Error(`Failed to download template: ${response.statusText}`);
|
|
489
|
+
const tempFile = path2.join(projectDir, "template.tar.gz");
|
|
490
|
+
const fileStream = createWriteStream(tempFile);
|
|
491
|
+
if (!response.body) throw new Error("Failed to get response body");
|
|
492
|
+
await streamPipeline(response.body, fileStream);
|
|
493
|
+
await extract({
|
|
494
|
+
file: tempFile,
|
|
495
|
+
cwd: projectDir,
|
|
496
|
+
strip: 1
|
|
497
|
+
});
|
|
498
|
+
await fs2.remove(tempFile);
|
|
499
|
+
} catch (error) {
|
|
500
|
+
throw new Error(`Failed to download template: ${error.message}`);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
export {
|
|
505
|
+
Create as default
|
|
506
|
+
};
|
|
507
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/create.ts","../../src/commands/base-command.ts","../../src/utils/version.ts","../../src/utils/trpc.ts","../../src/lib/init/scaffold/github.ts"],"sourcesContent":["import { Config, Flags, Args } from \"@oclif/core\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport { promisify } from \"util\";\nimport { pipeline } from \"stream\";\nimport { createWriteStream } from \"fs\";\nimport { extract } from \"tar\";\nimport ora, { Ora } from \"ora\";\n\nimport { BaseCommand } from \"./base-command.js\";\nimport {\n cloneGitHubSubdirectory,\n isValidGitHubUrl,\n} from \"../lib/init/scaffold/github.js\";\n\nconst streamPipeline = promisify(pipeline);\n\nconst theme = {\n primary: chalk.magenta,\n secondary: chalk.gray,\n tertiary: chalk.gray,\n error: chalk.red,\n command: chalk.blue,\n success: chalk.green,\n warning: chalk.yellow,\n divider: chalk.gray(\"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\"),\n bottomPadding: \"\",\n};\n\ninterface CreateOptions {\n projectName: string;\n agentFramework: AgentFramework;\n}\n\ntype AgentFramework =\n | \"langgraph-py\"\n | \"langgraph-js\"\n | \"flows\"\n | \"mastra\"\n | \"pydantic-ai\"\n | \"llamaindex\"\n | \"agno\"\n | \"ag2\"\n | \"adk\"\n | \"aws-strands-py\"\n | \"a2a\"\n | \"microsoft-agent-framework-dotnet\"\n | \"microsoft-agent-framework-py\"\n | \"mcp-apps\";\n\nconst TEMPLATE_REPOS: Record<AgentFramework, string> = {\n \"langgraph-py\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-python\",\n \"langgraph-js\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/langgraph-js\",\n mastra:\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/mastra\",\n flows:\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/crewai-flows\",\n llamaindex:\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/llamaindex\",\n agno: \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/agno\",\n \"pydantic-ai\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/pydantic-ai\",\n ag2: \"ag2ai/ag2-copilotkit-starter\",\n adk: \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/adk\",\n \"aws-strands-py\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/strands-python\",\n a2a: \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/a2a-middleware\",\n \"microsoft-agent-framework-dotnet\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/ms-agent-framework-dotnet\",\n \"microsoft-agent-framework-py\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/ms-agent-framework-python\",\n \"mcp-apps\":\n \"https://github.com/CopilotKit/CopilotKit/tree/main/examples/integrations/mcp-apps\",\n};\n\nconst FRAMEWORK_DOCUMENTATION: Record<AgentFramework, string> = {\n \"langgraph-py\":\n \"https://langchain-ai.github.io/langgraph/concepts/why-langgraph\",\n \"langgraph-js\": \"https://langchain-ai.github.io/langgraphjs\",\n flows: \"https://docs.crewai.com/guides/flows/first-flow\",\n mastra: \"https://mastra.ai/en/docs\",\n \"pydantic-ai\": \"https://ai.pydantic.dev/ag-ui/\",\n llamaindex: \"https://docs.llamaindex.ai/en/stable\",\n agno: \"https://docs.agno.com/\",\n ag2: \"https://docs.ag2.ai/latest/docs/user-guide/basic-concepts/overview\",\n adk: \"https://google.github.io/adk-docs/\",\n \"aws-strands-py\": \"https://strandsagents.com/latest/documentation/docs/\",\n a2a: \"https://a2a-protocol.org/latest/\",\n \"microsoft-agent-framework-dotnet\":\n \"https://learn.microsoft.com/en-us/agent-framework/\",\n \"microsoft-agent-framework-py\":\n \"https://learn.microsoft.com/en-us/agent-framework/\",\n \"mcp-apps\": \"https://modelcontextprotocol.github.io/ext-apps\",\n};\n\nconst FRAMEWORK_EMOJI: Record<AgentFramework, string> = {\n \"langgraph-js\": \"🦜\",\n \"langgraph-py\": \"🦜\",\n flows: \"👥\",\n mastra: \"🌑\",\n \"pydantic-ai\": \"🔼\",\n llamaindex: \"🦙\",\n ag2: \"🤖\",\n agno: \"🅰️\",\n adk: \"🤖\",\n a2a: \"🤖\",\n \"aws-strands-py\": \"🧬\",\n \"microsoft-agent-framework-dotnet\": \"🟦\",\n \"microsoft-agent-framework-py\": \"🟦\",\n \"mcp-apps\": \"♍\",\n};\n\nconst KITE = `\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠙⣿⡛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠀⠀⠈⢿⡄⠀⠀⠀⠈⠉⠙⣻⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠈⢿⡄⠀⢀⣠⣴⠾⠋⢸⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⢀⣀⣀⣀⣀⣤⣤⡾⢿⡟⠛⠉⠀⠀⠀⠀⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⠛⠛⠛⠉⠉⠉⠁⠀⢠⡿⣿⡀⠀⠀⠀⠀⠀⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⣰⡟⠀⠸⣧⠀⠀⠀⠀⢠⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⢀⣼⠏⠀⠀⠀⣿⡀⠀⠀⠀⢸⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠂⣠⡿⠁⠀⠀⠀⠀⢸⡇⠀⠀⠀⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⣡⣾⣿⣄⠀⠀⠀⠀⠀⢸⡇⠀⠀⢰⣿⣿⣿\n⣿⣿⣿⣿⣿⣿⣿⡟⠛⡿⠋⣡⣾⣿⣿⣿⣿⣦⡀⠀⠀⠀⢸⡇⠀⠀⣿⣿⣿⣿\n⣿⣿⣿⣿⡿⠿⣿⠷⠂⡀⠘⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⢸⡇⠀⣼⣿⣿⣿⣿\n⣿⣿⠻⢿⡷⠀⠁⠴⣿⣷⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⣾⠇⣴⣿⣿⣿⣿⣿\n⡿⠛⠀⠀⢴⣾⣷⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⣿⣾⣿⣿⣿⣿⣿⣿\n⣷⣾⣿⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿\n`;\n\nexport default class Create extends BaseCommand {\n static description = \"Create a new CopilotKit project\";\n\n static examples = [\n \"$ copilotkit create my-app\",\n \"$ copilotkit create my-app --framework langgraph-js\",\n \"$ copilotkit create -n my-app -f langgraph-js\",\n ];\n\n static flags = {\n ...BaseCommand.flags,\n framework: Flags.string({\n char: \"f\",\n description: \"Agent framework to use\",\n options: Object.keys(TEMPLATE_REPOS),\n required: false,\n }),\n name: Flags.string({\n char: \"n\",\n description: \"Name of the project\",\n required: false,\n }),\n \"no-banner\": Flags.boolean({\n char: \"q\",\n description: \"Removes the banner\",\n default: false,\n required: false,\n }),\n project: Flags.string({\n description: \"project ID (deprecated, kept for backwards compatibility)\",\n }),\n };\n\n static args = {\n projectName: Args.string({\n description: \"Name of the project\",\n required: false,\n }),\n };\n\n constructor(argv: string[], config: Config) {\n super(argv, config);\n }\n\n async run() {\n const { args, flags } = await this.parse(Create);\n\n if (!flags[\"no-banner\"]) {\n this.log(theme.primary(KITE));\n this.log(theme.primary(\"~ Welcome to CopilotKit! ~\\n\"));\n this.log(theme.divider);\n\n if (!flags.name && !args.projectName && !flags.framework) {\n this.log(\n \"\\n\" + theme.secondary(\"Just a few questions to get started!\\n\"),\n );\n }\n }\n\n const projectNameInput =\n flags.name || args.projectName || (await this.promptProjectName());\n const projectName = projectNameInput.trim();\n const usingCurrentDir = projectName === \".\" || projectName === \"./\";\n const agentFramework =\n flags.framework || (await this.promptAgentFramework());\n\n const projectDir = usingCurrentDir\n ? process.cwd()\n : path.resolve(process.cwd(), projectName);\n\n if (usingCurrentDir) {\n const allowedEntries = new Set([\".git\", \".gitignore\", \".DS_Store\"]);\n const existingEntries = await fs.readdir(projectDir);\n const blockingEntries = existingEntries.filter(\n (entry) => !allowedEntries.has(entry),\n );\n\n if (blockingEntries.length > 0) {\n this.log(theme.error(\"\\nCurrent directory is not empty.\"));\n this.log(\n theme.secondary(\n \"\\nPlease run create in an empty directory or specify a new project name.\",\n ),\n );\n this.exit(1);\n }\n } else if (await fs.pathExists(projectDir)) {\n this.log(theme.error(`\\nDirectory \"${projectName}\" already exists.`));\n this.log(theme.secondary(\"\\nYou can:\"));\n this.log(theme.secondary(\" 1. Choose a different project name\"));\n this.log(\n theme.secondary(\n \" 2. Remove the existing directory manually if you want to use this name\\n\",\n ),\n );\n this.exit(1);\n }\n\n const options: CreateOptions = {\n projectName,\n agentFramework: agentFramework as AgentFramework,\n };\n\n const spinner = ora({\n text: theme.secondary.bold(\"Creating your project...\"),\n color: \"cyan\",\n spinner: \"dots\",\n }).start();\n\n try {\n await fs.ensureDir(projectDir);\n\n spinner.text = theme.secondary.bold(\"Downloading template...\");\n await this.downloadTemplate(projectDir, options.agentFramework, spinner);\n\n const displayName = usingCurrentDir\n ? \"current directory\"\n : `\"${projectName}\"`;\n spinner.succeed(\n theme.secondary.bold(`Project ${displayName} created successfully!`),\n );\n } catch (error: any) {\n spinner.fail(theme.error(`Failed to create project: ${error.message}`));\n this.exit(1);\n }\n\n this.log(\"\\n\" + theme.divider);\n this.log(\n \"\\n\" +\n theme.secondary.bold(\n `🪁🤝${FRAMEWORK_EMOJI[options.agentFramework]} All set! \\n\\nYour project is ready to explore CopilotKit locally.`,\n ),\n );\n this.log(\"\\n\" + theme.secondary(\"Next steps:\"));\n if (usingCurrentDir) {\n this.log(\n theme.secondary(\n \" • You are already inside your new project directory\",\n ),\n );\n } else {\n this.log(theme.secondary(` • ${theme.command(`cd ${projectName}`)}`));\n }\n this.log(\n theme.secondary(\" • Follow the setup instructions in the README.md\"),\n );\n this.log(\"\\n\" + theme.secondary(\"Documentation:\"));\n this.log(\n theme.secondary(\" • \") + theme.command(\"https://docs.copilotkit.ai\"),\n );\n this.log(\n theme.secondary(\" • \") +\n theme.command(FRAMEWORK_DOCUMENTATION[options.agentFramework]),\n );\n this.log(theme.bottomPadding);\n }\n\n private async promptProjectName(): Promise<string> {\n const { projectName } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"projectName\",\n message: theme.secondary(\"What is your project named?\"),\n validate: (input: string) => {\n if (!input) return theme.error(\"Project name is required\");\n if (!/^[a-z0-9-]+$/.test(input)) {\n return theme.error(\n \"Project name can only contain lowercase letters, numbers, and hyphens\",\n );\n }\n if (input.length > 30) {\n return theme.error(\"Project name must be less than 30 characters\");\n }\n return true;\n },\n },\n ]);\n return projectName;\n }\n\n private async promptAgentFramework(): Promise<string> {\n const { framework } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"framework\",\n message: theme.secondary(\n \"Which agent framework would you like to use?\",\n ),\n choices: [\n {\n name: `${FRAMEWORK_EMOJI[\"langgraph-py\"]} LangGraph (Python)`,\n value: \"langgraph-py\",\n },\n {\n name: `${FRAMEWORK_EMOJI[\"langgraph-js\"]} LangGraph (JavaScript)`,\n value: \"langgraph-js\",\n },\n { name: `${FRAMEWORK_EMOJI.mastra} Mastra`, value: \"mastra\" },\n {\n name: `${FRAMEWORK_EMOJI[\"pydantic-ai\"]} Pydantic AI`,\n value: \"pydantic-ai\",\n },\n {\n name: `${FRAMEWORK_EMOJI[\"aws-strands-py\"]} AWS Strands (Python)`,\n value: \"aws-strands-py\",\n },\n { name: `${FRAMEWORK_EMOJI.adk} ADK`, value: \"adk\" },\n {\n name: `${FRAMEWORK_EMOJI[\"microsoft-agent-framework-dotnet\"]} Microsoft Agent Framework (.NET)`,\n value: \"microsoft-agent-framework-dotnet\",\n },\n {\n name: `${FRAMEWORK_EMOJI[\"microsoft-agent-framework-py\"]} Microsoft Agent Framework (Python)`,\n value: \"microsoft-agent-framework-py\",\n },\n {\n name: `${FRAMEWORK_EMOJI[\"mcp-apps\"]} MCP Apps`,\n value: \"mcp-apps\",\n },\n { name: `${FRAMEWORK_EMOJI.flows} CrewAI Flows`, value: \"flows\" },\n {\n name: `${FRAMEWORK_EMOJI.llamaindex} LlamaIndex`,\n value: \"llamaindex\",\n },\n { name: `${FRAMEWORK_EMOJI.agno} Agno`, value: \"agno\" },\n { name: `${FRAMEWORK_EMOJI.ag2} AG2`, value: \"ag2\" },\n { name: `${FRAMEWORK_EMOJI.a2a} A2A`, value: \"a2a\" },\n ],\n },\n ]);\n return framework;\n }\n\n private async downloadTemplate(\n projectDir: string,\n framework: AgentFramework,\n spinner: Ora,\n ): Promise<void> {\n const templateRef = TEMPLATE_REPOS[framework];\n\n // Monorepo subdirectory URLs use sparse checkout; standalone repos use tarball download\n if (isValidGitHubUrl(templateRef)) {\n const success = await cloneGitHubSubdirectory(\n templateRef,\n projectDir,\n spinner,\n );\n if (!success) {\n throw new Error(`Failed to clone template from ${templateRef}`);\n }\n return;\n }\n\n // Fallback: standalone repo tarball (e.g. ag2ai/ag2-copilotkit-starter)\n const url = `https://github.com/${templateRef}/archive/refs/heads/main.tar.gz`;\n\n try {\n const response = await fetch(url);\n if (!response.ok)\n throw new Error(`Failed to download template: ${response.statusText}`);\n\n const tempFile = path.join(projectDir, \"template.tar.gz\");\n const fileStream = createWriteStream(tempFile);\n\n if (!response.body) throw new Error(\"Failed to get response body\");\n await streamPipeline(response.body as any, fileStream);\n\n await extract({\n file: tempFile,\n cwd: projectDir,\n strip: 1,\n });\n\n await fs.remove(tempFile);\n } catch (error: any) {\n throw new Error(`Failed to download template: ${error.message}`);\n }\n }\n}\n","import { Command } from \"@oclif/core\";\nimport Sentry, { consoleIntegration } from \"@sentry/node\";\nimport { LIB_VERSION } from \"../utils/version.js\";\nimport { COPILOT_CLOUD_BASE_URL } from \"../utils/trpc.js\";\nimport chalk from \"chalk\";\n\nexport class BaseCommand extends Command {\n async init() {\n await this.checkCLIVersion();\n\n if (process.env.SENTRY_DISABLED === \"true\") {\n return;\n }\n\n Sentry.init({\n dsn:\n process.env.SENTRY_DSN ||\n \"https://1eea15d32e2eacb0456a77db5e39aeeb@o4507288195170304.ingest.us.sentry.io/4508581448581120\",\n integrations: [consoleIntegration()],\n // Tracing\n tracesSampleRate: 1.0, // Capture 100% of the transactions\n });\n }\n\n async catch(err: any) {\n if (process.env.SENTRY_DISABLED !== \"true\") {\n Sentry.captureException(err);\n }\n\n const message = err?.message ?? \"Unknown error\";\n\n this.log(\"\\n\" + chalk.red(message) + \"\\n\");\n\n const exitCode = err?.oclif?.exit ?? 1;\n this.exit(exitCode);\n }\n\n async finally() {\n if (process.env.SENTRY_DISABLED === \"true\") {\n return;\n }\n\n Sentry.close();\n }\n\n async run() {}\n\n async checkCLIVersion() {\n try {\n const response = await fetch(`${COPILOT_CLOUD_BASE_URL}/api/healthz`);\n\n const data = await response.json();\n const cloudVersion = data.cliVersion;\n\n if (!cloudVersion || cloudVersion === LIB_VERSION) {\n return;\n }\n\n // TODO: add this back in, removed for crew ai launch since we don't want to keep releasing cloud\n // this.log(chalk.yellow('================ New version available! =================\\n'))\n // this.log(`You are using CopilotKit CLI v${LIB_VERSION}.`)\n // this.log(`A new CopilotKit CLI version is available (v${cloudVersion}).\\n`)\n // this.log('Please update your CLI to the latest version:\\n\\n')\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('npm:')))}\\t npm install -g copilotkit@${cloudVersion}\\n`)\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('pnpm:')))}\\t pnpm install -g copilotkit@${cloudVersion}\\n`)\n // this.log(`${chalk.cyan(chalk.underline(chalk.bold('yarn:')))}\\t yarn global add copilotkit@${cloudVersion}\\n`)\n // this.log(chalk.yellow('============================================================\\n\\n'))\n } catch {\n // Version check is non-critical — don't crash the CLI when offline\n }\n }\n\n async gracefulError(message: string) {\n this.log(\"\\n\" + chalk.red(message));\n process.exit(1);\n }\n}\n","// This is auto generated!\nexport const LIB_VERSION = \"0.0.0-main-20260402184302\";\n","import { createTRPCClient as trpcClient, httpBatchLink } from \"@trpc/client\";\nimport superjson from \"superjson\";\n\nexport const COPILOT_CLOUD_BASE_URL =\n process.env.COPILOT_CLOUD_BASE_URL || \"https://cloud.copilotkit.ai\";\n\nexport function createTRPCClient(cliToken: string): any {\n return trpcClient({\n links: [\n httpBatchLink({\n url: `${COPILOT_CLOUD_BASE_URL}/api/trpc-cli`,\n transformer: superjson,\n headers: () => {\n return {\n \"x-trpc-source\": \"cli\",\n \"x-cli-token\": cliToken,\n };\n },\n }),\n ],\n });\n}\n","import { execSync } from \"child_process\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport * as os from \"os\";\nimport { Config } from \"../types/index.js\";\nimport chalk from \"chalk\";\nimport ora, { Ora } from \"ora\";\n\n/**\n * Clones a specific subdirectory from a GitHub repository\n *\n * @param githubUrl - The GitHub URL to the repository or subdirectory\n * @param destinationPath - The local path where the content should be copied\n * @param spinner - The spinner to update with progress information\n * @returns A boolean indicating success or failure\n */\nexport async function cloneGitHubSubdirectory(\n githubUrl: string,\n destinationPath: string,\n spinner: Ora,\n): Promise<boolean> {\n try {\n // Parse the GitHub URL to extract repo info\n const { owner, repo, branch, subdirectoryPath } = parseGitHubUrl(githubUrl);\n\n spinner.text = chalk.cyan(`Cloning from ${owner}/${repo}...`);\n\n // Method 1: Use sparse checkout (more efficient than full clone)\n return await sparseCheckout(\n owner,\n repo,\n branch,\n subdirectoryPath,\n destinationPath,\n spinner,\n );\n } catch (error) {\n spinner.text = chalk.red(`Failed to clone from GitHub: ${error}`);\n return false;\n }\n}\n\n/**\n * Uses Git sparse-checkout to efficiently download only the needed subdirectory\n */\nasync function sparseCheckout(\n owner: string,\n repo: string,\n branch: string,\n subdirectoryPath: string,\n destinationPath: string,\n spinner: Ora,\n): Promise<boolean> {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), \"copilotkit-sparse-\"));\n\n try {\n spinner.text = chalk.cyan(\"Creating temporary workspace...\");\n\n // Initialize git repo\n execSync(\"git init\", { cwd: tempDir, stdio: \"pipe\" });\n\n spinner.text = chalk.cyan(\"Connecting to repository...\");\n\n // Add remote\n execSync(`git remote add origin https://github.com/${owner}/${repo}.git`, {\n cwd: tempDir,\n stdio: \"pipe\",\n });\n\n // Enable sparse checkout\n execSync(\"git config core.sparseCheckout true\", {\n cwd: tempDir,\n stdio: \"pipe\",\n });\n\n // Specify which subdirectory to checkout\n fs.writeFileSync(\n path.join(tempDir, \".git/info/sparse-checkout\"),\n subdirectoryPath,\n );\n\n spinner.text = chalk.cyan(\"Downloading agent files...\");\n\n // Pull only the specified branch\n execSync(`git pull origin ${branch} --depth=1`, {\n cwd: tempDir,\n stdio: \"pipe\",\n });\n\n // Copy the subdirectory to the destination\n const sourcePath = path.join(tempDir, subdirectoryPath);\n if (!fs.existsSync(sourcePath)) {\n throw new Error(\n `Subdirectory '${subdirectoryPath}' not found in the repository.`,\n );\n }\n\n // Ensure destination directory exists\n fs.mkdirSync(destinationPath, { recursive: true });\n\n spinner.text = chalk.cyan(\"Installing agent files...\");\n\n // Copy the subdirectory to the destination\n await copyDirectoryAsync(sourcePath, destinationPath);\n\n return true;\n } finally {\n // Clean up the temporary directory\n try {\n fs.rmSync(tempDir, { recursive: true, force: true });\n } catch (error) {\n console.warn(`Failed to clean up temporary directory: ${error}`);\n }\n }\n}\n\n/**\n * Recursively copies a directory with async pauses\n */\nasync function copyDirectoryAsync(\n source: string,\n destination: string,\n): Promise<void> {\n // Create destination directory if it doesn't exist\n if (!fs.existsSync(destination)) {\n fs.mkdirSync(destination, { recursive: true });\n }\n\n // Read all files/directories from source\n const entries = fs.readdirSync(source, { withFileTypes: true });\n\n for (const entry of entries) {\n const srcPath = path.join(source, entry.name);\n const destPath = path.join(destination, entry.name);\n\n if (entry.isDirectory()) {\n // Recursively copy subdirectories\n await copyDirectoryAsync(srcPath, destPath);\n } else {\n // Copy files\n fs.copyFileSync(srcPath, destPath);\n }\n\n // For large directories, add small pauses\n if (entries.length > 10) {\n await new Promise((resolve) => setTimeout(resolve, 1));\n }\n }\n}\n\n/**\n * Parses a GitHub URL to extract owner, repo, branch and subdirectory path\n */\nfunction parseGitHubUrl(githubUrl: string): {\n owner: string;\n repo: string;\n branch: string;\n subdirectoryPath: string;\n} {\n const url = new URL(githubUrl);\n\n if (url.hostname !== \"github.com\") {\n throw new Error(\"Only GitHub URLs are supported\");\n }\n\n const pathParts = url.pathname.split(\"/\").filter(Boolean);\n\n if (pathParts.length < 2) {\n throw new Error(\"Invalid GitHub URL format\");\n }\n\n const owner = pathParts[0];\n const repo = pathParts[1];\n let branch = \"main\"; // Default branch\n let subdirectoryPath = \"\";\n\n if (\n pathParts.length > 3 &&\n (pathParts[2] === \"tree\" || pathParts[2] === \"blob\")\n ) {\n branch = pathParts[3];\n subdirectoryPath = pathParts.slice(4).join(\"/\");\n }\n\n return { owner, repo, branch, subdirectoryPath };\n}\n\n/**\n * Validates if a string is a valid GitHub URL\n */\nexport function isValidGitHubUrl(url: string): boolean {\n try {\n const parsedUrl = new URL(url);\n return (\n parsedUrl.hostname === \"github.com\" &&\n parsedUrl.pathname.split(\"/\").filter(Boolean).length >= 2\n );\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA,SAAiB,OAAO,YAAY;AACpC,OAAO,cAAc;AACrB,OAAOA,YAAW;AAClB,OAAOC,SAAQ;AACf,OAAOC,WAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,OAAO,SAAkB;;;ACTzB,SAAS,eAAe;AACxB,OAAO,UAAU,0BAA0B;;;ACApC,IAAM,cAAc;;;ACD3B,SAAS,oBAAoB,YAAY,qBAAqB;AAC9D,OAAO,eAAe;AAEf,IAAM,yBACX,QAAQ,IAAI,0BAA0B;;;AFAxC,OAAO,WAAW;AAEX,IAAM,cAAN,cAA0B,QAAQ;AAAA,EACvC,MAAM,OAAO;AACX,UAAM,KAAK,gBAAgB;AAE3B,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,KAAK;AAAA,MACV,KACE,QAAQ,IAAI,cACZ;AAAA,MACF,cAAc,CAAC,mBAAmB,CAAC;AAAA;AAAA,MAEnC,kBAAkB;AAAA;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAM,KAAU;AACpB,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C,aAAO,iBAAiB,GAAG;AAAA,IAC7B;AAEA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EAAE,MAAM,GAAG,gBAAgB,GAAG,QAAQ,OAAO,MAAM;AAAA,UACnD,EAAE,MAAM,GAAG,gBAAgB,GAAG,QAAQ,OAAO,MAAM;AAAA,QACrD;AAAA,MACF;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,iBACZ,YACA,WACA,SACe;AACf,UAAM,cAAc,eAAe,SAAS;AAG5C,QAAI,iBAAiB,WAAW,GAAG;AACjC,YAAM,UAAU,MAAM;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA,UAAI,CAAC,SAAS;AACZ,cAAM,IAAI,MAAM,iCAAiC,WAAW,EAAE;AAAA,MAChE;AACA;AAAA,IACF;AAGA,UAAM,MAAM,sBAAsB,WAAW;AAE7C,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,UAAI,CAAC,SAAS;AACZ,cAAM,IAAI,MAAM,gCAAgC,SAAS,UAAU,EAAE;AAEvE,YAAM,WAAWD,MAAK,KAAK,YAAY,iBAAiB;AACxD,YAAM,aAAa,kBAAkB,QAAQ;AAE7C,UAAI,CAAC,SAAS,KAAM,OAAM,IAAI,MAAM,6BAA6B;AACjE,YAAM,eAAe,SAAS,MAAa,UAAU;AAErD,YAAM,QAAQ;AAAA,QACZ,MAAM;AAAA,QACN,KAAK;AAAA,QACL,OAAO;AAAA,MACT,CAAC;AAED,YAAMC,IAAG,OAAO,QAAQ;AAAA,IAC1B,SAAS,OAAY;AACnB,YAAM,IAAI,MAAM,gCAAgC,MAAM,OAAO,EAAE;AAAA,IACjE;AAAA,EACF;AACF;","names":["chalk","fs","path","chalk","chalk","path","fs"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as _oclif_core_interfaces from '@oclif/core/interfaces';
|
|
2
|
+
import { Config } from '@oclif/core';
|
|
3
|
+
import { AuthService } from '../services/auth.service.js';
|
|
4
|
+
import { TunnelService } from '../services/tunnel.service.js';
|
|
5
|
+
import { BaseCommand } from './base-command.js';
|
|
6
|
+
import 'localtunnel';
|
|
7
|
+
|
|
8
|
+
declare class Dev extends BaseCommand {
|
|
9
|
+
private authService;
|
|
10
|
+
private tunnelService;
|
|
11
|
+
static flags: {
|
|
12
|
+
port: _oclif_core_interfaces.OptionFlag<string, _oclif_core_interfaces.CustomOptions>;
|
|
13
|
+
project: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
static description: string;
|
|
16
|
+
static examples: string[];
|
|
17
|
+
private trpcClient;
|
|
18
|
+
private copilotCloudTunnelId;
|
|
19
|
+
constructor(argv: string[], config: Config, authService?: AuthService, tunnelService?: TunnelService);
|
|
20
|
+
private pingTunnelRecursively;
|
|
21
|
+
run(): Promise<void>;
|
|
22
|
+
private setupTunnel;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Dev as default };
|