assistant-ui 0.0.116 → 0.0.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codemods/utils/createTransformer.d.ts +13 -16
- package/dist/codemods/utils/createTransformer.d.ts.map +1 -1
- package/dist/codemods/utils/resolveBinding.d.ts +3 -0
- package/dist/codemods/utils/resolveBinding.d.ts.map +1 -0
- package/dist/codemods/utils/resolveBinding.js +78 -0
- package/dist/codemods/utils/resolveBinding.js.map +1 -0
- package/dist/codemods/v0-11/content-part-to-message-part.d.ts +1 -3
- package/dist/codemods/v0-11/content-part-to-message-part.d.ts.map +1 -1
- package/dist/codemods/v0-12/assistant-api-to-aui.d.ts +1 -3
- package/dist/codemods/v0-12/assistant-api-to-aui.d.ts.map +1 -1
- package/dist/codemods/v0-12/assistant-api-to-aui.js +51 -99
- package/dist/codemods/v0-12/assistant-api-to-aui.js.map +1 -1
- package/dist/codemods/v0-12/event-names-to-camelcase.d.ts +1 -3
- package/dist/codemods/v0-12/event-names-to-camelcase.d.ts.map +1 -1
- package/dist/codemods/v0-12/primitive-if-to-aui-if.d.ts +1 -3
- package/dist/codemods/v0-12/primitive-if-to-aui-if.d.ts.map +1 -1
- package/dist/codemods/v0-15/aui-accessor-calls-to-properties.d.ts +1 -3
- package/dist/codemods/v0-15/aui-accessor-calls-to-properties.d.ts.map +1 -1
- package/dist/codemods/v0-15/aui-accessor-calls-to-properties.js +33 -5
- package/dist/codemods/v0-15/aui-accessor-calls-to-properties.js.map +1 -1
- package/dist/codemods/v0-8/ui-package-split.d.ts +1 -3
- package/dist/codemods/v0-8/ui-package-split.d.ts.map +1 -1
- package/dist/codemods/v0-9/edge-package-split.d.ts +1 -3
- package/dist/codemods/v0-9/edge-package-split.d.ts.map +1 -1
- package/dist/commands/add.d.ts +13 -16
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +3 -3
- package/dist/commands/agent.d.ts +1 -4
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +16 -13
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/create.d.ts +43 -39
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +40 -26
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/doctor.d.ts +17 -20
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/info.d.ts +4 -6
- package/dist/commands/info.d.ts.map +1 -1
- package/dist/commands/info.js +3 -3
- package/dist/commands/init.d.ts +8 -10
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mcp.d.ts +1 -4
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +2 -2
- package/dist/commands/update.d.ts +1 -4
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +1 -1
- package/dist/commands/upgrade.d.ts +7 -10
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/agent-skill.d.ts +11 -10
- package/dist/lib/agent-skill.d.ts.map +1 -1
- package/dist/lib/agent-skill.js +78 -2
- package/dist/lib/agent-skill.js.map +1 -1
- package/dist/lib/create-project.d.ts +33 -32
- package/dist/lib/create-project.d.ts.map +1 -1
- package/dist/lib/create-project.js +91 -5
- package/dist/lib/create-project.js.map +1 -1
- package/dist/lib/handle-cli-error.d.ts +1 -4
- package/dist/lib/handle-cli-error.d.ts.map +1 -1
- package/dist/lib/install-ai-sdk-lib.d.ts +1 -4
- package/dist/lib/install-ai-sdk-lib.d.ts.map +1 -1
- package/dist/lib/install-edge-lib.d.ts +1 -4
- package/dist/lib/install-edge-lib.d.ts.map +1 -1
- package/dist/lib/run-spawn.d.ts +17 -19
- package/dist/lib/run-spawn.d.ts.map +1 -1
- package/dist/lib/run-spawn.js +25 -10
- package/dist/lib/run-spawn.js.map +1 -1
- package/dist/lib/transform-options.d.ts +5 -8
- package/dist/lib/transform-options.d.ts.map +1 -1
- package/dist/lib/transform.d.ts +13 -16
- package/dist/lib/transform.d.ts.map +1 -1
- package/dist/lib/transform.js +19 -35
- package/dist/lib/transform.js.map +1 -1
- package/dist/lib/upgrade.d.ts +3 -6
- package/dist/lib/upgrade.d.ts.map +1 -1
- package/dist/lib/upgrade.js +6 -11
- package/dist/lib/upgrade.js.map +1 -1
- package/dist/lib/utils/config.d.ts +18 -21
- package/dist/lib/utils/config.d.ts.map +1 -1
- package/dist/lib/utils/file-scanner.d.ts +12 -15
- package/dist/lib/utils/file-scanner.d.ts.map +1 -1
- package/dist/lib/utils/logger.d.ts +7 -10
- package/dist/lib/utils/logger.d.ts.map +1 -1
- package/dist/lib/utils/package-installer.d.ts +7 -10
- package/dist/lib/utils/package-installer.d.ts.map +1 -1
- package/dist/lib/utils/package-json.d.ts +1 -4
- package/dist/lib/utils/package-json.d.ts.map +1 -1
- package/dist/lib/utils/package-manager.d.ts +9 -12
- package/dist/lib/utils/package-manager.d.ts.map +1 -1
- package/dist/lib/utils/package-manager.js +13 -2
- package/dist/lib/utils/package-manager.js.map +1 -1
- package/dist/lib/utils/registry.d.ts +5 -8
- package/dist/lib/utils/registry.d.ts.map +1 -1
- package/dist/lib/utils/workspace.d.ts +2 -5
- package/dist/lib/utils/workspace.d.ts.map +1 -1
- package/dist/program.d.ts +1 -4
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +6 -6
- package/dist/run.d.ts +1 -4
- package/dist/run.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/codemods/utils/resolveBinding.test.ts +107 -0
- package/src/codemods/utils/resolveBinding.ts +130 -0
- package/src/codemods/v0-12/__tests__/assistant-api-to-aui.test.ts +256 -0
- package/src/codemods/v0-12/assistant-api-to-aui.ts +125 -225
- package/src/codemods/v0-15/__tests__/aui-accessor-calls-to-properties.test.ts +101 -0
- package/src/codemods/v0-15/aui-accessor-calls-to-properties.ts +60 -5
- package/src/commands/agent.ts +15 -22
- package/src/commands/create.ts +53 -20
- package/src/commands/init.ts +1 -2
- package/src/lib/agent-skill.ts +103 -1
- package/src/lib/create-project.ts +99 -4
- package/src/lib/run-spawn.test.ts +47 -0
- package/src/lib/run-spawn.ts +29 -17
- package/src/lib/transform-files.test.ts +71 -0
- package/src/lib/transform.test.ts +69 -1
- package/src/lib/transform.ts +23 -38
- package/src/lib/upgrade.ts +9 -13
- package/src/lib/utils/package-manager.ts +24 -1
- package/plugin/.claude-plugin/plugin.json +0 -8
- package/plugin/skills/assistant-ui/SKILL.md +0 -199
- package/plugin/skills/assistant-ui/shipables.json +0 -22
package/dist/commands/add.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { PackageManagerName } from "../lib/utils/package-manager.js";
|
|
2
1
|
import { Command } from "commander";
|
|
3
|
-
|
|
4
|
-
interface AddComponentsPlan {
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { type PackageManagerName } from "../lib/utils/package-manager.js";
|
|
3
|
+
export interface AddComponentsPlan {
|
|
4
|
+
command: string;
|
|
5
|
+
args: string[];
|
|
7
6
|
}
|
|
8
|
-
declare function createAddComponentsPlan(params: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
export declare function createAddComponentsPlan(params: {
|
|
8
|
+
components: string[];
|
|
9
|
+
packageManager: PackageManagerName;
|
|
10
|
+
yes?: boolean;
|
|
11
|
+
overwrite?: boolean;
|
|
12
|
+
path?: string;
|
|
13
|
+
style?: string;
|
|
14
|
+
platform?: "web" | "native";
|
|
16
15
|
}): AddComponentsPlan;
|
|
17
|
-
declare const add: Command;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { AddComponentsPlan, add, createAddComponentsPlan };
|
|
16
|
+
export declare const add: Command;
|
|
20
17
|
//# sourceMappingURL=add.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,OAAO,EACL,KAAK,kBAAkB,EAExB,wCAAqC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC9C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,kBAAkB,CAAC;IACnC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CAC7B,GAAG,iBAAiB,CAkBpB;AAED,eAAO,MAAM,GAAG,SA4DZ,CAAC"}
|
package/dist/commands/add.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SpawnExitError, SpawnSignalError, runSpawn } from "../lib/run-spawn.js";
|
|
2
1
|
import { logger } from "../lib/utils/logger.js";
|
|
3
|
-
import {
|
|
2
|
+
import { hasConfig } from "../lib/utils/config.js";
|
|
4
3
|
import { detectRegistryPlatform, getComponentsJsonStyle, resolveRegistryItemUrl } from "../lib/utils/registry.js";
|
|
4
|
+
import { SpawnExitError, SpawnSignalError, runSpawn } from "../lib/run-spawn.js";
|
|
5
|
+
import { resolvePackageManagerForCwd } from "../lib/utils/package-manager.js";
|
|
5
6
|
import { dlxCommand, resolvePackageManager } from "../lib/create-project.js";
|
|
6
|
-
import { hasConfig } from "../lib/utils/config.js";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
//#region src/commands/add.ts
|
|
9
9
|
function createAddComponentsPlan(params) {
|
package/dist/commands/agent.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,eAAO,MAAM,KAAK,SAed,CAAC"}
|
package/dist/commands/agent.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
+
import { logger } from "../lib/utils/logger.js";
|
|
2
|
+
import { ensureSkillsPlugin, skillsPluginDir } from "../lib/agent-skill.js";
|
|
1
3
|
import { Command } from "commander";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
4
|
import { launch } from "@assistant-ui/agent-launcher";
|
|
6
5
|
//#region src/commands/agent.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
async function resolvePluginDir(dry) {
|
|
7
|
+
if (dry) return skillsPluginDir();
|
|
8
|
+
try {
|
|
9
|
+
return await ensureSkillsPlugin();
|
|
10
|
+
} catch (error) {
|
|
11
|
+
logger.error(error instanceof Error ? error.message : String(error));
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
12
14
|
}
|
|
13
|
-
const agent = new Command().name("agent").description("launch Claude Code with assistant-ui skills").argument("<prompt...>", "prompt for the agent").option("--dry", "print the command instead of running it").action((promptParts, opts) => {
|
|
14
|
-
const
|
|
15
|
+
const agent = new Command().name("agent").description("launch Claude Code with assistant-ui skills").argument("<prompt...>", "prompt for the agent").option("--dry", "print the command instead of running it").action(async (promptParts, opts) => {
|
|
16
|
+
const dry = opts.dry === true;
|
|
17
|
+
const pluginDir = await resolvePluginDir(dry);
|
|
15
18
|
launch({
|
|
16
|
-
pluginDir
|
|
19
|
+
pluginDir,
|
|
17
20
|
skillName: "assistant-ui",
|
|
18
|
-
prompt,
|
|
19
|
-
dry
|
|
21
|
+
prompt: promptParts.join(" "),
|
|
22
|
+
dry
|
|
20
23
|
});
|
|
21
24
|
});
|
|
22
25
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","names":[],"sources":["../../src/commands/agent.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport {
|
|
1
|
+
{"version":3,"file":"agent.js","names":[],"sources":["../../src/commands/agent.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { launch } from \"@assistant-ui/agent-launcher\";\nimport { ensureSkillsPlugin, skillsPluginDir } from \"../lib/agent-skill\";\nimport { logger } from \"../lib/utils/logger\";\n\nasync function resolvePluginDir(dry: boolean): Promise<string> {\n if (dry) return skillsPluginDir();\n try {\n return await ensureSkillsPlugin();\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n}\n\nexport const agent = new Command()\n .name(\"agent\")\n .description(\"launch Claude Code with assistant-ui skills\")\n .argument(\"<prompt...>\", \"prompt for the agent\")\n .option(\"--dry\", \"print the command instead of running it\")\n .action(async (promptParts: string[], opts: { dry?: boolean }) => {\n const dry = opts.dry === true;\n const pluginDir = await resolvePluginDir(dry);\n\n launch({\n pluginDir,\n skillName: \"assistant-ui\",\n prompt: promptParts.join(\" \"),\n dry,\n });\n });\n"],"mappings":";;;;;AAKA,eAAe,iBAAiB,KAA+B;CAC7D,IAAI,KAAK,OAAO,gBAAgB;CAChC,IAAI;EACF,OAAO,MAAM,mBAAmB;CAClC,SAAS,OAAO;EACd,OAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EACnE,QAAQ,KAAK,CAAC;CAChB;AACF;AAEA,MAAa,QAAQ,IAAI,QAAQ,CAAC,CAC/B,KAAK,OAAO,CAAC,CACb,YAAY,6CAA6C,CAAC,CAC1D,SAAS,eAAe,sBAAsB,CAAC,CAC/C,OAAO,SAAS,yCAAyC,CAAC,CAC1D,OAAO,OAAO,aAAuB,SAA4B;CAChE,MAAM,MAAM,KAAK,QAAQ;CACzB,MAAM,YAAY,MAAM,iBAAiB,GAAG;CAE5C,OAAO;EACL;EACA,WAAW;EACX,QAAQ,YAAY,KAAK,GAAG;EAC5B;CACF,CAAC;AACH,CAAC"}
|
|
@@ -1,49 +1,53 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
hasLocalComponents: boolean;
|
|
3
|
+
export interface ProjectMetadata {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
category: "template" | "example";
|
|
8
|
+
path: string;
|
|
9
|
+
hasLocalComponents: boolean;
|
|
11
10
|
}
|
|
12
|
-
declare const PROJECT_METADATA: ProjectMetadata[];
|
|
13
|
-
declare function resolveProject(params: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
export declare const PROJECT_METADATA: ProjectMetadata[];
|
|
12
|
+
export declare function resolveProject(params: {
|
|
13
|
+
template?: string;
|
|
14
|
+
example?: string;
|
|
15
|
+
stdinIsTTY?: boolean;
|
|
16
|
+
select?: typeof p.select;
|
|
17
|
+
isCancel?: typeof p.isCancel;
|
|
19
18
|
}): Promise<ProjectMetadata | null>;
|
|
20
|
-
declare function resolveCreateProjectDirectory(params: {
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
export declare function resolveCreateProjectDirectory(params: {
|
|
20
|
+
projectDirectory?: string;
|
|
21
|
+
stdinIsTTY?: boolean;
|
|
23
22
|
}): string | undefined;
|
|
24
|
-
declare
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export declare const DEFAULT_PROJECT_DIRECTORY = "my-aui-app";
|
|
24
|
+
export declare const projectNamePromptOptions: {
|
|
25
|
+
message: string;
|
|
26
|
+
placeholder: string;
|
|
27
|
+
defaultValue: string;
|
|
28
|
+
validate: (value?: string) => "Project name cannot be empty" | "Project name cannot be . or .." | "Project name cannot contain path separators" | undefined;
|
|
29
|
+
};
|
|
30
|
+
export declare function resolveProjectDirectoryGuidance(params: {
|
|
31
|
+
absoluteProjectDir: string;
|
|
32
|
+
cwd?: string;
|
|
33
|
+
platform?: NodeJS.Platform;
|
|
28
34
|
}): {
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
display: string;
|
|
36
|
+
cdCommand: string;
|
|
31
37
|
};
|
|
32
|
-
declare function resolvePresetUrl(preset: string): string;
|
|
33
|
-
interface ScaffoldSelectorOptions {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
export declare function resolvePresetUrl(preset: string): string;
|
|
39
|
+
export interface ScaffoldSelectorOptions {
|
|
40
|
+
template?: string;
|
|
41
|
+
example?: string;
|
|
42
|
+
preset?: string;
|
|
43
|
+
native?: boolean;
|
|
44
|
+
ink?: boolean;
|
|
39
45
|
}
|
|
40
|
-
interface ResolvedScaffoldSelector {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
export interface ResolvedScaffoldSelector {
|
|
47
|
+
template?: string;
|
|
48
|
+
example?: string;
|
|
49
|
+
preset?: string;
|
|
44
50
|
}
|
|
45
|
-
declare function resolveScaffoldSelector(opts: ScaffoldSelectorOptions): ResolvedScaffoldSelector;
|
|
46
|
-
declare const create: Command;
|
|
47
|
-
//#endregion
|
|
48
|
-
export { PROJECT_METADATA, ProjectMetadata, ResolvedScaffoldSelector, ScaffoldSelectorOptions, create, resolveCreateProjectDirectory, resolvePresetUrl, resolveProject, resolveProjectDirectoryGuidance, resolveScaffoldSelector };
|
|
51
|
+
export declare function resolveScaffoldSelector(opts: ScaffoldSelectorOptions): ResolvedScaffoldSelector;
|
|
52
|
+
export declare const create: Command;
|
|
49
53
|
//# sourceMappingURL=create.d.ts.map
|
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AC;CAC5B,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CA8BzC;AAKD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAYD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,uBAAuB,GAC5B,wBAAwB,CAkC1B;AAED,eAAO,MAAM,MAAM,SA+Uf,CAAC"}
|
package/dist/commands/create.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SpawnExitError, SpawnSignalError, hasActiveSpawn, runSpawn } from "../lib/run-spawn.js";
|
|
2
1
|
import { logger } from "../lib/utils/logger.js";
|
|
2
|
+
import { SpawnExitError, SpawnSignalError, hasActiveSpawn, runSpawn } from "../lib/run-spawn.js";
|
|
3
3
|
import { resolvePackageManagerForCwd } from "../lib/utils/package-manager.js";
|
|
4
|
-
import { dlxCommand, downloadProject, resolveLatestReleaseRef, resolvePackageManager, scaffoldProject, transformProject } from "../lib/create-project.js";
|
|
4
|
+
import { cleanupPendingProjectDownloads, dlxCommand, downloadProject, resolveLatestReleaseRef, resolvePackageManager, scaffoldProject, transformProject } from "../lib/create-project.js";
|
|
5
5
|
import { buildSkillsAddCommand, resolveSkillsInstall } from "../lib/agent-skill.js";
|
|
6
6
|
import { Command, Option } from "commander";
|
|
7
7
|
import chalk from "chalk";
|
|
@@ -310,8 +310,21 @@ async function resolveProject(params) {
|
|
|
310
310
|
function resolveCreateProjectDirectory(params) {
|
|
311
311
|
const { projectDirectory, stdinIsTTY = process.stdin.isTTY } = params;
|
|
312
312
|
if (projectDirectory) return projectDirectory;
|
|
313
|
-
if (!stdinIsTTY) return
|
|
313
|
+
if (!stdinIsTTY) return DEFAULT_PROJECT_DIRECTORY;
|
|
314
314
|
}
|
|
315
|
+
const DEFAULT_PROJECT_DIRECTORY = "my-aui-app";
|
|
316
|
+
const projectNamePromptOptions = {
|
|
317
|
+
message: "Project name:",
|
|
318
|
+
placeholder: DEFAULT_PROJECT_DIRECTORY,
|
|
319
|
+
defaultValue: DEFAULT_PROJECT_DIRECTORY,
|
|
320
|
+
validate: (value) => {
|
|
321
|
+
if (value === void 0 || value === "") return void 0;
|
|
322
|
+
const name = value.trim();
|
|
323
|
+
if (!name) return "Project name cannot be empty";
|
|
324
|
+
if (name === "." || name === "..") return "Project name cannot be . or ..";
|
|
325
|
+
if (name.includes("/") || name.includes("\\")) return "Project name cannot contain path separators";
|
|
326
|
+
}
|
|
327
|
+
};
|
|
315
328
|
function resolveProjectDirectoryGuidance(params) {
|
|
316
329
|
const { absoluteProjectDir, cwd = process.cwd(), platform = process.platform } = params;
|
|
317
330
|
const isWindows = platform === "win32";
|
|
@@ -359,7 +372,7 @@ function resolveScaffoldSelector(opts) {
|
|
|
359
372
|
...hasPreset && { preset: opts.preset }
|
|
360
373
|
};
|
|
361
374
|
}
|
|
362
|
-
const create = new Command().name("create").description("create a new project").argument("[project-directory]").usage(`${chalk.green("[project-directory]")} [options]`).option("-t, --template <template>", `template to use (${templateNames.join(", ")})`).option("-e, --example <example>", `create from an example (${exampleNames.join(", ")})`).option("-p, --preset <name-or-url>", "preset name or URL (e.g., chatgpt or https://www.assistant-ui.com/playground/init?preset=chatgpt)").option("--use-npm", "explicitly use npm").option("--use-pnpm", "explicitly use pnpm").option("--use-yarn", "explicitly use yarn").option("--use-bun", "explicitly use bun").option("--native", "create an Expo / React Native project").option("--ink", "create a React Ink terminal project").option("--skip-install", "skip installing packages").option("--skills", "add assistant-ui agent skills for AI coding assistants").option("--no-skills", "skip adding assistant-ui agent skills").addOption(new Option("--debug-source-root <path>", "copy templates/examples from a local assistant-ui repo root").hideHelp()).action(async (projectDirectory, opts) => {
|
|
375
|
+
const create = new Command().name("create").description("create a new project").argument("[project-directory]").usage(`${chalk.green("[project-directory]")} [options]`).option("-t, --template <template>", `template to use (${templateNames.join(", ")})`).option("-e, --example <example>", `create from an example (${exampleNames.join(", ")})`).option("-p, --preset <name-or-url>", "preset name or URL (e.g., chatgpt or https://www.assistant-ui.com/playground/init?preset=chatgpt)").option("--use-npm", "explicitly use npm").option("--use-pnpm", "explicitly use pnpm").option("--use-yarn", "explicitly use yarn").option("--use-bun", "explicitly use bun").option("--native", "create an Expo / React Native project").option("--ink", "create a React Ink terminal project").option("--skip-install", "skip installing packages").option("--skills", "add assistant-ui agent skills for AI coding assistants").option("--no-skills", "skip adding assistant-ui agent skills").addOption(new Option("--cwd <cwd>", "the working directory. defaults to the current directory.").hideHelp()).addOption(new Option("--debug-source-root <path>", "copy templates/examples from a local assistant-ui repo root").hideHelp()).action(async (projectDirectory, opts) => {
|
|
363
376
|
let scaffoldSelector;
|
|
364
377
|
try {
|
|
365
378
|
scaffoldSelector = resolveScaffoldSelector(opts);
|
|
@@ -372,25 +385,16 @@ const create = new Command().name("create").description("create a new project").
|
|
|
372
385
|
const refPromise = localSourceRoot ? Promise.resolve(void 0) : resolveLatestReleaseRef();
|
|
373
386
|
let resolvedProjectDirectory = resolveCreateProjectDirectory({ projectDirectory });
|
|
374
387
|
if (!resolvedProjectDirectory) {
|
|
375
|
-
const result = await p.text(
|
|
376
|
-
message: "Project name:",
|
|
377
|
-
placeholder: "my-aui-app",
|
|
378
|
-
defaultValue: "my-aui-app",
|
|
379
|
-
validate: (value) => {
|
|
380
|
-
const name = (value ?? "").trim();
|
|
381
|
-
if (!name) return "Project name cannot be empty";
|
|
382
|
-
if (name === "." || name === "..") return "Project name cannot be . or ..";
|
|
383
|
-
if (name.includes("/") || name.includes("\\")) return "Project name cannot contain path separators";
|
|
384
|
-
}
|
|
385
|
-
});
|
|
388
|
+
const result = await p.text(projectNamePromptOptions);
|
|
386
389
|
if (p.isCancel(result)) {
|
|
387
390
|
p.cancel("Project creation cancelled.");
|
|
388
391
|
process.exit(0);
|
|
389
392
|
}
|
|
390
393
|
resolvedProjectDirectory = result;
|
|
391
394
|
}
|
|
392
|
-
const absoluteProjectDir = path.resolve(resolvedProjectDirectory);
|
|
395
|
+
const absoluteProjectDir = path.resolve(opts.cwd ?? process.cwd(), resolvedProjectDirectory);
|
|
393
396
|
const { display: displayProjectDir, cdCommand } = resolveProjectDirectoryGuidance({ absoluteProjectDir });
|
|
397
|
+
let projectDirExisted = true;
|
|
394
398
|
try {
|
|
395
399
|
if (fs.readdirSync(absoluteProjectDir).length > 0) {
|
|
396
400
|
logger.error(`Directory ${displayProjectDir} already exists and is not empty`);
|
|
@@ -398,7 +402,8 @@ const create = new Command().name("create").description("create a new project").
|
|
|
398
402
|
}
|
|
399
403
|
} catch (err) {
|
|
400
404
|
const code = err instanceof Error ? err.code : void 0;
|
|
401
|
-
if (code === "ENOENT")
|
|
405
|
+
if (code === "ENOENT") projectDirExisted = false;
|
|
406
|
+
else if (code === "ENOTDIR") {
|
|
402
407
|
logger.error(`${displayProjectDir} already exists and is not a directory`);
|
|
403
408
|
process.exit(1);
|
|
404
409
|
} else {
|
|
@@ -431,14 +436,25 @@ const create = new Command().name("create").description("create a new project").
|
|
|
431
436
|
logger.info(`Creating project from ${project.category}: ${project.label}`);
|
|
432
437
|
logger.break();
|
|
433
438
|
const pm = await resolvePackageManagerForCwd(path.dirname(absoluteProjectDir), resolvePackageManager(opts));
|
|
439
|
+
const resetProjectDir = () => {
|
|
440
|
+
if (!projectDirExisted) {
|
|
441
|
+
fs.rmSync(absoluteProjectDir, {
|
|
442
|
+
recursive: true,
|
|
443
|
+
force: true
|
|
444
|
+
});
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
if (!fs.existsSync(absoluteProjectDir)) return;
|
|
448
|
+
for (const entry of fs.readdirSync(absoluteProjectDir)) fs.rmSync(path.join(absoluteProjectDir, entry), {
|
|
449
|
+
recursive: true,
|
|
450
|
+
force: true
|
|
451
|
+
});
|
|
452
|
+
};
|
|
434
453
|
let cleanupArmed = true;
|
|
435
454
|
const cleanupOnExit = () => {
|
|
436
455
|
if (!cleanupArmed) return;
|
|
437
456
|
cleanupArmed = false;
|
|
438
|
-
|
|
439
|
-
recursive: true,
|
|
440
|
-
force: true
|
|
441
|
-
});
|
|
457
|
+
resetProjectDir();
|
|
442
458
|
};
|
|
443
459
|
const disarmCleanup = () => {
|
|
444
460
|
cleanupArmed = false;
|
|
@@ -448,6 +464,7 @@ const create = new Command().name("create").description("create a new project").
|
|
|
448
464
|
};
|
|
449
465
|
const cleanupOnSignal = (signal) => {
|
|
450
466
|
if (hasActiveSpawn()) return;
|
|
467
|
+
cleanupPendingProjectDownloads();
|
|
451
468
|
cleanupOnExit();
|
|
452
469
|
disarmCleanup();
|
|
453
470
|
process.kill(process.pid, signal);
|
|
@@ -471,10 +488,7 @@ const create = new Command().name("create").description("create a new project").
|
|
|
471
488
|
};
|
|
472
489
|
await scaffoldProject(project.path, absoluteProjectDir, source);
|
|
473
490
|
if (!localSourceRoot && ref && !fs.existsSync(path.join(absoluteProjectDir, "package.json"))) {
|
|
474
|
-
|
|
475
|
-
recursive: true,
|
|
476
|
-
force: true
|
|
477
|
-
});
|
|
491
|
+
resetProjectDir();
|
|
478
492
|
logger.warn("Template not found at release tag, downloading from HEAD");
|
|
479
493
|
await downloadProject(project.path, absoluteProjectDir);
|
|
480
494
|
}
|
|
@@ -567,6 +581,6 @@ const create = new Command().name("create").description("create a new project").
|
|
|
567
581
|
}
|
|
568
582
|
});
|
|
569
583
|
//#endregion
|
|
570
|
-
export { PROJECT_METADATA, create, resolveCreateProjectDirectory, resolvePresetUrl, resolveProject, resolveProjectDirectoryGuidance, resolveScaffoldSelector };
|
|
584
|
+
export { DEFAULT_PROJECT_DIRECTORY, PROJECT_METADATA, create, projectNamePromptOptions, resolveCreateProjectDirectory, resolvePresetUrl, resolveProject, resolveProjectDirectoryGuidance, resolveScaffoldSelector };
|
|
571
585
|
|
|
572
586
|
//# sourceMappingURL=create.js.map
|
|
@@ -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 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 \"my-aui-app\";\n return undefined;\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 \"--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({\n message: \"Project name:\",\n placeholder: \"my-aui-app\",\n defaultValue: \"my-aui-app\",\n validate: (value?: string) => {\n const name = (value ?? \"\").trim();\n if (!name) return \"Project name cannot be empty\";\n if (name === \".\" || name === \"..\")\n 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\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(resolvedProjectDirectory);\n const { display: displayProjectDir, cdCommand } =\n resolveProjectDirectoryGuidance({ absoluteProjectDir });\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 } 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 let cleanupArmed = true;\n const cleanupOnExit = () => {\n if (!cleanupArmed) return;\n cleanupArmed = false;\n fs.rmSync(absoluteProjectDir, { recursive: true, force: true });\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 the directory is removed on the\n // error path once the child is reaped rather than while it is still writing.\n const cleanupOnSignal = (signal: NodeJS.Signals) => {\n if (hasActiveSpawn()) return;\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 fs.rmSync(absoluteProjectDir, { recursive: true, force: true });\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":";;;;;;;;;;;AAoCA,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,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,IAAI,iBAAiB,kBAAkB,MAAM;IAC7C,OAAO,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 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,oB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K,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,25 +1,22 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
installPath: string;
|
|
2
|
+
export interface DiscoveredPackage {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
installPath: string;
|
|
7
6
|
}
|
|
8
|
-
declare function discoverInstalledPackages(cwd: string): DiscoveredPackage[];
|
|
9
|
-
interface DuplicateGroup {
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export declare function discoverInstalledPackages(cwd: string): DiscoveredPackage[];
|
|
8
|
+
export interface DuplicateGroup {
|
|
9
|
+
name: string;
|
|
10
|
+
installations: DiscoveredPackage[];
|
|
12
11
|
}
|
|
13
|
-
declare function findDuplicates(packages: DiscoveredPackage[]): DuplicateGroup[];
|
|
14
|
-
declare function uniquePackageNames(packages: DiscoveredPackage[]): string[];
|
|
15
|
-
declare function compareSemver(a: string, b: string): number;
|
|
16
|
-
interface OutdatedPackage {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
export declare function findDuplicates(packages: DiscoveredPackage[]): DuplicateGroup[];
|
|
13
|
+
export declare function uniquePackageNames(packages: DiscoveredPackage[]): string[];
|
|
14
|
+
export declare function compareSemver(a: string, b: string): number;
|
|
15
|
+
export interface OutdatedPackage {
|
|
16
|
+
name: string;
|
|
17
|
+
current: string;
|
|
18
|
+
latest: string;
|
|
20
19
|
}
|
|
21
|
-
declare function findOutdated(packages: DiscoveredPackage[], latest: Map<string, string | null>): OutdatedPackage[];
|
|
22
|
-
declare const doctor: Command;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { DiscoveredPackage, DuplicateGroup, OutdatedPackage, compareSemver, discoverInstalledPackages, doctor, findDuplicates, findOutdated, uniquePackageNames };
|
|
20
|
+
export declare function findOutdated(packages: DiscoveredPackage[], latest: Map<string, string | null>): OutdatedPackage[];
|
|
21
|
+
export declare const doctor: Command;
|
|
25
22
|
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAgKD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAe1E;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,iBAAiB,EAAE,CAAC;CACpC;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,cAAc,EAAE,CAiBlB;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAE1E;AAiCD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAK1D;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GACjC,eAAe,EAAE,CAmBnB;AAmED,eAAO,MAAM,MAAM,SA6Df,CAAC"}
|