copilotkit 0.0.34 → 0.0.36

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 (38) 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 +78 -33
  4. package/dist/commands/dev.js.map +1 -1
  5. package/dist/commands/init.d.ts +0 -1
  6. package/dist/commands/init.js +27 -47
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/login.js +1 -1
  9. package/dist/commands/login.js.map +1 -1
  10. package/dist/commands/logout.js +1 -1
  11. package/dist/commands/logout.js.map +1 -1
  12. package/dist/lib/init/index.js +13 -36
  13. package/dist/lib/init/index.js.map +1 -1
  14. package/dist/lib/init/questions.js +9 -23
  15. package/dist/lib/init/questions.js.map +1 -1
  16. package/dist/lib/init/scaffold/agent.js +1 -6
  17. package/dist/lib/init/scaffold/agent.js.map +1 -1
  18. package/dist/lib/init/scaffold/env.js +1 -5
  19. package/dist/lib/init/scaffold/env.js.map +1 -1
  20. package/dist/lib/init/scaffold/index.js +8 -23
  21. package/dist/lib/init/scaffold/index.js.map +1 -1
  22. package/dist/lib/init/scaffold/shadcn.js +6 -12
  23. package/dist/lib/init/scaffold/shadcn.js.map +1 -1
  24. package/dist/lib/init/types/index.js +4 -10
  25. package/dist/lib/init/types/index.js.map +1 -1
  26. package/dist/lib/init/types/questions.d.ts +6 -14
  27. package/dist/lib/init/types/questions.js +3 -5
  28. package/dist/lib/init/types/questions.js.map +1 -1
  29. package/dist/lib/init/types/templates.d.ts +1 -1
  30. package/dist/lib/init/types/templates.js +1 -5
  31. package/dist/lib/init/types/templates.js.map +1 -1
  32. package/dist/lib/init/utils.js.map +1 -1
  33. package/dist/utils/detect-endpoint-type.utils.d.ts +1 -1
  34. package/dist/utils/version.d.ts +1 -1
  35. package/dist/utils/version.js +1 -1
  36. package/dist/utils/version.js.map +1 -1
  37. package/oclif.manifest.json +1 -11
  38. package/package.json +6 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/logout.ts","../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts","../../src/commands/base-command.ts","../../src/utils/version.ts"],"sourcesContent":["import {Config} from '@oclif/core'\nimport chalk from 'chalk'\nimport ora from 'ora'\n\nimport {AuthService} from '../services/auth.service.js'\nimport {BaseCommand} from './base-command.js'\n\nexport default class CloudLogout extends BaseCommand {\n static override description = 'Logout from Copilot Cloud'\n\n static override examples = ['<%= config.bin %> logout']\n\n constructor(\n argv: string[],\n config: Config,\n private authService = new AuthService(),\n ) {\n super(argv, config)\n }\n\n public async run(): Promise<void> {\n await this.parse(CloudLogout)\n this.log('Logging out...\\n')\n await this.authService.logout(this)\n this.log(chalk.green('Successfully logged out!'))\n }\n}\n","// @ts-ignore\nimport Conf from 'conf'\nimport cors from 'cors'\nimport express from 'express'\nimport crypto from 'node:crypto'\nimport open from 'open'\nimport getPort from 'get-port'\nimport ora from 'ora'\nimport chalk from 'chalk'\nimport inquirer from 'inquirer'\nimport {Command} from '@oclif/core'\nimport {createTRPCClient} from '../utils/trpc.js'\nimport {AnalyticsService} from '../services/analytics.service.js'\nimport {BaseCommand} from '../commands/base-command.js'\n\ninterface LoginResponse {\n cliToken: string\n user: {\n email: string\n id: string\n }\n organization: {\n id: string\n }\n}\n\nexport class AuthService {\n private readonly config = new Conf({projectName: 'CopilotKitCLI'})\n private readonly COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || 'https://cloud.copilotkit.ai'\n\n getToken(): string | undefined {\n return this.config.get('cliToken') as string | undefined\n }\n\n getCLIToken(): string | undefined {\n const cliToken = this.config.get('cliToken') as string | undefined\n return cliToken\n }\n\n async logout(cmd: BaseCommand): Promise<void> {\n this.config.delete('cliToken')\n }\n\n async requireLogin(cmd: Command): Promise<LoginResponse> {\n let cliToken = this.getCLIToken()\n // Check authentication\n if (!cliToken) {\n try {\n const {shouldLogin} = await inquirer.prompt([\n {\n name: 'shouldLogin',\n type: 'confirm',\n message: '🪁 You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)',\n default: true,\n },\n ])\n if (shouldLogin) {\n const loginResult = await this.login({exitAfterLogin: false})\n cliToken = loginResult.cliToken\n return loginResult\n } else {\n cmd.error('Authentication required to proceed.')\n }\n } catch (error) {\n if (error instanceof Error && error.name === 'ExitPromptError') {\n cmd.error(chalk.yellow('\\nAuthentication cancelled'))\n }\n\n throw error\n }\n }\n\n let me\n\n const trpcClient = createTRPCClient(cliToken)\n try {\n me = await trpcClient.me.query()\n } catch (error) {\n cmd.log(chalk.red('Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login'))\n process.exit(1)\n }\n\n if (!me.organization || !me.user) {\n cmd.error('Authentication required to proceed.')\n }\n\n return {cliToken, user: me.user, organization: me.organization}\n }\n\n async login({exitAfterLogin}: {exitAfterLogin?: boolean} = {exitAfterLogin: true}): Promise<LoginResponse> {\n const spinner = ora('🪁 Opening browser for authentication...').start()\n let analytics: AnalyticsService\n analytics = new AnalyticsService()\n\n const app = express()\n app.use(cors())\n app.use(express.urlencoded({extended: true}))\n app.use(express.json())\n\n const port = await getPort()\n const state = crypto.randomBytes(16).toString('hex')\n\n return new Promise(async (resolve) => {\n const server = app.listen(port, () => {})\n\n await analytics.track({\n event: 'cli.login.initiated',\n properties: {},\n })\n\n spinner.text = '🪁 Waiting for browser authentication to complete...'\n\n app.post('/callback', async (req, res) => {\n const {cliToken, user, organization} = req.body\n\n analytics = new AnalyticsService({userId: user.id, organizationId: organization.id, email: user.email})\n await analytics.track({\n event: 'cli.login.success',\n properties: {\n organizationId: organization.id,\n userId: user.id,\n email: user.email,\n },\n })\n\n if (state !== req.query.state) {\n res.status(401).json({message: 'Invalid state'})\n spinner.fail('Invalid state')\n return\n }\n\n this.config.set('cliToken', cliToken)\n res.status(200).json({message: 'Callback called'})\n spinner.succeed(`🪁 Successfully logged in as ${chalk.hex('#7553fc')(user.email)}`)\n if (exitAfterLogin) {\n process.exit(0)\n } else {\n server.close()\n resolve({cliToken, user, organization})\n }\n })\n\n open(`${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`)\n })\n }\n}\n","import {createTRPCClient as trpcClient, httpBatchLink} from '@trpc/client'\nimport superjson from 'superjson'\n\nexport const COPILOT_CLOUD_BASE_URL = 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 {Analytics} from '@segment/analytics-node'\nimport {AnalyticsEvents} from './events.js'\nimport Conf from 'conf'\n\nexport class AnalyticsService {\n private segment: Analytics | undefined\n private globalProperties: Record<string, any> = {}\n private userId: string | undefined\n private email: string | undefined\n private organizationId: string | undefined\n private config = new Conf({projectName: 'CopilotKitCLI'})\n\n constructor(\n private readonly authData?: {\n userId: string\n email: string\n organizationId: string\n },\n ) {\n if (process.env.SEGMENT_DISABLED === 'true') {\n return\n }\n\n const segmentWriteKey = process.env.SEGMENT_WRITE_KEY || '9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf'\n\n this.globalProperties = {\n service: 'cli',\n }\n\n if (this.authData?.userId) {\n this.userId = this.authData.userId\n }\n\n if (this.authData?.email) {\n this.email = this.authData.email\n this.globalProperties.email = this.authData.email\n }\n\n if (this.authData?.organizationId) {\n this.organizationId = this.authData.organizationId\n }\n\n this.segment = new Analytics({\n writeKey: segmentWriteKey,\n disable: process.env.SEGMENT_DISABLE === 'true',\n })\n\n const config = new Conf({projectName: 'CopilotKitCLI'})\n if (!config.get('anonymousId')) {\n config.set('anonymousId', crypto.randomUUID())\n }\n }\n\n private getAnonymousId(): string {\n const anonymousId = this.config.get('anonymousId')\n if (!anonymousId) {\n const anonymousId = crypto.randomUUID()\n this.config.set('anonymousId', anonymousId)\n return anonymousId\n }\n\n return anonymousId as string\n }\n\n public track<K extends keyof AnalyticsEvents>(\n event: Omit<Parameters<Analytics['track']>[0], 'userId'> & {\n event: K\n properties: AnalyticsEvents[K]\n },\n ): Promise<void> {\n if (!this.segment) {\n return Promise.resolve()\n }\n\n const payload = {\n userId: this.userId ? this.userId : undefined,\n email: this.email ? this.email : undefined,\n anonymousId: this.getAnonymousId(),\n event: event.event,\n properties: {\n ...this.globalProperties,\n ...event.properties,\n $groups: this.organizationId\n ? {\n segment_group: this.organizationId,\n }\n : undefined,\n eventProperties: {\n ...event.properties,\n ...this.globalProperties,\n },\n },\n }\n\n return new Promise((resolve, reject) => {\n this.segment!.track(payload, (err) => {\n if (err) {\n // Resolve anyway\n resolve()\n }\n\n resolve()\n })\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 super.catch(err)\n return\n }\n\n Sentry.captureException(err)\n super.catch(err)\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 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 }\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.34\";\n"],"mappings":";AACA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAU;AACjB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAOC,aAAY;AACnB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAO,cAAc;;;ACTrB,SAAQ,oBAAoB,YAAY,qBAAoB;AAC5D,OAAO,eAAe;AAEf,IAAM,yBAAyB,QAAQ,IAAI,0BAA0B;AAErE,SAAS,iBAAiB,UAAuB;AACtD,SAAO,WAAW;AAAA,IAChB,OAAO;AAAA,MACL,cAAc;AAAA,QACZ,KAAK,GAAG,sBAAsB;AAAA,QAC9B,aAAa;AAAA,QACb,SAAS,MAAM;AACb,iBAAO;AAAA,YACL,iBAAiB;AAAA,YACjB,eAAe;AAAA,UACjB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;;;ACpBA,SAAQ,iBAAgB;AAExB,OAAO,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,MAEnC,kBAAkB;AAAA;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAM,KAAU;AACpB,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C,YAAM,MAAM,GAAG;AACf;AAAA,IACF;AAEA,WAAO,iBAAiB,GAAG;AAC3B,UAAM,MAAM,GAAG;AAAA,EACjB;AAAA,EAEA,MAAM,UAAU;AACd,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,MAAM,MAAM;AAAA,EAAC;AAAA,EAEb,MAAM,kBAAkB;AACtB,UAAM,WAAW,MAAM,MAAM,GAAG,sBAAsB,cAAc;AAEpE,UAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAM,eAAe,KAAK;AAE1B,QAAI,CAAC,gBAAgB,iBAAiB,aAAa;AACjD;AAAA,IACF;AAAA,EAWF;AAAA,EAEA,MAAM,cAAc,SAAiB;AACnC,SAAK,IAAI,OAAOA,OAAM,IAAI,OAAO,CAAC;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;;AJ9DA,IAAqB,cAArB,MAAqB,qBAAoB,YAAY;AAAA,EAKnD,YACE,MACA,QACQ,cAAc,IAAI,YAAY,GACtC;AACA,UAAM,MAAM,MAAM;AAFV;AAAA,EAGV;AAAA,EAVA,OAAgB,cAAc;AAAA,EAE9B,OAAgB,WAAW,CAAC,0BAA0B;AAAA,EAUtD,MAAa,MAAqB;AAChC,UAAM,KAAK,MAAM,YAAW;AAC5B,SAAK,IAAI,kBAAkB;AAC3B,UAAM,KAAK,YAAY,OAAO,IAAI;AAClC,SAAK,IAAIC,OAAM,MAAM,0BAA0B,CAAC;AAAA,EAClD;AACF;","names":["chalk","Conf","crypto","anonymousId","Conf","trpcClient","crypto","chalk","chalk"]}
1
+ {"version":3,"sources":["../../src/commands/logout.ts","../../src/services/auth.service.ts","../../src/utils/trpc.ts","../../src/services/analytics.service.ts","../../src/commands/base-command.ts","../../src/utils/version.ts"],"sourcesContent":["import {Config} from '@oclif/core'\nimport chalk from 'chalk'\nimport ora from 'ora'\n\nimport {AuthService} from '../services/auth.service.js'\nimport {BaseCommand} from './base-command.js'\n\nexport default class CloudLogout extends BaseCommand {\n static override description = 'Logout from Copilot Cloud'\n\n static override examples = ['<%= config.bin %> logout']\n\n constructor(\n argv: string[],\n config: Config,\n private authService = new AuthService(),\n ) {\n super(argv, config)\n }\n\n public async run(): Promise<void> {\n await this.parse(CloudLogout)\n this.log('Logging out...\\n')\n await this.authService.logout(this)\n this.log(chalk.green('Successfully logged out!'))\n }\n}\n","// @ts-ignore\nimport Conf from 'conf'\nimport cors from 'cors'\nimport express from 'express'\nimport crypto from 'node:crypto'\nimport open from 'open'\nimport getPort from 'get-port'\nimport ora from 'ora'\nimport chalk from 'chalk'\nimport inquirer from 'inquirer'\nimport {Command} from '@oclif/core'\nimport {createTRPCClient} from '../utils/trpc.js'\nimport {AnalyticsService} from '../services/analytics.service.js'\nimport {BaseCommand} from '../commands/base-command.js'\n\ninterface LoginResponse {\n cliToken: string\n user: {\n email: string\n id: string\n }\n organization: {\n id: string\n }\n}\n\nexport class AuthService {\n private readonly config = new Conf({projectName: 'CopilotKitCLI'})\n private readonly COPILOT_CLOUD_BASE_URL = process.env.COPILOT_CLOUD_BASE_URL || 'https://cloud.copilotkit.ai'\n\n getToken(): string | undefined {\n return this.config.get('cliToken') as string | undefined\n }\n\n getCLIToken(): string | undefined {\n const cliToken = this.config.get('cliToken') as string | undefined\n return cliToken\n }\n\n async logout(cmd: BaseCommand): Promise<void> {\n this.config.delete('cliToken')\n }\n\n async requireLogin(cmd: Command): Promise<LoginResponse> {\n let cliToken = this.getCLIToken()\n // Check authentication\n if (!cliToken) {\n try {\n const {shouldLogin} = await inquirer.prompt([\n {\n name: 'shouldLogin',\n type: 'confirm',\n message: '🪁 You are not yet authenticated. Authenticate with Copilot Cloud? (press Enter to confirm)',\n default: true,\n },\n ])\n if (shouldLogin) {\n const loginResult = await this.login({exitAfterLogin: false})\n cliToken = loginResult.cliToken\n return loginResult\n } else {\n cmd.error('Authentication required to proceed.')\n }\n } catch (error) {\n if (error instanceof Error && error.name === 'ExitPromptError') {\n cmd.error(chalk.yellow('\\nAuthentication cancelled'))\n }\n\n throw error\n }\n }\n\n let me\n\n const trpcClient = createTRPCClient(cliToken)\n try {\n me = await trpcClient.me.query()\n } catch (error) {\n cmd.log(chalk.red('Could not authenticate with Copilot Cloud. Please run: npx copilotkit@latest login'))\n process.exit(1)\n }\n\n if (!me.organization || !me.user) {\n cmd.error('Authentication required to proceed.')\n }\n\n return {cliToken, user: me.user, organization: me.organization}\n }\n\n async login({exitAfterLogin}: {exitAfterLogin?: boolean} = {exitAfterLogin: true}): Promise<LoginResponse> {\n const spinner = ora('🪁 Opening browser for authentication...').start()\n let analytics: AnalyticsService\n analytics = new AnalyticsService()\n\n const app = express()\n app.use(cors())\n app.use(express.urlencoded({extended: true}))\n app.use(express.json())\n\n const port = await getPort()\n const state = crypto.randomBytes(16).toString('hex')\n\n return new Promise(async (resolve) => {\n const server = app.listen(port, () => {})\n\n await analytics.track({\n event: 'cli.login.initiated',\n properties: {},\n })\n\n spinner.text = '🪁 Waiting for browser authentication to complete...'\n\n app.post('/callback', async (req, res) => {\n const {cliToken, user, organization} = req.body\n\n analytics = new AnalyticsService({userId: user.id, organizationId: organization.id, email: user.email})\n await analytics.track({\n event: 'cli.login.success',\n properties: {\n organizationId: organization.id,\n userId: user.id,\n email: user.email,\n },\n })\n\n if (state !== req.query.state) {\n res.status(401).json({message: 'Invalid state'})\n spinner.fail('Invalid state')\n return\n }\n\n this.config.set('cliToken', cliToken)\n res.status(200).json({message: 'Callback called'})\n spinner.succeed(`🪁 Successfully logged in as ${chalk.hex('#7553fc')(user.email)}`)\n if (exitAfterLogin) {\n process.exit(0)\n } else {\n server.close()\n resolve({cliToken, user, organization})\n }\n })\n\n open(`${this.COPILOT_CLOUD_BASE_URL}/cli-auth?callbackUrl=http://localhost:${port}/callback&state=${state}`)\n })\n }\n}\n","import {createTRPCClient as trpcClient, httpBatchLink} from '@trpc/client'\nimport superjson from 'superjson'\n\nexport const COPILOT_CLOUD_BASE_URL = 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 {Analytics} from '@segment/analytics-node'\nimport {AnalyticsEvents} from './events.js'\nimport Conf from 'conf'\n\nexport class AnalyticsService {\n private segment: Analytics | undefined\n private globalProperties: Record<string, any> = {}\n private userId: string | undefined\n private email: string | undefined\n private organizationId: string | undefined\n private config = new Conf({projectName: 'CopilotKitCLI'})\n\n constructor(\n private readonly authData?: {\n userId: string\n email: string\n organizationId: string\n },\n ) {\n if (process.env.SEGMENT_DISABLED === 'true') {\n return\n }\n\n const segmentWriteKey = process.env.SEGMENT_WRITE_KEY || '9Pv6QyExYef2P4hPz4gks6QAvNMi2AOf'\n\n this.globalProperties = {\n service: 'cli',\n }\n\n if (this.authData?.userId) {\n this.userId = this.authData.userId\n }\n\n if (this.authData?.email) {\n this.email = this.authData.email\n this.globalProperties.email = this.authData.email\n }\n\n if (this.authData?.organizationId) {\n this.organizationId = this.authData.organizationId\n }\n\n this.segment = new Analytics({\n writeKey: segmentWriteKey,\n disable: process.env.SEGMENT_DISABLE === 'true',\n })\n\n const config = new Conf({projectName: 'CopilotKitCLI'})\n if (!config.get('anonymousId')) {\n config.set('anonymousId', crypto.randomUUID())\n }\n }\n\n private getAnonymousId(): string {\n const anonymousId = this.config.get('anonymousId')\n if (!anonymousId) {\n const anonymousId = crypto.randomUUID()\n this.config.set('anonymousId', anonymousId)\n return anonymousId\n }\n\n return anonymousId as string\n }\n\n public track<K extends keyof AnalyticsEvents>(\n event: Omit<Parameters<Analytics['track']>[0], 'userId'> & {\n event: K\n properties: AnalyticsEvents[K]\n },\n ): Promise<void> {\n if (!this.segment) {\n return Promise.resolve()\n }\n\n const payload = {\n userId: this.userId ? this.userId : undefined,\n email: this.email ? this.email : undefined,\n anonymousId: this.getAnonymousId(),\n event: event.event,\n properties: {\n ...this.globalProperties,\n ...event.properties,\n $groups: this.organizationId\n ? {\n segment_group: this.organizationId,\n }\n : undefined,\n eventProperties: {\n ...event.properties,\n ...this.globalProperties,\n },\n },\n }\n\n return new Promise((resolve, reject) => {\n this.segment!.track(payload, (err) => {\n if (err) {\n // Resolve anyway\n resolve()\n }\n\n resolve()\n })\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 super.catch(err)\n return\n }\n\n Sentry.captureException(err)\n super.catch(err)\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 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 }\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.36\";\n"],"mappings":";AACA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAU;AACjB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAOC,aAAY;AACnB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAO,cAAc;;;ACTrB,SAAQ,oBAAoB,YAAY,qBAAoB;AAC5D,OAAO,eAAe;AAEf,IAAM,yBAAyB,QAAQ,IAAI,0BAA0B;AAErE,SAAS,iBAAiB,UAAuB;AACtD,SAAO,WAAW;AAAA,IAChB,OAAO;AAAA,MACL,cAAc;AAAA,QACZ,KAAK,GAAG,sBAAsB;AAAA,QAC9B,aAAa;AAAA,QACb,SAAS,MAAM;AACb,iBAAO;AAAA,YACL,iBAAiB;AAAA,YACjB,eAAe;AAAA,UACjB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;;;ACpBA,SAAQ,iBAAgB;AAExB,OAAO,UAAU;AAEV,IAAM,mBAAN,MAAuB;AAAA,EAQ5B,YACmB,UAKjB;AALiB;AAMjB,QAAI,QAAQ,IAAI,qBAAqB,QAAQ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,oBAAoB,QAAQ;AAC1C,YAAM,MAAM,GAAG;AACf;AAAA,IACF;AAEA,WAAO,iBAAiB,GAAG;AAC3B,UAAM,MAAM,GAAG;AAAA,EACjB;AAAA,EAEA,MAAM,UAAU;AACd,QAAI,QAAQ,IAAI,oBAAoB,QAAQ;AAC1C;AAAA,IACF;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,MAAM,MAAM;AAAA,EAAC;AAAA,EAEb,MAAM,kBAAkB;AACtB,UAAM,WAAW,MAAM,MAAM,GAAG,sBAAsB,cAAc;AAEpE,UAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAM,eAAe,KAAK;AAE1B,QAAI,CAAC,gBAAgB,iBAAiB,aAAa;AACjD;AAAA,IACF;AAAA,EAWF;AAAA,EAEA,MAAM,cAAc,SAAiB;AACnC,SAAK,IAAI,OAAOA,OAAM,IAAI,OAAO,CAAC;AAClC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;;AJ9DA,IAAqB,cAArB,MAAqB,qBAAoB,YAAY;AAAA,EAKnD,YACE,MACA,QACQ,cAAc,IAAI,YAAY,GACtC;AACA,UAAM,MAAM,MAAM;AAFV;AAAA,EAGV;AAAA,EAVA,OAAgB,cAAc;AAAA,EAE9B,OAAgB,WAAW,CAAC,0BAA0B;AAAA,EAUtD,MAAa,MAAqB;AAChC,UAAM,KAAK,MAAM,YAAW;AAC5B,SAAK,IAAI,kBAAkB;AAC3B,UAAM,KAAK,YAAY,OAAO,IAAI;AAClC,SAAK,IAAIC,OAAM,MAAM,0BAA0B,CAAC;AAAA,EAClD;AACF;","names":["chalk","Conf","crypto","anonymousId","Conf","trpcClient","crypto","chalk","chalk"]}
@@ -71,20 +71,19 @@ var ConfigSchema = z.object({
71
71
  crewName: NameSchema.optional(),
72
72
  crewUrl: UrlSchema.optional(),
73
73
  crewBearerToken: TokenSchema.optional(),
74
- crewFlowAgent: CrewFlowTemplateSchema.optional(),
75
74
  // API keys and tokens
76
75
  copilotCloudPublicApiKey: z.string().optional(),
77
76
  langSmithApiKey: ApiKeySchema.optional(),
78
77
  llmToken: ApiKeySchema.optional()
79
78
  }).refine(
80
79
  (data) => {
81
- if (data.mode === "CrewAI" && data.crewType === "Crews") {
80
+ if (data.mode === "CrewAI") {
82
81
  return !!data.crewUrl && !!data.crewBearerToken;
83
82
  }
84
83
  return true;
85
84
  },
86
85
  {
87
- message: "Crew URL and bearer token are required for CrewAI Crews",
86
+ message: "Crew URL and bearer token are required for CrewAI",
88
87
  path: ["crewUrl", "crewBearerToken"]
89
88
  }
90
89
  ).refine(
@@ -110,8 +109,7 @@ var ConfigFlags = {
110
109
  "crew-url": Flags.string({ description: "URL endpoint for your CrewAI agent" }),
111
110
  "crew-bearer-token": Flags.string({ description: "Bearer token for CrewAI authentication" }),
112
111
  "langsmith-api-key": Flags.string({ description: "LangSmith API key for LangGraph observability" }),
113
- "llm-token": Flags.string({ description: "API key for your preferred LLM provider" }),
114
- "crew-flow-agent": Flags.string({ description: "CrewAI Flow template to use", options: CREW_FLOW_TEMPLATES })
112
+ "llm-token": Flags.string({ description: "API key for your preferred LLM provider" })
115
113
  };
116
114
 
117
115
  // src/lib/init/types/templates.ts
@@ -122,11 +120,7 @@ var templateMapping = {
122
120
  LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,
123
121
  // CrewAI
124
122
  CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],
125
- CrewFlowsStarter: [
126
- `${BASE_URL}/coagents-starter-ui.json`,
127
- `${BASE_URL}/agent-layout.json`,
128
- `${BASE_URL}/remote-endpoint.json`
129
- ],
123
+ CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],
130
124
  // LangGraph
131
125
  LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,
132
126
  LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],
@@ -184,12 +178,12 @@ var questions = [
184
178
  }
185
179
  }
186
180
  },
187
- // CrewAI Crews specific questions - shown when CrewAI Crews selected
181
+ // CrewAI specific questions - shown when CrewAI Crews or Flows selected
188
182
  {
189
183
  type: "input",
190
184
  name: "crewName",
191
185
  message: "\u{1F465} What would you like to name your crew? (can be anything)",
192
- when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
186
+ when: (answers) => answers.mode === "CrewAI",
193
187
  default: "MyCopilotCrew",
194
188
  validate: validateRequired,
195
189
  sanitize: sanitizers.trim
@@ -198,7 +192,7 @@ var questions = [
198
192
  type: "input",
199
193
  name: "crewUrl",
200
194
  message: "\u{1F517} Enter your Crew's Enterprise URL (more info at https://app.crewai.com):",
201
- when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
195
+ when: (answers) => answers.mode === "CrewAI",
202
196
  validate: validateUrl,
203
197
  sanitize: sanitizers.url
204
198
  },
@@ -206,19 +200,11 @@ var questions = [
206
200
  type: "input",
207
201
  name: "crewBearerToken",
208
202
  message: "\u{1F511} Enter your Crew's bearer token:",
209
- when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
203
+ when: (answers) => answers.mode === "CrewAI",
210
204
  sensitive: true,
211
205
  validate: validateRequired,
212
206
  sanitize: sanitizers.trim
213
207
  },
214
- // CrewAI Flows specific questions - shown when CrewAI Flows selected
215
- {
216
- type: "select",
217
- name: "crewFlowAgent",
218
- message: "\u{1F4E6} Choose a CrewAI Flow Template",
219
- choices: Array.from(CREW_FLOW_TEMPLATES),
220
- when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Flows"
221
- },
222
208
  // LangGraph specific questions - shown when LangGraph selected
223
209
  {
224
210
  type: "yes/no",
@@ -292,7 +278,7 @@ var questions = [
292
278
  type: "input",
293
279
  name: "llmToken",
294
280
  message: "\u{1F511} Enter your OpenAI API key (required for LLM interfacing):",
295
- when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No" || answers.mode === "CrewAI" && answers.crewType === "Flows" || answers.mode === "Standard" && answers.useCopilotCloud !== "Yes" || answers.mode === "MCP" && answers.useCopilotCloud !== "Yes",
281
+ when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No" || answers.mode === "Standard" && answers.useCopilotCloud !== "Yes" || answers.mode === "MCP" && answers.useCopilotCloud !== "Yes",
296
282
  sensitive: true,
297
283
  validate: validateRequired,
298
284
  sanitize: sanitizers.apiKey
@@ -322,8 +308,8 @@ async function scaffoldShadCN(flags, userAnswers) {
322
308
  case "CrewAI":
323
309
  if (userAnswers.crewType === "Crews") {
324
310
  components.push(...templateMapping.CrewEnterprise);
325
- } else if (userAnswers.crewFlowAgent) {
326
- components.push(...templateMapping.CrewFlowsStarter);
311
+ } else if (userAnswers.crewType === "Flows") {
312
+ components.push(...templateMapping.CrewFlowsEnterprise);
327
313
  } else {
328
314
  components.push(templateMapping.RemoteEndpoint);
329
315
  }
@@ -425,12 +411,8 @@ async function scaffoldEnv(flags, userAnswers) {
425
411
  if (flags.runtimeUrl) {
426
412
  newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=${flags.runtimeUrl}
427
413
  `;
428
- } else if (userAnswers.useCopilotCloud !== "Yes" && userAnswers.crewType !== "Crews") {
414
+ } else if (userAnswers.useCopilotCloud !== "Yes" && userAnswers.crewType !== "Crews" && userAnswers.crewType !== "Flows") {
429
415
  newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=/api/copilotkit
430
- `;
431
- }
432
- if (userAnswers.crewFlowAgent === "Starter") {
433
- newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=sample_agent
434
416
  `;
435
417
  }
436
418
  if (userAnswers.langGraphPlatformUrl && userAnswers.langSmithApiKey) {
@@ -617,7 +599,7 @@ import chalk3 from "chalk";
617
599
  import path3 from "path";
618
600
  import fs4 from "fs";
619
601
  async function scaffoldAgent(userAnswers) {
620
- if (userAnswers.mode === "CrewAI" && userAnswers.crewType === "Crews" || userAnswers.mode === "LangGraph" && !userAnswers.langGraphAgent || userAnswers.mode === "Standard" || userAnswers.mode === "MCP") {
602
+ if (userAnswers.mode === "CrewAI" || userAnswers.mode === "LangGraph" && !userAnswers.langGraphAgent || userAnswers.mode === "Standard" || userAnswers.mode === "MCP") {
621
603
  return;
622
604
  }
623
605
  const spinner = ora2({
@@ -633,11 +615,6 @@ async function scaffoldAgent(userAnswers) {
633
615
  template = AgentTemplates.LangGraph.Starter.TypeScript;
634
616
  }
635
617
  break;
636
- case "CrewAI":
637
- if (userAnswers.crewFlowAgent === "Starter") {
638
- template = AgentTemplates.CrewAI.Flows.Starter;
639
- }
640
- break;
641
618
  }
642
619
  if (!template) {
643
620
  spinner.fail(chalk3.red("Failed to determine agent template"));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/init/types/questions.ts","../../../src/lib/init/utils.ts","../../../src/lib/init/types/templates.ts","../../../src/lib/init/questions.ts","../../../src/lib/init/scaffold/shadcn.ts","../../../src/lib/init/scaffold/env.ts","../../../src/lib/init/scaffold/langgraph-assistants.ts","../../../src/lib/init/scaffold/github.ts","../../../src/lib/init/scaffold/packages.ts","../../../src/lib/init/scaffold/agent.ts","../../../src/lib/init/scaffold/crew-inputs.ts"],"sourcesContent":["import {z} from 'zod'\nimport { Flags } from \"@oclif/core\"\nimport { isLocalhost } from \"../utils.js\"\n\n// ===== Core Constants =====\nexport const MODES = ['LangGraph', 'CrewAI', 'Mastra', 'AG2', 'MCP', 'Standard'] as const\nexport const CREW_TYPES = ['Crews', 'Flows'] as const\nexport const CHAT_COMPONENTS = ['CopilotChat', 'CopilotSidebar', 'Headless', 'CopilotPopup'] as const\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter'] as const\nexport const CREW_FLOW_TEMPLATES = ['Starter'] as const\nexport const YES_NO = ['Yes', 'No'] as const\n\n// ===== Sanitizers =====\nexport const sanitizers = {\n // Remove trailing slash from URLs\n url: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\/+$/, '')\n },\n\n // Trim whitespace from strings\n trim: (value: string): string => {\n if (!value) return value\n return value.trim()\n },\n\n // Lowercase strings\n lowercase: (value: string): string => {\n if (!value) return value\n return value.toLowerCase().trim()\n },\n\n // Clean API keys (remove whitespace)\n apiKey: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\s/g, '')\n },\n}\n\n// ===== Zod Schemas =====\n\n// Basic schemas\nexport const ModeSchema = z.enum(MODES)\nexport const CrewTypeSchema = z.enum(CREW_TYPES)\nexport const ChatComponentSchema = z.enum(CHAT_COMPONENTS)\nexport const LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS)\nexport const CrewFlowTemplateSchema = z.enum(CREW_FLOW_TEMPLATES)\nexport const YesNoSchema = z.enum(YES_NO)\n\n// URL validation schema with preprocessing to remove trailing slash\nexport const UrlSchema = z.preprocess(\n (val) => sanitizers.url(String(val)),\n z.string().url('Please enter a valid URL').min(1, 'URL is required'),\n)\n\n// Token validation schema with preprocessing to trim\nexport const TokenSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Token is required'))\n\n// API key validation schema with preprocessing to remove whitespace\nexport const ApiKeySchema = z.preprocess(\n (val) => sanitizers.apiKey(String(val)),\n z.string().min(1, 'API key is required'),\n)\n\n// Name validation schema with preprocessing to trim\nexport const NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Name is required'))\n\n// Config schema\nexport const ConfigSchema = z\n .object({\n // Core fields\n copilotKitVersion: z.string().optional(),\n mode: ModeSchema,\n chatUi: ChatComponentSchema.optional(),\n\n // Yes/No fields\n alreadyDeployed: YesNoSchema.optional(),\n fastApiEnabled: YesNoSchema.optional(),\n useCopilotCloud: YesNoSchema.optional(),\n\n // LangGraph specific fields\n langGraphAgent: LangGraphAgentSchema.optional(),\n langGraphPlatform: YesNoSchema.optional(),\n langGraphPlatformUrl: UrlSchema.optional(),\n langGraphRemoteEndpointURL: UrlSchema.optional(),\n\n // CrewAI specific fields\n crewType: CrewTypeSchema.optional(),\n crewName: NameSchema.optional(),\n crewUrl: UrlSchema.optional(),\n crewBearerToken: TokenSchema.optional(),\n crewFlowAgent: CrewFlowTemplateSchema.optional(),\n\n // API keys and tokens\n copilotCloudPublicApiKey: z.string().optional(),\n langSmithApiKey: ApiKeySchema.optional(),\n llmToken: ApiKeySchema.optional(),\n })\n .refine(\n (data) => {\n // If CrewAI is selected with Crews type, require crew URL and bearer token\n if (data.mode === 'CrewAI' && data.crewType === 'Crews') {\n return !!data.crewUrl && !!data.crewBearerToken\n }\n return true\n },\n {\n message: 'Crew URL and bearer token are required for CrewAI Crews',\n path: ['crewUrl', 'crewBearerToken'],\n },\n )\n .refine(\n (data) => {\n // If LangGraph is selected with LangGraph Platform, require platform URL and LangSmith API key\n if (data.mode === 'LangGraph' && data.alreadyDeployed === 'Yes' && data.langGraphPlatform === 'Yes') {\n return (!!data.langGraphPlatformUrl && !!data.langSmithApiKey) || isLocalhost(data.langGraphPlatformUrl || '');\n }\n return true\n },\n {\n message: 'LangGraph Platform URL and LangSmith API key are required',\n path: ['langGraphPlatformUrl', 'langSmithApiKey'],\n },\n )\n\n// Export the inferred type from the schema\nexport type Config = z.infer<typeof ConfigSchema>\n\n// Question type definition with improved validation and sanitization\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: keyof Config\n message: string\n choices?: readonly string[]\n default?: string\n when?: (answers: Partial<Config>) => boolean\n sensitive?: boolean\n validate?: (input: string) => true | string // Return true if valid, error message string if invalid\n sanitize?: (input: string) => string // Function to sanitize input before validation\n}\n\n// CLI flags definition with descriptions\nexport const ConfigFlags = {\n booth: Flags.boolean({description: 'Use CopilotKit in booth mode', default: false, char: 'b'}),\n mode: Flags.string({description: 'How you will be interacting with AI', options: MODES, char: 'm'}),\n 'copilotkit-version': Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n 'use-copilot-cloud': Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: YES_NO}),\n 'langgraph-agent': Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n 'crew-type': Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n 'crew-name': Flags.string({description: 'Name for your CrewAI agent'}),\n 'crew-url': Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n 'crew-bearer-token': Flags.string({description: 'Bearer token for CrewAI authentication'}),\n 'langsmith-api-key': Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n 'llm-token': Flags.string({description: 'API key for your preferred LLM provider'}),\n 'crew-flow-agent': Flags.string({description: 'CrewAI Flow template to use', options: CREW_FLOW_TEMPLATES}),\n}\n","export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0');\n}","export type ChatTemplate = 'CopilotChat' | 'CopilotPopup' | 'CopilotSidebar'\n\nexport type StarterTemplate =\n | 'LangGraphPlatform'\n | 'RemoteEndpoint'\n | 'Standard'\n | 'CrewEnterprise'\n | 'CrewFlowsStarter'\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = 'https://registry.copilotkit.ai/r'\n\nexport const templateMapping = {\n // Runtimes\n RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,\n LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,\n\n // CrewAI\n CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],\n CrewFlowsStarter: [\n `${BASE_URL}/coagents-starter-ui.json`,\n `${BASE_URL}/agent-layout.json`,\n `${BASE_URL}/remote-endpoint.json`,\n ],\n\n // LangGraph\n LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,\n LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],\n\n // No Agent\n StandardStarter: `${BASE_URL}/standard-starter.json`,\n StandardRuntime: `${BASE_URL}/standard-runtime.json`,\n\n // MCP\n McpStarter: `${BASE_URL}/mcp-starter.json`,\n McpRuntime: `${BASE_URL}/mcp-starter-runtime.json`,\n}\n","import {\n Question,\n CHAT_COMPONENTS,\n MODES,\n CREW_TYPES,\n LANGGRAPH_AGENTS,\n CREW_FLOW_TEMPLATES,\n ModeSchema,\n CrewTypeSchema,\n UrlSchema,\n YesNoSchema,\n sanitizers,\n} from './types/index.js'\nimport { isLocalhost } from './utils.js'\n\n// Validation helpers\nconst validateUrl = (input: string): true | string => {\n try {\n // First sanitize the URL by removing trailing slashes\n const sanitized = sanitizers.url(input)\n // Then validate\n const result = UrlSchema.safeParse(sanitized)\n if (result.success) return true\n return result.error.errors[0]?.message || 'Invalid URL format'\n } catch (error) {\n return 'Invalid URL format'\n }\n}\n\nconst validateRequired = (input: string): true | string => {\n return sanitizers.trim(input) ? true : 'This field is required'\n}\n\n// Single source of truth for all questions in the CLI\n// Organized in a logical flow with improved phrasing\nexport const questions: Question[] = [\n // Core setup questions - always shown first\n {\n type: 'select',\n name: 'mode',\n message: '🤖 How will you be interacting with AI?',\n choices: Array.from(MODES),\n validate: (input) => {\n try {\n ModeSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select a valid mode'\n }\n },\n },\n\n // CrewAI specific questions - shown when CrewAI selected\n {\n type: 'select',\n name: 'crewType',\n message: '👥 What kind of CrewAI implementation would you like to use?',\n choices: Array.from(CREW_TYPES),\n when: (answers) => answers.mode === 'CrewAI',\n validate: (input) => {\n try {\n CrewTypeSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select a valid crew type'\n }\n },\n },\n\n // CrewAI Crews specific questions - shown when CrewAI Crews selected\n {\n type: 'input',\n name: 'crewName',\n message: '👥 What would you like to name your crew? (can be anything)',\n when: (answers) => answers.mode === 'CrewAI' && answers.crewType === 'Crews',\n default: 'MyCopilotCrew',\n validate: validateRequired,\n sanitize: sanitizers.trim,\n },\n {\n type: 'input',\n name: 'crewUrl',\n message: \"🔗 Enter your Crew's Enterprise URL (more info at https://app.crewai.com):\",\n when: (answers) => answers.mode === 'CrewAI' && answers.crewType === 'Crews',\n validate: validateUrl,\n sanitize: sanitizers.url,\n },\n {\n type: 'input',\n name: 'crewBearerToken',\n message: \"🔑 Enter your Crew's bearer token:\",\n when: (answers) => answers.mode === 'CrewAI' && answers.crewType === 'Crews',\n sensitive: true,\n validate: validateRequired,\n sanitize: sanitizers.trim,\n },\n\n // CrewAI Flows specific questions - shown when CrewAI Flows selected\n {\n type: 'select',\n name: 'crewFlowAgent',\n message: '📦 Choose a CrewAI Flow Template',\n choices: Array.from(CREW_FLOW_TEMPLATES),\n when: (answers) => answers.mode === 'CrewAI' && answers.crewType === 'Flows',\n },\n\n // LangGraph specific questions - shown when LangGraph selected\n {\n type: 'yes/no',\n name: 'alreadyDeployed',\n message: '🦜🔗 Do you have an existing LangGraph agent?',\n when: (answers) => answers.mode === 'LangGraph',\n validate: (input) => {\n try {\n YesNoSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select Yes or No'\n }\n },\n },\n {\n type: 'yes/no',\n name: 'langGraphPlatform',\n message: '🦜🔗 Do you already have a LangGraph Agent URL? (remote or localhost)',\n when: (answers) => answers.mode === 'LangGraph' && answers.alreadyDeployed === 'Yes',\n validate: (input) => {\n try {\n YesNoSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select Yes or No'\n }\n },\n },\n {\n type: 'input',\n name: 'langGraphPlatformUrl',\n message: '🦜🔗 Enter your LangGraph Agent URL (remote or localhost)',\n when: (answers) =>\n answers.mode === 'LangGraph' && answers.alreadyDeployed === 'Yes' && answers.langGraphPlatform === 'Yes',\n validate: validateUrl,\n sanitize: sanitizers.url,\n },\n {\n type: 'select',\n name: 'langGraphAgent',\n message: '📦 Choose a LangGraph starter template:',\n choices: Array.from(LANGGRAPH_AGENTS),\n when: (answers) => answers.mode === 'LangGraph' && answers.alreadyDeployed === 'No',\n },\n {\n type: 'input',\n name: 'langSmithApiKey',\n message: '🦜🔗 Enter your LangSmith API key (required by LangGraph Platform) :',\n when: (answers) => \n answers.mode === 'LangGraph' && \n answers.langGraphPlatform === 'Yes' &&\n !(answers.langGraphPlatformUrl && isLocalhost(answers.langGraphPlatformUrl)),\n sensitive: true,\n validate: validateRequired,\n sanitize: sanitizers.apiKey,\n },\n\n // Deployment options\n {\n type: 'yes/no',\n name: 'useCopilotCloud',\n message: '🪁 Deploy with Copilot Cloud? (recommended for production)',\n when: (answers) => \n answers.mode === 'Standard' ||\n answers.mode === 'MCP' ||\n (\n answers.mode !== 'CrewAI' && // Crews only cloud, flows are self-hosted\n answers.alreadyDeployed === 'Yes' &&\n answers.langGraphPlatform !== 'No' &&\n answers.mode !== 'Mastra' &&\n answers.mode !== 'AG2' &&\n !isLocalhost(answers.langGraphPlatformUrl || '')\n ),\n validate: (input) => {\n try {\n YesNoSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select Yes or No'\n }\n },\n },\n {\n type: 'input',\n name: 'llmToken',\n message: '🔑 Enter your OpenAI API key (required for LLM interfacing):',\n when: (answers) =>\n (answers.mode === 'LangGraph' && answers.alreadyDeployed === 'No') ||\n (answers.mode === 'CrewAI' && answers.crewType === 'Flows') ||\n (answers.mode === 'Standard' && answers.useCopilotCloud !== 'Yes') ||\n (answers.mode === 'MCP' && answers.useCopilotCloud !== 'Yes'),\n sensitive: true,\n validate: validateRequired,\n sanitize: sanitizers.apiKey,\n },\n]\n","import spawn from 'cross-spawn'\nimport {templateMapping, Config} from '../types/index.js'\n\nexport async function scaffoldShadCN(flags: any, userAnswers: Config) {\n try {\n // Determine which components to install based on user choices\n const components: string[] = []\n \n // Add additional components based on agent framework\n switch (userAnswers.mode) {\n case 'LangGraph':\n if (userAnswers.langGraphAgent || flags.booth) {\n components.push(...templateMapping.LangGraphStarter)\n } else {\n components.push(templateMapping.LangGraphGeneric)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n if (userAnswers.langGraphPlatform === 'Yes') {\n components.push(templateMapping.LangGraphPlatformRuntime)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n }\n }\n break\n case 'CrewAI':\n if (userAnswers.crewType === 'Crews') {\n components.push(...templateMapping.CrewEnterprise)\n } else if (userAnswers.crewFlowAgent) {\n components.push(...templateMapping.CrewFlowsStarter)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n break\n case 'MCP':\n components.push(templateMapping.McpStarter)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n components.push(templateMapping.McpRuntime)\n }\n break\n case 'Standard':\n components.push(templateMapping.StandardStarter)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n components.push(templateMapping.StandardRuntime)\n }\n break\n default:\n return\n }\n\n // Small pause before running shadcn\n await new Promise((resolve) => setTimeout(resolve, 100))\n\n try {\n // Run shadcn with inherited stdio for all streams to allow for user input\n const result = spawn.sync('npx', ['shadcn@latest', 'add', ...components], {\n stdio: 'inherit', // This ensures stdin/stdout/stderr are all passed through\n })\n\n if (result.status !== 0) {\n throw new Error(`The shadcn installation process exited with code ${result.status}`)\n }\n } catch (error) {\n throw error\n }\n } catch (error) {\n throw error\n }\n}\n","import path from 'path'\nimport fs from 'fs'\nimport {Config} from '../types/index.js'\nimport {getLangGraphAgents} from './langgraph-assistants.js'\nimport inquirer from 'inquirer'\n\nexport async function scaffoldEnv(flags: any, userAnswers: Config) {\n try {\n // Define the env file path\n const envFile = path.join(process.cwd(), '.env')\n\n // Create the env file if it doesn't exist\n if (!fs.existsSync(envFile)) {\n fs.writeFileSync(envFile, '', 'utf8')\n } else {\n }\n\n // Build environment variables based on user selections\n let newEnvValues = ''\n\n // Copilot Cloud API key\n if (userAnswers.copilotCloudPublicApiKey) {\n newEnvValues += `NEXT_PUBLIC_COPILOT_API_KEY=${userAnswers.copilotCloudPublicApiKey}\\n`\n }\n\n // LangSmith API key (for LangGraph)\n if (userAnswers.langSmithApiKey) {\n // Add both formats for compatibility\n newEnvValues += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}\\n`\n }\n\n // LLM API key - set as both LLM_TOKEN and OPENAI_API_KEY for compatibility\n if (userAnswers.llmToken) {\n newEnvValues += `OPENAI_API_KEY=${userAnswers.llmToken}\\n`\n }\n\n // CrewAI name\n if (userAnswers.crewName) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=${userAnswers.crewName}\\n`\n }\n\n if (userAnswers.langGraphAgent) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=sample_agent\\n`\n newEnvValues += `LANGGRAPH_DEPLOYMENT_URL=http://localhost:8123\\n`\n } else if (userAnswers.langGraphPlatform === 'Yes' && userAnswers.useCopilotCloud === 'No') {\n newEnvValues += `LANGGRAPH_DEPLOYMENT_URL=${userAnswers.langGraphPlatformUrl}\\n`\n } else if (userAnswers.langGraphRemoteEndpointURL) {\n newEnvValues += `COPILOTKIT_REMOTE_ENDPOINT=${userAnswers.langGraphRemoteEndpointURL}\\n`\n }\n\n // Runtime URL if provided via flags\n if (flags.runtimeUrl) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=${flags.runtimeUrl}\\n`\n } else if (userAnswers.useCopilotCloud !== 'Yes' && userAnswers.crewType !== 'Crews') {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=/api/copilotkit\\n`\n }\n\n if (userAnswers.crewFlowAgent === 'Starter') {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=sample_agent\\n`\n }\n\n if (userAnswers.langGraphPlatformUrl && userAnswers.langSmithApiKey) {\n const langGraphAgents = await getLangGraphAgents(userAnswers.langGraphPlatformUrl, userAnswers.langSmithApiKey)\n let langGraphAgent = ''\n if (langGraphAgents.length > 1) {\n const {langGraphAgentChoice} = await inquirer.prompt([\n {\n type: 'list',\n name: 'langGraphAgentChoice',\n message: '🦜🔗 Which agent from your graph would you like to use?',\n choices: langGraphAgents.map((agent: any) => ({\n name: agent.graph_id,\n value: agent.graph_id,\n })),\n },\n ])\n langGraphAgent = langGraphAgentChoice\n } else if (langGraphAgents.length === 1) {\n langGraphAgent = langGraphAgents[0].graph_id\n } else {\n throw new Error('No agents found in your LangGraph endpoint')\n }\n\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=${langGraphAgent}\\n`\n }\n\n // Append the variables to the .env file\n if (newEnvValues) {\n fs.appendFileSync(envFile, newEnvValues)\n }\n } catch (error) {\n throw error\n }\n}\n","export type LangGraphAgent = {\n assistant_id: string\n graph_id: string\n config: {\n tags: string[]\n recursion_limit: number\n configurable: Record<string, any>\n }\n created_at: string\n updated_at: string\n metadata: Record<string, any>\n version: number\n name: string\n description: string\n}\n\nexport async function getLangGraphAgents(url: string, langSmithApiKey: string) {\n try {\n const response = await fetch(`${url.trim().replace(/\\/$/, '')}/assistants/search`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Api-Key': langSmithApiKey,\n },\n body: JSON.stringify({\n limit: 10,\n offset: 0,\n }),\n })\n\n return (await response.json()) as LangGraphAgent[]\n } catch (error) {\n throw new Error(`Failed to get LangGraph agents: ${error}`)\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(owner, repo, branch, subdirectoryPath, destinationPath, spinner)\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`, {cwd: tempDir, stdio: 'pipe'})\n\n // Enable sparse checkout\n execSync('git config core.sparseCheckout true', {cwd: tempDir, stdio: 'pipe'})\n\n // Specify which subdirectory to checkout\n fs.writeFileSync(path.join(tempDir, '.git/info/sparse-checkout'), subdirectoryPath)\n\n spinner.text = chalk.cyan('Downloading agent files...')\n\n // Pull only the specified branch\n execSync(`git pull origin ${branch} --depth=1`, {cwd: tempDir, stdio: 'pipe'})\n\n // Copy the subdirectory to the destination\n const sourcePath = path.join(tempDir, subdirectoryPath)\n if (!fs.existsSync(sourcePath)) {\n throw new Error(`Subdirectory '${subdirectoryPath}' not found in the repository.`)\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(source: string, destination: string): 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 (pathParts.length > 3 && (pathParts[2] === 'tree' || pathParts[2] === 'blob')) {\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 parsedUrl.hostname === 'github.com' && parsedUrl.pathname.split('/').filter(Boolean).length >= 2\n } catch {\n return false\n }\n}\n","/*\n Currently unusued but will be used in the future once we have more time to think\n about what to use outside of shadcn/ui.\n*/\n\nimport spawn from 'cross-spawn'\nimport {Config} from '../types/index.js'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport ora from 'ora'\n\ntype PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport async function scaffoldPackages(userAnswers: Config) {\n const spinner = ora({\n text: chalk.cyan('Preparing to install packages...'),\n color: 'cyan',\n }).start()\n\n try {\n const packages = [\n `@copilotkit/react-ui@${userAnswers.copilotKitVersion}`,\n `@copilotkit/react-core@${userAnswers.copilotKitVersion}`,\n `@copilotkit/runtime@${userAnswers.copilotKitVersion}`,\n ]\n\n // Small pause before starting\n await new Promise((resolve) => setTimeout(resolve, 50))\n\n const packageManager = detectPackageManager()\n const installCommand = detectInstallCommand(packageManager)\n\n spinner.text = chalk.cyan(`Using ${packageManager} to install packages...`)\n\n // Pause the spinner for the package installation\n spinner.stop()\n\n console.log(chalk.cyan('\\n⚙️ Installing packages...\\n'))\n\n const result = spawn.sync(packageManager, [installCommand, ...packages], {\n stdio: 'inherit', // This ensures stdin/stdout/stderr are all passed through\n })\n\n if (result.status !== 0) {\n throw new Error(`Package installation process exited with code ${result.status}`)\n }\n\n // Resume the spinner for success message\n spinner.start()\n spinner.succeed(chalk.green('CopilotKit packages installed successfully'))\n } catch (error) {\n // Use spinner for consistent error reporting\n if (!spinner.isSpinning) {\n spinner.start()\n }\n spinner.fail(chalk.red('Failed to install CopilotKit packages'))\n throw error\n }\n}\n\nfunction detectPackageManager(): PackageManager {\n // Check for lock files in the current directory\n const files = fs.readdirSync(process.cwd())\n\n if (files.includes('bun.lockb')) return 'bun'\n if (files.includes('pnpm-lock.yaml')) return 'pnpm'\n if (files.includes('yarn.lock')) return 'yarn'\n if (files.includes('package-lock.json')) return 'npm'\n\n // Default to npm if no lock file found\n return 'npm'\n}\n\nfunction detectInstallCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case 'yarn':\n case 'pnpm':\n return 'add'\n default:\n return 'install'\n }\n}\n","import ora from 'ora'\nimport chalk from 'chalk'\nimport {cloneGitHubSubdirectory} from './github.js'\nimport {Config} from '../types/index.js'\nimport path from 'path'\nimport fs from 'fs'\n\nexport async function scaffoldAgent(userAnswers: Config) {\n if (\n (userAnswers.mode === 'CrewAI' && userAnswers.crewType === 'Crews') ||\n (userAnswers.mode === 'LangGraph' && !userAnswers.langGraphAgent) ||\n userAnswers.mode === 'Standard' ||\n userAnswers.mode === 'MCP'\n ) {\n return\n }\n\n const spinner = ora({\n text: chalk.cyan('Setting up AI agent...'),\n color: 'cyan',\n }).start()\n\n let template = ''\n switch (userAnswers.mode) {\n case 'LangGraph':\n if (userAnswers.langGraphAgent === 'Python Starter') {\n template = AgentTemplates.LangGraph.Starter.Python\n } else {\n template = AgentTemplates.LangGraph.Starter.TypeScript\n }\n break\n case 'CrewAI':\n if (userAnswers.crewFlowAgent === 'Starter') {\n template = AgentTemplates.CrewAI.Flows.Starter\n }\n break\n }\n\n if (!template) {\n spinner.fail(chalk.red('Failed to determine agent template'))\n throw new Error('Failed to determine agent template')\n }\n\n const agentDir = path.join(process.cwd(), 'agent')\n\n try {\n await cloneGitHubSubdirectory(template, agentDir, spinner)\n\n // Create .env file in the agent directory\n spinner.text = chalk.cyan('Creating agent environment variables...')\n\n let envContent = ''\n\n // Add OpenAI API key if provided\n if (userAnswers.llmToken) {\n envContent += `OPENAI_API_KEY=${userAnswers.llmToken}\\n`\n }\n\n // Add LangSmith API key for LangGraph\n if (userAnswers.mode === 'LangGraph' && userAnswers.langSmithApiKey) {\n envContent += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}\\n`\n }\n\n if (envContent) {\n const agentEnvFile = path.join(agentDir, '.env')\n fs.writeFileSync(agentEnvFile, envContent, 'utf8')\n spinner.text = chalk.cyan('Added API keys to agent .env file')\n }\n\n // Add LangSmith API key for LangGraph\n if (userAnswers.mode === 'LangGraph' && userAnswers.langSmithApiKey) {\n envContent += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}\\n`\n }\n\n if (envContent) {\n const agentEnvFile = path.join(agentDir, '.env')\n fs.writeFileSync(agentEnvFile, envContent, 'utf8')\n spinner.text = chalk.cyan('Added API keys to agent .env file')\n }\n\n if (envContent) {\n const agentEnvFile = path.join(agentDir, '.env')\n fs.writeFileSync(agentEnvFile, envContent, 'utf8')\n spinner.text = chalk.cyan('Added API keys to agent .env file')\n }\n } catch (error) {\n spinner.fail(chalk.red('Failed to clone agent template'))\n throw error\n }\n\n spinner.succeed(`${userAnswers.mode} agent cloned successfully`)\n}\n\nexport const AgentTemplates = {\n LangGraph: {\n Starter: {\n Python: 'https://github.com/CopilotKit/coagents-starter-langgraph/tree/main/agent-py',\n TypeScript: 'https://github.com/CopilotKit/coagents-starter-langgraph/tree/main/agent-js',\n },\n },\n CrewAI: {\n Flows: {\n Starter: 'https://github.com/CopilotKit/coagents-starter-crewai-flows/tree/main/agent-py',\n },\n },\n}\n","import * as fs from 'fs/promises'\nimport ora from 'ora'\nimport * as path from 'path'\n\nexport async function addCrewInputs(url: string, token: string) {\n try {\n const spinner = ora('Analyzing crew inputs...').start()\n // Get inputs from the crew API\n const inputs = await getCrewInputs(url, token)\n spinner.text = 'Adding inputs to app/copilotkit/page.tsx...'\n\n // Path to the file we need to modify\n let filePath = path.join(process.cwd(), 'app', 'copilotkit', 'page.tsx')\n\n // check if non-src file exists\n try {\n await fs.access(filePath)\n } catch {\n filePath = path.join(process.cwd(), 'src', 'app', 'copilotkit', 'page.tsx')\n }\n\n // check if src file exists\n try {\n await fs.access(filePath)\n } catch {\n throw new Error('app/copilotkit/page.tsx and src/app/copilotkit/page.tsx not found')\n }\n\n // Read the file content\n let fileContent = await fs.readFile(filePath, 'utf8')\n\n // Replace all instances of \"YOUR_INPUTS_HERE\" with the inputs array as a string\n const inputsString = JSON.stringify(inputs)\n fileContent = fileContent.replace(/\\[[\"']YOUR_INPUTS_HERE[\"']\\]/g, inputsString)\n\n // Write the updated content back to the file\n await fs.writeFile(filePath, fileContent, 'utf8')\n\n spinner.succeed('Successfully added crew inputs to app/copilotkit/page.tsx')\n } catch (error) {\n console.error('Error updating crew inputs:', error)\n throw error\n }\n}\n\nasync function getCrewInputs(url: string, token: string): Promise<string[]> {\n const response = await fetch(`${url.trim()}/inputs`, {\n headers: {\n Authorization: `Bearer ${token}`,\n },\n })\n\n if (!response.ok) {\n throw new Error(`Failed to fetch inputs: ${response.statusText}`)\n }\n\n const data = (await response.json()) as {inputs: string[]}\n return data.inputs\n}\n"],"mappings":";AAAA,SAAQ,SAAQ;AAChB,SAAS,aAAa;;;ACDf,IAAM,cAAc,CAAC,QAAyB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AC1E,QAAM,WAAW,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,WAAW;AAAA,IACnD,SAAS;AAAA,MACP,eAAe,UAAU,KAAK;AAAA,IAChC;AAAA,EACF,CAAC;AAED,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,IAAI,MAAM,2BAA2B,SAAS,UAAU,EAAE;AAAA,EAClE;AAEA,QAAM,OAAQ,MAAM,SAAS,KAAK;AAClC,SAAO,KAAK;AACd;","names":["fs","path","spawn","chalk","fs","ora","chalk","path","fs","ora","chalk","fs","ora","path"]}
1
+ {"version":3,"sources":["../../../src/lib/init/types/questions.ts","../../../src/lib/init/utils.ts","../../../src/lib/init/types/templates.ts","../../../src/lib/init/questions.ts","../../../src/lib/init/scaffold/shadcn.ts","../../../src/lib/init/scaffold/env.ts","../../../src/lib/init/scaffold/langgraph-assistants.ts","../../../src/lib/init/scaffold/github.ts","../../../src/lib/init/scaffold/packages.ts","../../../src/lib/init/scaffold/agent.ts","../../../src/lib/init/scaffold/crew-inputs.ts"],"sourcesContent":["import {z} from 'zod'\nimport {Flags} from '@oclif/core'\nimport {isLocalhost} from '../utils.js'\n\n// ===== Core Constants =====\nexport const MODES = ['LangGraph', 'CrewAI', 'Mastra', 'AG2', 'MCP', 'Standard'] as const\nexport const CREW_TYPES = ['Crews', 'Flows'] as const\nexport const CHAT_COMPONENTS = ['CopilotChat', 'CopilotSidebar', 'Headless', 'CopilotPopup'] as const\nexport const LANGGRAPH_AGENTS = ['Python Starter', 'TypeScript Starter'] as const\nexport const CREW_FLOW_TEMPLATES = ['Starter'] as const\nexport const YES_NO = ['Yes', 'No'] as const\n\n// ===== Sanitizers =====\nexport const sanitizers = {\n // Remove trailing slash from URLs\n url: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\/+$/, '')\n },\n\n // Trim whitespace from strings\n trim: (value: string): string => {\n if (!value) return value\n return value.trim()\n },\n\n // Lowercase strings\n lowercase: (value: string): string => {\n if (!value) return value\n return value.toLowerCase().trim()\n },\n\n // Clean API keys (remove whitespace)\n apiKey: (value: string): string => {\n if (!value) return value\n return value.trim().replace(/\\s/g, '')\n },\n}\n\n// ===== Zod Schemas =====\n\n// Basic schemas\nexport const ModeSchema = z.enum(MODES)\nexport const CrewTypeSchema = z.enum(CREW_TYPES)\nexport const ChatComponentSchema = z.enum(CHAT_COMPONENTS)\nexport const LangGraphAgentSchema = z.enum(LANGGRAPH_AGENTS)\nexport const CrewFlowTemplateSchema = z.enum(CREW_FLOW_TEMPLATES)\nexport const YesNoSchema = z.enum(YES_NO)\n\n// URL validation schema with preprocessing to remove trailing slash\nexport const UrlSchema = z.preprocess(\n (val) => sanitizers.url(String(val)),\n z.string().url('Please enter a valid URL').min(1, 'URL is required'),\n)\n\n// Token validation schema with preprocessing to trim\nexport const TokenSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Token is required'))\n\n// API key validation schema with preprocessing to remove whitespace\nexport const ApiKeySchema = z.preprocess(\n (val) => sanitizers.apiKey(String(val)),\n z.string().min(1, 'API key is required'),\n)\n\n// Name validation schema with preprocessing to trim\nexport const NameSchema = z.preprocess((val) => sanitizers.trim(String(val)), z.string().min(1, 'Name is required'))\n\n// Config schema\nexport const ConfigSchema = z\n .object({\n // Core fields\n copilotKitVersion: z.string().optional(),\n mode: ModeSchema,\n chatUi: ChatComponentSchema.optional(),\n\n // Yes/No fields\n alreadyDeployed: YesNoSchema.optional(),\n fastApiEnabled: YesNoSchema.optional(),\n useCopilotCloud: YesNoSchema.optional(),\n\n // LangGraph specific fields\n langGraphAgent: LangGraphAgentSchema.optional(),\n langGraphPlatform: YesNoSchema.optional(),\n langGraphPlatformUrl: UrlSchema.optional(),\n langGraphRemoteEndpointURL: UrlSchema.optional(),\n\n // CrewAI specific fields\n crewType: CrewTypeSchema.optional(),\n crewName: NameSchema.optional(),\n crewUrl: UrlSchema.optional(),\n crewBearerToken: TokenSchema.optional(),\n\n // API keys and tokens\n copilotCloudPublicApiKey: z.string().optional(),\n langSmithApiKey: ApiKeySchema.optional(),\n llmToken: ApiKeySchema.optional(),\n })\n .refine(\n (data) => {\n // If CrewAI is selected, require crew URL and bearer token\n if (data.mode === 'CrewAI') {\n return !!data.crewUrl && !!data.crewBearerToken\n }\n return true\n },\n {\n message: 'Crew URL and bearer token are required for CrewAI',\n path: ['crewUrl', 'crewBearerToken'],\n },\n )\n .refine(\n (data) => {\n // If LangGraph is selected with LangGraph Platform, require platform URL and LangSmith API key\n if (data.mode === 'LangGraph' && data.alreadyDeployed === 'Yes' && data.langGraphPlatform === 'Yes') {\n return (!!data.langGraphPlatformUrl && !!data.langSmithApiKey) || isLocalhost(data.langGraphPlatformUrl || '')\n }\n return true\n },\n {\n message: 'LangGraph Platform URL and LangSmith API key are required',\n path: ['langGraphPlatformUrl', 'langSmithApiKey'],\n },\n )\n\n// Export the inferred type from the schema\nexport type Config = z.infer<typeof ConfigSchema>\n\n// Question type definition with improved validation and sanitization\nexport type Question = {\n type: 'input' | 'yes/no' | 'select'\n name: keyof Config\n message: string\n choices?: readonly string[]\n default?: string\n when?: (answers: Partial<Config>) => boolean\n sensitive?: boolean\n validate?: (input: string) => true | string // Return true if valid, error message string if invalid\n sanitize?: (input: string) => string // Function to sanitize input before validation\n}\n\n// CLI flags definition with descriptions\nexport const ConfigFlags = {\n booth: Flags.boolean({description: 'Use CopilotKit in booth mode', default: false, char: 'b'}),\n mode: Flags.string({description: 'How you will be interacting with AI', options: MODES, char: 'm'}),\n 'copilotkit-version': Flags.string({description: 'CopilotKit version to use (e.g. 1.7.0)'}),\n 'use-copilot-cloud': Flags.string({description: 'Use Copilot Cloud for production-ready hosting', options: YES_NO}),\n 'langgraph-agent': Flags.string({description: 'LangGraph agent template to use', options: LANGGRAPH_AGENTS}),\n 'crew-type': Flags.string({description: 'CrewAI implementation type', options: CREW_TYPES}),\n 'crew-name': Flags.string({description: 'Name for your CrewAI agent'}),\n 'crew-url': Flags.string({description: 'URL endpoint for your CrewAI agent'}),\n 'crew-bearer-token': Flags.string({description: 'Bearer token for CrewAI authentication'}),\n 'langsmith-api-key': Flags.string({description: 'LangSmith API key for LangGraph observability'}),\n 'llm-token': Flags.string({description: 'API key for your preferred LLM provider'}),\n}\n","export const isLocalhost = (url: string): boolean => {\n return url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0')\n}\n","export type ChatTemplate = 'CopilotChat' | 'CopilotPopup' | 'CopilotSidebar'\n\nexport type StarterTemplate =\n | 'LangGraphPlatform'\n | 'RemoteEndpoint'\n | 'Standard'\n | 'CrewEnterprise'\n | 'CrewFlowsStarter'\n\nexport type Template = ChatTemplate | StarterTemplate\n\nconst BASE_URL = 'https://registry.copilotkit.ai/r'\n\nexport const templateMapping = {\n // Runtimes\n RemoteEndpoint: `${BASE_URL}/remote-endpoint-starter.json`,\n LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,\n\n // CrewAI\n CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],\n CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],\n\n // LangGraph\n LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,\n LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],\n\n // No Agent\n StandardStarter: `${BASE_URL}/standard-starter.json`,\n StandardRuntime: `${BASE_URL}/standard-runtime.json`,\n\n // MCP\n McpStarter: `${BASE_URL}/mcp-starter.json`,\n McpRuntime: `${BASE_URL}/mcp-starter-runtime.json`,\n}\n","import {\n Question,\n CHAT_COMPONENTS,\n MODES,\n CREW_TYPES,\n LANGGRAPH_AGENTS,\n CREW_FLOW_TEMPLATES,\n ModeSchema,\n CrewTypeSchema,\n UrlSchema,\n YesNoSchema,\n sanitizers,\n} from './types/index.js'\nimport {isLocalhost} from './utils.js'\n\n// Validation helpers\nconst validateUrl = (input: string): true | string => {\n try {\n // First sanitize the URL by removing trailing slashes\n const sanitized = sanitizers.url(input)\n // Then validate\n const result = UrlSchema.safeParse(sanitized)\n if (result.success) return true\n return result.error.errors[0]?.message || 'Invalid URL format'\n } catch (error) {\n return 'Invalid URL format'\n }\n}\n\nconst validateRequired = (input: string): true | string => {\n return sanitizers.trim(input) ? true : 'This field is required'\n}\n\n// Single source of truth for all questions in the CLI\n// Organized in a logical flow with improved phrasing\nexport const questions: Question[] = [\n // Core setup questions - always shown first\n {\n type: 'select',\n name: 'mode',\n message: '🤖 How will you be interacting with AI?',\n choices: Array.from(MODES),\n validate: (input) => {\n try {\n ModeSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select a valid mode'\n }\n },\n },\n\n // CrewAI specific questions - shown when CrewAI selected\n {\n type: 'select',\n name: 'crewType',\n message: '👥 What kind of CrewAI implementation would you like to use?',\n choices: Array.from(CREW_TYPES),\n when: (answers) => answers.mode === 'CrewAI',\n validate: (input) => {\n try {\n CrewTypeSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select a valid crew type'\n }\n },\n },\n\n // CrewAI specific questions - shown when CrewAI Crews or Flows selected\n {\n type: 'input',\n name: 'crewName',\n message: '👥 What would you like to name your crew? (can be anything)',\n when: (answers) => answers.mode === 'CrewAI',\n default: 'MyCopilotCrew',\n validate: validateRequired,\n sanitize: sanitizers.trim,\n },\n {\n type: 'input',\n name: 'crewUrl',\n message: \"🔗 Enter your Crew's Enterprise URL (more info at https://app.crewai.com):\",\n when: (answers) => answers.mode === 'CrewAI',\n validate: validateUrl,\n sanitize: sanitizers.url,\n },\n {\n type: 'input',\n name: 'crewBearerToken',\n message: \"🔑 Enter your Crew's bearer token:\",\n when: (answers) => answers.mode === 'CrewAI',\n sensitive: true,\n validate: validateRequired,\n sanitize: sanitizers.trim,\n },\n\n // LangGraph specific questions - shown when LangGraph selected\n {\n type: 'yes/no',\n name: 'alreadyDeployed',\n message: '🦜🔗 Do you have an existing LangGraph agent?',\n when: (answers) => answers.mode === 'LangGraph',\n validate: (input) => {\n try {\n YesNoSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select Yes or No'\n }\n },\n },\n {\n type: 'yes/no',\n name: 'langGraphPlatform',\n message: '🦜🔗 Do you already have a LangGraph Agent URL? (remote or localhost)',\n when: (answers) => answers.mode === 'LangGraph' && answers.alreadyDeployed === 'Yes',\n validate: (input) => {\n try {\n YesNoSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select Yes or No'\n }\n },\n },\n {\n type: 'input',\n name: 'langGraphPlatformUrl',\n message: '🦜🔗 Enter your LangGraph Agent URL (remote or localhost)',\n when: (answers) =>\n answers.mode === 'LangGraph' && answers.alreadyDeployed === 'Yes' && answers.langGraphPlatform === 'Yes',\n validate: validateUrl,\n sanitize: sanitizers.url,\n },\n {\n type: 'select',\n name: 'langGraphAgent',\n message: '📦 Choose a LangGraph starter template:',\n choices: Array.from(LANGGRAPH_AGENTS),\n when: (answers) => answers.mode === 'LangGraph' && answers.alreadyDeployed === 'No',\n },\n {\n type: 'input',\n name: 'langSmithApiKey',\n message: '🦜🔗 Enter your LangSmith API key (required by LangGraph Platform) :',\n when: (answers) =>\n answers.mode === 'LangGraph' &&\n answers.langGraphPlatform === 'Yes' &&\n !(answers.langGraphPlatformUrl && isLocalhost(answers.langGraphPlatformUrl)),\n sensitive: true,\n validate: validateRequired,\n sanitize: sanitizers.apiKey,\n },\n\n // Deployment options\n {\n type: 'yes/no',\n name: 'useCopilotCloud',\n message: '🪁 Deploy with Copilot Cloud? (recommended for production)',\n when: (answers) =>\n answers.mode === 'Standard' ||\n answers.mode === 'MCP' ||\n (answers.mode !== 'CrewAI' && // Crews only cloud, flows are self-hosted\n answers.alreadyDeployed === 'Yes' &&\n answers.langGraphPlatform !== 'No' &&\n answers.mode !== 'Mastra' &&\n answers.mode !== 'AG2' &&\n !isLocalhost(answers.langGraphPlatformUrl || '')),\n validate: (input) => {\n try {\n YesNoSchema.parse(input)\n return true\n } catch (error) {\n return 'Please select Yes or No'\n }\n },\n },\n {\n type: 'input',\n name: 'llmToken',\n message: '🔑 Enter your OpenAI API key (required for LLM interfacing):',\n when: (answers) =>\n (answers.mode === 'LangGraph' && answers.alreadyDeployed === 'No') ||\n (answers.mode === 'Standard' && answers.useCopilotCloud !== 'Yes') ||\n (answers.mode === 'MCP' && answers.useCopilotCloud !== 'Yes'),\n sensitive: true,\n validate: validateRequired,\n sanitize: sanitizers.apiKey,\n },\n]\n","import spawn from 'cross-spawn'\nimport {templateMapping, Config} from '../types/index.js'\n\nexport async function scaffoldShadCN(flags: any, userAnswers: Config) {\n try {\n // Determine which components to install based on user choices\n const components: string[] = []\n\n // Add additional components based on agent framework\n switch (userAnswers.mode) {\n case 'LangGraph':\n if (userAnswers.langGraphAgent || flags.booth) {\n components.push(...templateMapping.LangGraphStarter)\n } else {\n components.push(templateMapping.LangGraphGeneric)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n if (userAnswers.langGraphPlatform === 'Yes') {\n components.push(templateMapping.LangGraphPlatformRuntime)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n }\n }\n break\n case 'CrewAI':\n if (userAnswers.crewType === 'Crews') {\n components.push(...templateMapping.CrewEnterprise)\n } else if (userAnswers.crewType === 'Flows') {\n components.push(...templateMapping.CrewFlowsEnterprise)\n } else {\n components.push(templateMapping.RemoteEndpoint)\n }\n break\n case 'MCP':\n components.push(templateMapping.McpStarter)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n components.push(templateMapping.McpRuntime)\n }\n break\n case 'Standard':\n components.push(templateMapping.StandardStarter)\n if (userAnswers.useCopilotCloud !== 'Yes') {\n components.push(templateMapping.StandardRuntime)\n }\n break\n default:\n return\n }\n\n // Small pause before running shadcn\n await new Promise((resolve) => setTimeout(resolve, 100))\n\n try {\n // Run shadcn with inherited stdio for all streams to allow for user input\n const result = spawn.sync('npx', ['shadcn@latest', 'add', ...components], {\n stdio: 'inherit', // This ensures stdin/stdout/stderr are all passed through\n })\n\n if (result.status !== 0) {\n throw new Error(`The shadcn installation process exited with code ${result.status}`)\n }\n } catch (error) {\n throw error\n }\n } catch (error) {\n throw error\n }\n}\n","import path from 'path'\nimport fs from 'fs'\nimport {Config} from '../types/index.js'\nimport {getLangGraphAgents} from './langgraph-assistants.js'\nimport inquirer from 'inquirer'\n\nexport async function scaffoldEnv(flags: any, userAnswers: Config) {\n try {\n // Define the env file path\n const envFile = path.join(process.cwd(), '.env')\n\n // Create the env file if it doesn't exist\n if (!fs.existsSync(envFile)) {\n fs.writeFileSync(envFile, '', 'utf8')\n } else {\n }\n\n // Build environment variables based on user selections\n let newEnvValues = ''\n\n // Copilot Cloud API key\n if (userAnswers.copilotCloudPublicApiKey) {\n newEnvValues += `NEXT_PUBLIC_COPILOT_API_KEY=${userAnswers.copilotCloudPublicApiKey}\\n`\n }\n\n // LangSmith API key (for LangGraph)\n if (userAnswers.langSmithApiKey) {\n // Add both formats for compatibility\n newEnvValues += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}\\n`\n }\n\n // LLM API key - set as both LLM_TOKEN and OPENAI_API_KEY for compatibility\n if (userAnswers.llmToken) {\n newEnvValues += `OPENAI_API_KEY=${userAnswers.llmToken}\\n`\n }\n\n // CrewAI name\n if (userAnswers.crewName) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=${userAnswers.crewName}\\n`\n }\n\n if (userAnswers.langGraphAgent) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=sample_agent\\n`\n newEnvValues += `LANGGRAPH_DEPLOYMENT_URL=http://localhost:8123\\n`\n } else if (userAnswers.langGraphPlatform === 'Yes' && userAnswers.useCopilotCloud === 'No') {\n newEnvValues += `LANGGRAPH_DEPLOYMENT_URL=${userAnswers.langGraphPlatformUrl}\\n`\n } else if (userAnswers.langGraphRemoteEndpointURL) {\n newEnvValues += `COPILOTKIT_REMOTE_ENDPOINT=${userAnswers.langGraphRemoteEndpointURL}\\n`\n }\n\n // Runtime URL if provided via flags\n if (flags.runtimeUrl) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=${flags.runtimeUrl}\\n`\n } else if (\n userAnswers.useCopilotCloud !== 'Yes' &&\n userAnswers.crewType !== 'Crews' &&\n userAnswers.crewType !== 'Flows'\n ) {\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_RUNTIME_URL=/api/copilotkit\\n`\n }\n\n if (userAnswers.langGraphPlatformUrl && userAnswers.langSmithApiKey) {\n const langGraphAgents = await getLangGraphAgents(userAnswers.langGraphPlatformUrl, userAnswers.langSmithApiKey)\n let langGraphAgent = ''\n if (langGraphAgents.length > 1) {\n const {langGraphAgentChoice} = await inquirer.prompt([\n {\n type: 'list',\n name: 'langGraphAgentChoice',\n message: '🦜🔗 Which agent from your graph would you like to use?',\n choices: langGraphAgents.map((agent: any) => ({\n name: agent.graph_id,\n value: agent.graph_id,\n })),\n },\n ])\n langGraphAgent = langGraphAgentChoice\n } else if (langGraphAgents.length === 1) {\n langGraphAgent = langGraphAgents[0].graph_id\n } else {\n throw new Error('No agents found in your LangGraph endpoint')\n }\n\n newEnvValues += `NEXT_PUBLIC_COPILOTKIT_AGENT_NAME=${langGraphAgent}\\n`\n }\n\n // Append the variables to the .env file\n if (newEnvValues) {\n fs.appendFileSync(envFile, newEnvValues)\n }\n } catch (error) {\n throw error\n }\n}\n","export type LangGraphAgent = {\n assistant_id: string\n graph_id: string\n config: {\n tags: string[]\n recursion_limit: number\n configurable: Record<string, any>\n }\n created_at: string\n updated_at: string\n metadata: Record<string, any>\n version: number\n name: string\n description: string\n}\n\nexport async function getLangGraphAgents(url: string, langSmithApiKey: string) {\n try {\n const response = await fetch(`${url.trim().replace(/\\/$/, '')}/assistants/search`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Api-Key': langSmithApiKey,\n },\n body: JSON.stringify({\n limit: 10,\n offset: 0,\n }),\n })\n\n return (await response.json()) as LangGraphAgent[]\n } catch (error) {\n throw new Error(`Failed to get LangGraph agents: ${error}`)\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(owner, repo, branch, subdirectoryPath, destinationPath, spinner)\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`, {cwd: tempDir, stdio: 'pipe'})\n\n // Enable sparse checkout\n execSync('git config core.sparseCheckout true', {cwd: tempDir, stdio: 'pipe'})\n\n // Specify which subdirectory to checkout\n fs.writeFileSync(path.join(tempDir, '.git/info/sparse-checkout'), subdirectoryPath)\n\n spinner.text = chalk.cyan('Downloading agent files...')\n\n // Pull only the specified branch\n execSync(`git pull origin ${branch} --depth=1`, {cwd: tempDir, stdio: 'pipe'})\n\n // Copy the subdirectory to the destination\n const sourcePath = path.join(tempDir, subdirectoryPath)\n if (!fs.existsSync(sourcePath)) {\n throw new Error(`Subdirectory '${subdirectoryPath}' not found in the repository.`)\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(source: string, destination: string): 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 (pathParts.length > 3 && (pathParts[2] === 'tree' || pathParts[2] === 'blob')) {\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 parsedUrl.hostname === 'github.com' && parsedUrl.pathname.split('/').filter(Boolean).length >= 2\n } catch {\n return false\n }\n}\n","/*\n Currently unusued but will be used in the future once we have more time to think\n about what to use outside of shadcn/ui.\n*/\n\nimport spawn from 'cross-spawn'\nimport {Config} from '../types/index.js'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport ora from 'ora'\n\ntype PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport async function scaffoldPackages(userAnswers: Config) {\n const spinner = ora({\n text: chalk.cyan('Preparing to install packages...'),\n color: 'cyan',\n }).start()\n\n try {\n const packages = [\n `@copilotkit/react-ui@${userAnswers.copilotKitVersion}`,\n `@copilotkit/react-core@${userAnswers.copilotKitVersion}`,\n `@copilotkit/runtime@${userAnswers.copilotKitVersion}`,\n ]\n\n // Small pause before starting\n await new Promise((resolve) => setTimeout(resolve, 50))\n\n const packageManager = detectPackageManager()\n const installCommand = detectInstallCommand(packageManager)\n\n spinner.text = chalk.cyan(`Using ${packageManager} to install packages...`)\n\n // Pause the spinner for the package installation\n spinner.stop()\n\n console.log(chalk.cyan('\\n⚙️ Installing packages...\\n'))\n\n const result = spawn.sync(packageManager, [installCommand, ...packages], {\n stdio: 'inherit', // This ensures stdin/stdout/stderr are all passed through\n })\n\n if (result.status !== 0) {\n throw new Error(`Package installation process exited with code ${result.status}`)\n }\n\n // Resume the spinner for success message\n spinner.start()\n spinner.succeed(chalk.green('CopilotKit packages installed successfully'))\n } catch (error) {\n // Use spinner for consistent error reporting\n if (!spinner.isSpinning) {\n spinner.start()\n }\n spinner.fail(chalk.red('Failed to install CopilotKit packages'))\n throw error\n }\n}\n\nfunction detectPackageManager(): PackageManager {\n // Check for lock files in the current directory\n const files = fs.readdirSync(process.cwd())\n\n if (files.includes('bun.lockb')) return 'bun'\n if (files.includes('pnpm-lock.yaml')) return 'pnpm'\n if (files.includes('yarn.lock')) return 'yarn'\n if (files.includes('package-lock.json')) return 'npm'\n\n // Default to npm if no lock file found\n return 'npm'\n}\n\nfunction detectInstallCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case 'yarn':\n case 'pnpm':\n return 'add'\n default:\n return 'install'\n }\n}\n","import ora from 'ora'\nimport chalk from 'chalk'\nimport {cloneGitHubSubdirectory} from './github.js'\nimport {Config} from '../types/index.js'\nimport path from 'path'\nimport fs from 'fs'\n\nexport async function scaffoldAgent(userAnswers: Config) {\n if (\n userAnswers.mode === 'CrewAI' ||\n (userAnswers.mode === 'LangGraph' && !userAnswers.langGraphAgent) ||\n userAnswers.mode === 'Standard' ||\n userAnswers.mode === 'MCP'\n ) {\n return\n }\n\n const spinner = ora({\n text: chalk.cyan('Setting up AI agent...'),\n color: 'cyan',\n }).start()\n\n let template = ''\n switch (userAnswers.mode) {\n case 'LangGraph':\n if (userAnswers.langGraphAgent === 'Python Starter') {\n template = AgentTemplates.LangGraph.Starter.Python\n } else {\n template = AgentTemplates.LangGraph.Starter.TypeScript\n }\n break\n }\n\n if (!template) {\n spinner.fail(chalk.red('Failed to determine agent template'))\n throw new Error('Failed to determine agent template')\n }\n\n const agentDir = path.join(process.cwd(), 'agent')\n\n try {\n await cloneGitHubSubdirectory(template, agentDir, spinner)\n\n // Create .env file in the agent directory\n spinner.text = chalk.cyan('Creating agent environment variables...')\n\n let envContent = ''\n\n // Add OpenAI API key if provided\n if (userAnswers.llmToken) {\n envContent += `OPENAI_API_KEY=${userAnswers.llmToken}\\n`\n }\n\n // Add LangSmith API key for LangGraph\n if (userAnswers.mode === 'LangGraph' && userAnswers.langSmithApiKey) {\n envContent += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}\\n`\n }\n\n if (envContent) {\n const agentEnvFile = path.join(agentDir, '.env')\n fs.writeFileSync(agentEnvFile, envContent, 'utf8')\n spinner.text = chalk.cyan('Added API keys to agent .env file')\n }\n\n // Add LangSmith API key for LangGraph\n if (userAnswers.mode === 'LangGraph' && userAnswers.langSmithApiKey) {\n envContent += `LANGSMITH_API_KEY=${userAnswers.langSmithApiKey}\\n`\n }\n\n if (envContent) {\n const agentEnvFile = path.join(agentDir, '.env')\n fs.writeFileSync(agentEnvFile, envContent, 'utf8')\n spinner.text = chalk.cyan('Added API keys to agent .env file')\n }\n\n if (envContent) {\n const agentEnvFile = path.join(agentDir, '.env')\n fs.writeFileSync(agentEnvFile, envContent, 'utf8')\n spinner.text = chalk.cyan('Added API keys to agent .env file')\n }\n } catch (error) {\n spinner.fail(chalk.red('Failed to clone agent template'))\n throw error\n }\n\n spinner.succeed(`${userAnswers.mode} agent cloned successfully`)\n}\n\nexport const AgentTemplates = {\n LangGraph: {\n Starter: {\n Python: 'https://github.com/CopilotKit/coagents-starter-langgraph/tree/main/agent-py',\n TypeScript: 'https://github.com/CopilotKit/coagents-starter-langgraph/tree/main/agent-js',\n },\n },\n CrewAI: {\n Flows: {\n Starter: 'https://github.com/CopilotKit/coagents-starter-crewai-flows/tree/main/agent-py',\n },\n },\n}\n","import * as fs from 'fs/promises'\nimport ora from 'ora'\nimport * as path from 'path'\n\nexport async function addCrewInputs(url: string, token: string) {\n try {\n const spinner = ora('Analyzing crew inputs...').start()\n // Get inputs from the crew API\n const inputs = await getCrewInputs(url, token)\n spinner.text = 'Adding inputs to app/copilotkit/page.tsx...'\n\n // Path to the file we need to modify\n let filePath = path.join(process.cwd(), 'app', 'copilotkit', 'page.tsx')\n\n // check if non-src file exists\n try {\n await fs.access(filePath)\n } catch {\n filePath = path.join(process.cwd(), 'src', 'app', 'copilotkit', 'page.tsx')\n }\n\n // check if src file exists\n try {\n await fs.access(filePath)\n } catch {\n throw new Error('app/copilotkit/page.tsx and src/app/copilotkit/page.tsx not found')\n }\n\n // Read the file content\n let fileContent = await fs.readFile(filePath, 'utf8')\n\n // Replace all instances of \"YOUR_INPUTS_HERE\" with the inputs array as a string\n const inputsString = JSON.stringify(inputs)\n fileContent = fileContent.replace(/\\[[\"']YOUR_INPUTS_HERE[\"']\\]/g, inputsString)\n\n // Write the updated content back to the file\n await fs.writeFile(filePath, fileContent, 'utf8')\n\n spinner.succeed('Successfully added crew inputs to app/copilotkit/page.tsx')\n } catch (error) {\n console.error('Error updating crew inputs:', error)\n throw error\n }\n}\n\nasync function getCrewInputs(url: string, token: string): Promise<string[]> {\n const response = await fetch(`${url.trim()}/inputs`, {\n headers: {\n Authorization: `Bearer ${token}`,\n },\n })\n\n if (!response.ok) {\n throw new Error(`Failed to fetch inputs: ${response.statusText}`)\n }\n\n const data = (await response.json()) as {inputs: string[]}\n return data.inputs\n}\n"],"mappings":";AAAA,SAAQ,SAAQ;AAChB,SAAQ,aAAY;;;ACDb,IAAM,cAAc,CAAC,QAAyB;AACnD,SAAO,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,WAAW,KAAK,IAAI,SAAS,SAAS;AACzF;;;ADGO,IAAM,QAAQ,CAAC,aAAa,UAAU,UAAU,OAAO,OAAO,UAAU;AACxE,IAAM,aAAa,CAAC,SAAS,OAAO;AACpC,IAAM,kBAAkB,CAAC,eAAe,kBAAkB,YAAY,cAAc;AACpF,IAAM,mBAAmB,CAAC,kBAAkB,oBAAoB;AAChE,IAAM,sBAAsB,CAAC,SAAS;AACtC,IAAM,SAAS,CAAC,OAAO,IAAI;AAG3B,IAAM,aAAa;AAAA;AAAA,EAExB,KAAK,CAAC,UAA0B;AAC9B,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK,EAAE,QAAQ,QAAQ,EAAE;AAAA,EACxC;AAAA;AAAA,EAGA,MAAM,CAAC,UAA0B;AAC/B,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA;AAAA,EAGA,WAAW,CAAC,UAA0B;AACpC,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,MAAM,YAAY,EAAE,KAAK;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,UAAU,KAAK;AAAA,IAChC;AAAA,EACF,CAAC;AAED,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,IAAI,MAAM,2BAA2B,SAAS,UAAU,EAAE;AAAA,EAClE;AAEA,QAAM,OAAQ,MAAM,SAAS,KAAK;AAClC,SAAO,KAAK;AACd;","names":["fs","path","spawn","chalk","fs","ora","chalk","path","fs","ora","chalk","fs","ora","path"]}
@@ -71,20 +71,19 @@ var ConfigSchema = z.object({
71
71
  crewName: NameSchema.optional(),
72
72
  crewUrl: UrlSchema.optional(),
73
73
  crewBearerToken: TokenSchema.optional(),
74
- crewFlowAgent: CrewFlowTemplateSchema.optional(),
75
74
  // API keys and tokens
76
75
  copilotCloudPublicApiKey: z.string().optional(),
77
76
  langSmithApiKey: ApiKeySchema.optional(),
78
77
  llmToken: ApiKeySchema.optional()
79
78
  }).refine(
80
79
  (data) => {
81
- if (data.mode === "CrewAI" && data.crewType === "Crews") {
80
+ if (data.mode === "CrewAI") {
82
81
  return !!data.crewUrl && !!data.crewBearerToken;
83
82
  }
84
83
  return true;
85
84
  },
86
85
  {
87
- message: "Crew URL and bearer token are required for CrewAI Crews",
86
+ message: "Crew URL and bearer token are required for CrewAI",
88
87
  path: ["crewUrl", "crewBearerToken"]
89
88
  }
90
89
  ).refine(
@@ -110,8 +109,7 @@ var ConfigFlags = {
110
109
  "crew-url": Flags.string({ description: "URL endpoint for your CrewAI agent" }),
111
110
  "crew-bearer-token": Flags.string({ description: "Bearer token for CrewAI authentication" }),
112
111
  "langsmith-api-key": Flags.string({ description: "LangSmith API key for LangGraph observability" }),
113
- "llm-token": Flags.string({ description: "API key for your preferred LLM provider" }),
114
- "crew-flow-agent": Flags.string({ description: "CrewAI Flow template to use", options: CREW_FLOW_TEMPLATES })
112
+ "llm-token": Flags.string({ description: "API key for your preferred LLM provider" })
115
113
  };
116
114
 
117
115
  // src/lib/init/types/templates.ts
@@ -122,11 +120,7 @@ var templateMapping = {
122
120
  LangGraphPlatformRuntime: `${BASE_URL}/langgraph-platform-starter.json`,
123
121
  // CrewAI
124
122
  CrewEnterprise: [`${BASE_URL}/coagents-crew-starter.json`],
125
- CrewFlowsStarter: [
126
- `${BASE_URL}/coagents-starter-ui.json`,
127
- `${BASE_URL}/agent-layout.json`,
128
- `${BASE_URL}/remote-endpoint.json`
129
- ],
123
+ CrewFlowsEnterprise: [`${BASE_URL}/coagents-starter-crewai-flows.json`],
130
124
  // LangGraph
131
125
  LangGraphGeneric: `${BASE_URL}/generic-lg-starter.json`,
132
126
  LangGraphStarter: [`${BASE_URL}/langgraph-platform-starter.json`, `${BASE_URL}/coagents-starter-ui.json`],
@@ -184,12 +178,12 @@ var questions = [
184
178
  }
185
179
  }
186
180
  },
187
- // CrewAI Crews specific questions - shown when CrewAI Crews selected
181
+ // CrewAI specific questions - shown when CrewAI Crews or Flows selected
188
182
  {
189
183
  type: "input",
190
184
  name: "crewName",
191
185
  message: "\u{1F465} What would you like to name your crew? (can be anything)",
192
- when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
186
+ when: (answers) => answers.mode === "CrewAI",
193
187
  default: "MyCopilotCrew",
194
188
  validate: validateRequired,
195
189
  sanitize: sanitizers.trim
@@ -198,7 +192,7 @@ var questions = [
198
192
  type: "input",
199
193
  name: "crewUrl",
200
194
  message: "\u{1F517} Enter your Crew's Enterprise URL (more info at https://app.crewai.com):",
201
- when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
195
+ when: (answers) => answers.mode === "CrewAI",
202
196
  validate: validateUrl,
203
197
  sanitize: sanitizers.url
204
198
  },
@@ -206,19 +200,11 @@ var questions = [
206
200
  type: "input",
207
201
  name: "crewBearerToken",
208
202
  message: "\u{1F511} Enter your Crew's bearer token:",
209
- when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Crews",
203
+ when: (answers) => answers.mode === "CrewAI",
210
204
  sensitive: true,
211
205
  validate: validateRequired,
212
206
  sanitize: sanitizers.trim
213
207
  },
214
- // CrewAI Flows specific questions - shown when CrewAI Flows selected
215
- {
216
- type: "select",
217
- name: "crewFlowAgent",
218
- message: "\u{1F4E6} Choose a CrewAI Flow Template",
219
- choices: Array.from(CREW_FLOW_TEMPLATES),
220
- when: (answers) => answers.mode === "CrewAI" && answers.crewType === "Flows"
221
- },
222
208
  // LangGraph specific questions - shown when LangGraph selected
223
209
  {
224
210
  type: "yes/no",
@@ -292,7 +278,7 @@ var questions = [
292
278
  type: "input",
293
279
  name: "llmToken",
294
280
  message: "\u{1F511} Enter your OpenAI API key (required for LLM interfacing):",
295
- when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No" || answers.mode === "CrewAI" && answers.crewType === "Flows" || answers.mode === "Standard" && answers.useCopilotCloud !== "Yes" || answers.mode === "MCP" && answers.useCopilotCloud !== "Yes",
281
+ when: (answers) => answers.mode === "LangGraph" && answers.alreadyDeployed === "No" || answers.mode === "Standard" && answers.useCopilotCloud !== "Yes" || answers.mode === "MCP" && answers.useCopilotCloud !== "Yes",
296
282
  sensitive: true,
297
283
  validate: validateRequired,
298
284
  sanitize: sanitizers.apiKey