assistant-ui 0.0.120 → 0.0.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +1 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/cloud.d.ts +25 -0
- package/dist/commands/cloud.d.ts.map +1 -0
- package/dist/commands/cloud.js +194 -0
- package/dist/commands/cloud.js.map +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +10 -2
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/info.js +2 -2
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +1 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +95 -23
- package/dist/commands/mcp.js.map +1 -1
- package/dist/lib/agent-skill.d.ts +2 -2
- package/dist/lib/agent-skill.d.ts.map +1 -1
- package/dist/lib/agent-skill.js +10 -28
- package/dist/lib/agent-skill.js.map +1 -1
- package/dist/lib/cloud-abort.d.ts +2 -0
- package/dist/lib/cloud-abort.d.ts.map +1 -0
- package/dist/lib/cloud-abort.js +13 -0
- package/dist/lib/cloud-abort.js.map +1 -0
- package/dist/lib/cloud-auth.d.ts +28 -0
- package/dist/lib/cloud-auth.d.ts.map +1 -0
- package/dist/lib/cloud-auth.js +169 -0
- package/dist/lib/cloud-auth.js.map +1 -0
- package/dist/lib/cloud-config.d.ts +21 -0
- package/dist/lib/cloud-config.d.ts.map +1 -0
- package/dist/lib/cloud-config.js +76 -0
- package/dist/lib/cloud-config.js.map +1 -0
- package/dist/lib/cloud-provision.d.ts +20 -0
- package/dist/lib/cloud-provision.d.ts.map +1 -0
- package/dist/lib/cloud-provision.js +55 -0
- package/dist/lib/cloud-provision.js.map +1 -0
- package/dist/lib/cloud-setup-login.d.ts +9 -0
- package/dist/lib/cloud-setup-login.d.ts.map +1 -0
- package/dist/lib/cloud-setup-login.js +137 -0
- package/dist/lib/cloud-setup-login.js.map +1 -0
- package/dist/lib/cloud-url.d.ts +2 -0
- package/dist/lib/cloud-url.d.ts.map +1 -0
- package/dist/lib/cloud-url.js +14 -0
- package/dist/lib/cloud-url.js.map +1 -0
- package/dist/lib/create-project.d.ts +0 -9
- package/dist/lib/create-project.d.ts.map +1 -1
- package/dist/lib/create-project.js +15 -46
- package/dist/lib/create-project.js.map +1 -1
- package/dist/lib/transform.d.ts +0 -4
- package/dist/lib/transform.d.ts.map +1 -1
- package/dist/lib/transform.js +8 -17
- package/dist/lib/transform.js.map +1 -1
- package/dist/lib/utils/download.d.ts +5 -0
- package/dist/lib/utils/download.d.ts.map +1 -0
- package/dist/lib/utils/download.js +41 -0
- package/dist/lib/utils/download.js.map +1 -0
- package/dist/lib/utils/file-scanner.d.ts +0 -1
- package/dist/lib/utils/file-scanner.d.ts.map +1 -1
- package/dist/lib/utils/file-scanner.js +1 -16
- package/dist/lib/utils/file-scanner.js.map +1 -1
- package/dist/lib/utils/package-manager.d.ts +7 -0
- package/dist/lib/utils/package-manager.d.ts.map +1 -1
- package/dist/lib/utils/package-manager.js +15 -1
- package/dist/lib/utils/package-manager.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -1
- package/dist/program.js.map +1 -1
- package/package.json +12 -8
- package/src/commands/add.ts +2 -1
- package/src/commands/cloud.test.ts +238 -0
- package/src/commands/cloud.ts +455 -0
- package/src/commands/create.ts +13 -3
- package/src/commands/init.ts +5 -2
- package/src/commands/mcp.ts +223 -56
- package/src/lib/agent-skill.ts +18 -44
- package/src/lib/cloud-abort.ts +12 -0
- package/src/lib/cloud-auth.test.ts +500 -0
- package/src/lib/cloud-auth.ts +273 -0
- package/src/lib/cloud-config.test.ts +82 -0
- package/src/lib/cloud-config.ts +138 -0
- package/src/lib/cloud-provision.test.ts +132 -0
- package/src/lib/cloud-provision.ts +93 -0
- package/src/lib/cloud-setup-login.test.ts +361 -0
- package/src/lib/cloud-setup-login.ts +240 -0
- package/src/lib/cloud-url.ts +19 -0
- package/src/lib/create-project.test.ts +0 -17
- package/src/lib/create-project.ts +33 -98
- package/src/lib/transform-files.test.ts +1 -3
- package/src/lib/transform.ts +6 -20
- package/src/lib/utils/download.ts +57 -0
- package/src/lib/utils/file-scanner.ts +0 -26
- package/src/lib/utils/package-manager.ts +26 -0
- package/src/lib/utils/registry.test.ts +0 -6
- package/src/program.ts +2 -0
- package/templates/cloud-harness/.assistant-ui/template.json +3 -0
- package/templates/cloud-harness/.env.example +1 -0
- package/templates/cloud-harness/.gitignore +42 -0
- package/templates/cloud-harness/README.md +28 -0
- package/templates/cloud-harness/app/api/chat/route.ts +14 -0
- package/templates/cloud-harness/app/api/credential/route.ts +14 -0
- package/templates/cloud-harness/app/assistant.tsx +83 -0
- package/templates/cloud-harness/app/favicon.ico +0 -0
- package/templates/cloud-harness/app/globals.css +139 -0
- package/templates/cloud-harness/app/layout.tsx +37 -0
- package/templates/cloud-harness/app/page.tsx +5 -0
- package/templates/cloud-harness/components/assistant-ui/elements/attachment.aui.tsx +279 -0
- package/templates/cloud-harness/components/assistant-ui/elements/collapsible-root.tsx +19 -0
- package/templates/cloud-harness/components/assistant-ui/elements/markdown-text.tsx +238 -0
- package/templates/cloud-harness/components/assistant-ui/elements/thread.aui.tsx +521 -0
- package/templates/cloud-harness/components/assistant-ui/elements/tool-fallback.aui.tsx +1321 -0
- package/templates/cloud-harness/components/assistant-ui/elements/tooltip-icon-button.tsx +49 -0
- package/templates/cloud-harness/components/ui/avatar.tsx +109 -0
- package/templates/cloud-harness/components/ui/button.tsx +58 -0
- package/templates/cloud-harness/components/ui/collapsible.tsx +21 -0
- package/templates/cloud-harness/components/ui/dialog.tsx +159 -0
- package/templates/cloud-harness/components/ui/textarea.tsx +18 -0
- package/templates/cloud-harness/components/ui/tooltip.tsx +69 -0
- package/templates/cloud-harness/components.json +24 -0
- package/templates/cloud-harness/hooks/use-attachment-src.ts +46 -0
- package/templates/cloud-harness/hooks/use-copy-to-clipboard.ts +54 -0
- package/templates/cloud-harness/lib/utils.ts +1 -0
- package/templates/cloud-harness/next.config.ts +6 -0
- package/templates/cloud-harness/package.json +51 -0
- package/templates/cloud-harness/postcss.config.mjs +5 -0
- package/templates/cloud-harness/tsconfig.json +33 -0
- package/templates/cloud-harness/vendor/README.md +13 -0
- package/templates/cloud-harness/vendor/assistant-ui-react-harness-sdk-0.0.2.tgz +0 -0
- package/templates/cloud-harness/vendor/harness-sdk-0.3.1.tgz +0 -0
- package/templates/cloud-harness/vendor/provenance.json +38 -0
- package/templates/cloud-harness/vendor/statewire-0.19.3.tgz +0 -0
- /package/{LICENSE → templates/cloud-harness/vendor/LICENSE} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","names":[],"sources":["../../src/commands/create.ts"],"sourcesContent":["import { Command, Option } from \"commander\";\nimport chalk from \"chalk\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { logger } from \"../lib/utils/logger\";\nimport {\n cleanupPendingProjectDownloads,\n dlxCommand,\n downloadProject,\n resolveLatestReleaseRef,\n resolvePackageManager,\n scaffoldProject,\n transformProject,\n type TransformResult,\n} from \"../lib/create-project\";\nimport {\n hasActiveSpawn,\n runSpawn,\n SpawnExitError,\n SpawnSignalError,\n} from \"../lib/run-spawn\";\nimport { resolvePackageManagerForCwd } from \"../lib/utils/package-manager\";\nimport {\n buildSkillsAddCommand,\n resolveSkillsInstall,\n} from \"../lib/agent-skill\";\n\nexport interface ProjectMetadata {\n name: string;\n label: string;\n description?: string;\n category: \"template\" | \"example\";\n path: string;\n hasLocalComponents: boolean;\n}\n\nexport const PROJECT_METADATA: ProjectMetadata[] = [\n // Templates\n {\n name: \"default\",\n label: \"Default\",\n description: \"Default template with Vercel AI SDK\",\n category: \"template\",\n path: \"templates/default\",\n hasLocalComponents: false,\n },\n {\n name: \"minimal\",\n label: \"Minimal\",\n description: \"Bare-bones starting point\",\n category: \"template\",\n path: \"templates/minimal\",\n hasLocalComponents: true,\n },\n {\n name: \"cloud\",\n label: \"Cloud\",\n description: \"Cloud-backed persistence starter\",\n category: \"template\",\n path: \"templates/cloud\",\n hasLocalComponents: false,\n },\n {\n name: \"cloud-clerk\",\n label: \"Cloud + Clerk\",\n description: \"Cloud-backed starter with Clerk auth\",\n category: \"template\",\n path: \"templates/cloud-clerk\",\n hasLocalComponents: false,\n },\n {\n name: \"langchain\",\n label: \"LangChain\",\n description: \"LangGraph starter with the react-langchain adapter\",\n category: \"template\",\n path: \"templates/langchain\",\n hasLocalComponents: false,\n },\n {\n name: \"mcp\",\n label: \"MCP\",\n description: \"MCP tools + MCP Apps renderer starter\",\n category: \"template\",\n path: \"templates/mcp\",\n hasLocalComponents: false,\n },\n {\n name: \"eve\",\n label: \"Eve\",\n description: \"Eve agent + Next.js starter\",\n category: \"template\",\n path: \"templates/eve\",\n hasLocalComponents: false,\n },\n // Examples\n {\n name: \"with-ag-ui\",\n label: \"AG-UI\",\n description: \"AG-UI protocol integration\",\n category: \"example\",\n path: \"examples/with-ag-ui\",\n hasLocalComponents: false,\n },\n {\n name: \"with-google-adk\",\n label: \"Google ADK\",\n description: \"Google ADK agent integration\",\n category: \"example\",\n path: \"examples/with-google-adk\",\n hasLocalComponents: false,\n },\n {\n name: \"with-ai-sdk-v7\",\n label: \"AI SDK v7\",\n description: \"Vercel AI SDK v7\",\n category: \"example\",\n path: \"examples/with-ai-sdk-v7\",\n hasLocalComponents: false,\n },\n {\n name: \"with-eve\",\n label: \"Eve\",\n description: \"Eve agent integration\",\n category: \"example\",\n path: \"examples/with-eve\",\n hasLocalComponents: false,\n },\n {\n name: \"with-artifacts\",\n label: \"Artifacts\",\n description: \"Artifact rendering\",\n category: \"example\",\n path: \"examples/with-artifacts\",\n hasLocalComponents: false,\n },\n {\n name: \"with-assistant-transport\",\n label: \"Assistant Transport\",\n description: \"Assistant transport protocol\",\n category: \"example\",\n path: \"examples/with-assistant-transport\",\n hasLocalComponents: false,\n },\n {\n name: \"with-chain-of-thought\",\n label: \"Chain of Thought\",\n description: \"Chain-of-thought, tool calls, and source citations\",\n category: \"example\",\n path: \"examples/with-chain-of-thought\",\n hasLocalComponents: false,\n },\n {\n name: \"with-cloud\",\n label: \"Cloud Example\",\n description: \"Cloud integration example\",\n category: \"example\",\n path: \"examples/with-cloud\",\n hasLocalComponents: false,\n },\n {\n name: \"with-custom-thread-list\",\n label: \"Custom Thread List\",\n description: \"Custom thread list UI\",\n category: \"example\",\n path: \"examples/with-custom-thread-list\",\n hasLocalComponents: false,\n },\n {\n name: \"with-elevenlabs-conversational\",\n label: \"ElevenLabs Conversational\",\n description: \"Realtime voice with ElevenLabs\",\n category: \"example\",\n path: \"examples/with-elevenlabs-conversational\",\n hasLocalComponents: false,\n },\n {\n name: \"with-elevenlabs-scribe\",\n label: \"ElevenLabs Scribe\",\n description: \"Audio/speech integration\",\n category: \"example\",\n path: \"examples/with-elevenlabs-scribe\",\n hasLocalComponents: false,\n },\n {\n name: \"with-livekit\",\n label: \"LiveKit Voice\",\n description: \"Realtime voice with LiveKit\",\n category: \"example\",\n path: \"examples/with-livekit\",\n hasLocalComponents: false,\n },\n {\n name: \"with-expo\",\n label: \"Expo\",\n description: \"Expo / React Native\",\n category: \"example\",\n path: \"examples/with-expo\",\n hasLocalComponents: false,\n },\n {\n name: \"with-interactables\",\n label: \"Interactables\",\n description: \"AI-driven interactive UI components\",\n category: \"example\",\n path: \"examples/with-interactables\",\n hasLocalComponents: false,\n },\n {\n name: \"with-external-store\",\n label: \"External Store\",\n description: \"Custom message store\",\n category: \"example\",\n path: \"examples/with-external-store\",\n hasLocalComponents: false,\n },\n {\n name: \"with-ffmpeg\",\n label: \"FFmpeg\",\n description: \"File processing\",\n category: \"example\",\n path: \"examples/with-ffmpeg\",\n hasLocalComponents: false,\n },\n {\n name: \"with-langgraph\",\n label: \"LangGraph Example\",\n description: \"LangGraph integration\",\n category: \"example\",\n path: \"examples/with-langgraph\",\n hasLocalComponents: false,\n },\n {\n name: \"with-react-hook-form\",\n label: \"React Hook Form\",\n description: \"Form integration\",\n category: \"example\",\n path: \"examples/with-react-hook-form\",\n hasLocalComponents: false,\n },\n {\n name: \"with-react-ink\",\n label: \"React Ink\",\n description: \"Terminal UI chat\",\n category: \"example\",\n path: \"examples/with-react-ink\",\n hasLocalComponents: true,\n },\n {\n name: \"with-react-router\",\n label: \"React Router\",\n description: \"React Router v7 + Vite\",\n category: \"example\",\n path: \"examples/with-react-router\",\n hasLocalComponents: false,\n },\n {\n name: \"with-tanstack\",\n label: \"TanStack\",\n description: \"TanStack/React Router + Vite\",\n category: \"example\",\n path: \"examples/with-tanstack\",\n hasLocalComponents: false,\n },\n {\n name: \"with-resumable-stream\",\n label: \"Resumable Stream\",\n description: \"Resumable LLM stream that survives reload mid-response\",\n category: \"example\",\n path: \"examples/with-resumable-stream\",\n hasLocalComponents: false,\n },\n {\n name: \"with-openui\",\n label: \"OpenUI\",\n description: \"OpenUI generative UI integration\",\n category: \"example\",\n path: \"examples/with-openui\",\n hasLocalComponents: false,\n },\n];\n\n// Examples that exist in the monorepo but are intentionally excluded from the CLI:\n//\n// - waterfall: Still in development, not ready for production.\n// - with-store: In development, not ready for public use of the tap store.\n// - with-tap-runtime: In development, not ready for public use of the tap\n// store.\n\nconst templateNames = PROJECT_METADATA.filter(\n (m) => m.category === \"template\",\n).map((m) => m.name);\n\nconst exampleNames = PROJECT_METADATA.filter(\n (m) => m.category === \"example\",\n).map((m) => m.name);\n\nexport async function resolveProject(params: {\n template?: string;\n example?: string;\n stdinIsTTY?: boolean;\n select?: typeof p.select;\n isCancel?: typeof p.isCancel;\n}): Promise<ProjectMetadata | null> {\n const {\n template,\n example,\n stdinIsTTY = process.stdin.isTTY,\n select = p.select,\n isCancel = p.isCancel,\n } = params;\n\n if (template !== undefined) {\n const meta = PROJECT_METADATA.find(\n (m) => m.name === template && m.category === \"template\",\n );\n if (!meta) {\n logger.error(`Unknown template: ${template}`);\n logger.info(`Available templates: ${templateNames.join(\", \")}`);\n process.exit(1);\n }\n return meta;\n }\n\n if (example !== undefined) {\n const meta = PROJECT_METADATA.find(\n (m) => m.name === example && m.category === \"example\",\n );\n if (!meta) {\n logger.error(`Unknown example: ${example}`);\n logger.info(`Available examples: ${exampleNames.join(\", \")}`);\n process.exit(1);\n }\n return meta;\n }\n\n if (!stdinIsTTY) {\n return PROJECT_METADATA.find((m) => m.name === \"default\")!;\n }\n\n const selected = await select({\n message: \"Select a project to scaffold:\",\n options: [\n {\n value: \"_separator\",\n label: \"────── Starter Templates ──────\",\n disabled: true,\n },\n ...PROJECT_METADATA.filter((m) => m.category === \"template\").map((m) => ({\n value: m.name,\n label: m.label,\n ...(m.description ? { hint: m.description } : {}),\n })),\n {\n value: \"_separator\",\n label: \"────── Feature Examples ──────\",\n disabled: true,\n },\n ...PROJECT_METADATA.filter((m) => m.category === \"example\").map((m) => ({\n value: m.name,\n label: m.label,\n ...(m.description ? { hint: m.description } : {}),\n })),\n ],\n });\n\n if (isCancel(selected)) {\n return null;\n }\n\n const meta = PROJECT_METADATA.find((m) => m.name === selected);\n if (!meta) {\n logger.error(`Unknown selection: ${String(selected)}`);\n process.exit(1);\n }\n return meta;\n}\n\nexport function resolveCreateProjectDirectory(params: {\n projectDirectory?: string;\n stdinIsTTY?: boolean;\n}): string | undefined {\n const { projectDirectory, stdinIsTTY = process.stdin.isTTY } = params;\n\n if (projectDirectory) return projectDirectory;\n if (!stdinIsTTY) return DEFAULT_PROJECT_DIRECTORY;\n return undefined;\n}\n\nexport const DEFAULT_PROJECT_DIRECTORY = \"my-aui-app\";\n\nexport const projectNamePromptOptions = {\n message: \"Project name:\",\n placeholder: DEFAULT_PROJECT_DIRECTORY,\n defaultValue: DEFAULT_PROJECT_DIRECTORY,\n validate: (value?: string) => {\n // Enter on an untouched prompt is how clack accepts `defaultValue`, and it\n // validates before finalize substitutes it, so an empty value has to pass\n // here or the default is unreachable.\n if (value === undefined || value === \"\") return undefined;\n const name = value.trim();\n if (!name) return \"Project name cannot be empty\";\n if (name === \".\" || name === \"..\") return \"Project name cannot be . or ..\";\n if (name.includes(\"/\") || name.includes(\"\\\\\"))\n return \"Project name cannot contain path separators\";\n return undefined;\n },\n};\n\nexport function resolveProjectDirectoryGuidance(params: {\n absoluteProjectDir: string;\n cwd?: string;\n platform?: NodeJS.Platform;\n}): { display: string; cdCommand: string } {\n const {\n absoluteProjectDir,\n cwd = process.cwd(),\n platform = process.platform,\n } = params;\n const isWindows = platform === \"win32\";\n const pathApi = isWindows ? path.win32 : path.posix;\n\n const relative = pathApi.relative(cwd, absoluteProjectDir);\n const escapesCwd =\n relative === \"..\" || relative.startsWith(`..${pathApi.sep}`);\n const display =\n relative && !escapesCwd && !pathApi.isAbsolute(relative)\n ? relative\n : absoluteProjectDir;\n\n const target = display.startsWith(\"-\")\n ? `.${pathApi.sep}${display}`\n : display;\n // Neither Windows shell has a literal quoting form the other accepts: cmd\n // reads single quotes as part of the name, and double quotes still expand\n // %VAR% there and $var in PowerShell.\n const quoted = (isWindows ? /^[\\w@.:/\\\\+-]+$/ : /^[\\w@./+-]+$/).test(target)\n ? target\n : isWindows\n ? `\"${target}\"`\n : `'${target.replaceAll(\"'\", \"'\\\\''\")}'`;\n\n return { display, cdCommand: `cd ${quoted}` };\n}\n\nconst PLAYGROUND_PRESET_BASE_URL =\n \"https://www.assistant-ui.com/playground/init\";\n\nexport function resolvePresetUrl(preset: string): string {\n if (preset.startsWith(\"http://\") || preset.startsWith(\"https://\")) {\n return preset;\n }\n return `${PLAYGROUND_PRESET_BASE_URL}?preset=${encodeURIComponent(preset)}`;\n}\n\nexport interface ScaffoldSelectorOptions {\n template?: string;\n example?: string;\n preset?: string;\n native?: boolean;\n ink?: boolean;\n}\n\nexport interface ResolvedScaffoldSelector {\n template?: string;\n example?: string;\n preset?: string;\n}\n\nconst scaffoldSelectorHelp =\n \"Choose one scaffold selector: --template <name>, --example <name>, --native, or --ink. --preset <name-or-url> can be used with --template or by itself.\";\n\nfunction getPresetConflict(opts: ScaffoldSelectorOptions): string | undefined {\n if (opts.example !== undefined) return \"--example\";\n if (opts.native) return \"--native\";\n if (opts.ink) return \"--ink\";\n return undefined;\n}\n\nexport function resolveScaffoldSelector(\n opts: ScaffoldSelectorOptions,\n): ResolvedScaffoldSelector {\n const hasPreset = opts.preset !== undefined;\n const presetConflict = getPresetConflict(opts);\n const selectors = [\n opts.template !== undefined ? \"--template\" : undefined,\n opts.example !== undefined ? \"--example\" : undefined,\n opts.native ? \"--native\" : undefined,\n opts.ink ? \"--ink\" : undefined,\n ].filter((selector): selector is string => selector !== undefined);\n\n if (selectors.length > 1) {\n throw new Error(\n `Only one scaffold selector can be provided (${selectors.join(\", \")}). ${scaffoldSelectorHelp}`,\n );\n }\n\n if (hasPreset && presetConflict) {\n throw new Error(\n `Cannot use --preset with ${presetConflict}. ${scaffoldSelectorHelp}`,\n );\n }\n\n if (opts.native) return { example: \"with-expo\" };\n if (opts.ink) return { example: \"with-react-ink\" };\n\n if (opts.preset !== undefined && opts.template === undefined) {\n return { template: \"default\", preset: opts.preset };\n }\n\n return {\n ...(opts.template !== undefined && { template: opts.template }),\n ...(opts.example !== undefined && { example: opts.example }),\n ...(hasPreset && { preset: opts.preset }),\n };\n}\n\nexport const create = new Command()\n .name(\"create\")\n .description(\"create a new project\")\n .argument(\"[project-directory]\")\n .usage(`${chalk.green(\"[project-directory]\")} [options]`)\n .option(\n \"-t, --template <template>\",\n `template to use (${templateNames.join(\", \")})`,\n )\n .option(\n \"-e, --example <example>\",\n `create from an example (${exampleNames.join(\", \")})`,\n )\n .option(\n \"-p, --preset <name-or-url>\",\n \"preset name or URL (e.g., chatgpt or https://www.assistant-ui.com/playground/init?preset=chatgpt)\",\n )\n .option(\"--use-npm\", \"explicitly use npm\")\n .option(\"--use-pnpm\", \"explicitly use pnpm\")\n .option(\"--use-yarn\", \"explicitly use yarn\")\n .option(\"--use-bun\", \"explicitly use bun\")\n .option(\"--native\", \"create an Expo / React Native project\")\n .option(\"--ink\", \"create a React Ink terminal project\")\n .option(\"--skip-install\", \"skip installing packages\")\n .option(\"--skills\", \"add assistant-ui agent skills for AI coding assistants\")\n .option(\"--no-skills\", \"skip adding assistant-ui agent skills\")\n .addOption(\n new Option(\n \"--cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n ).hideHelp(),\n )\n .addOption(\n new Option(\n \"--debug-source-root <path>\",\n \"copy templates/examples from a local assistant-ui repo root\",\n ).hideHelp(),\n )\n .action(async (projectDirectory, opts) => {\n let scaffoldSelector: ResolvedScaffoldSelector;\n try {\n scaffoldSelector = resolveScaffoldSelector(opts);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error(message);\n process.exit(1);\n }\n\n const localSourceRoot = opts.debugSourceRoot\n ? path.resolve(opts.debugSourceRoot)\n : undefined;\n\n // Start release ref resolution early (runs during user prompts)\n const refPromise = localSourceRoot\n ? Promise.resolve(undefined)\n : resolveLatestReleaseRef();\n\n // 1. Resolve project directory\n let resolvedProjectDirectory = resolveCreateProjectDirectory({\n projectDirectory,\n });\n\n if (!resolvedProjectDirectory) {\n const result = await p.text(projectNamePromptOptions);\n\n if (p.isCancel(result)) {\n p.cancel(\"Project creation cancelled.\");\n process.exit(0);\n }\n\n resolvedProjectDirectory = result;\n }\n\n // Check directory\n const absoluteProjectDir = path.resolve(\n opts.cwd ?? process.cwd(),\n resolvedProjectDirectory,\n );\n const { display: displayProjectDir, cdCommand } =\n resolveProjectDirectoryGuidance({ absoluteProjectDir });\n let projectDirExisted = true;\n try {\n const files = fs.readdirSync(absoluteProjectDir);\n if (files.length > 0) {\n logger.error(\n `Directory ${displayProjectDir} already exists and is not empty`,\n );\n process.exit(1);\n }\n } catch (err: unknown) {\n const code =\n err instanceof Error ? (err as NodeJS.ErrnoException).code : undefined;\n if (code === \"ENOENT\") {\n // Directory doesn't exist — good, proceed\n projectDirExisted = false;\n } else if (code === \"ENOTDIR\") {\n logger.error(\n `${displayProjectDir} already exists and is not a directory`,\n );\n process.exit(1);\n } else {\n const message = err instanceof Error ? err.message : String(err);\n logger.error(`Cannot access ${displayProjectDir}: ${message}`);\n process.exit(1);\n }\n }\n\n // 2. Resolve scaffold target\n const project = await resolveProject(scaffoldSelector);\n if (!project) {\n p.cancel(\"Project creation cancelled.\");\n process.exit(0);\n }\n\n const stdinIsTTY = process.stdin.isTTY;\n let installSkills = resolveSkillsInstall({\n skills: opts.skills,\n stdinIsTTY,\n });\n if (installSkills === undefined) {\n const result = await p.confirm({\n message: \"Add assistant-ui agent skills for AI coding assistants?\",\n initialValue: true,\n });\n\n if (p.isCancel(result)) {\n p.cancel(\"Project creation cancelled.\");\n process.exit(0);\n }\n\n installSkills = result;\n }\n\n logger.info(`Creating project from ${project.category}: ${project.label}`);\n logger.break();\n\n const pm = await resolvePackageManagerForCwd(\n path.dirname(absoluteProjectDir),\n resolvePackageManager(opts),\n );\n\n // Clean up partial project directory on unexpected exit (e.g. Ctrl+C)\n const resetProjectDir = () => {\n if (!projectDirExisted) {\n fs.rmSync(absoluteProjectDir, { recursive: true, force: true });\n return;\n }\n if (!fs.existsSync(absoluteProjectDir)) return;\n for (const entry of fs.readdirSync(absoluteProjectDir)) {\n fs.rmSync(path.join(absoluteProjectDir, entry), {\n recursive: true,\n force: true,\n });\n }\n };\n let cleanupArmed = true;\n const cleanupOnExit = () => {\n if (!cleanupArmed) return;\n cleanupArmed = false;\n resetProjectDir();\n };\n const disarmCleanup = () => {\n cleanupArmed = false;\n process.removeListener(\"exit\", cleanupOnExit);\n process.removeListener(\"SIGINT\", cleanupOnSignal);\n process.removeListener(\"SIGTERM\", cleanupOnSignal);\n };\n // Node emits no \"exit\" when a signal kills the process. An in-flight\n // runSpawn forwards the signal itself, so cleanup runs on the error path\n // once the child is reaped rather than while it is still writing.\n const cleanupOnSignal = (signal: NodeJS.Signals) => {\n if (hasActiveSpawn()) return;\n cleanupPendingProjectDownloads();\n cleanupOnExit();\n disarmCleanup();\n process.kill(process.pid, signal);\n };\n\n process.once(\"exit\", cleanupOnExit);\n process.on(\"SIGINT\", cleanupOnSignal);\n process.on(\"SIGTERM\", cleanupOnSignal);\n\n try {\n // 3. Resolve latest release ref (started before prompts)\n if (!localSourceRoot) {\n logger.step(\"Resolving latest release...\");\n }\n const ref = await refPromise;\n if (!localSourceRoot && !ref) {\n logger.warn(\"Could not resolve latest release, downloading from HEAD\");\n }\n\n // 4. Scaffold project\n logger.step(\n localSourceRoot\n ? `Copying project from local source: ${localSourceRoot}`\n : \"Downloading project...\",\n );\n let transformResult: TransformResult;\n try {\n const source = localSourceRoot\n ? { kind: \"local\" as const, rootDir: localSourceRoot }\n : {\n kind: \"github\" as const,\n ref,\n };\n await scaffoldProject(project.path, absoluteProjectDir, source);\n\n // If the template didn't exist at the release tag, retry from HEAD\n if (\n !localSourceRoot &&\n ref &&\n !fs.existsSync(path.join(absoluteProjectDir, \"package.json\"))\n ) {\n resetProjectDir();\n logger.warn(\n \"Template not found at release tag, downloading from HEAD\",\n );\n await downloadProject(project.path, absoluteProjectDir);\n }\n\n // 5. Run transform pipeline\n transformResult = await transformProject(absoluteProjectDir, {\n hasLocalComponents: project.hasLocalComponents,\n skipInstall: opts.skipInstall,\n packageManager: pm,\n });\n\n if (installSkills) {\n logger.step(\"Adding assistant-ui agent skills...\");\n const [skillsCmd, skillsArgs] = buildSkillsAddCommand(pm, {\n stdinIsTTY,\n });\n try {\n await runSpawn(skillsCmd, skillsArgs, absoluteProjectDir);\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n logger.warn(\n `Could not add assistant-ui agent skills. You can add them later with:\\n ${skillsCmd} ${skillsArgs.join(\" \")}`,\n );\n }\n }\n } catch (err) {\n // Clean up partially created project directory\n cleanupOnExit();\n disarmCleanup();\n throw err;\n }\n\n if (transformResult.registryInstallFailure) {\n disarmCleanup();\n logger.break();\n logger.error(\"Project created with missing components.\");\n logger.info(\"Retry the component install with:\");\n logger.info(` ${cdCommand}`);\n logger.info(` ${transformResult.registryInstallFailure.retryCommand}`);\n process.exit(1);\n }\n\n // 6. Apply preset if provided\n if (scaffoldSelector.preset) {\n const presetUrl = resolvePresetUrl(scaffoldSelector.preset);\n logger.info(\"Applying preset configuration...\");\n logger.break();\n const [dlxCmd, dlxArgs] = dlxCommand(pm);\n try {\n await runSpawn(\n dlxCmd,\n [\n ...dlxArgs,\n \"shadcn@latest\",\n \"add\",\n \"--yes\",\n \"--overwrite\",\n presetUrl,\n ],\n absoluteProjectDir,\n );\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n logger.warn(\n `Preset application failed. You can retry manually with:\\n ${dlxCmd} ${[...dlxArgs, \"shadcn@latest\", \"add\", presetUrl].join(\" \")}`,\n );\n }\n }\n\n disarmCleanup();\n\n logger.break();\n logger.success(\"Project created successfully!\");\n logger.break();\n const runCmd = pm === \"npm\" ? \"npm run\" : pm;\n let devScript = \"dev\";\n let envFile = \".env.local\";\n try {\n const scaffoldedPkg = JSON.parse(\n fs.readFileSync(\n path.join(absoluteProjectDir, \"package.json\"),\n \"utf-8\",\n ),\n );\n devScript = scaffoldedPkg.scripts?.dev\n ? \"dev\"\n : scaffoldedPkg.scripts?.start\n ? \"start\"\n : \"dev\";\n envFile = scaffoldedPkg.dependencies?.next ? \".env.local\" : \".env\";\n } catch {\n // Fall back to defaults if package.json cannot be read\n }\n\n logger.info(\"Next steps:\");\n logger.info(` ${cdCommand}`);\n if (opts.skipInstall) {\n logger.info(` ${pm} install`);\n if (transformResult.registryInstallCommand) {\n logger.info(` ${transformResult.registryInstallCommand}`);\n }\n }\n logger.info(` # Set up your environment variables in ${envFile}`);\n logger.info(` ${runCmd} ${devScript}`);\n } catch (error) {\n if (error instanceof SpawnSignalError) {\n cleanupOnExit();\n disarmCleanup();\n throw error;\n }\n if (error instanceof SpawnExitError) {\n logger.error(`Project creation failed with code ${error.code}`);\n process.exit(error.code);\n }\n const message = error instanceof Error ? error.message : String(error);\n logger.error(`Failed to create project: ${message}`);\n process.exit(1);\n }\n });\n"],"mappings":";;;;;;;;;;;AAqCA,MAAa,mBAAsC;CAEjD;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CAEA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;AACF;AASA,MAAM,gBAAgB,iBAAiB,QACpC,MAAM,EAA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AAO,KACL,8DAA8D,OAAO,GAAG;KAAC,GAAG;KAAS;KAAiB;KAAO;IAAS,CAAC,CAAC,KAAK,GAAG,GAClI;GACF;EACF;EAEA,cAAc;EAEd,OAAO,MAAM;EACb,OAAO,QAAQ,+BAA+B;EAC9C,OAAO,MAAM;EACb,MAAM,SAAS,OAAO,QAAQ,YAAY;EAC1C,IAAI,YAAY;EAChB,IAAI,UAAU;EACd,IAAI;GACF,MAAM,gBAAgB,KAAK,MACzB,GAAG,aACD,KAAK,KAAK,oBAAoB,cAAc,GAC5C,OACF,CACF;GACA,YAAY,cAAc,SAAS,MAC/B,QACA,cAAc,SAAS,QACrB,UACA;GACN,UAAU,cAAc,cAAc,OAAO,eAAe;EAC9D,QAAQ,CAER;EAEA,OAAO,KAAK,aAAa;EACzB,OAAO,KAAK,KAAK,WAAW;EAC5B,IAAI,KAAK,aAAa;GACpB,OAAO,KAAK,KAAK,GAAG,SAAS;GAC7B,IAAI,gBAAgB,wBAClB,OAAO,KAAK,KAAK,gBAAgB,wBAAwB;EAE7D;EACA,OAAO,KAAK,4CAA4C,SAAS;EACjE,OAAO,KAAK,KAAK,OAAO,GAAG,WAAW;CACxC,SAAS,OAAO;EACd,IAAI,iBAAiB,kBAAkB;GACrC,cAAc;GACd,cAAc;GACd,MAAM;EACR;EACA,IAAI,iBAAiB,gBAAgB;GACnC,OAAO,MAAM,qCAAqC,MAAM,MAAM;GAC9D,QAAQ,KAAK,MAAM,IAAI;EACzB;EACA,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,OAAO,MAAM,6BAA6B,SAAS;EACnD,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"create.js","names":[],"sources":["../../src/commands/create.ts"],"sourcesContent":["import { Command, Option } from \"commander\";\nimport chalk from \"chalk\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { logger } from \"../lib/utils/logger\";\nimport {\n cleanupPendingProjectDownloads,\n downloadProject,\n resolveLatestReleaseRef,\n scaffoldProject,\n transformProject,\n type TransformResult,\n} from \"../lib/create-project\";\nimport {\n hasActiveSpawn,\n runSpawn,\n SpawnExitError,\n SpawnSignalError,\n} from \"../lib/run-spawn\";\nimport {\n dlxCommand,\n resolvePackageManager,\n resolvePackageManagerForCwd,\n} from \"../lib/utils/package-manager\";\nimport {\n buildSkillsAddCommand,\n resolveSkillsInstall,\n} from \"../lib/agent-skill\";\n\nexport interface ProjectMetadata {\n name: string;\n label: string;\n description?: string;\n category: \"template\" | \"example\";\n path: string;\n hasLocalComponents: boolean;\n}\n\nexport const PROJECT_METADATA: ProjectMetadata[] = [\n // Templates\n {\n name: \"default\",\n label: \"Default\",\n description: \"Default template with Vercel AI SDK\",\n category: \"template\",\n path: \"templates/default\",\n hasLocalComponents: false,\n },\n {\n name: \"minimal\",\n label: \"Minimal\",\n description: \"Bare-bones starting point\",\n category: \"template\",\n path: \"templates/minimal\",\n hasLocalComponents: true,\n },\n {\n name: \"cloud\",\n label: \"Cloud\",\n description: \"Cloud-backed persistence starter\",\n category: \"template\",\n path: \"templates/cloud\",\n hasLocalComponents: false,\n },\n {\n name: \"cloud-clerk\",\n label: \"Cloud + Clerk\",\n description: \"Cloud-backed starter with Clerk auth\",\n category: \"template\",\n path: \"templates/cloud-clerk\",\n hasLocalComponents: false,\n },\n {\n name: \"cloud-harness\",\n label: \"Shared cloud chat\",\n description: \"A hosted harness with a shared conversation across browsers\",\n category: \"template\",\n path: \"templates/cloud-harness\",\n hasLocalComponents: true,\n },\n {\n name: \"langchain\",\n label: \"LangChain\",\n description: \"LangGraph starter with the react-langchain adapter\",\n category: \"template\",\n path: \"templates/langchain\",\n hasLocalComponents: false,\n },\n {\n name: \"mcp\",\n label: \"MCP\",\n description: \"MCP tools + MCP Apps renderer starter\",\n category: \"template\",\n path: \"templates/mcp\",\n hasLocalComponents: false,\n },\n {\n name: \"eve\",\n label: \"Eve\",\n description: \"Eve agent + Next.js starter\",\n category: \"template\",\n path: \"templates/eve\",\n hasLocalComponents: false,\n },\n // Examples\n {\n name: \"with-ag-ui\",\n label: \"AG-UI\",\n description: \"AG-UI protocol integration\",\n category: \"example\",\n path: \"examples/with-ag-ui\",\n hasLocalComponents: false,\n },\n {\n name: \"with-google-adk\",\n label: \"Google ADK\",\n description: \"Google ADK agent integration\",\n category: \"example\",\n path: \"examples/with-google-adk\",\n hasLocalComponents: false,\n },\n {\n name: \"with-ai-sdk-v7\",\n label: \"AI SDK v7\",\n description: \"Vercel AI SDK v7\",\n category: \"example\",\n path: \"examples/with-ai-sdk-v7\",\n hasLocalComponents: false,\n },\n {\n name: \"with-eve\",\n label: \"Eve\",\n description: \"Eve agent integration\",\n category: \"example\",\n path: \"examples/with-eve\",\n hasLocalComponents: false,\n },\n {\n name: \"with-artifacts\",\n label: \"Artifacts\",\n description: \"Artifact rendering\",\n category: \"example\",\n path: \"examples/with-artifacts\",\n hasLocalComponents: false,\n },\n {\n name: \"with-assistant-transport\",\n label: \"Assistant Transport\",\n description: \"Assistant transport protocol\",\n category: \"example\",\n path: \"examples/with-assistant-transport\",\n hasLocalComponents: false,\n },\n {\n name: \"with-chain-of-thought\",\n label: \"Chain of Thought\",\n description: \"Chain-of-thought, tool calls, and source citations\",\n category: \"example\",\n path: \"examples/with-chain-of-thought\",\n hasLocalComponents: false,\n },\n {\n name: \"with-cloud\",\n label: \"Cloud Example\",\n description: \"Cloud integration example\",\n category: \"example\",\n path: \"examples/with-cloud\",\n hasLocalComponents: false,\n },\n {\n name: \"with-custom-thread-list\",\n label: \"Custom Thread List\",\n description: \"Custom thread list UI\",\n category: \"example\",\n path: \"examples/with-custom-thread-list\",\n hasLocalComponents: false,\n },\n {\n name: \"with-elevenlabs-conversational\",\n label: \"ElevenLabs Conversational\",\n description: \"Realtime voice with ElevenLabs\",\n category: \"example\",\n path: \"examples/with-elevenlabs-conversational\",\n hasLocalComponents: false,\n },\n {\n name: \"with-elevenlabs-scribe\",\n label: \"ElevenLabs Scribe\",\n description: \"Audio/speech integration\",\n category: \"example\",\n path: \"examples/with-elevenlabs-scribe\",\n hasLocalComponents: false,\n },\n {\n name: \"with-livekit\",\n label: \"LiveKit Voice\",\n description: \"Realtime voice with LiveKit\",\n category: \"example\",\n path: \"examples/with-livekit\",\n hasLocalComponents: false,\n },\n {\n name: \"with-expo\",\n label: \"Expo\",\n description: \"Expo / React Native\",\n category: \"example\",\n path: \"examples/with-expo\",\n hasLocalComponents: false,\n },\n {\n name: \"with-interactables\",\n label: \"Interactables\",\n description: \"AI-driven interactive UI components\",\n category: \"example\",\n path: \"examples/with-interactables\",\n hasLocalComponents: false,\n },\n {\n name: \"with-external-store\",\n label: \"External Store\",\n description: \"Custom message store\",\n category: \"example\",\n path: \"examples/with-external-store\",\n hasLocalComponents: false,\n },\n {\n name: \"with-ffmpeg\",\n label: \"FFmpeg\",\n description: \"File processing\",\n category: \"example\",\n path: \"examples/with-ffmpeg\",\n hasLocalComponents: false,\n },\n {\n name: \"with-langgraph\",\n label: \"LangGraph Example\",\n description: \"LangGraph integration\",\n category: \"example\",\n path: \"examples/with-langgraph\",\n hasLocalComponents: false,\n },\n {\n name: \"with-react-hook-form\",\n label: \"React Hook Form\",\n description: \"Form integration\",\n category: \"example\",\n path: \"examples/with-react-hook-form\",\n hasLocalComponents: false,\n },\n {\n name: \"with-react-ink\",\n label: \"React Ink\",\n description: \"Terminal UI chat\",\n category: \"example\",\n path: \"examples/with-react-ink\",\n hasLocalComponents: true,\n },\n {\n name: \"with-react-router\",\n label: \"React Router\",\n description: \"React Router v7 + Vite\",\n category: \"example\",\n path: \"examples/with-react-router\",\n hasLocalComponents: false,\n },\n {\n name: \"with-tanstack\",\n label: \"TanStack\",\n description: \"TanStack/React Router + Vite\",\n category: \"example\",\n path: \"examples/with-tanstack\",\n hasLocalComponents: false,\n },\n {\n name: \"with-resumable-stream\",\n label: \"Resumable Stream\",\n description: \"Resumable LLM stream that survives reload mid-response\",\n category: \"example\",\n path: \"examples/with-resumable-stream\",\n hasLocalComponents: false,\n },\n {\n name: \"with-openui\",\n label: \"OpenUI\",\n description: \"OpenUI generative UI integration\",\n category: \"example\",\n path: \"examples/with-openui\",\n hasLocalComponents: false,\n },\n];\n\n// Examples that exist in the monorepo but are intentionally excluded from the CLI:\n//\n// - waterfall: Still in development, not ready for production.\n// - with-store: In development, not ready for public use of the tap store.\n// - with-tap-runtime: In development, not ready for public use of the tap\n// store.\n\nconst templateNames = PROJECT_METADATA.filter(\n (m) => m.category === \"template\",\n).map((m) => m.name);\n\nconst exampleNames = PROJECT_METADATA.filter(\n (m) => m.category === \"example\",\n).map((m) => m.name);\n\nexport async function resolveProject(params: {\n template?: string;\n example?: string;\n stdinIsTTY?: boolean;\n select?: typeof p.select;\n isCancel?: typeof p.isCancel;\n}): Promise<ProjectMetadata | null> {\n const {\n template,\n example,\n stdinIsTTY = process.stdin.isTTY,\n select = p.select,\n isCancel = p.isCancel,\n } = params;\n\n if (template !== undefined) {\n const meta = PROJECT_METADATA.find(\n (m) => m.name === template && m.category === \"template\",\n );\n if (!meta) {\n logger.error(`Unknown template: ${template}`);\n logger.info(`Available templates: ${templateNames.join(\", \")}`);\n process.exit(1);\n }\n return meta;\n }\n\n if (example !== undefined) {\n const meta = PROJECT_METADATA.find(\n (m) => m.name === example && m.category === \"example\",\n );\n if (!meta) {\n logger.error(`Unknown example: ${example}`);\n logger.info(`Available examples: ${exampleNames.join(\", \")}`);\n process.exit(1);\n }\n return meta;\n }\n\n if (!stdinIsTTY) {\n return PROJECT_METADATA.find((m) => m.name === \"default\")!;\n }\n\n const selected = await select({\n message: \"Select a project to scaffold:\",\n options: [\n {\n value: \"_separator\",\n label: \"────── Starter Templates ──────\",\n disabled: true,\n },\n ...PROJECT_METADATA.filter((m) => m.category === \"template\").map((m) => ({\n value: m.name,\n label: m.label,\n ...(m.description ? { hint: m.description } : {}),\n })),\n {\n value: \"_separator\",\n label: \"────── Feature Examples ──────\",\n disabled: true,\n },\n ...PROJECT_METADATA.filter((m) => m.category === \"example\").map((m) => ({\n value: m.name,\n label: m.label,\n ...(m.description ? { hint: m.description } : {}),\n })),\n ],\n });\n\n if (isCancel(selected)) {\n return null;\n }\n\n const meta = PROJECT_METADATA.find((m) => m.name === selected);\n if (!meta) {\n logger.error(`Unknown selection: ${String(selected)}`);\n process.exit(1);\n }\n return meta;\n}\n\nexport function resolveCreateProjectDirectory(params: {\n projectDirectory?: string;\n stdinIsTTY?: boolean;\n}): string | undefined {\n const { projectDirectory, stdinIsTTY = process.stdin.isTTY } = params;\n\n if (projectDirectory) return projectDirectory;\n if (!stdinIsTTY) return DEFAULT_PROJECT_DIRECTORY;\n return undefined;\n}\n\nexport const DEFAULT_PROJECT_DIRECTORY = \"my-aui-app\";\n\nexport const projectNamePromptOptions = {\n message: \"Project name:\",\n placeholder: DEFAULT_PROJECT_DIRECTORY,\n defaultValue: DEFAULT_PROJECT_DIRECTORY,\n validate: (value?: string) => {\n // Enter on an untouched prompt is how clack accepts `defaultValue`, and it\n // validates before finalize substitutes it, so an empty value has to pass\n // here or the default is unreachable.\n if (value === undefined || value === \"\") return undefined;\n const name = value.trim();\n if (!name) return \"Project name cannot be empty\";\n if (name === \".\" || name === \"..\") return \"Project name cannot be . or ..\";\n if (name.includes(\"/\") || name.includes(\"\\\\\"))\n return \"Project name cannot contain path separators\";\n return undefined;\n },\n};\n\nexport function resolveProjectDirectoryGuidance(params: {\n absoluteProjectDir: string;\n cwd?: string;\n platform?: NodeJS.Platform;\n}): { display: string; cdCommand: string } {\n const {\n absoluteProjectDir,\n cwd = process.cwd(),\n platform = process.platform,\n } = params;\n const isWindows = platform === \"win32\";\n const pathApi = isWindows ? path.win32 : path.posix;\n\n const relative = pathApi.relative(cwd, absoluteProjectDir);\n const escapesCwd =\n relative === \"..\" || relative.startsWith(`..${pathApi.sep}`);\n const display =\n relative && !escapesCwd && !pathApi.isAbsolute(relative)\n ? relative\n : absoluteProjectDir;\n\n const target = display.startsWith(\"-\")\n ? `.${pathApi.sep}${display}`\n : display;\n // Neither Windows shell has a literal quoting form the other accepts: cmd\n // reads single quotes as part of the name, and double quotes still expand\n // %VAR% there and $var in PowerShell.\n const quoted = (isWindows ? /^[\\w@.:/\\\\+-]+$/ : /^[\\w@./+-]+$/).test(target)\n ? target\n : isWindows\n ? `\"${target}\"`\n : `'${target.replaceAll(\"'\", \"'\\\\''\")}'`;\n\n return { display, cdCommand: `cd ${quoted}` };\n}\n\nconst PLAYGROUND_PRESET_BASE_URL =\n \"https://www.assistant-ui.com/playground/init\";\n\nexport function resolvePresetUrl(preset: string): string {\n if (preset.startsWith(\"http://\") || preset.startsWith(\"https://\")) {\n return preset;\n }\n return `${PLAYGROUND_PRESET_BASE_URL}?preset=${encodeURIComponent(preset)}`;\n}\n\nexport interface ScaffoldSelectorOptions {\n template?: string;\n example?: string;\n preset?: string;\n native?: boolean;\n ink?: boolean;\n}\n\nexport interface ResolvedScaffoldSelector {\n template?: string;\n example?: string;\n preset?: string;\n}\n\nconst scaffoldSelectorHelp =\n \"Choose one scaffold selector: --template <name>, --example <name>, --native, or --ink. --preset <name-or-url> can be used with --template or by itself.\";\n\nfunction getPresetConflict(opts: ScaffoldSelectorOptions): string | undefined {\n if (opts.example !== undefined) return \"--example\";\n if (opts.native) return \"--native\";\n if (opts.ink) return \"--ink\";\n return undefined;\n}\n\nexport function resolveScaffoldSelector(\n opts: ScaffoldSelectorOptions,\n): ResolvedScaffoldSelector {\n const hasPreset = opts.preset !== undefined;\n const presetConflict = getPresetConflict(opts);\n const selectors = [\n opts.template !== undefined ? \"--template\" : undefined,\n opts.example !== undefined ? \"--example\" : undefined,\n opts.native ? \"--native\" : undefined,\n opts.ink ? \"--ink\" : undefined,\n ].filter((selector): selector is string => selector !== undefined);\n\n if (selectors.length > 1) {\n throw new Error(\n `Only one scaffold selector can be provided (${selectors.join(\", \")}). ${scaffoldSelectorHelp}`,\n );\n }\n\n if (hasPreset && presetConflict) {\n throw new Error(\n `Cannot use --preset with ${presetConflict}. ${scaffoldSelectorHelp}`,\n );\n }\n\n if (opts.native) return { example: \"with-expo\" };\n if (opts.ink) return { example: \"with-react-ink\" };\n\n if (opts.preset !== undefined && opts.template === undefined) {\n return { template: \"default\", preset: opts.preset };\n }\n\n return {\n ...(opts.template !== undefined && { template: opts.template }),\n ...(opts.example !== undefined && { example: opts.example }),\n ...(hasPreset && { preset: opts.preset }),\n };\n}\n\nexport const create = new Command()\n .name(\"create\")\n .description(\"create a new project\")\n .argument(\"[project-directory]\")\n .usage(`${chalk.green(\"[project-directory]\")} [options]`)\n .option(\n \"-t, --template <template>\",\n `template to use (${templateNames.join(\", \")})`,\n )\n .option(\n \"-e, --example <example>\",\n `create from an example (${exampleNames.join(\", \")})`,\n )\n .option(\n \"-p, --preset <name-or-url>\",\n \"preset name or URL (e.g., chatgpt or https://www.assistant-ui.com/playground/init?preset=chatgpt)\",\n )\n .option(\"--use-npm\", \"explicitly use npm\")\n .option(\"--use-pnpm\", \"explicitly use pnpm\")\n .option(\"--use-yarn\", \"explicitly use yarn\")\n .option(\"--use-bun\", \"explicitly use bun\")\n .option(\"--native\", \"create an Expo / React Native project\")\n .option(\"--ink\", \"create a React Ink terminal project\")\n .option(\"--skip-install\", \"skip installing packages\")\n .option(\"--skills\", \"add assistant-ui agent skills for AI coding assistants\")\n .option(\"--no-skills\", \"skip adding assistant-ui agent skills\")\n .addOption(\n new Option(\n \"--cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n ).hideHelp(),\n )\n .addOption(\n new Option(\n \"--debug-source-root <path>\",\n \"copy templates/examples from a local assistant-ui repo root\",\n ).hideHelp(),\n )\n .action(async (projectDirectory, opts) => {\n let scaffoldSelector: ResolvedScaffoldSelector;\n try {\n scaffoldSelector = resolveScaffoldSelector(opts);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error(message);\n process.exit(1);\n }\n\n const localSourceRoot = opts.debugSourceRoot\n ? path.resolve(opts.debugSourceRoot)\n : undefined;\n\n // Start release ref resolution early (runs during user prompts)\n const refPromise = localSourceRoot\n ? Promise.resolve(undefined)\n : resolveLatestReleaseRef();\n\n // 1. Resolve project directory\n let resolvedProjectDirectory = resolveCreateProjectDirectory({\n projectDirectory,\n });\n\n if (!resolvedProjectDirectory) {\n const result = await p.text(projectNamePromptOptions);\n\n if (p.isCancel(result)) {\n p.cancel(\"Project creation cancelled.\");\n process.exit(0);\n }\n\n resolvedProjectDirectory = result;\n }\n\n // Check directory\n const absoluteProjectDir = path.resolve(\n opts.cwd ?? process.cwd(),\n resolvedProjectDirectory,\n );\n const { display: displayProjectDir, cdCommand } =\n resolveProjectDirectoryGuidance({ absoluteProjectDir });\n let projectDirExisted = true;\n try {\n const files = fs.readdirSync(absoluteProjectDir);\n if (files.length > 0) {\n logger.error(\n `Directory ${displayProjectDir} already exists and is not empty`,\n );\n process.exit(1);\n }\n } catch (err: unknown) {\n const code =\n err instanceof Error ? (err as NodeJS.ErrnoException).code : undefined;\n if (code === \"ENOENT\") {\n // Directory doesn't exist — good, proceed\n projectDirExisted = false;\n } else if (code === \"ENOTDIR\") {\n logger.error(\n `${displayProjectDir} already exists and is not a directory`,\n );\n process.exit(1);\n } else {\n const message = err instanceof Error ? err.message : String(err);\n logger.error(`Cannot access ${displayProjectDir}: ${message}`);\n process.exit(1);\n }\n }\n\n // 2. Resolve scaffold target\n const project = await resolveProject(scaffoldSelector);\n if (!project) {\n p.cancel(\"Project creation cancelled.\");\n process.exit(0);\n }\n\n const stdinIsTTY = process.stdin.isTTY;\n let installSkills = resolveSkillsInstall({\n skills: opts.skills,\n stdinIsTTY,\n });\n if (installSkills === undefined) {\n const result = await p.confirm({\n message: \"Add assistant-ui agent skills for AI coding assistants?\",\n initialValue: true,\n });\n\n if (p.isCancel(result)) {\n p.cancel(\"Project creation cancelled.\");\n process.exit(0);\n }\n\n installSkills = result;\n }\n\n logger.info(`Creating project from ${project.category}: ${project.label}`);\n logger.break();\n\n const pm = await resolvePackageManagerForCwd(\n path.dirname(absoluteProjectDir),\n resolvePackageManager(opts),\n );\n\n // Clean up partial project directory on unexpected exit (e.g. Ctrl+C)\n const resetProjectDir = () => {\n if (!projectDirExisted) {\n fs.rmSync(absoluteProjectDir, { recursive: true, force: true });\n return;\n }\n if (!fs.existsSync(absoluteProjectDir)) return;\n for (const entry of fs.readdirSync(absoluteProjectDir)) {\n fs.rmSync(path.join(absoluteProjectDir, entry), {\n recursive: true,\n force: true,\n });\n }\n };\n let cleanupArmed = true;\n const cleanupOnExit = () => {\n if (!cleanupArmed) return;\n cleanupArmed = false;\n resetProjectDir();\n };\n const disarmCleanup = () => {\n cleanupArmed = false;\n process.removeListener(\"exit\", cleanupOnExit);\n process.removeListener(\"SIGINT\", cleanupOnSignal);\n process.removeListener(\"SIGTERM\", cleanupOnSignal);\n };\n // Node emits no \"exit\" when a signal kills the process. An in-flight\n // runSpawn forwards the signal itself, so cleanup runs on the error path\n // once the child is reaped rather than while it is still writing.\n const cleanupOnSignal = (signal: NodeJS.Signals) => {\n if (hasActiveSpawn()) return;\n cleanupPendingProjectDownloads();\n cleanupOnExit();\n disarmCleanup();\n process.kill(process.pid, signal);\n };\n\n process.once(\"exit\", cleanupOnExit);\n process.on(\"SIGINT\", cleanupOnSignal);\n process.on(\"SIGTERM\", cleanupOnSignal);\n\n try {\n // 3. Resolve latest release ref (started before prompts)\n if (!localSourceRoot) {\n logger.step(\"Resolving latest release...\");\n }\n const ref = await refPromise;\n if (!localSourceRoot && !ref) {\n logger.warn(\"Could not resolve latest release, downloading from HEAD\");\n }\n\n // 4. Scaffold project\n logger.step(\n localSourceRoot\n ? `Copying project from local source: ${localSourceRoot}`\n : \"Downloading project...\",\n );\n let transformResult: TransformResult;\n try {\n const source = localSourceRoot\n ? { kind: \"local\" as const, rootDir: localSourceRoot }\n : {\n kind: \"github\" as const,\n ref,\n };\n await scaffoldProject(project.path, absoluteProjectDir, source);\n\n // If the template didn't exist at the release tag, retry from HEAD\n if (\n !localSourceRoot &&\n ref &&\n !fs.existsSync(path.join(absoluteProjectDir, \"package.json\"))\n ) {\n resetProjectDir();\n logger.warn(\n \"Template not found at release tag, downloading from HEAD\",\n );\n await downloadProject(project.path, absoluteProjectDir);\n }\n\n // 5. Run transform pipeline\n transformResult = await transformProject(absoluteProjectDir, {\n hasLocalComponents: project.hasLocalComponents,\n skipInstall: opts.skipInstall,\n packageManager: pm,\n });\n\n if (installSkills) {\n logger.step(\"Adding assistant-ui agent skills...\");\n const [skillsCmd, skillsArgs] = buildSkillsAddCommand(pm, {\n stdinIsTTY,\n });\n try {\n await runSpawn(skillsCmd, skillsArgs, absoluteProjectDir);\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n logger.warn(\n `Could not add assistant-ui agent skills. You can add them later with:\\n ${skillsCmd} ${skillsArgs.join(\" \")}`,\n );\n }\n }\n } catch (err) {\n // Clean up partially created project directory\n cleanupOnExit();\n disarmCleanup();\n throw err;\n }\n\n if (transformResult.registryInstallFailure) {\n disarmCleanup();\n logger.break();\n logger.error(\"Project created with missing components.\");\n logger.info(\"Retry the component install with:\");\n logger.info(` ${cdCommand}`);\n logger.info(` ${transformResult.registryInstallFailure.retryCommand}`);\n process.exit(1);\n }\n\n // 6. Apply preset if provided\n if (scaffoldSelector.preset) {\n const presetUrl = resolvePresetUrl(scaffoldSelector.preset);\n logger.info(\"Applying preset configuration...\");\n logger.break();\n const [dlxCmd, dlxArgs] = dlxCommand(pm);\n try {\n await runSpawn(\n dlxCmd,\n [\n ...dlxArgs,\n \"shadcn@latest\",\n \"add\",\n \"--yes\",\n \"--overwrite\",\n presetUrl,\n ],\n absoluteProjectDir,\n );\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n logger.warn(\n `Preset application failed. You can retry manually with:\\n ${dlxCmd} ${[...dlxArgs, \"shadcn@latest\", \"add\", presetUrl].join(\" \")}`,\n );\n }\n }\n\n disarmCleanup();\n\n logger.break();\n logger.success(\"Project created successfully!\");\n logger.break();\n const runCmd = pm === \"npm\" ? \"npm run\" : pm;\n let devScript = \"dev\";\n let envFile = \".env.local\";\n try {\n const scaffoldedPkg = JSON.parse(\n fs.readFileSync(\n path.join(absoluteProjectDir, \"package.json\"),\n \"utf-8\",\n ),\n );\n devScript = scaffoldedPkg.scripts?.dev\n ? \"dev\"\n : scaffoldedPkg.scripts?.start\n ? \"start\"\n : \"dev\";\n envFile = scaffoldedPkg.dependencies?.next ? \".env.local\" : \".env\";\n } catch {\n // Fall back to defaults if package.json cannot be read\n }\n\n logger.info(\"Next steps:\");\n logger.info(` ${cdCommand}`);\n if (opts.skipInstall) {\n logger.info(` ${pm} install`);\n if (transformResult.registryInstallCommand) {\n logger.info(` ${transformResult.registryInstallCommand}`);\n }\n }\n logger.info(` # Set up your environment variables in ${envFile}`);\n logger.info(` ${runCmd} ${devScript}`);\n } catch (error) {\n if (error instanceof SpawnSignalError) {\n cleanupOnExit();\n disarmCleanup();\n throw error;\n }\n if (error instanceof SpawnExitError) {\n logger.error(`Project creation failed with code ${error.code}`);\n process.exit(error.code);\n }\n const message = error instanceof Error ? error.message : String(error);\n logger.error(`Failed to create project: ${message}`);\n process.exit(1);\n }\n });\n"],"mappings":";;;;;;;;;;;AAuCA,MAAa,mBAAsC;CAEjD;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CAEA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAAM;EACN,oBAAoB;CACtB;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;EACb,UAAU;EACV,MAA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,CAER;EAEA,OAAO,KAAK,aAAa;EACzB,OAAO,KAAK,KAAK,WAAW;EAC5B,IAAI,KAAK,aAAa;GACpB,OAAO,KAAK,KAAK,GAAG,SAAS;GAC7B,IAAI,gBAAgB,wBAClB,OAAO,KAAK,KAAK,gBAAgB,wBAAwB;EAE7D;EACA,OAAO,KAAK,4CAA4C,SAAS;EACjE,OAAO,KAAK,KAAK,OAAO,GAAG,WAAW;CACxC,SAAS,OAAO;EACd,IAAI,iBAAiB,kBAAkB;GACrC,cAAc;GACd,cAAc;GACd,MAAM;EACR;EACA,IAAI,iBAAiB,gBAAgB;GACnC,OAAO,MAAM,qCAAqC,MAAM,MAAM;GAC9D,QAAQ,KAAK,MAAM,IAAI;EACzB;EACA,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,OAAO,MAAM,6BAA6B,SAAS;EACnD,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC"}
|
package/dist/commands/info.js
CHANGED
|
@@ -4,10 +4,10 @@ import { Command } from "commander";
|
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
7
|
-
import * as os$1 from "node:os";
|
|
8
7
|
import { detect } from "detect-package-manager";
|
|
9
|
-
import
|
|
8
|
+
import * as os$1 from "node:os";
|
|
10
9
|
import { spawnSync } from "node:child_process";
|
|
10
|
+
import { satisfies } from "semver";
|
|
11
11
|
//#region src/commands/info.ts
|
|
12
12
|
const ASSISTANT_UI_PACKAGES = [
|
|
13
13
|
"@assistant-ui/react",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAgB5C,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,uBAAuB,CAU1B;AAED,wBAAgB,qBAAqB,CACnC,UAAU,UAAsB,GAC/B,OAAO,CAET;AAED,eAAO,MAAM,IAAI,SAuGb,CAAC"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { logger } from "../lib/utils/logger.js";
|
|
2
2
|
import { getComponentsJsonStyle, resolveQuickStartRegistryUrl } from "../lib/utils/registry.js";
|
|
3
3
|
import { SpawnExitError, SpawnSignalError, runSpawn } from "../lib/run-spawn.js";
|
|
4
|
-
import { resolvePackageManagerForCwd } from "../lib/utils/package-manager.js";
|
|
5
|
-
import { dlxCommand, resolvePackageManager } from "../lib/create-project.js";
|
|
4
|
+
import { dlxCommand, resolvePackageManager, resolvePackageManagerForCwd } from "../lib/utils/package-manager.js";
|
|
6
5
|
import { create } from "./create.js";
|
|
7
6
|
import { Command, Option } from "commander";
|
|
8
7
|
import fs from "node:fs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","names":[],"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command, Option } from \"commander\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport {
|
|
1
|
+
{"version":3,"file":"init.js","names":[],"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command, Option } from \"commander\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { runSpawn, SpawnExitError, SpawnSignalError } from \"../lib/run-spawn\";\nimport { logger } from \"../lib/utils/logger\";\nimport {\n dlxCommand,\n resolvePackageManager,\n resolvePackageManagerForCwd,\n} from \"../lib/utils/package-manager\";\nimport {\n getComponentsJsonStyle,\n resolveQuickStartRegistryUrl,\n} from \"../lib/utils/registry\";\nimport { create } from \"./create\";\n\ninterface ExistingProjectInitPlan {\n initArgs: string[];\n addArgs: string[];\n}\n\nexport function createExistingProjectInitPlan(params: {\n yes: boolean;\n overwrite: boolean;\n}): ExistingProjectInitPlan {\n const { yes, overwrite } = params;\n const initArgs = yes\n ? [`shadcn@latest`, \"init\", \"--defaults\", \"--yes\"]\n : [`shadcn@latest`, \"init\"];\n const addArgs = [`shadcn@latest`, \"add\"];\n if (yes) addArgs.push(\"--yes\");\n if (overwrite) addArgs.push(\"--overwrite\");\n\n return { initArgs, addArgs };\n}\n\nexport function isNonInteractiveShell(\n stdinIsTTY = process.stdin.isTTY,\n): boolean {\n return !stdinIsTTY;\n}\n\nexport const init = new Command()\n .name(\"init\")\n .description(\"initialize assistant-ui in an existing project\")\n .argument(\"[project-directory]\", \"directory for the new project\")\n .option(\"-y, --yes\", \"skip confirmation prompt.\", false)\n .option(\"-o, --overwrite\", \"overwrite existing files.\", false)\n .option(\n \"-c, --cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n process.cwd(),\n )\n .addOption(\n new Option(\n \"-p, --preset <name-or-url>\",\n \"preset name or URL (forwarded to 'assistant-ui create')\",\n ).hideHelp(),\n )\n .option(\"--use-npm\", \"explicitly use npm\")\n .option(\"--use-pnpm\", \"explicitly use pnpm\")\n .option(\"--use-yarn\", \"explicitly use yarn\")\n .option(\"--use-bun\", \"explicitly use bun\")\n .option(\"--skip-install\", \"skip installing packages\")\n .action(async (projectDirectory, opts) => {\n const cwd = opts.cwd;\n const presetUrl = opts.preset as string | undefined;\n const targetDir = projectDirectory\n ? path.resolve(cwd, projectDirectory)\n : cwd;\n\n const componentsConfigPath = path.join(targetDir, \"components.json\");\n\n if (!presetUrl && fs.existsSync(componentsConfigPath)) {\n logger.warn(\"Project is already initialized.\");\n logger.info(\"Use 'assistant-ui add' to add more components.\");\n return;\n }\n\n const packageJsonPath = path.join(targetDir, \"package.json\");\n const packageJsonExists = fs.existsSync(packageJsonPath);\n\n if (presetUrl || !packageJsonExists) {\n if (!presetUrl) {\n logger.info(\"No existing project found. Running 'create' instead...\");\n logger.break();\n }\n\n const createArgs = projectDirectory ? [targetDir] : [\"--cwd\", cwd];\n if (presetUrl) createArgs.push(\"--preset\", presetUrl);\n if (opts.useNpm) createArgs.push(\"--use-npm\");\n if (opts.usePnpm) createArgs.push(\"--use-pnpm\");\n if (opts.useYarn) createArgs.push(\"--use-yarn\");\n if (opts.useBun) createArgs.push(\"--use-bun\");\n if (opts.skipInstall) createArgs.push(\"--skip-install\");\n\n await create.parseAsync(createArgs, { from: \"user\" });\n return;\n }\n\n logger.info(\"Initializing assistant-ui in existing project...\");\n logger.break();\n\n if (!opts.yes && isNonInteractiveShell()) {\n logger.error(\n [\n \"Detected a non-interactive shell, but 'assistant-ui init' needs interactive prompts by default.\",\n \"To run this in CI/agent mode, re-run with '--yes' so shadcn initialization and component install run non-interactively.\",\n \"Example: assistant-ui init --yes\",\n ].join(\"\\n\"),\n );\n process.exit(1);\n }\n\n try {\n const pm = await resolvePackageManagerForCwd(\n targetDir,\n resolvePackageManager(opts),\n );\n const [dlxCmd, dlxArgs] = dlxCommand(pm);\n\n const { initArgs, addArgs } = createExistingProjectInitPlan({\n yes: opts.yes,\n overwrite: opts.overwrite,\n });\n\n await runSpawn(dlxCmd, [...dlxArgs, ...initArgs], targetDir);\n const registryUrl = resolveQuickStartRegistryUrl(\n getComponentsJsonStyle(targetDir),\n );\n await runSpawn(dlxCmd, [...dlxArgs, ...addArgs, registryUrl], targetDir);\n\n logger.break();\n logger.success(\"Project initialized successfully!\");\n logger.info(\"You can now add more components with 'assistant-ui add'\");\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n if (error instanceof SpawnExitError) {\n logger.error(`Initialization failed with code ${error.code}`);\n process.exit(error.code);\n }\n const message = error instanceof Error ? error.message : String(error);\n logger.error(`Failed to initialize: ${message}`);\n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AC7C,IAAI,iBAAiB,gBAAgB;GACnC,OAAO,MAAM,mCAAmC,MAAM,MAAM;GAC5D,QAAQ,KAAK,MAAM,IAAI;EACzB;EACA,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,OAAO,MAAM,yBAAyB,SAAS;EAC/C,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuapC,eAAO,MAAM,GAAG,SAmDZ,CAAC"}
|
package/dist/commands/mcp.js
CHANGED
|
@@ -5,43 +5,47 @@ import fs from "node:fs";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import os from "node:os";
|
|
7
7
|
import * as p from "@clack/prompts";
|
|
8
|
+
import { applyEdits, parse, parseTree, stripComments } from "jsonc-parser";
|
|
8
9
|
//#region src/commands/mcp.ts
|
|
9
10
|
const HOSTED_MCP_URL = "https://www.assistant-ui.com/mcp";
|
|
10
11
|
const MCP_CONFIGS = {
|
|
11
12
|
cursor: {
|
|
12
13
|
name: "Cursor",
|
|
13
14
|
getPath: () => path.join(process.cwd(), ".cursor", "mcp.json"),
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
serverKey: "mcpServers",
|
|
16
|
+
server: { url: HOSTED_MCP_URL },
|
|
16
17
|
postInstall: "Open Cursor Settings → MCP → find 'assistant-ui' and click enable."
|
|
17
18
|
},
|
|
18
19
|
windsurf: {
|
|
19
20
|
name: "Windsurf",
|
|
20
21
|
getPath: () => path.join(os.homedir(), ".codeium", "windsurf", "mcp_config.json"),
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
serverKey: "mcpServers",
|
|
23
|
+
server: { serverUrl: HOSTED_MCP_URL },
|
|
23
24
|
postInstall: "Fully quit and re-open Windsurf to activate."
|
|
24
25
|
},
|
|
25
26
|
vscode: {
|
|
26
27
|
name: "VSCode",
|
|
27
28
|
getPath: () => path.join(process.cwd(), ".vscode", "mcp.json"),
|
|
28
|
-
|
|
29
|
+
serverKey: "servers",
|
|
30
|
+
server: {
|
|
29
31
|
type: "http",
|
|
30
32
|
url: HOSTED_MCP_URL
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
+
},
|
|
34
|
+
jsonc: true,
|
|
33
35
|
postInstall: "Enable MCP in Settings → search 'MCP' → enable 'Chat > MCP'. Use Copilot Chat in Agent mode."
|
|
34
36
|
},
|
|
35
37
|
zed: {
|
|
36
38
|
name: "Zed",
|
|
39
|
+
serverKey: "context_servers",
|
|
40
|
+
jsonc: true,
|
|
37
41
|
getPath: () => {
|
|
38
42
|
if (process.platform === "win32") return path.join(process.env.APPDATA || "", "Zed", "settings.json");
|
|
39
43
|
return path.join(os.homedir(), ".config", "zed", "settings.json");
|
|
40
44
|
},
|
|
41
|
-
|
|
45
|
+
server: { command: {
|
|
42
46
|
path: "npx",
|
|
43
47
|
args: ["-y", "@assistant-ui/mcp-docs-server"]
|
|
44
|
-
} }
|
|
48
|
+
} },
|
|
45
49
|
postInstall: "The server starts automatically with the Assistant Panel."
|
|
46
50
|
},
|
|
47
51
|
"claude-desktop": {
|
|
@@ -50,10 +54,11 @@ const MCP_CONFIGS = {
|
|
|
50
54
|
if (process.platform === "win32") return path.join(process.env.APPDATA || "", "Claude", "claude_desktop_config.json");
|
|
51
55
|
return path.join(os.homedir(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
52
56
|
},
|
|
53
|
-
|
|
57
|
+
serverKey: "mcpServers",
|
|
58
|
+
server: {
|
|
54
59
|
command: "npx",
|
|
55
60
|
args: ["-y", "@assistant-ui/mcp-docs-server"]
|
|
56
|
-
}
|
|
61
|
+
},
|
|
57
62
|
postInstall: "Restart Claude Desktop to activate."
|
|
58
63
|
}
|
|
59
64
|
};
|
|
@@ -70,6 +75,68 @@ var McpConfigParseError = class extends Error {
|
|
|
70
75
|
}
|
|
71
76
|
};
|
|
72
77
|
const getTargetFlag = (target) => `--${target}`;
|
|
78
|
+
const lastPropertyValue = (node, key) => node.children?.findLast((property) => property.children?.[0]?.value === key)?.children?.[1];
|
|
79
|
+
const lineStartAt = (content, offset) => content.lastIndexOf("\n", offset - 1) + 1;
|
|
80
|
+
const lineIndentAt = (content, offset) => content.slice(lineStartAt(content, offset), offset).match(/^[\t ]*/)?.[0] ?? "";
|
|
81
|
+
const getIndentUnit = (content, object) => {
|
|
82
|
+
const objectLine = lineStartAt(content, object.offset);
|
|
83
|
+
const objectIndent = lineIndentAt(content, object.offset);
|
|
84
|
+
const multilineChild = object.children?.find((child) => lineStartAt(content, child.offset) > objectLine);
|
|
85
|
+
if (multilineChild) {
|
|
86
|
+
const childIndent = lineIndentAt(content, multilineChild.offset);
|
|
87
|
+
if (childIndent.startsWith(objectIndent) && childIndent.length > objectIndent.length) return childIndent.slice(objectIndent.length);
|
|
88
|
+
}
|
|
89
|
+
const documentIndent = content.match(/(?:^|\r?\n)([\t ]+)(?=")/)?.[1];
|
|
90
|
+
if (documentIndent?.includes(" ")) return " ";
|
|
91
|
+
return documentIndent || " ";
|
|
92
|
+
};
|
|
93
|
+
const stringifyValue = (value, baseIndent, indentUnit, eol) => JSON.stringify(value, null, indentUnit).replaceAll("\n", `${eol}${baseIndent}`);
|
|
94
|
+
const appendObjectProperty = (content, object, key, value, eol) => {
|
|
95
|
+
const objectIndent = lineIndentAt(content, object.offset);
|
|
96
|
+
const indentUnit = getIndentUnit(content, object);
|
|
97
|
+
const propertyIndent = objectIndent + indentUnit;
|
|
98
|
+
const property = `${propertyIndent}${JSON.stringify(key)}: ${stringifyValue(value, propertyIndent, indentUnit, eol)}`;
|
|
99
|
+
const closeOffset = object.offset + object.length - 1;
|
|
100
|
+
const closeLineStart = lineStartAt(content, closeOffset);
|
|
101
|
+
const closeOnOwnLine = /^[\t ]*$/.test(content.slice(closeLineStart, closeOffset));
|
|
102
|
+
const edits = [{
|
|
103
|
+
offset: closeOnOwnLine ? closeLineStart : closeOffset,
|
|
104
|
+
length: 0,
|
|
105
|
+
content: closeOnOwnLine ? `${property}${eol}` : `${eol}${property}${eol}${objectIndent}`
|
|
106
|
+
}];
|
|
107
|
+
const lastProperty = object.children?.at(-1);
|
|
108
|
+
if (lastProperty) {
|
|
109
|
+
const propertyEnd = lastProperty.offset + lastProperty.length;
|
|
110
|
+
if (!stripComments(content.slice(propertyEnd, closeOffset)).trimStart().startsWith(",")) edits.unshift({
|
|
111
|
+
offset: propertyEnd,
|
|
112
|
+
length: 0,
|
|
113
|
+
content: ","
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return applyEdits(content, edits);
|
|
117
|
+
};
|
|
118
|
+
const replaceNodeValue = (content, node, container, value, eol) => applyEdits(content, [{
|
|
119
|
+
offset: node.offset,
|
|
120
|
+
length: node.length,
|
|
121
|
+
content: stringifyValue(value, lineIndentAt(content, node.offset), getIndentUnit(content, container), eol)
|
|
122
|
+
}]);
|
|
123
|
+
function updateJsoncConfig(content, serverKey, server) {
|
|
124
|
+
const eol = content.includes("\r\n") ? "\r\n" : "\n";
|
|
125
|
+
const root = parseTree(content, [], {
|
|
126
|
+
allowTrailingComma: true,
|
|
127
|
+
allowEmptyContent: true
|
|
128
|
+
});
|
|
129
|
+
if (!root) {
|
|
130
|
+
const initialized = JSON.stringify({ [serverKey]: { "assistant-ui": server } }, null, 2).replaceAll("\n", eol);
|
|
131
|
+
if (!content.trim()) return `${initialized}${eol}`;
|
|
132
|
+
return `${content}${content.endsWith(eol) ? "" : eol}${initialized}${eol}`;
|
|
133
|
+
}
|
|
134
|
+
const servers = lastPropertyValue(root, serverKey);
|
|
135
|
+
if (!servers) return appendObjectProperty(content, root, serverKey, { "assistant-ui": server }, eol);
|
|
136
|
+
if (servers.type !== "object") return replaceNodeValue(content, servers, root, { "assistant-ui": server }, eol);
|
|
137
|
+
const existing = lastPropertyValue(servers, "assistant-ui");
|
|
138
|
+
return existing ? replaceNodeValue(content, existing, servers, server, eol) : appendObjectProperty(content, servers, "assistant-ui", server, eol);
|
|
139
|
+
}
|
|
73
140
|
async function installForTarget(target) {
|
|
74
141
|
if (target === "claude-code") {
|
|
75
142
|
logger.info("Installing MCP server for Claude Code...");
|
|
@@ -116,10 +183,22 @@ async function installForTarget(target) {
|
|
|
116
183
|
logger.info(`Installing MCP server for ${targetConfig.name}...`);
|
|
117
184
|
if (!fs.existsSync(configDir)) fs.mkdirSync(configDir, { recursive: true });
|
|
118
185
|
let existingConfig = {};
|
|
186
|
+
let content = "{}\n";
|
|
119
187
|
if (fs.existsSync(configPath)) {
|
|
120
|
-
|
|
188
|
+
content = fs.readFileSync(configPath, "utf-8");
|
|
121
189
|
try {
|
|
122
|
-
|
|
190
|
+
if (targetConfig.jsonc) {
|
|
191
|
+
const errors = [];
|
|
192
|
+
existingConfig = parse(content, errors, {
|
|
193
|
+
allowTrailingComma: true,
|
|
194
|
+
allowEmptyContent: true
|
|
195
|
+
});
|
|
196
|
+
if (existingConfig === void 0) existingConfig = {};
|
|
197
|
+
if (errors.length > 0 || existingConfig === null || typeof existingConfig !== "object" || Array.isArray(existingConfig)) throw new SyntaxError("Invalid MCP configuration");
|
|
198
|
+
} else {
|
|
199
|
+
existingConfig = JSON.parse(content);
|
|
200
|
+
if (existingConfig === null || typeof existingConfig !== "object" || Array.isArray(existingConfig)) throw new SyntaxError("Invalid MCP configuration");
|
|
201
|
+
}
|
|
123
202
|
} catch {
|
|
124
203
|
const flag = getTargetFlag(target);
|
|
125
204
|
logger.error(`Could not parse ${targetConfig.name} MCP config.`);
|
|
@@ -129,19 +208,12 @@ async function installForTarget(target) {
|
|
|
129
208
|
throw new McpConfigParseError(targetConfig.name, configPath, flag);
|
|
130
209
|
}
|
|
131
210
|
}
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const key = targetConfig.replaceServerKey;
|
|
135
|
-
newConfig[key] = {
|
|
136
|
-
...newConfig[key],
|
|
137
|
-
"assistant-ui": targetConfig.config[key]["assistant-ui"]
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
fs.writeFileSync(configPath, `${JSON.stringify(newConfig, null, 2)}\n`);
|
|
211
|
+
const updatedContent = updateJsoncConfig(content, targetConfig.serverKey, target === "zed" || target === "claude-desktop" ? deepMerge(existingConfig[targetConfig.serverKey]?.["assistant-ui"] ?? {}, targetConfig.server) : targetConfig.server);
|
|
212
|
+
fs.writeFileSync(configPath, updatedContent);
|
|
141
213
|
logger.break();
|
|
142
214
|
logger.success(`MCP server installed for ${targetConfig.name}!`);
|
|
143
215
|
logger.info(`Config written to: ${configPath}`);
|
|
144
|
-
if (
|
|
216
|
+
if (target === "cursor" || target === "windsurf" || target === "vscode") {
|
|
145
217
|
logger.break();
|
|
146
218
|
logger.info(`Connects to the hosted assistant-ui MCP server at ${HOSTED_MCP_URL}.`);
|
|
147
219
|
}
|
package/dist/commands/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","names":[],"sources":["../../src/commands/mcp.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport os from \"node:os\";\nimport { logger } from \"../lib/utils/logger\";\nimport { runSpawn, SpawnExitError, SpawnSignalError } from \"../lib/run-spawn\";\nimport * as p from \"@clack/prompts\";\n\ntype MCPTarget =\n | \"cursor\"\n | \"windsurf\"\n | \"vscode\"\n | \"zed\"\n | \"claude-code\"\n | \"claude-desktop\";\n\nconst HOSTED_MCP_URL = \"https://www.assistant-ui.com/mcp\";\n\nconst MCP_CONFIGS: Record<\n Exclude<MCPTarget, \"claude-code\">,\n {\n name: string;\n getPath: () => string;\n config: object;\n replaceServerKey?: string;\n postInstall?: string;\n }\n> = {\n cursor: {\n name: \"Cursor\",\n getPath: () => path.join(process.cwd(), \".cursor\", \"mcp.json\"),\n config: {\n mcpServers: {\n \"assistant-ui\": {\n url: HOSTED_MCP_URL,\n },\n },\n },\n replaceServerKey: \"mcpServers\",\n postInstall:\n \"Open Cursor Settings → MCP → find 'assistant-ui' and click enable.\",\n },\n windsurf: {\n name: \"Windsurf\",\n getPath: () =>\n path.join(os.homedir(), \".codeium\", \"windsurf\", \"mcp_config.json\"),\n config: {\n mcpServers: {\n \"assistant-ui\": {\n serverUrl: HOSTED_MCP_URL,\n },\n },\n },\n replaceServerKey: \"mcpServers\",\n postInstall: \"Fully quit and re-open Windsurf to activate.\",\n },\n vscode: {\n name: \"VSCode\",\n getPath: () => path.join(process.cwd(), \".vscode\", \"mcp.json\"),\n config: {\n servers: {\n \"assistant-ui\": {\n type: \"http\",\n url: HOSTED_MCP_URL,\n },\n },\n },\n replaceServerKey: \"servers\",\n postInstall:\n \"Enable MCP in Settings → search 'MCP' → enable 'Chat > MCP'. Use Copilot Chat in Agent mode.\",\n },\n zed: {\n name: \"Zed\",\n getPath: () => {\n if (process.platform === \"win32\") {\n return path.join(process.env.APPDATA || \"\", \"Zed\", \"settings.json\");\n }\n return path.join(os.homedir(), \".config\", \"zed\", \"settings.json\");\n },\n config: {\n context_servers: {\n \"assistant-ui\": {\n command: {\n path: \"npx\",\n args: [\"-y\", \"@assistant-ui/mcp-docs-server\"],\n },\n },\n },\n },\n postInstall: \"The server starts automatically with the Assistant Panel.\",\n },\n \"claude-desktop\": {\n name: \"Claude Desktop\",\n getPath: () => {\n if (process.platform === \"win32\") {\n return path.join(\n process.env.APPDATA || \"\",\n \"Claude\",\n \"claude_desktop_config.json\",\n );\n }\n return path.join(\n os.homedir(),\n \"Library\",\n \"Application Support\",\n \"Claude\",\n \"claude_desktop_config.json\",\n );\n },\n config: {\n mcpServers: {\n \"assistant-ui\": {\n command: \"npx\",\n args: [\"-y\", \"@assistant-ui/mcp-docs-server\"],\n },\n },\n },\n postInstall: \"Restart Claude Desktop to activate.\",\n },\n};\n\nfunction deepMerge(target: any, source: any): any {\n const result = { ...target };\n for (const key of Object.keys(source)) {\n if (\n source[key] &&\n typeof source[key] === \"object\" &&\n !Array.isArray(source[key])\n ) {\n result[key] = deepMerge(result[key] || {}, source[key]);\n } else {\n result[key] = source[key];\n }\n }\n return result;\n}\n\nclass McpConfigParseError extends Error {\n constructor(targetName: string, configPath: string, flag: string) {\n super(\n `Invalid ${targetName} MCP config JSON at ${configPath}. Fix the JSON syntax, then run: assistant-ui mcp ${flag}`,\n );\n this.name = \"McpConfigParseError\";\n }\n}\n\nconst getTargetFlag = (target: Exclude<MCPTarget, \"claude-code\">) =>\n `--${target}`;\n\nasync function installForTarget(target: MCPTarget): Promise<void> {\n if (target === \"claude-code\") {\n logger.info(\"Installing MCP server for Claude Code...\");\n logger.break();\n\n try {\n await runSpawn(\"claude\", [\"mcp\", \"remove\", \"assistant-ui\"]).catch(\n (error: unknown) => {\n if (error instanceof SpawnSignalError) throw error;\n },\n );\n await runSpawn(\"claude\", [\n \"mcp\",\n \"add\",\n \"--transport\",\n \"http\",\n \"assistant-ui\",\n HOSTED_MCP_URL,\n ]);\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n if (error instanceof SpawnExitError) {\n logger.error(`Installation failed with code ${error.code}`);\n } else if (error instanceof Error) {\n logger.error(`Failed to install: ${error.message}`);\n logger.info(\n \"Make sure Claude Code CLI is installed: https://docs.anthropic.com/en/docs/claude-code\",\n );\n }\n throw error;\n }\n\n logger.break();\n logger.success(\"MCP server installed for Claude Code!\");\n logger.info(\n `Connects to the hosted assistant-ui MCP server at ${HOSTED_MCP_URL}.`,\n );\n logger.info(\n \"The server starts automatically. Try asking about assistant-ui!\",\n );\n return;\n }\n\n if (target === \"claude-desktop\" && process.platform === \"linux\") {\n logger.error(\"Claude Desktop is not available on Linux.\");\n logger.info(\n \"See: https://claude.ai/download for supported operating systems.\",\n );\n throw new Error(\"Unsupported platform for Claude Desktop\");\n }\n\n const targetConfig = MCP_CONFIGS[target];\n const configPath = targetConfig.getPath();\n const configDir = path.dirname(configPath);\n\n logger.info(`Installing MCP server for ${targetConfig.name}...`);\n\n if (!fs.existsSync(configDir)) {\n fs.mkdirSync(configDir, { recursive: true });\n }\n\n let existingConfig: any = {};\n if (fs.existsSync(configPath)) {\n const content = fs.readFileSync(configPath, \"utf-8\");\n try {\n existingConfig = JSON.parse(content);\n } catch {\n const flag = getTargetFlag(target);\n logger.error(`Could not parse ${targetConfig.name} MCP config.`);\n logger.info(`Config path: ${configPath}`);\n logger.info(\n `Fix the JSON syntax in that file, then run: assistant-ui mcp ${flag}`,\n );\n logger.info(\"No changes were written.\");\n throw new McpConfigParseError(targetConfig.name, configPath, flag);\n }\n }\n\n const newConfig = deepMerge(existingConfig, targetConfig.config);\n\n if (targetConfig.replaceServerKey) {\n const key = targetConfig.replaceServerKey;\n newConfig[key] = {\n ...newConfig[key],\n \"assistant-ui\": (targetConfig.config as any)[key][\"assistant-ui\"],\n };\n }\n\n fs.writeFileSync(configPath, `${JSON.stringify(newConfig, null, 2)}\\n`);\n\n logger.break();\n logger.success(`MCP server installed for ${targetConfig.name}!`);\n logger.info(`Config written to: ${configPath}`);\n\n if (targetConfig.replaceServerKey) {\n logger.break();\n logger.info(\n `Connects to the hosted assistant-ui MCP server at ${HOSTED_MCP_URL}.`,\n );\n }\n\n if (targetConfig.postInstall) {\n logger.break();\n logger.info(targetConfig.postInstall);\n }\n}\n\nexport const mcp = new Command()\n .name(\"mcp\")\n .description(\"connect your IDE to the assistant-ui MCP server\")\n .option(\"--cursor\", \"install for Cursor\")\n .option(\"--windsurf\", \"install for Windsurf\")\n .option(\"--vscode\", \"install for VSCode\")\n .option(\"--zed\", \"install for Zed\")\n .option(\"--claude-code\", \"install for Claude Code\")\n .option(\"--claude-desktop\", \"install for Claude Desktop\")\n .action(async (opts) => {\n const targets: MCPTarget[] = [];\n\n if (opts.cursor) targets.push(\"cursor\");\n if (opts.windsurf) targets.push(\"windsurf\");\n if (opts.vscode) targets.push(\"vscode\");\n if (opts.zed) targets.push(\"zed\");\n if (opts.claudeCode) targets.push(\"claude-code\");\n if (opts.claudeDesktop) targets.push(\"claude-desktop\");\n\n // If no target specified, prompt user\n if (targets.length === 0) {\n p.intro(\"assistant-ui MCP Server Installation\");\n\n const selected = await p.select({\n message: \"Select your IDE or tool:\",\n options: [\n { value: \"cursor\", label: \"Cursor\" },\n { value: \"windsurf\", label: \"Windsurf\" },\n { value: \"vscode\", label: \"VSCode\" },\n { value: \"zed\", label: \"Zed\" },\n { value: \"claude-code\", label: \"Claude Code\" },\n { value: \"claude-desktop\", label: \"Claude Desktop\" },\n ],\n });\n\n if (p.isCancel(selected)) {\n p.cancel(\"Installation cancelled.\");\n process.exit(0);\n }\n\n targets.push(selected as MCPTarget);\n }\n\n for (const target of targets) {\n try {\n await installForTarget(target);\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n process.exit(1);\n }\n }\n });\n"],"mappings":";;;;;;;;AAgBA,MAAM,iBAAiB;AAEvB,MAAM,cASF;CACF,QAAQ;EACN,MAAM;EACN,eAAe,KAAK,KAAK,QAAQ,IAAI,GAAG,WAAW,UAAU;EAC7D,QAAQ,EACN,YAAY,EACV,gBAAgB,EACd,KAAK,eACP,EACF,EACF;EACA,kBAAkB;EAClB,aACE;CACJ;CACA,UAAU;EACR,MAAM;EACN,eACE,KAAK,KAAK,GAAG,QAAQ,GAAG,YAAY,YAAY,iBAAiB;EACnE,QAAQ,EACN,YAAY,EACV,gBAAgB,EACd,WAAW,eACb,EACF,EACF;EACA,kBAAkB;EAClB,aAAa;CACf;CACA,QAAQ;EACN,MAAM;EACN,eAAe,KAAK,KAAK,QAAQ,IAAI,GAAG,WAAW,UAAU;EAC7D,QAAQ,EACN,SAAS,EACP,gBAAgB;GACd,MAAM;GACN,KAAK;EACP,EACF,EACF;EACA,kBAAkB;EAClB,aACE;CACJ;CACA,KAAK;EACH,MAAM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;IACP;KAAE,OAAO;KAAU,OAAO;IAAS;IACnC;KAAE,OAAO;KAAY,OAAO;IAAW;IACvC;KAAE,OAAO;KAAU,OAAO;IAAS;IACnC;KAAE,OAAO;KAAO,OAAO;IAAM;IAC7B;KAAE,OAAO;KAAe,OAAO;IAAc;IAC7C;KAAE,OAAO;KAAkB,OAAO;IAAiB;GACrD;EACF,CAAC;EAED,IAAI,EAAE,SAAS,QAAQ,GAAG;GACxB,EAAE,OAAO,yBAAyB;GAClC,QAAQ,KAAK,CAAC;EAChB;EAEA,QAAQ,KAAK,QAAqB;CACpC;CAEA,KAAK,MAAM,UAAU,SACnB,IAAI;EACF,MAAM,iBAAiB,MAAM;CAC/B,SAAS,OAAO;EACd,IAAI,iBAAiB,kBAAkB,MAAM;EAC7C,QAAQ,KAAK,CAAC;CAChB;AAEJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"mcp.js","names":["parseJsonc"],"sources":["../../src/commands/mcp.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport os from \"node:os\";\nimport {\n applyEdits,\n parse as parseJsonc,\n parseTree,\n stripComments,\n type Node,\n type ParseError,\n} from \"jsonc-parser\";\nimport { logger } from \"../lib/utils/logger\";\nimport { runSpawn, SpawnExitError, SpawnSignalError } from \"../lib/run-spawn\";\nimport * as p from \"@clack/prompts\";\n\ntype MCPTarget =\n | \"cursor\"\n | \"windsurf\"\n | \"vscode\"\n | \"zed\"\n | \"claude-code\"\n | \"claude-desktop\";\n\nconst HOSTED_MCP_URL = \"https://www.assistant-ui.com/mcp\";\n\nconst MCP_CONFIGS: Record<\n Exclude<MCPTarget, \"claude-code\">,\n {\n name: string;\n getPath: () => string;\n serverKey: string;\n server: object;\n jsonc?: boolean;\n postInstall?: string;\n }\n> = {\n cursor: {\n name: \"Cursor\",\n getPath: () => path.join(process.cwd(), \".cursor\", \"mcp.json\"),\n serverKey: \"mcpServers\",\n server: { url: HOSTED_MCP_URL },\n postInstall:\n \"Open Cursor Settings → MCP → find 'assistant-ui' and click enable.\",\n },\n windsurf: {\n name: \"Windsurf\",\n getPath: () =>\n path.join(os.homedir(), \".codeium\", \"windsurf\", \"mcp_config.json\"),\n serverKey: \"mcpServers\",\n server: { serverUrl: HOSTED_MCP_URL },\n postInstall: \"Fully quit and re-open Windsurf to activate.\",\n },\n vscode: {\n name: \"VSCode\",\n getPath: () => path.join(process.cwd(), \".vscode\", \"mcp.json\"),\n serverKey: \"servers\",\n server: { type: \"http\", url: HOSTED_MCP_URL },\n jsonc: true,\n postInstall:\n \"Enable MCP in Settings → search 'MCP' → enable 'Chat > MCP'. Use Copilot Chat in Agent mode.\",\n },\n zed: {\n name: \"Zed\",\n serverKey: \"context_servers\",\n jsonc: true,\n getPath: () => {\n if (process.platform === \"win32\") {\n return path.join(process.env.APPDATA || \"\", \"Zed\", \"settings.json\");\n }\n return path.join(os.homedir(), \".config\", \"zed\", \"settings.json\");\n },\n server: {\n command: {\n path: \"npx\",\n args: [\"-y\", \"@assistant-ui/mcp-docs-server\"],\n },\n },\n postInstall: \"The server starts automatically with the Assistant Panel.\",\n },\n \"claude-desktop\": {\n name: \"Claude Desktop\",\n getPath: () => {\n if (process.platform === \"win32\") {\n return path.join(\n process.env.APPDATA || \"\",\n \"Claude\",\n \"claude_desktop_config.json\",\n );\n }\n return path.join(\n os.homedir(),\n \"Library\",\n \"Application Support\",\n \"Claude\",\n \"claude_desktop_config.json\",\n );\n },\n serverKey: \"mcpServers\",\n server: {\n command: \"npx\",\n args: [\"-y\", \"@assistant-ui/mcp-docs-server\"],\n },\n postInstall: \"Restart Claude Desktop to activate.\",\n },\n};\n\nfunction deepMerge(target: any, source: any): any {\n const result = { ...target };\n for (const key of Object.keys(source)) {\n if (\n source[key] &&\n typeof source[key] === \"object\" &&\n !Array.isArray(source[key])\n ) {\n result[key] = deepMerge(result[key] || {}, source[key]);\n } else {\n result[key] = source[key];\n }\n }\n return result;\n}\n\nclass McpConfigParseError extends Error {\n constructor(targetName: string, configPath: string, flag: string) {\n super(\n `Invalid ${targetName} MCP config JSON at ${configPath}. Fix the JSON syntax, then run: assistant-ui mcp ${flag}`,\n );\n this.name = \"McpConfigParseError\";\n }\n}\n\nconst getTargetFlag = (target: Exclude<MCPTarget, \"claude-code\">) =>\n `--${target}`;\n\nconst lastPropertyValue = (node: Node, key: string) =>\n node.children?.findLast((property) => property.children?.[0]?.value === key)\n ?.children?.[1];\n\nconst lineStartAt = (content: string, offset: number) =>\n content.lastIndexOf(\"\\n\", offset - 1) + 1;\n\nconst lineIndentAt = (content: string, offset: number) =>\n content.slice(lineStartAt(content, offset), offset).match(/^[\\t ]*/)?.[0] ??\n \"\";\n\nconst getIndentUnit = (content: string, object: Node) => {\n const objectLine = lineStartAt(content, object.offset);\n const objectIndent = lineIndentAt(content, object.offset);\n const multilineChild = object.children?.find(\n (child) => lineStartAt(content, child.offset) > objectLine,\n );\n if (multilineChild) {\n const childIndent = lineIndentAt(content, multilineChild.offset);\n if (\n childIndent.startsWith(objectIndent) &&\n childIndent.length > objectIndent.length\n ) {\n return childIndent.slice(objectIndent.length);\n }\n }\n\n const documentIndent = content.match(/(?:^|\\r?\\n)([\\t ]+)(?=\")/)?.[1];\n if (documentIndent?.includes(\"\\t\")) return \"\\t\";\n return documentIndent || \" \";\n};\n\nconst stringifyValue = (\n value: object,\n baseIndent: string,\n indentUnit: string,\n eol: string,\n) =>\n JSON.stringify(value, null, indentUnit).replaceAll(\n \"\\n\",\n `${eol}${baseIndent}`,\n );\n\nconst appendObjectProperty = (\n content: string,\n object: Node,\n key: string,\n value: object,\n eol: string,\n) => {\n const objectIndent = lineIndentAt(content, object.offset);\n const indentUnit = getIndentUnit(content, object);\n const propertyIndent = objectIndent + indentUnit;\n const property = `${propertyIndent}${JSON.stringify(key)}: ${stringifyValue(\n value,\n propertyIndent,\n indentUnit,\n eol,\n )}`;\n const closeOffset = object.offset + object.length - 1;\n const closeLineStart = lineStartAt(content, closeOffset);\n const closeOnOwnLine = /^[\\t ]*$/.test(\n content.slice(closeLineStart, closeOffset),\n );\n const edits = [\n {\n offset: closeOnOwnLine ? closeLineStart : closeOffset,\n length: 0,\n content: closeOnOwnLine\n ? `${property}${eol}`\n : `${eol}${property}${eol}${objectIndent}`,\n },\n ];\n\n const lastProperty = object.children?.at(-1);\n if (lastProperty) {\n const propertyEnd = lastProperty.offset + lastProperty.length;\n const trailingContent = stripComments(\n content.slice(propertyEnd, closeOffset),\n ).trimStart();\n if (!trailingContent.startsWith(\",\")) {\n edits.unshift({ offset: propertyEnd, length: 0, content: \",\" });\n }\n }\n\n return applyEdits(content, edits);\n};\n\nconst replaceNodeValue = (\n content: string,\n node: Node,\n container: Node,\n value: object,\n eol: string,\n) =>\n applyEdits(content, [\n {\n offset: node.offset,\n length: node.length,\n content: stringifyValue(\n value,\n lineIndentAt(content, node.offset),\n getIndentUnit(content, container),\n eol,\n ),\n },\n ]);\n\nfunction updateJsoncConfig(\n content: string,\n serverKey: string,\n server: object,\n): string {\n const eol = content.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const root = parseTree(content, [], {\n allowTrailingComma: true,\n allowEmptyContent: true,\n });\n if (!root) {\n const initialized = JSON.stringify(\n { [serverKey]: { \"assistant-ui\": server } },\n null,\n 2,\n ).replaceAll(\"\\n\", eol);\n if (!content.trim()) return `${initialized}${eol}`;\n return `${content}${content.endsWith(eol) ? \"\" : eol}${initialized}${eol}`;\n }\n\n // JSONC resolves duplicate keys to the last value.\n const servers = lastPropertyValue(root, serverKey);\n if (!servers) {\n return appendObjectProperty(\n content,\n root,\n serverKey,\n { \"assistant-ui\": server },\n eol,\n );\n }\n\n if (servers.type !== \"object\") {\n return replaceNodeValue(\n content,\n servers,\n root,\n { \"assistant-ui\": server },\n eol,\n );\n }\n\n const existing = lastPropertyValue(servers, \"assistant-ui\");\n return existing\n ? replaceNodeValue(content, existing, servers, server, eol)\n : appendObjectProperty(content, servers, \"assistant-ui\", server, eol);\n}\n\nasync function installForTarget(target: MCPTarget): Promise<void> {\n if (target === \"claude-code\") {\n logger.info(\"Installing MCP server for Claude Code...\");\n logger.break();\n\n try {\n await runSpawn(\"claude\", [\"mcp\", \"remove\", \"assistant-ui\"]).catch(\n (error: unknown) => {\n if (error instanceof SpawnSignalError) throw error;\n },\n );\n await runSpawn(\"claude\", [\n \"mcp\",\n \"add\",\n \"--transport\",\n \"http\",\n \"assistant-ui\",\n HOSTED_MCP_URL,\n ]);\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n if (error instanceof SpawnExitError) {\n logger.error(`Installation failed with code ${error.code}`);\n } else if (error instanceof Error) {\n logger.error(`Failed to install: ${error.message}`);\n logger.info(\n \"Make sure Claude Code CLI is installed: https://docs.anthropic.com/en/docs/claude-code\",\n );\n }\n throw error;\n }\n\n logger.break();\n logger.success(\"MCP server installed for Claude Code!\");\n logger.info(\n `Connects to the hosted assistant-ui MCP server at ${HOSTED_MCP_URL}.`,\n );\n logger.info(\n \"The server starts automatically. Try asking about assistant-ui!\",\n );\n return;\n }\n\n if (target === \"claude-desktop\" && process.platform === \"linux\") {\n logger.error(\"Claude Desktop is not available on Linux.\");\n logger.info(\n \"See: https://claude.ai/download for supported operating systems.\",\n );\n throw new Error(\"Unsupported platform for Claude Desktop\");\n }\n\n const targetConfig = MCP_CONFIGS[target];\n const configPath = targetConfig.getPath();\n const configDir = path.dirname(configPath);\n\n logger.info(`Installing MCP server for ${targetConfig.name}...`);\n\n if (!fs.existsSync(configDir)) {\n fs.mkdirSync(configDir, { recursive: true });\n }\n\n let existingConfig: any = {};\n let content = \"{}\\n\";\n if (fs.existsSync(configPath)) {\n content = fs.readFileSync(configPath, \"utf-8\");\n try {\n if (targetConfig.jsonc) {\n const errors: ParseError[] = [];\n existingConfig = parseJsonc(content, errors, {\n allowTrailingComma: true,\n allowEmptyContent: true,\n });\n if (existingConfig === undefined) existingConfig = {};\n if (\n errors.length > 0 ||\n existingConfig === null ||\n typeof existingConfig !== \"object\" ||\n Array.isArray(existingConfig)\n ) {\n throw new SyntaxError(\"Invalid MCP configuration\");\n }\n } else {\n existingConfig = JSON.parse(content);\n if (\n existingConfig === null ||\n typeof existingConfig !== \"object\" ||\n Array.isArray(existingConfig)\n ) {\n throw new SyntaxError(\"Invalid MCP configuration\");\n }\n }\n } catch {\n const flag = getTargetFlag(target);\n logger.error(`Could not parse ${targetConfig.name} MCP config.`);\n logger.info(`Config path: ${configPath}`);\n logger.info(\n `Fix the JSON syntax in that file, then run: assistant-ui mcp ${flag}`,\n );\n logger.info(\"No changes were written.\");\n throw new McpConfigParseError(targetConfig.name, configPath, flag);\n }\n }\n\n const updatedContent = updateJsoncConfig(\n content,\n targetConfig.serverKey,\n target === \"zed\" || target === \"claude-desktop\"\n ? deepMerge(\n existingConfig[targetConfig.serverKey]?.[\"assistant-ui\"] ?? {},\n targetConfig.server,\n )\n : targetConfig.server,\n );\n fs.writeFileSync(configPath, updatedContent);\n\n logger.break();\n logger.success(`MCP server installed for ${targetConfig.name}!`);\n logger.info(`Config written to: ${configPath}`);\n\n if (target === \"cursor\" || target === \"windsurf\" || target === \"vscode\") {\n logger.break();\n logger.info(\n `Connects to the hosted assistant-ui MCP server at ${HOSTED_MCP_URL}.`,\n );\n }\n\n if (targetConfig.postInstall) {\n logger.break();\n logger.info(targetConfig.postInstall);\n }\n}\n\nexport const mcp = new Command()\n .name(\"mcp\")\n .description(\"connect your IDE to the assistant-ui MCP server\")\n .option(\"--cursor\", \"install for Cursor\")\n .option(\"--windsurf\", \"install for Windsurf\")\n .option(\"--vscode\", \"install for VSCode\")\n .option(\"--zed\", \"install for Zed\")\n .option(\"--claude-code\", \"install for Claude Code\")\n .option(\"--claude-desktop\", \"install for Claude Desktop\")\n .action(async (opts) => {\n const targets: MCPTarget[] = [];\n\n if (opts.cursor) targets.push(\"cursor\");\n if (opts.windsurf) targets.push(\"windsurf\");\n if (opts.vscode) targets.push(\"vscode\");\n if (opts.zed) targets.push(\"zed\");\n if (opts.claudeCode) targets.push(\"claude-code\");\n if (opts.claudeDesktop) targets.push(\"claude-desktop\");\n\n // If no target specified, prompt user\n if (targets.length === 0) {\n p.intro(\"assistant-ui MCP Server Installation\");\n\n const selected = await p.select({\n message: \"Select your IDE or tool:\",\n options: [\n { value: \"cursor\", label: \"Cursor\" },\n { value: \"windsurf\", label: \"Windsurf\" },\n { value: \"vscode\", label: \"VSCode\" },\n { value: \"zed\", label: \"Zed\" },\n { value: \"claude-code\", label: \"Claude Code\" },\n { value: \"claude-desktop\", label: \"Claude Desktop\" },\n ],\n });\n\n if (p.isCancel(selected)) {\n p.cancel(\"Installation cancelled.\");\n process.exit(0);\n }\n\n targets.push(selected as MCPTarget);\n }\n\n for (const target of targets) {\n try {\n await installForTarget(target);\n } catch (error) {\n if (error instanceof SpawnSignalError) throw error;\n process.exit(1);\n }\n }\n });\n"],"mappings":";;;;;;;;;AAwBA,MAAM,iBAAiB;AAEvB,MAAM,cAUF;CACF,QAAQ;EACN,MAAM;EACN,eAAe,KAAK,KAAK,QAAQ,IAAI,GAAG,WAAW,UAAU;EAC7D,WAAW;EACX,QAAQ,EAAE,KAAK,eAAe;EAC9B,aACE;CACJ;CACA,UAAU;EACR,MAAM;EACN,eACE,KAAK,KAAK,GAAG,QAAQ,GAAG,YAAY,YAAY,iBAAiB;EACnE,WAAW;EACX,QAAQ,EAAE,WAAW,eAAe;EACpC,aAAa;CACf;CACA,QAAQ;EACN,MAAM;EACN,eAAe,KAAK,KAAK,QAAQ,IAAI,GAAG,WAAW,UAAU;EAC7D,WAAW;EACX,QAAQ;GAAE,MAAM;GAAQ,KAAK;EAAe;EAC5C,OAAO;EACP,aACE;CACJ;CACA,KAAK;EACH,MAAM;EACN,WAAW;EACX,OAAO;EACP,eAAe;GACb,IAAI,QAAQ,aAAa,SACvB,OAAO,KAAK,KAAK,QAAQ,IAAI,WAAW,IAAI,OAAO,eAAe;GAEpE,OAAO,KAAK,KAAK,GAAG,QAAQ,GAAG,WAAW,OAAO,eAAe;EACl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AE9B,IAAI,KAAK,QAAQ,QAAQ,KAAK,QAAQ;CACtC,IAAI,KAAK,UAAU,QAAQ,KAAK,UAAU;CAC1C,IAAI,KAAK,QAAQ,QAAQ,KAAK,QAAQ;CACtC,IAAI,KAAK,KAAK,QAAQ,KAAK,KAAK;CAChC,IAAI,KAAK,YAAY,QAAQ,KAAK,aAAa;CAC/C,IAAI,KAAK,eAAe,QAAQ,KAAK,gBAAgB;CAGrD,IAAI,QAAQ,WAAW,GAAG;EACxB,EAAE,MAAM,sCAAsC;EAE9C,MAAM,WAAW,MAAM,EAAE,OAAO;GAC9B,SAAS;GACT,SAAS;IACP;KAAE,OAAO;KAAU,OAAO;IAAS;IACnC;KAAE,OAAO;KAAY,OAAO;IAAW;IACvC;KAAE,OAAO;KAAU,OAAO;IAAS;IACnC;KAAE,OAAO;KAAO,OAAO;IAAM;IAC7B;KAAE,OAAO;KAAe,OAAO;IAAc;IAC7C;KAAE,OAAO;KAAkB,OAAO;IAAiB;GACrD;EACF,CAAC;EAED,IAAI,EAAE,SAAS,QAAQ,GAAG;GACxB,EAAE,OAAO,yBAAyB;GAClC,QAAQ,KAAK,CAAC;EAChB;EAEA,QAAQ,KAAK,QAAqB;CACpC;CAEA,KAAK,MAAM,UAAU,SACnB,IAAI;EACF,MAAM,iBAAiB,MAAM;CAC/B,SAAS,OAAO;EACd,IAAI,iBAAiB,kBAAkB,MAAM;EAC7C,QAAQ,KAAK,CAAC;CAChB;AAEJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type PackageManagerName } from "./utils/package-manager.js";
|
|
2
2
|
export declare const SKILLS_PACKAGE = "assistant-ui/skills";
|
|
3
|
-
export declare const SKILLS_COMMIT = "
|
|
4
|
-
export declare const SKILLS_PLUGIN_SOURCE = "gh:assistant-ui/skills/assistant-ui#
|
|
3
|
+
export declare const SKILLS_COMMIT = "139674dc888ee076982b6726e8e6f5d0fe0b5f67";
|
|
4
|
+
export declare const SKILLS_PLUGIN_SOURCE = "gh:assistant-ui/skills/assistant-ui#139674dc888ee076982b6726e8e6f5d0fe0b5f67";
|
|
5
5
|
export declare function resolveSkillsInstall(params: {
|
|
6
6
|
skills?: boolean;
|
|
7
7
|
stdinIsTTY?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-skill.d.ts","sourceRoot":"","sources":["../../src/lib/agent-skill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-skill.d.ts","sourceRoot":"","sources":["../../src/lib/agent-skill.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,kBAAkB,EAAE,mCAAgC;AAE9E,eAAO,MAAM,cAAc,wBAAwB,CAAC;AACpD,eAAO,MAAM,aAAa,6CAA6C,CAAC;AACxE,eAAO,MAAM,oBAAoB,iFAAuD,CAAC;AAEzF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,OAAO,GAAG,SAAS,CAKtB;AAED,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,kBAAkB,EACtB,MAAM,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACpC,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAUpB;AAED,wBAAgB,eAAe,IAAI,MAAM,CAIxC;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CA2C1D"}
|