assistant-ui 0.0.65 → 0.0.67
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 +81 -3
- package/dist/codemods/v0-11/__tests__/content-part-to-message-part.test.d.ts +2 -0
- package/dist/codemods/v0-11/__tests__/content-part-to-message-part.test.d.ts.map +1 -0
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +16 -3
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +16 -39
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +30 -10
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +29 -26
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +12 -4
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/lib/install-ai-sdk-lib.d.ts.map +1 -1
- package/dist/lib/install-ai-sdk-lib.js +7 -82
- package/dist/lib/install-ai-sdk-lib.js.map +1 -1
- package/dist/lib/install-edge-lib.d.ts.map +1 -1
- package/dist/lib/install-edge-lib.js +11 -82
- package/dist/lib/install-edge-lib.js.map +1 -1
- package/dist/lib/install-ui-lib.d.ts.map +1 -1
- package/dist/lib/install-ui-lib.js +7 -82
- package/dist/lib/install-ui-lib.js.map +1 -1
- package/dist/lib/upgrade.d.ts.map +1 -1
- package/dist/lib/upgrade.js +5 -4
- package/dist/lib/upgrade.js.map +1 -1
- package/dist/lib/utils/config.d.ts +20 -0
- package/dist/lib/utils/config.d.ts.map +1 -0
- package/dist/lib/utils/config.js +39 -0
- package/dist/lib/utils/config.js.map +1 -0
- package/dist/lib/utils/file-scanner.d.ts +8 -0
- package/dist/lib/utils/file-scanner.d.ts.map +1 -0
- package/dist/lib/utils/file-scanner.js +53 -0
- package/dist/lib/utils/file-scanner.js.map +1 -0
- package/dist/lib/utils/logger.d.ts +9 -0
- package/dist/lib/utils/logger.d.ts.map +1 -0
- package/dist/lib/utils/logger.js +26 -0
- package/dist/lib/utils/logger.js.map +1 -0
- package/dist/lib/utils/package-installer.d.ts +9 -0
- package/dist/lib/utils/package-installer.d.ts.map +1 -0
- package/dist/lib/utils/package-installer.js +29 -0
- package/dist/lib/utils/package-installer.js.map +1 -0
- package/dist/lib/utils/package-manager.d.ts +9 -0
- package/dist/lib/utils/package-manager.d.ts.map +1 -0
- package/dist/lib/utils/package-manager.js +72 -0
- package/dist/lib/utils/package-manager.js.map +1 -0
- package/package.json +8 -3
- package/src/codemods/v0-11/__tests__/content-part-to-message-part.test.ts +2 -2
- package/src/commands/add.ts +19 -3
- package/src/commands/create.ts +22 -44
- package/src/commands/init.ts +35 -11
- package/src/commands/update.ts +41 -26
- package/src/commands/upgrade.ts +14 -6
- package/src/lib/install-ai-sdk-lib.ts +9 -88
- package/src/lib/install-edge-lib.ts +13 -92
- package/src/lib/install-ui-lib.ts +9 -88
- package/src/lib/upgrade.ts +5 -4
- package/src/lib/utils/config.ts +60 -0
- package/src/lib/utils/file-scanner.ts +71 -0
- package/src/lib/utils/logger.ts +22 -0
- package/src/lib/utils/package-installer.ts +38 -0
- package/src/lib/utils/package-manager.ts +87 -0
package/README.md
CHANGED
|
@@ -1,9 +1,87 @@
|
|
|
1
1
|
# `assistant-ui` CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `assistant-ui` CLI for adding components and dependencies to your project.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Use the `init` command to initialize dependencies for a new or existing project.
|
|
8
|
+
|
|
9
|
+
The `init` command installs dependencies, adds components, and configures your project for assistant-ui.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx assistant-ui@latest init
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## create
|
|
16
|
+
|
|
17
|
+
Use the `create` command to scaffold a new Next.js project with assistant-ui.
|
|
18
|
+
|
|
19
|
+
The `create` command uses `create-next-app` with assistant-ui starter templates.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx assistant-ui@latest create my-app
|
|
9
23
|
```
|
|
24
|
+
|
|
25
|
+
You can choose from multiple templates:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Default template with Vercel AI SDK
|
|
29
|
+
npx assistant-ui@latest create my-app
|
|
30
|
+
|
|
31
|
+
# With Assistant Cloud for persistence
|
|
32
|
+
npx assistant-ui@latest create my-app -t cloud
|
|
33
|
+
|
|
34
|
+
# With LangGraph integration
|
|
35
|
+
npx assistant-ui@latest create my-app -t langgraph
|
|
36
|
+
|
|
37
|
+
# With MCP support
|
|
38
|
+
npx assistant-ui@latest create my-app -t mcp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## add
|
|
42
|
+
|
|
43
|
+
Use the `add` command to add components to your project.
|
|
44
|
+
|
|
45
|
+
The `add` command adds a component to your project and installs all required dependencies.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx assistant-ui@latest add [component]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx assistant-ui@latest add thread
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
You can also add multiple components at once:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx assistant-ui@latest add thread thread-list assistant-modal
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## update
|
|
64
|
+
|
|
65
|
+
Use the `update` command to update all assistant-ui packages to their latest versions.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx assistant-ui@latest update
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## upgrade
|
|
72
|
+
|
|
73
|
+
Use the `upgrade` command to automatically migrate your codebase when upgrading to a new major version.
|
|
74
|
+
|
|
75
|
+
The `upgrade` command runs codemods to transform your code and prompts to install new dependencies.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx assistant-ui@latest upgrade
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
|
|
83
|
+
Visit https://assistant-ui.com/docs/cli to view the full documentation.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
Licensed under the [MIT license](https://github.com/assistant-ui/assistant-ui/blob/main/LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-part-to-message-part.test.d.ts","sourceRoot":"","sources":["../../../../src/codemods/v0-11/__tests__/content-part-to-message-part.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,GAAG,SAuDZ,CAAC"}
|
package/dist/commands/add.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
// src/commands/add.ts
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { spawn } from "cross-spawn";
|
|
4
|
+
import { logger } from "../lib/utils/logger.js";
|
|
5
|
+
import { hasConfig } from "../lib/utils/config.js";
|
|
4
6
|
var REGISTRY_BASE_URL = "https://r.assistant-ui.com";
|
|
5
7
|
var add = new Command().name("add").description("add a component to your project").argument("<components...>", "the components to add").option("-y, --yes", "skip confirmation prompt.", true).option("-o, --overwrite", "overwrite existing files.", false).option(
|
|
6
8
|
"-c, --cwd <cwd>",
|
|
7
9
|
"the working directory. defaults to the current directory.",
|
|
8
10
|
process.cwd()
|
|
9
11
|
).option("-p, --path <path>", "the path to add the component to.").action((components, opts) => {
|
|
12
|
+
if (!hasConfig(opts.cwd)) {
|
|
13
|
+
logger.warn(
|
|
14
|
+
"It looks like you haven't initialized your project yet. Run 'assistant-ui init' first."
|
|
15
|
+
);
|
|
16
|
+
logger.break();
|
|
17
|
+
}
|
|
10
18
|
const componentsToAdd = components.map((c) => {
|
|
11
|
-
if (!/^[a-zA-Z0-9
|
|
19
|
+
if (!/^[a-zA-Z0-9-/]+$/.test(c)) {
|
|
12
20
|
throw new Error(`Invalid component name: ${c}`);
|
|
13
21
|
}
|
|
14
22
|
return `${REGISTRY_BASE_URL}/${encodeURIComponent(c)}`;
|
|
15
23
|
});
|
|
24
|
+
logger.step(`Adding ${components.length} component(s)...`);
|
|
16
25
|
const args = [`shadcn@latest`, "add", ...componentsToAdd];
|
|
17
26
|
if (opts.yes) args.push("--yes");
|
|
18
27
|
if (opts.overwrite) args.push("--overwrite");
|
|
@@ -23,11 +32,15 @@ var add = new Command().name("add").description("add a component to your project
|
|
|
23
32
|
shell: true
|
|
24
33
|
});
|
|
25
34
|
child.on("error", (error) => {
|
|
26
|
-
|
|
35
|
+
logger.error(`Failed to add components: ${error.message}`);
|
|
36
|
+
process.exit(1);
|
|
27
37
|
});
|
|
28
38
|
child.on("close", (code) => {
|
|
29
39
|
if (code !== 0) {
|
|
30
|
-
|
|
40
|
+
logger.error(`Process exited with code ${code}`);
|
|
41
|
+
process.exit(code || 1);
|
|
42
|
+
} else {
|
|
43
|
+
logger.success("Components added successfully!");
|
|
31
44
|
}
|
|
32
45
|
});
|
|
33
46
|
});
|
package/dist/commands/add.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/add.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\n\nconst REGISTRY_BASE_URL = \"https://r.assistant-ui.com\";\n\nexport const add = new Command()\n .name(\"add\")\n .description(\"add a component to your project\")\n .argument(\"<components...>\", \"the components to add\")\n .option(\"-y, --yes\", \"skip confirmation prompt.\", true)\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 .option(\"-p, --path <path>\", \"the path to add the component to.\")\n .action((components: string[], opts) => {\n const componentsToAdd = components.map((c) => {\n if (!/^[a-zA-Z0-9
|
|
1
|
+
{"version":3,"sources":["../../src/commands/add.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\nimport { logger } from \"../lib/utils/logger\";\nimport { hasConfig } from \"../lib/utils/config\";\n\nconst REGISTRY_BASE_URL = \"https://r.assistant-ui.com\";\n\nexport const add = new Command()\n .name(\"add\")\n .description(\"add a component to your project\")\n .argument(\"<components...>\", \"the components to add\")\n .option(\"-y, --yes\", \"skip confirmation prompt.\", true)\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 .option(\"-p, --path <path>\", \"the path to add the component to.\")\n .action((components: string[], opts) => {\n // Check if project is initialized\n if (!hasConfig(opts.cwd)) {\n logger.warn(\n \"It looks like you haven't initialized your project yet. Run 'assistant-ui init' first.\",\n );\n logger.break();\n }\n\n const componentsToAdd = components.map((c) => {\n if (!/^[a-zA-Z0-9-/]+$/.test(c)) {\n throw new Error(`Invalid component name: ${c}`);\n }\n return `${REGISTRY_BASE_URL}/${encodeURIComponent(c)}`;\n });\n\n logger.step(`Adding ${components.length} component(s)...`);\n\n const args = [`shadcn@latest`, \"add\", ...componentsToAdd];\n\n if (opts.yes) args.push(\"--yes\");\n if (opts.overwrite) args.push(\"--overwrite\");\n if (opts.cwd) args.push(\"--cwd\", opts.cwd);\n if (opts.path) args.push(\"--path\", opts.path);\n\n const child = spawn(\"npx\", args, {\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"error\", (error) => {\n logger.error(`Failed to add components: ${error.message}`);\n process.exit(1);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n logger.error(`Process exited with code ${code}`);\n process.exit(code || 1);\n } else {\n logger.success(\"Components added successfully!\");\n }\n });\n });\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAE1B,IAAM,oBAAoB;AAEnB,IAAM,MAAM,IAAI,QAAQ,EAC5B,KAAK,KAAK,EACV,YAAY,iCAAiC,EAC7C,SAAS,mBAAmB,uBAAuB,EACnD,OAAO,aAAa,6BAA6B,IAAI,EACrD,OAAO,mBAAmB,6BAA6B,KAAK,EAC5D;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ,IAAI;AACd,EACC,OAAO,qBAAqB,mCAAmC,EAC/D,OAAO,CAAC,YAAsB,SAAS;AAEtC,MAAI,CAAC,UAAU,KAAK,GAAG,GAAG;AACxB,WAAO;AAAA,MACL;AAAA,IACF;AACA,WAAO,MAAM;AAAA,EACf;AAEA,QAAM,kBAAkB,WAAW,IAAI,CAAC,MAAM;AAC5C,QAAI,CAAC,mBAAmB,KAAK,CAAC,GAAG;AAC/B,YAAM,IAAI,MAAM,2BAA2B,CAAC,EAAE;AAAA,IAChD;AACA,WAAO,GAAG,iBAAiB,IAAI,mBAAmB,CAAC,CAAC;AAAA,EACtD,CAAC;AAED,SAAO,KAAK,UAAU,WAAW,MAAM,kBAAkB;AAEzD,QAAM,OAAO,CAAC,iBAAiB,OAAO,GAAG,eAAe;AAExD,MAAI,KAAK,IAAK,MAAK,KAAK,OAAO;AAC/B,MAAI,KAAK,UAAW,MAAK,KAAK,aAAa;AAC3C,MAAI,KAAK,IAAK,MAAK,KAAK,SAAS,KAAK,GAAG;AACzC,MAAI,KAAK,KAAM,MAAK,KAAK,UAAU,KAAK,IAAI;AAE5C,QAAM,QAAQ,MAAM,OAAO,MAAM;AAAA,IAC/B,OAAO;AAAA,IACP,OAAO;AAAA,EACT,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,WAAO,MAAM,6BAA6B,MAAM,OAAO,EAAE;AACzD,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,QAAI,SAAS,GAAG;AACd,aAAO,MAAM,4BAA4B,IAAI,EAAE;AAC/C,cAAQ,KAAK,QAAQ,CAAC;AAAA,IACxB,OAAO;AACL,aAAO,QAAQ,gCAAgC;AAAA,IACjD;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,MAAM,SAkEf,CAAC"}
|
package/dist/commands/create.js
CHANGED
|
@@ -2,54 +2,26 @@
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { spawn } from "cross-spawn";
|
|
5
|
+
import { logger } from "../lib/utils/logger.js";
|
|
5
6
|
var create = new Command().name("create").description("create a new project").argument("[project-directory]").usage(`${chalk.green("[project-directory]")} [options]`).option(
|
|
6
7
|
"-t, --template <template>",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
The template to use for the project, e.g. default, langgraph
|
|
10
|
-
`
|
|
11
|
-
).option(
|
|
12
|
-
"--use-npm",
|
|
13
|
-
`
|
|
14
|
-
|
|
15
|
-
Explicitly tell the CLI to bootstrap the application using npm
|
|
16
|
-
`
|
|
17
|
-
).option(
|
|
18
|
-
"--use-pnpm",
|
|
19
|
-
`
|
|
20
|
-
|
|
21
|
-
Explicitly tell the CLI to bootstrap the application using pnpm
|
|
22
|
-
`
|
|
23
|
-
).option(
|
|
24
|
-
"--use-yarn",
|
|
25
|
-
`
|
|
26
|
-
|
|
27
|
-
Explicitly tell the CLI to bootstrap the application using Yarn
|
|
28
|
-
`
|
|
29
|
-
).option(
|
|
30
|
-
"--use-bun",
|
|
31
|
-
`
|
|
32
|
-
|
|
33
|
-
Explicitly tell the CLI to bootstrap the application using Bun
|
|
34
|
-
`
|
|
35
|
-
).option(
|
|
36
|
-
"--skip-install",
|
|
37
|
-
`
|
|
38
|
-
|
|
39
|
-
Explicitly tell the CLI to skip installing packages
|
|
40
|
-
`
|
|
41
|
-
).action((_, opts) => {
|
|
8
|
+
"template to use (default, cloud, langgraph, mcp)"
|
|
9
|
+
).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("--skip-install", "skip installing packages").action((_, opts) => {
|
|
42
10
|
const templates = {
|
|
43
11
|
default: "https://github.com/assistant-ui/assistant-ui-starter",
|
|
44
12
|
cloud: "https://github.com/assistant-ui/assistant-ui-starter-cloud",
|
|
45
13
|
langgraph: "https://github.com/assistant-ui/assistant-ui-starter-langgraph",
|
|
46
14
|
mcp: "https://github.com/assistant-ui/assistant-ui-starter-mcp"
|
|
47
15
|
};
|
|
48
|
-
const
|
|
16
|
+
const templateName = opts.template ?? "default";
|
|
17
|
+
const templateUrl = templates[templateName];
|
|
49
18
|
if (!templateUrl) {
|
|
50
|
-
|
|
19
|
+
logger.error(`Unknown template: ${opts.template}`);
|
|
20
|
+
logger.info(`Available templates: ${Object.keys(templates).join(", ")}`);
|
|
51
21
|
process.exit(1);
|
|
52
22
|
}
|
|
23
|
+
logger.info(`Creating project with template: ${templateName}`);
|
|
24
|
+
logger.break();
|
|
53
25
|
const filteredArgs = process.argv.slice(3).filter((arg, index, arr) => {
|
|
54
26
|
return !(arg === "-t" || arg === "--template" || arr[index - 1] === "-t" || arr[index - 1] === "--template");
|
|
55
27
|
});
|
|
@@ -61,11 +33,16 @@ var create = new Command().name("create").description("create a new project").ar
|
|
|
61
33
|
}
|
|
62
34
|
);
|
|
63
35
|
child.on("error", (error) => {
|
|
64
|
-
|
|
36
|
+
logger.error(`Failed to create project: ${error.message}`);
|
|
37
|
+
process.exit(1);
|
|
65
38
|
});
|
|
66
39
|
child.on("close", (code) => {
|
|
67
40
|
if (code !== 0) {
|
|
68
|
-
|
|
41
|
+
logger.error(`Project creation failed with code ${code}`);
|
|
42
|
+
process.exit(code || 1);
|
|
43
|
+
} else {
|
|
44
|
+
logger.break();
|
|
45
|
+
logger.success("Project created successfully!");
|
|
69
46
|
}
|
|
70
47
|
});
|
|
71
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/create.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { spawn } from \"cross-spawn\";\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
|
|
1
|
+
{"version":3,"sources":["../../src/commands/create.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { spawn } from \"cross-spawn\";\nimport { logger } from \"../lib/utils/logger\";\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 (default, cloud, langgraph, mcp)\",\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((_, opts) => {\n const templates = {\n default: \"https://github.com/assistant-ui/assistant-ui-starter\",\n cloud: \"https://github.com/assistant-ui/assistant-ui-starter-cloud\",\n langgraph:\n \"https://github.com/assistant-ui/assistant-ui-starter-langgraph\",\n mcp: \"https://github.com/assistant-ui/assistant-ui-starter-mcp\",\n };\n\n const templateName = (opts.template as keyof typeof templates) ?? \"default\";\n const templateUrl = templates[templateName];\n\n if (!templateUrl) {\n logger.error(`Unknown template: ${opts.template}`);\n logger.info(`Available templates: ${Object.keys(templates).join(\", \")}`);\n process.exit(1);\n }\n\n logger.info(`Creating project with template: ${templateName}`);\n logger.break();\n\n const filteredArgs = process.argv.slice(3).filter((arg, index, arr) => {\n return !(\n arg === \"-t\" ||\n arg === \"--template\" ||\n arr[index - 1] === \"-t\" ||\n arr[index - 1] === \"--template\"\n );\n });\n\n const child = spawn(\n \"npx\",\n [`create-next-app@latest`, ...filteredArgs, \"-e\", templateUrl],\n {\n stdio: \"inherit\",\n },\n );\n\n child.on(\"error\", (error) => {\n logger.error(`Failed to create project: ${error.message}`);\n process.exit(1);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n logger.error(`Project creation failed with code ${code}`);\n process.exit(code || 1);\n } else {\n logger.break();\n logger.success(\"Project created successfully!\");\n }\n });\n });\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,SAAS,aAAa;AACtB,SAAS,cAAc;AAEhB,IAAM,SAAS,IAAI,QAAQ,EAC/B,KAAK,QAAQ,EACb,YAAY,sBAAsB,EAClC,SAAS,qBAAqB,EAC9B,MAAM,GAAG,MAAM,MAAM,qBAAqB,CAAC,YAAY,EACvD;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,aAAa,oBAAoB,EACxC,OAAO,cAAc,qBAAqB,EAC1C,OAAO,cAAc,qBAAqB,EAC1C,OAAO,aAAa,oBAAoB,EACxC,OAAO,kBAAkB,0BAA0B,EACnD,OAAO,CAAC,GAAG,SAAS;AACnB,QAAM,YAAY;AAAA,IAChB,SAAS;AAAA,IACT,OAAO;AAAA,IACP,WACE;AAAA,IACF,KAAK;AAAA,EACP;AAEA,QAAM,eAAgB,KAAK,YAAuC;AAClE,QAAM,cAAc,UAAU,YAAY;AAE1C,MAAI,CAAC,aAAa;AAChB,WAAO,MAAM,qBAAqB,KAAK,QAAQ,EAAE;AACjD,WAAO,KAAK,wBAAwB,OAAO,KAAK,SAAS,EAAE,KAAK,IAAI,CAAC,EAAE;AACvE,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,SAAO,KAAK,mCAAmC,YAAY,EAAE;AAC7D,SAAO,MAAM;AAEb,QAAM,eAAe,QAAQ,KAAK,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,OAAO,QAAQ;AACrE,WAAO,EACL,QAAQ,QACR,QAAQ,gBACR,IAAI,QAAQ,CAAC,MAAM,QACnB,IAAI,QAAQ,CAAC,MAAM;AAAA,EAEvB,CAAC;AAED,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA,CAAC,0BAA0B,GAAG,cAAc,MAAM,WAAW;AAAA,IAC7D;AAAA,MACE,OAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,WAAO,MAAM,6BAA6B,MAAM,OAAO,EAAE;AACzD,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AAED,QAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,QAAI,SAAS,GAAG;AACd,aAAO,MAAM,qCAAqC,IAAI,EAAE;AACxD,cAAQ,KAAK,QAAQ,CAAC;AAAA,IACxB,OAAO;AACL,aAAO,MAAM;AACb,aAAO,QAAQ,+BAA+B;AAAA,IAChD;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,IAAI,SAiEb,CAAC"}
|
package/dist/commands/init.js
CHANGED
|
@@ -3,15 +3,25 @@ import { Command } from "commander";
|
|
|
3
3
|
import { spawn } from "cross-spawn";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import path from "path";
|
|
6
|
-
import chalk from "chalk";
|
|
7
6
|
import { create } from "./create.js";
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { logger } from "../lib/utils/logger.js";
|
|
8
|
+
import { hasConfig } from "../lib/utils/config.js";
|
|
9
|
+
var init = new Command().name("init").description("initialize assistant-ui in a new or existing project").option(
|
|
10
|
+
"-c, --cwd <cwd>",
|
|
11
|
+
"the working directory. defaults to the current directory.",
|
|
12
|
+
process.cwd()
|
|
13
|
+
).action(async (opts) => {
|
|
14
|
+
const cwd = opts.cwd;
|
|
15
|
+
if (hasConfig(cwd)) {
|
|
16
|
+
logger.warn("Project is already initialized.");
|
|
17
|
+
logger.info("Use 'assistant-ui add' to add more components.");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
10
21
|
const packageJsonExists = fs.existsSync(packageJsonPath);
|
|
11
22
|
if (packageJsonExists) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
23
|
+
logger.info("Initializing assistant-ui in existing project...");
|
|
24
|
+
logger.break();
|
|
15
25
|
const child = spawn(
|
|
16
26
|
"npx",
|
|
17
27
|
[
|
|
@@ -20,19 +30,29 @@ var init = new Command().name("init").description("initialize assistant-ui in a
|
|
|
20
30
|
"https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json"
|
|
21
31
|
],
|
|
22
32
|
{
|
|
23
|
-
stdio: "inherit"
|
|
33
|
+
stdio: "inherit",
|
|
34
|
+
cwd
|
|
24
35
|
}
|
|
25
36
|
);
|
|
26
37
|
child.on("error", (error) => {
|
|
27
|
-
|
|
38
|
+
logger.error(`Failed to initialize: ${error.message}`);
|
|
39
|
+
process.exit(1);
|
|
28
40
|
});
|
|
29
41
|
child.on("close", (code) => {
|
|
30
42
|
if (code !== 0) {
|
|
31
|
-
|
|
43
|
+
logger.error(`Initialization failed with code ${code}`);
|
|
44
|
+
process.exit(code || 1);
|
|
45
|
+
} else {
|
|
46
|
+
logger.break();
|
|
47
|
+
logger.success("Project initialized successfully!");
|
|
48
|
+
logger.info(
|
|
49
|
+
"You can now add more components with 'assistant-ui add'"
|
|
50
|
+
);
|
|
32
51
|
}
|
|
33
52
|
});
|
|
34
53
|
} else {
|
|
35
|
-
|
|
54
|
+
logger.info("Creating a new assistant-ui project...");
|
|
55
|
+
logger.break();
|
|
36
56
|
await create.parseAsync([]);
|
|
37
57
|
}
|
|
38
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { spawn } from \"cross-spawn\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { create } from \"./create\";\nimport { logger } from \"../lib/utils/logger\";\nimport { hasConfig } from \"../lib/utils/config\";\n\nexport const init = new Command()\n .name(\"init\")\n .description(\"initialize assistant-ui in a new or existing project\")\n .option(\n \"-c, --cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n process.cwd(),\n )\n .action(async (opts) => {\n const cwd = opts.cwd;\n\n // Check if already initialized\n if (hasConfig(cwd)) {\n logger.warn(\"Project is already initialized.\");\n logger.info(\"Use 'assistant-ui add' to add more components.\");\n return;\n }\n\n // Check if package.json exists in the current directory\n const packageJsonPath = path.join(cwd, \"package.json\");\n const packageJsonExists = fs.existsSync(packageJsonPath);\n\n if (packageJsonExists) {\n // If package.json exists, run shadcn add command\n logger.info(\"Initializing assistant-ui in existing project...\");\n logger.break();\n\n const child = spawn(\n \"npx\",\n [\n `shadcn@latest`,\n \"add\",\n \"https://r.assistant-ui.com/chat/b/ai-sdk-quick-start/json\",\n ],\n {\n stdio: \"inherit\",\n cwd,\n },\n );\n\n child.on(\"error\", (error) => {\n logger.error(`Failed to initialize: ${error.message}`);\n process.exit(1);\n });\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n logger.error(`Initialization failed with code ${code}`);\n process.exit(code || 1);\n } else {\n logger.break();\n logger.success(\"Project initialized successfully!\");\n logger.info(\n \"You can now add more components with 'assistant-ui add'\",\n );\n }\n });\n } else {\n // If package.json doesn't exist, use the create command\n logger.info(\"Creating a new assistant-ui project...\");\n logger.break();\n\n // Execute the create command with default template\n await create.parseAsync([]);\n }\n });\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAEnB,IAAM,OAAO,IAAI,QAAQ,EAC7B,KAAK,MAAM,EACX,YAAY,sDAAsD,EAClE;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ,IAAI;AACd,EACC,OAAO,OAAO,SAAS;AACtB,QAAM,MAAM,KAAK;AAGjB,MAAI,UAAU,GAAG,GAAG;AAClB,WAAO,KAAK,iCAAiC;AAC7C,WAAO,KAAK,gDAAgD;AAC5D;AAAA,EACF;AAGA,QAAM,kBAAkB,KAAK,KAAK,KAAK,cAAc;AACrD,QAAM,oBAAoB,GAAG,WAAW,eAAe;AAEvD,MAAI,mBAAmB;AAErB,WAAO,KAAK,kDAAkD;AAC9D,WAAO,MAAM;AAEb,UAAM,QAAQ;AAAA,MACZ;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP;AAAA,MACF;AAAA,IACF;AAEA,UAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,aAAO,MAAM,yBAAyB,MAAM,OAAO,EAAE;AACrD,cAAQ,KAAK,CAAC;AAAA,IAChB,CAAC;AAED,UAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,UAAI,SAAS,GAAG;AACd,eAAO,MAAM,mCAAmC,IAAI,EAAE;AACtD,gBAAQ,KAAK,QAAQ,CAAC;AAAA,MACxB,OAAO;AACL,eAAO,MAAM;AACb,eAAO,QAAQ,mCAAmC;AAClD,eAAO;AAAA,UACL;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,OAAO;AAEL,WAAO,KAAK,wCAAwC;AACpD,WAAO,MAAM;AAGb,UAAM,OAAO,WAAW,CAAC,CAAC;AAAA,EAC5B;AACF,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,MAAM,SAuEf,CAAC"}
|
package/dist/commands/update.js
CHANGED
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import chalk from "chalk";
|
|
6
|
-
import { detect } from "detect-package-manager";
|
|
7
5
|
import { sync as spawnSync } from "cross-spawn";
|
|
6
|
+
import { logger } from "../lib/utils/logger.js";
|
|
7
|
+
import { getInstallCommand } from "../lib/utils/package-manager.js";
|
|
8
8
|
var update = new Command().name("update").description(
|
|
9
9
|
"Update all '@assistant-ui/*' and 'assistant-*' packages in package.json to latest versions using your package manager."
|
|
10
|
-
).option("--dry", "Print the package manager command instead of running it.").
|
|
11
|
-
|
|
10
|
+
).option("--dry", "Print the package manager command instead of running it.").option(
|
|
11
|
+
"-c, --cwd <cwd>",
|
|
12
|
+
"the working directory. defaults to the current directory.",
|
|
13
|
+
process.cwd()
|
|
14
|
+
).action(async (opts) => {
|
|
15
|
+
const packageJsonPath = path.join(opts.cwd, "package.json");
|
|
12
16
|
if (!fs.existsSync(packageJsonPath)) {
|
|
13
|
-
|
|
14
|
-
chalk.red("No package.json found in the current directory.")
|
|
15
|
-
);
|
|
17
|
+
logger.error("No package.json found in the current directory.");
|
|
16
18
|
process.exit(1);
|
|
17
19
|
}
|
|
18
20
|
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
@@ -27,33 +29,34 @@ var update = new Command().name("update").description(
|
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
if (!targets.length) {
|
|
30
|
-
|
|
32
|
+
logger.warn("No matching packages found to update.");
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
cmd = `npm install ${targets.map((d) => `${d}@latest`).join(" ")}`;
|
|
43
|
-
}
|
|
35
|
+
logger.info(`Found ${targets.length} package(s) to update:`);
|
|
36
|
+
targets.forEach((pkg2) => {
|
|
37
|
+
logger.info(` - ${pkg2}`);
|
|
38
|
+
});
|
|
39
|
+
logger.break();
|
|
40
|
+
const installCmd = await getInstallCommand(
|
|
41
|
+
targets.map((d) => `${d}@latest`),
|
|
42
|
+
opts.cwd
|
|
43
|
+
);
|
|
44
44
|
if (opts.dry) {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
logger.info("Dry run: would run the following command:");
|
|
46
|
+
logger.info(` ${installCmd.command} ${installCmd.args.join(" ")}`);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
logger.step("Updating packages...");
|
|
50
|
+
const result = spawnSync(installCmd.command, installCmd.args, {
|
|
51
|
+
stdio: "inherit",
|
|
52
|
+
cwd: opts.cwd
|
|
53
|
+
});
|
|
52
54
|
if (result.status !== 0) {
|
|
53
|
-
|
|
55
|
+
logger.error("Package manager update failed.");
|
|
54
56
|
process.exit(result.status || 1);
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
logger.break();
|
|
59
|
+
logger.success("All packages updated to latest version!");
|
|
57
60
|
});
|
|
58
61
|
export {
|
|
59
62
|
update
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/update.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/commands/update.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { sync as spawnSync } from \"cross-spawn\";\nimport { logger } from \"../lib/utils/logger\";\nimport { getInstallCommand } from \"../lib/utils/package-manager\";\n\nexport const update = new Command()\n .name(\"update\")\n .description(\n \"Update all '@assistant-ui/*' and 'assistant-*' packages in package.json to latest versions using your package manager.\",\n )\n .option(\"--dry\", \"Print the package manager command instead of running it.\")\n .option(\n \"-c, --cwd <cwd>\",\n \"the working directory. defaults to the current directory.\",\n process.cwd(),\n )\n .action(async (opts) => {\n const packageJsonPath = path.join(opts.cwd, \"package.json\");\n if (!fs.existsSync(packageJsonPath)) {\n logger.error(\"No package.json found in the current directory.\");\n process.exit(1);\n }\n\n const pkg = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n const sections = [\"dependencies\", \"devDependencies\"];\n const targets: string[] = [];\n\n for (const section of sections) {\n if (!pkg[section]) continue;\n for (const dep in pkg[section]) {\n if (\n dep.startsWith(\"@assistant-ui/\") ||\n dep === \"assistant-stream\" ||\n dep === \"assistant-cloud\"\n ) {\n targets.push(dep);\n }\n }\n }\n\n if (!targets.length) {\n logger.warn(\"No matching packages found to update.\");\n return;\n }\n\n logger.info(`Found ${targets.length} package(s) to update:`);\n targets.forEach((pkg) => {\n logger.info(` - ${pkg}`);\n });\n logger.break();\n\n // Build command using the utility\n const installCmd = await getInstallCommand(\n targets.map((d) => `${d}@latest`),\n opts.cwd,\n );\n\n if (opts.dry) {\n logger.info(\"Dry run: would run the following command:\");\n logger.info(` ${installCmd.command} ${installCmd.args.join(\" \")}`);\n return;\n }\n\n logger.step(\"Updating packages...\");\n const result = spawnSync(installCmd.command, installCmd.args, {\n stdio: \"inherit\",\n cwd: opts.cwd,\n });\n\n if (result.status !== 0) {\n logger.error(\"Package manager update failed.\");\n process.exit(result.status || 1);\n }\n\n logger.break();\n logger.success(\"All packages updated to latest version!\");\n });\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,QAAQ,iBAAiB;AAClC,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAE3B,IAAM,SAAS,IAAI,QAAQ,EAC/B,KAAK,QAAQ,EACb;AAAA,EACC;AACF,EACC,OAAO,SAAS,0DAA0D,EAC1E;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ,IAAI;AACd,EACC,OAAO,OAAO,SAAS;AACtB,QAAM,kBAAkB,KAAK,KAAK,KAAK,KAAK,cAAc;AAC1D,MAAI,CAAC,GAAG,WAAW,eAAe,GAAG;AACnC,WAAO,MAAM,iDAAiD;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,MAAM,KAAK,MAAM,GAAG,aAAa,iBAAiB,OAAO,CAAC;AAChE,QAAM,WAAW,CAAC,gBAAgB,iBAAiB;AACnD,QAAM,UAAoB,CAAC;AAE3B,aAAW,WAAW,UAAU;AAC9B,QAAI,CAAC,IAAI,OAAO,EAAG;AACnB,eAAW,OAAO,IAAI,OAAO,GAAG;AAC9B,UACE,IAAI,WAAW,gBAAgB,KAC/B,QAAQ,sBACR,QAAQ,mBACR;AACA,gBAAQ,KAAK,GAAG;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,QAAQ;AACnB,WAAO,KAAK,uCAAuC;AACnD;AAAA,EACF;AAEA,SAAO,KAAK,SAAS,QAAQ,MAAM,wBAAwB;AAC3D,UAAQ,QAAQ,CAACA,SAAQ;AACvB,WAAO,KAAK,OAAOA,IAAG,EAAE;AAAA,EAC1B,CAAC;AACD,SAAO,MAAM;AAGb,QAAM,aAAa,MAAM;AAAA,IACvB,QAAQ,IAAI,CAAC,MAAM,GAAG,CAAC,SAAS;AAAA,IAChC,KAAK;AAAA,EACP;AAEA,MAAI,KAAK,KAAK;AACZ,WAAO,KAAK,2CAA2C;AACvD,WAAO,KAAK,KAAK,WAAW,OAAO,IAAI,WAAW,KAAK,KAAK,GAAG,CAAC,EAAE;AAClE;AAAA,EACF;AAEA,SAAO,KAAK,sBAAsB;AAClC,QAAM,SAAS,UAAU,WAAW,SAAS,WAAW,MAAM;AAAA,IAC5D,OAAO;AAAA,IACP,KAAK,KAAK;AAAA,EACZ,CAAC;AAED,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO,MAAM,gCAAgC;AAC7C,YAAQ,KAAK,OAAO,UAAU,CAAC;AAAA,EACjC;AAEA,SAAO,MAAM;AACb,SAAO,QAAQ,yCAAyC;AAC1D,CAAC;","names":["pkg"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgBD,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgBD,eAAO,MAAM,cAAc,SAkBzB,CAAC;AAEH,eAAO,MAAM,cAAc,SAgBzB,CAAC"}
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -17,8 +17,12 @@ var codemodCommand = addTransformOptions(
|
|
|
17
17
|
try {
|
|
18
18
|
transform(codemod, source, options);
|
|
19
19
|
} catch (err) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
21
|
+
const errorStack = err instanceof Error ? err.stack : void 0;
|
|
22
|
+
error(`Error transforming: ${errorMessage}`);
|
|
23
|
+
if (errorStack) {
|
|
24
|
+
error(errorStack);
|
|
25
|
+
}
|
|
22
26
|
process.exit(1);
|
|
23
27
|
}
|
|
24
28
|
});
|
|
@@ -28,8 +32,12 @@ var upgradeCommand = addTransformOptions(
|
|
|
28
32
|
try {
|
|
29
33
|
upgrade(options);
|
|
30
34
|
} catch (err) {
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
36
|
+
const errorStack = err instanceof Error ? err.stack : void 0;
|
|
37
|
+
error(`Error upgrading: ${errorMessage}`);
|
|
38
|
+
if (errorStack) {
|
|
39
|
+
error(errorStack);
|
|
40
|
+
}
|
|
33
41
|
process.exit(1);
|
|
34
42
|
}
|
|
35
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/upgrade.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { transform } from \"../lib/transform\";\nimport { upgrade } from \"../lib/upgrade\";\nimport debug from \"debug\";\n\nexport interface TransformOptions {\n dry?: boolean;\n print?: boolean;\n verbose?: boolean;\n jscodeshift?: string;\n}\n\nconst error = debug(\"codemod:error\");\ndebug.enable(\"codemod:*\");\n\nconst addTransformOptions = (command: Command): Command => {\n return command\n .option(\"-d, --dry\", \"Dry run (no changes are made to files)\")\n .option(\"-p, --print\", \"Print transformed files to stdout\")\n .option(\"--verbose\", \"Show more information about the transform process\")\n .option(\n \"-j, --jscodeshift <options>\",\n \"Pass options directly to jscodeshift\",\n );\n};\n\nexport const codemodCommand = addTransformOptions(\n new Command()\n .name(\"codemod\")\n .description(\"CLI tool for running codemods\")\n .argument(\"<codemod>\", \"Codemod to run (e.g., rewrite-framework-imports)\")\n .argument(\"<source>\", \"Path to source files or directory to transform\"),\n).action((codemod, source, options: TransformOptions) => {\n try {\n transform(codemod, source, options);\n } catch (err
|
|
1
|
+
{"version":3,"sources":["../../src/commands/upgrade.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { transform } from \"../lib/transform\";\nimport { upgrade } from \"../lib/upgrade\";\nimport debug from \"debug\";\n\nexport interface TransformOptions {\n dry?: boolean;\n print?: boolean;\n verbose?: boolean;\n jscodeshift?: string;\n}\n\nconst error = debug(\"codemod:error\");\ndebug.enable(\"codemod:*\");\n\nconst addTransformOptions = (command: Command): Command => {\n return command\n .option(\"-d, --dry\", \"Dry run (no changes are made to files)\")\n .option(\"-p, --print\", \"Print transformed files to stdout\")\n .option(\"--verbose\", \"Show more information about the transform process\")\n .option(\n \"-j, --jscodeshift <options>\",\n \"Pass options directly to jscodeshift\",\n );\n};\n\nexport const codemodCommand = addTransformOptions(\n new Command()\n .name(\"codemod\")\n .description(\"CLI tool for running codemods\")\n .argument(\"<codemod>\", \"Codemod to run (e.g., rewrite-framework-imports)\")\n .argument(\"<source>\", \"Path to source files or directory to transform\"),\n).action((codemod, source, options: TransformOptions) => {\n try {\n transform(codemod, source, options);\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n const errorStack = err instanceof Error ? err.stack : undefined;\n error(`Error transforming: ${errorMessage}`);\n if (errorStack) {\n error(errorStack);\n }\n process.exit(1);\n }\n});\n\nexport const upgradeCommand = addTransformOptions(\n new Command()\n .command(\"upgrade\")\n .description(\"Upgrade ai package dependencies and apply codemods\"),\n).action((options: TransformOptions) => {\n try {\n upgrade(options);\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n const errorStack = err instanceof Error ? err.stack : undefined;\n error(`Error upgrading: ${errorMessage}`);\n if (errorStack) {\n error(errorStack);\n }\n process.exit(1);\n }\n});\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,OAAO,WAAW;AASlB,IAAM,QAAQ,MAAM,eAAe;AACnC,MAAM,OAAO,WAAW;AAExB,IAAM,sBAAsB,CAAC,YAA8B;AACzD,SAAO,QACJ,OAAO,aAAa,wCAAwC,EAC5D,OAAO,eAAe,mCAAmC,EACzD,OAAO,aAAa,mDAAmD,EACvE;AAAA,IACC;AAAA,IACA;AAAA,EACF;AACJ;AAEO,IAAM,iBAAiB;AAAA,EAC5B,IAAI,QAAQ,EACT,KAAK,SAAS,EACd,YAAY,+BAA+B,EAC3C,SAAS,aAAa,kDAAkD,EACxE,SAAS,YAAY,gDAAgD;AAC1E,EAAE,OAAO,CAAC,SAAS,QAAQ,YAA8B;AACvD,MAAI;AACF,cAAU,SAAS,QAAQ,OAAO;AAAA,EACpC,SAAS,KAAK;AACZ,UAAM,eAAe,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AACpE,UAAM,aAAa,eAAe,QAAQ,IAAI,QAAQ;AACtD,UAAM,uBAAuB,YAAY,EAAE;AAC3C,QAAI,YAAY;AACd,YAAM,UAAU;AAAA,IAClB;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAEM,IAAM,iBAAiB;AAAA,EAC5B,IAAI,QAAQ,EACT,QAAQ,SAAS,EACjB,YAAY,oDAAoD;AACrE,EAAE,OAAO,CAAC,YAA8B;AACtC,MAAI;AACF,YAAQ,OAAO;AAAA,EACjB,SAAS,KAAK;AACZ,UAAM,eAAe,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AACpE,UAAM,aAAa,eAAe,QAAQ,IAAI,QAAQ;AACtD,UAAM,oBAAoB,YAAY,EAAE;AACxC,QAAI,YAAY;AACd,YAAM,UAAU;AAAA,IAClB;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-ai-sdk-lib.d.ts","sourceRoot":"","sources":["../../src/lib/install-ai-sdk-lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install-ai-sdk-lib.d.ts","sourceRoot":"","sources":["../../src/lib/install-ai-sdk-lib.ts"],"names":[],"mappings":"AAEA,wBAA8B,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAU7D"}
|