assistant-ui 0.0.91 → 0.0.93
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 +32 -108
- package/dist/codemods/utils/createTransformer.d.ts +17 -13
- package/dist/codemods/utils/createTransformer.d.ts.map +1 -1
- package/dist/codemods/utils/createTransformer.js +18 -15
- package/dist/codemods/utils/createTransformer.js.map +1 -1
- package/dist/codemods/v0-11/content-part-to-message-part.d.ts +3 -1
- package/dist/codemods/v0-11/content-part-to-message-part.d.ts.map +1 -1
- package/dist/codemods/v0-11/content-part-to-message-part.js +98 -135
- package/dist/codemods/v0-11/content-part-to-message-part.js.map +1 -1
- package/dist/codemods/v0-12/assistant-api-to-aui.d.ts +3 -1
- package/dist/codemods/v0-12/assistant-api-to-aui.d.ts.map +1 -1
- package/dist/codemods/v0-12/assistant-api-to-aui.js +126 -213
- package/dist/codemods/v0-12/assistant-api-to-aui.js.map +1 -1
- package/dist/codemods/v0-12/event-names-to-camelcase.d.ts +3 -1
- package/dist/codemods/v0-12/event-names-to-camelcase.d.ts.map +1 -1
- package/dist/codemods/v0-12/event-names-to-camelcase.js +33 -38
- package/dist/codemods/v0-12/event-names-to-camelcase.js.map +1 -1
- package/dist/codemods/v0-12/primitive-if-to-aui-if.d.ts +3 -1
- package/dist/codemods/v0-12/primitive-if-to-aui-if.d.ts.map +1 -1
- package/dist/codemods/v0-12/primitive-if-to-aui-if.js +212 -297
- package/dist/codemods/v0-12/primitive-if-to-aui-if.js.map +1 -1
- package/dist/codemods/v0-8/ui-package-split.d.ts +3 -1
- package/dist/codemods/v0-8/ui-package-split.d.ts.map +1 -1
- package/dist/codemods/v0-8/ui-package-split.js +121 -164
- package/dist/codemods/v0-8/ui-package-split.js.map +1 -1
- package/dist/codemods/v0-9/edge-package-split.d.ts +3 -1
- package/dist/codemods/v0-9/edge-package-split.d.ts.map +1 -1
- package/dist/codemods/v0-9/edge-package-split.js +96 -140
- package/dist/codemods/v0-9/edge-package-split.js.map +1 -1
- package/dist/commands/add.d.ts +18 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +54 -49
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/agent.d.ts +5 -1
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +16 -25
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/create.d.ts +36 -26
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +458 -519
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/info.d.ts +5 -1
- package/dist/commands/info.d.ts.map +1 -1
- package/dist/commands/info.js +233 -314
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.d.ts +12 -9
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +98 -136
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mcp.d.ts +5 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +175 -214
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/update.d.ts +5 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +46 -55
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/upgrade.d.ts +11 -7
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +26 -38
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/create-project.d.ts +27 -10
- package/dist/lib/create-project.d.ts.map +1 -1
- package/dist/lib/create-project.js +239 -277
- package/dist/lib/create-project.js.map +1 -1
- package/dist/lib/install-ai-sdk-lib.d.ts +4 -1
- package/dist/lib/install-ai-sdk-lib.d.ts.map +1 -1
- package/dist/lib/install-ai-sdk-lib.js +12 -8
- package/dist/lib/install-ai-sdk-lib.js.map +1 -1
- package/dist/lib/install-edge-lib.d.ts +4 -1
- package/dist/lib/install-edge-lib.d.ts.map +1 -1
- package/dist/lib/install-edge-lib.js +16 -12
- package/dist/lib/install-edge-lib.js.map +1 -1
- package/dist/lib/install-ui-lib.d.ts +4 -1
- package/dist/lib/install-ui-lib.d.ts.map +1 -1
- package/dist/lib/install-ui-lib.js +12 -8
- package/dist/lib/install-ui-lib.js.map +1 -1
- package/dist/lib/run-spawn.d.ts +9 -0
- package/dist/lib/run-spawn.d.ts.map +1 -0
- package/dist/lib/run-spawn.js +26 -0
- package/dist/lib/run-spawn.js.map +1 -0
- package/dist/lib/transform-options.d.ts +8 -5
- package/dist/lib/transform-options.d.ts.map +1 -1
- package/dist/lib/transform-options.js +0 -2
- package/dist/lib/transform.d.ts +15 -11
- package/dist/lib/transform.d.ts.map +1 -1
- package/dist/lib/transform.js +97 -114
- package/dist/lib/transform.js.map +1 -1
- package/dist/lib/upgrade.d.ts +6 -2
- package/dist/lib/upgrade.d.ts.map +1 -1
- package/dist/lib/upgrade.js +62 -64
- package/dist/lib/upgrade.js.map +1 -1
- package/dist/lib/utils/config.d.ts +21 -18
- package/dist/lib/utils/config.d.ts.map +1 -1
- package/dist/lib/utils/config.js +24 -28
- package/dist/lib/utils/config.js.map +1 -1
- package/dist/lib/utils/file-scanner.d.ts +9 -6
- package/dist/lib/utils/file-scanner.d.ts.map +1 -1
- package/dist/lib/utils/file-scanner.js +44 -51
- package/dist/lib/utils/file-scanner.js.map +1 -1
- package/dist/lib/utils/logger.d.ts +10 -7
- package/dist/lib/utils/logger.d.ts.map +1 -1
- package/dist/lib/utils/logger.js +23 -19
- package/dist/lib/utils/logger.js.map +1 -1
- package/dist/lib/utils/package-installer.d.ts +10 -7
- package/dist/lib/utils/package-installer.d.ts.map +1 -1
- package/dist/lib/utils/package-installer.js +18 -19
- package/dist/lib/utils/package-installer.js.map +1 -1
- package/dist/lib/utils/package-manager.d.ts +10 -7
- package/dist/lib/utils/package-manager.d.ts.map +1 -1
- package/dist/lib/utils/package-manager.js +68 -59
- package/dist/lib/utils/package-manager.js.map +1 -1
- package/package.json +7 -7
- package/plugin/skills/assistant-ui/SKILL.md +2 -2
- package/src/commands/add.ts +67 -30
- package/src/commands/create.ts +116 -84
- package/src/commands/init.ts +9 -42
- package/src/lib/create-project.ts +123 -74
- package/src/lib/run-spawn.ts +32 -0
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/transform-options.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,141 +1,65 @@
|
|
|
1
1
|
# `assistant-ui` CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/assistant-ui)
|
|
4
|
+
[](https://www.npmjs.com/package/assistant-ui)
|
|
5
|
+
[](https://github.com/assistant-ui/assistant-ui)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Command-line tool for adding shadcn-style components to your project, scaffolding a new app, and keeping your assistant-ui packages up to date.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Installation
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Run via your package manager of choice; nothing to install globally:
|
|
10
12
|
|
|
11
13
|
```bash
|
|
12
|
-
npx assistant-ui@latest
|
|
13
|
-
|
|
14
|
+
npx assistant-ui@latest <command>
|
|
15
|
+
pnpm dlx assistant-ui@latest <command>
|
|
16
|
+
yarn dlx assistant-ui@latest <command>
|
|
17
|
+
bunx assistant-ui@latest <command>
|
|
14
18
|
```
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
Passing `--preset` to `init` also forwards to `create` for compatibility.
|
|
18
|
-
|
|
19
|
-
## create
|
|
20
|
-
|
|
21
|
-
Use the `create` command to scaffold a new Next.js project with assistant-ui.
|
|
22
|
-
|
|
23
|
-
The `create` command scaffolds a project from assistant-ui starter templates or examples.
|
|
20
|
+
## Common tasks
|
|
24
21
|
|
|
25
22
|
```bash
|
|
23
|
+
# scaffold a new Next.js project
|
|
26
24
|
npx assistant-ui@latest create my-app
|
|
27
|
-
```
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
# scaffold a minimal project
|
|
27
|
+
npx assistant-ui@latest create my-app --template minimal
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
npx assistant-ui@latest create my-app
|
|
34
|
-
|
|
35
|
-
# Minimal starter
|
|
36
|
-
npx assistant-ui@latest create my-app -t minimal
|
|
37
|
-
|
|
38
|
-
# With Assistant Cloud for persistence
|
|
39
|
-
npx assistant-ui@latest create my-app -t cloud
|
|
29
|
+
# scaffold from a feature example
|
|
30
|
+
npx assistant-ui@latest create my-app --example with-ai-sdk-v6
|
|
40
31
|
|
|
41
|
-
#
|
|
42
|
-
npx assistant-ui@latest create my-app
|
|
32
|
+
# scaffold an Expo / React Native project
|
|
33
|
+
npx assistant-ui@latest create my-app --native
|
|
43
34
|
|
|
44
|
-
#
|
|
45
|
-
npx assistant-ui@latest create my-app
|
|
35
|
+
# scaffold a React Ink terminal project
|
|
36
|
+
npx assistant-ui@latest create my-app --ink
|
|
46
37
|
|
|
47
|
-
#
|
|
48
|
-
npx assistant-ui@latest
|
|
49
|
-
|
|
50
|
-
# With playground preset configuration
|
|
51
|
-
npx assistant-ui@latest create my-app --preset "https://www.assistant-ui.com/playground/init?preset=chatgpt"
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## add
|
|
55
|
-
|
|
56
|
-
Use the `add` command to add components to your project.
|
|
57
|
-
|
|
58
|
-
The `add` command adds a component to your project and installs all required dependencies.
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
npx assistant-ui@latest add [component]
|
|
62
|
-
```
|
|
38
|
+
# add assistant-ui to an existing project
|
|
39
|
+
npx assistant-ui@latest init
|
|
63
40
|
|
|
64
|
-
|
|
41
|
+
# initialize non-interactively for CI or agent flows
|
|
42
|
+
npx assistant-ui@latest init --yes
|
|
65
43
|
|
|
66
|
-
|
|
44
|
+
# add a component
|
|
67
45
|
npx assistant-ui@latest add thread
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
You can also add multiple components at once:
|
|
71
46
|
|
|
72
|
-
|
|
73
|
-
npx assistant-ui@latest add thread thread-list assistant-modal
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## update
|
|
77
|
-
|
|
78
|
-
Use the `update` command to update all assistant-ui packages to their latest versions.
|
|
79
|
-
|
|
80
|
-
```bash
|
|
47
|
+
# update all @assistant-ui/* and assistant-* packages
|
|
81
48
|
npx assistant-ui@latest update
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## upgrade
|
|
85
|
-
|
|
86
|
-
Use the `upgrade` command to automatically migrate your codebase when upgrading to a new major version.
|
|
87
49
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
```bash
|
|
50
|
+
# run codemods after a major version bump
|
|
91
51
|
npx assistant-ui@latest upgrade
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## info
|
|
95
|
-
|
|
96
|
-
Use the `info` command to print your environment and package versions for bug reports.
|
|
97
52
|
|
|
98
|
-
|
|
53
|
+
# print env + version info for a bug report
|
|
99
54
|
npx assistant-ui info
|
|
100
55
|
```
|
|
101
56
|
|
|
102
|
-
|
|
103
|
-
- OS, Node.js version, package manager, and framework
|
|
104
|
-
- All installed `@assistant-ui/*` and `assistant-*` package versions
|
|
105
|
-
- Key ecosystem dependency versions (React, Next.js, AI SDK, etc.)
|
|
106
|
-
- Peer dependency warnings if any mismatches are detected
|
|
107
|
-
|
|
108
|
-
**Example output:**
|
|
57
|
+
`init` falls back to `create` when no `package.json` is found, so a single command works for both new and existing projects. Use `init --yes` for CI and agent flows where prompts are not available.
|
|
109
58
|
|
|
110
|
-
|
|
111
|
-
Environment:
|
|
112
|
-
OS: macOS 15.3 (arm64)
|
|
113
|
-
Node.js: v22.14.0
|
|
114
|
-
Package Manager: pnpm 10.32.1
|
|
115
|
-
Framework: Next.js 15.3.1
|
|
116
|
-
|
|
117
|
-
Packages:
|
|
118
|
-
@assistant-ui/react 0.12.15
|
|
119
|
-
@assistant-ui/react-ai-sdk 1.3.12
|
|
120
|
-
@assistant-ui/react-markdown 0.3.8
|
|
121
|
-
assistant-stream 0.2.14
|
|
122
|
-
|
|
123
|
-
Ecosystem:
|
|
124
|
-
react 19.1.0
|
|
125
|
-
react-dom 19.1.0
|
|
126
|
-
next 15.3.1
|
|
127
|
-
ai 6.0.120
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
The output includes a copy-pasteable markdown block that you can paste directly into a bug report.
|
|
59
|
+
## Templates
|
|
131
60
|
|
|
132
|
-
|
|
133
|
-
- `-c, --cwd <cwd>` - the working directory. defaults to the current directory.
|
|
61
|
+
`create` scaffolds from named templates: `default` (AI SDK), `minimal`, `cloud`, `cloud-clerk`, `langgraph`, `mcp`. Pass `-t <name>`, pass `--example <name>` for examples such as `with-ai-sdk-v6`, use `--native` for Expo / React Native, use `--ink` for React Ink, or pass `--preset <url>` to scaffold from an `assistant-ui.com` playground link.
|
|
134
62
|
|
|
135
63
|
## Documentation
|
|
136
64
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
## License
|
|
140
|
-
|
|
141
|
-
Licensed under the [MIT license](https://github.com/assistant-ui/assistant-ui/blob/main/LICENSE).
|
|
65
|
+
Full command reference, flags, and template details at [assistant-ui.com/docs/cli](https://www.assistant-ui.com/docs/cli).
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { API, Collection, FileInfo, JSCodeshift } from "jscodeshift";
|
|
2
|
+
|
|
3
|
+
//#region src/codemods/utils/createTransformer.d.ts
|
|
4
|
+
type TransformerFunction = (context: TransformContext, fileInfo: FileInfo, api: API, options: any) => void;
|
|
5
|
+
interface TransformContext {
|
|
6
|
+
/**
|
|
7
|
+
* The jscodeshift API object.
|
|
8
|
+
*/
|
|
9
|
+
j: JSCodeshift;
|
|
10
|
+
/**
|
|
11
|
+
* The root collection of the AST.
|
|
12
|
+
*/
|
|
13
|
+
root: Collection<any>;
|
|
14
|
+
markAsChanged: () => void;
|
|
13
15
|
}
|
|
14
|
-
|
|
16
|
+
declare function createTransformer(transformFn: TransformerFunction): (fileInfo: FileInfo, api: API, options: any) => string | null;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { TransformContext, TransformerFunction, createTransformer };
|
|
15
19
|
//# sourceMappingURL=createTransformer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransformer.d.ts","
|
|
1
|
+
{"version":3,"file":"createTransformer.d.ts","names":[],"sources":["../../../src/codemods/utils/createTransformer.ts"],"mappings":";;;KAEY,mBAAA,IACV,OAAA,EAAS,gBAAA,EACT,QAAA,EAAU,QAAA,EACV,GAAA,EAAK,GAAA,EACL,OAAA;AAAA,UAGe,gBAAA;EAPL;;;EAWV,CAAA,EAAG,WAAA;EATO;;;EAcV,IAAA,EAAM,UAAU;EAEhB,aAAA;AAAA;AAAA,iBAGc,iBAAA,CAAkB,WAAA,EAAa,mBAAA,IACjB,QAAA,EAAU,QAAA,EAAU,GAAA,EAAK,GAAA,EAAK,OAAA"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
//#region src/codemods/utils/createTransformer.ts
|
|
2
|
+
function createTransformer(transformFn) {
|
|
3
|
+
return function transformer(fileInfo, api, options) {
|
|
4
|
+
const j = api.jscodeshift;
|
|
5
|
+
const root = j(fileInfo.source);
|
|
6
|
+
let isChanged = false;
|
|
7
|
+
transformFn({
|
|
8
|
+
j,
|
|
9
|
+
root,
|
|
10
|
+
markAsChanged: () => {
|
|
11
|
+
isChanged = true;
|
|
12
|
+
}
|
|
13
|
+
}, fileInfo, api, options);
|
|
14
|
+
return isChanged ? root.toSource() : null;
|
|
15
|
+
};
|
|
16
16
|
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { createTransformer };
|
|
19
|
+
|
|
17
20
|
//# sourceMappingURL=createTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransformer.js","
|
|
1
|
+
{"version":3,"file":"createTransformer.js","names":[],"sources":["../../../src/codemods/utils/createTransformer.ts"],"sourcesContent":["import type { FileInfo, API, JSCodeshift, Collection } from \"jscodeshift\";\n\nexport type TransformerFunction = (\n context: TransformContext,\n fileInfo: FileInfo,\n api: API,\n options: any,\n) => void;\n\nexport interface TransformContext {\n /**\n * The jscodeshift API object.\n */\n j: JSCodeshift;\n\n /**\n * The root collection of the AST.\n */\n root: Collection<any>;\n\n markAsChanged: () => void;\n}\n\nexport function createTransformer(transformFn: TransformerFunction) {\n return function transformer(fileInfo: FileInfo, api: API, options: any) {\n const j = api.jscodeshift;\n const root = j(fileInfo.source);\n\n let isChanged = false;\n const context: TransformContext = {\n j,\n root,\n markAsChanged: () => {\n isChanged = true;\n },\n };\n\n transformFn(context, fileInfo, api, options);\n return isChanged ? root.toSource() : null;\n };\n}\n"],"mappings":";AAuBA,SAAgB,kBAAkB,aAAkC;CAClE,OAAO,SAAS,YAAY,UAAoB,KAAU,SAAc;EACtE,MAAM,IAAI,IAAI;EACd,MAAM,OAAO,EAAE,SAAS,MAAM;EAE9B,IAAI,YAAY;EAShB,YAAY;GAPV;GACA;GACA,qBAAqB;IACnB,YAAY;GACd;EAGgB,GAAG,UAAU,KAAK,OAAO;EAC3C,OAAO,YAAY,KAAK,SAAS,IAAI;CACvC;AACF"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
//#region src/codemods/v0-11/content-part-to-message-part.d.ts
|
|
1
2
|
declare const migrateContentPartToMessagePart: (fileInfo: import("jscodeshift/src/core").FileInfo, api: import("jscodeshift/src/core").API, options: any) => string | null;
|
|
2
|
-
|
|
3
|
+
//#endregion
|
|
4
|
+
export { migrateContentPartToMessagePart as default };
|
|
3
5
|
//# sourceMappingURL=content-part-to-message-part.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-part-to-message-part.d.ts","
|
|
1
|
+
{"version":3,"file":"content-part-to-message-part.d.ts","names":[],"sources":["../../../src/codemods/v0-11/content-part-to-message-part.ts"],"mappings":";cAuEM,+BAAA,GAA+B,QAAA,iCAAA,QAAA,EAAA,GAAA,iCAAA,GAAA,EAAA,OAAA"}
|
|
@@ -1,141 +1,104 @@
|
|
|
1
1
|
import { createTransformer } from "../utils/createTransformer.js";
|
|
2
|
-
|
|
2
|
+
//#region src/codemods/v0-11/content-part-to-message-part.ts
|
|
3
3
|
const typeRenamingMap = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
useContentPartReasoning: "useMessagePartReasoning",
|
|
51
|
-
useContentPartSource: "useMessagePartSource",
|
|
52
|
-
useContentPartFile: "useMessagePartFile",
|
|
53
|
-
useContentPartImage: "useMessagePartImage",
|
|
54
|
-
useTextContentPart: "useTextMessagePart",
|
|
55
|
-
// Primitive names
|
|
56
|
-
ContentPartPrimitive: "MessagePartPrimitive",
|
|
57
|
-
ContentPartPrimitiveText: "MessagePartPrimitiveText",
|
|
58
|
-
ContentPartPrimitiveImage: "MessagePartPrimitiveImage",
|
|
59
|
-
ContentPartPrimitiveInProgress: "MessagePartPrimitiveInProgress",
|
|
4
|
+
TextContentPart: "TextMessagePart",
|
|
5
|
+
ReasoningContentPart: "ReasoningMessagePart",
|
|
6
|
+
SourceContentPart: "SourceMessagePart",
|
|
7
|
+
ImageContentPart: "ImageMessagePart",
|
|
8
|
+
FileContentPart: "FileMessagePart",
|
|
9
|
+
Unstable_AudioContentPart: "Unstable_AudioMessagePart",
|
|
10
|
+
ToolCallContentPart: "ToolCallMessagePart",
|
|
11
|
+
ContentPartStatus: "MessagePartStatus",
|
|
12
|
+
ToolCallContentPartStatus: "ToolCallMessagePartStatus",
|
|
13
|
+
ThreadUserContentPart: "ThreadUserMessagePart",
|
|
14
|
+
ThreadAssistantContentPart: "ThreadAssistantMessagePart",
|
|
15
|
+
ContentPartRuntime: "MessagePartRuntime",
|
|
16
|
+
ContentPartState: "MessagePartState",
|
|
17
|
+
EmptyContentPartComponent: "EmptyMessagePartComponent",
|
|
18
|
+
TextContentPartComponent: "TextMessagePartComponent",
|
|
19
|
+
ReasoningContentPartComponent: "ReasoningMessagePartComponent",
|
|
20
|
+
SourceContentPartComponent: "SourceMessagePartComponent",
|
|
21
|
+
ImageContentPartComponent: "ImageMessagePartComponent",
|
|
22
|
+
FileContentPartComponent: "FileMessagePartComponent",
|
|
23
|
+
Unstable_AudioContentPartComponent: "Unstable_AudioMessagePartComponent",
|
|
24
|
+
ToolCallContentPartComponent: "ToolCallMessagePartComponent",
|
|
25
|
+
EmptyContentPartProps: "EmptyMessagePartProps",
|
|
26
|
+
TextContentPartProps: "TextMessagePartProps",
|
|
27
|
+
ReasoningContentPartProps: "ReasoningMessagePartProps",
|
|
28
|
+
SourceContentPartProps: "SourceMessagePartProps",
|
|
29
|
+
ImageContentPartProps: "ImageMessagePartProps",
|
|
30
|
+
FileContentPartProps: "FileMessagePartProps",
|
|
31
|
+
Unstable_AudioContentPartProps: "Unstable_AudioMessagePartProps",
|
|
32
|
+
ToolCallContentPartProps: "ToolCallMessagePartProps",
|
|
33
|
+
TextContentPartProvider: "TextMessagePartProvider",
|
|
34
|
+
TextContentPartProviderProps: "TextMessagePartProviderProps",
|
|
35
|
+
ContentPartRuntimeProvider: "MessagePartRuntimeProvider",
|
|
36
|
+
ContentPartContext: "MessagePartContext",
|
|
37
|
+
ContentPartContextValue: "MessagePartContextValue",
|
|
38
|
+
useContentPart: "useMessagePart",
|
|
39
|
+
useContentPartRuntime: "useMessagePartRuntime",
|
|
40
|
+
useContentPartText: "useMessagePartText",
|
|
41
|
+
useContentPartReasoning: "useMessagePartReasoning",
|
|
42
|
+
useContentPartSource: "useMessagePartSource",
|
|
43
|
+
useContentPartFile: "useMessagePartFile",
|
|
44
|
+
useContentPartImage: "useMessagePartImage",
|
|
45
|
+
useTextContentPart: "useTextMessagePart",
|
|
46
|
+
ContentPartPrimitive: "MessagePartPrimitive",
|
|
47
|
+
ContentPartPrimitiveText: "MessagePartPrimitiveText",
|
|
48
|
+
ContentPartPrimitiveImage: "MessagePartPrimitiveImage",
|
|
49
|
+
ContentPartPrimitiveInProgress: "MessagePartPrimitiveInProgress"
|
|
60
50
|
};
|
|
61
51
|
const migrateContentPartToMessagePart = createTransformer(({ j, root, markAsChanged }) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// Update identifier references
|
|
111
|
-
root.find(j.Identifier).forEach((path) => {
|
|
112
|
-
if (path.value.name === oldName) {
|
|
113
|
-
// Skip if this is part of an import declaration (already handled above)
|
|
114
|
-
if (j.ImportSpecifier.check(path.parent.value)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
// Skip if this is a property key in an object
|
|
118
|
-
if (j.Property.check(path.parent.value) &&
|
|
119
|
-
path.parent.value.key === path.value) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
// Skip if this is a property in a member expression
|
|
123
|
-
if (j.MemberExpression.check(path.parent.value) &&
|
|
124
|
-
path.parent.value.property === path.value) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
path.value.name = newName;
|
|
128
|
-
markAsChanged();
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
// Update JSX element names
|
|
132
|
-
root.find(j.JSXIdentifier).forEach((path) => {
|
|
133
|
-
if (path.value.name === oldName) {
|
|
134
|
-
path.value.name = newName;
|
|
135
|
-
markAsChanged();
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
});
|
|
52
|
+
root.find(j.ImportDeclaration).forEach((path) => {
|
|
53
|
+
const source = path.value.source.value;
|
|
54
|
+
if (typeof source === "string" && source.startsWith("@assistant-ui/")) path.value.specifiers?.forEach((specifier) => {
|
|
55
|
+
if (j.ImportSpecifier.check(specifier)) {
|
|
56
|
+
const oldName = specifier.imported.name;
|
|
57
|
+
if (typeRenamingMap[oldName]) {
|
|
58
|
+
specifier.imported.name = typeRenamingMap[oldName];
|
|
59
|
+
if (specifier.local && specifier.local.name === oldName) specifier.local.name = typeRenamingMap[oldName];
|
|
60
|
+
markAsChanged();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
root.find(j.MemberExpression).forEach((path) => {
|
|
66
|
+
if (path.value.object && path.value.object.name === "MessagePrimitive" && path.value.property && path.value.property.name === "Content") {
|
|
67
|
+
path.value.property.name = "Parts";
|
|
68
|
+
markAsChanged();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
root.find(j.JSXMemberExpression).forEach((path) => {
|
|
72
|
+
if (path.value.object && path.value.object.name === "MessagePrimitive" && path.value.property && path.value.property.name === "Content") {
|
|
73
|
+
path.value.property.name = "Parts";
|
|
74
|
+
markAsChanged();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
Object.entries(typeRenamingMap).forEach(([oldName, newName]) => {
|
|
78
|
+
root.find(j.TSTypeReference).forEach((path) => {
|
|
79
|
+
if (path.value.typeName && path.value.typeName.name === oldName) {
|
|
80
|
+
path.value.typeName.name = newName;
|
|
81
|
+
markAsChanged();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
root.find(j.Identifier).forEach((path) => {
|
|
85
|
+
if (path.value.name === oldName) {
|
|
86
|
+
if (j.ImportSpecifier.check(path.parent.value)) return;
|
|
87
|
+
if (j.Property.check(path.parent.value) && path.parent.value.key === path.value) return;
|
|
88
|
+
if (j.MemberExpression.check(path.parent.value) && path.parent.value.property === path.value) return;
|
|
89
|
+
path.value.name = newName;
|
|
90
|
+
markAsChanged();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
root.find(j.JSXIdentifier).forEach((path) => {
|
|
94
|
+
if (path.value.name === oldName) {
|
|
95
|
+
path.value.name = newName;
|
|
96
|
+
markAsChanged();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
139
100
|
});
|
|
140
|
-
|
|
101
|
+
//#endregion
|
|
102
|
+
export { migrateContentPartToMessagePart as default };
|
|
103
|
+
|
|
141
104
|
//# sourceMappingURL=content-part-to-message-part.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-part-to-message-part.js","
|
|
1
|
+
{"version":3,"file":"content-part-to-message-part.js","names":[],"sources":["../../../src/codemods/v0-11/content-part-to-message-part.ts"],"sourcesContent":["import { createTransformer } from \"../utils/createTransformer\";\n\n// Map of old ContentPart names to new MessagePart names\nconst typeRenamingMap: Record<string, string> = {\n // Core types\n TextContentPart: \"TextMessagePart\",\n ReasoningContentPart: \"ReasoningMessagePart\",\n SourceContentPart: \"SourceMessagePart\",\n ImageContentPart: \"ImageMessagePart\",\n FileContentPart: \"FileMessagePart\",\n Unstable_AudioContentPart: \"Unstable_AudioMessagePart\",\n ToolCallContentPart: \"ToolCallMessagePart\",\n\n // Status types\n ContentPartStatus: \"MessagePartStatus\",\n ToolCallContentPartStatus: \"ToolCallMessagePartStatus\",\n\n // Thread message parts\n ThreadUserContentPart: \"ThreadUserMessagePart\",\n ThreadAssistantContentPart: \"ThreadAssistantMessagePart\",\n\n // Runtime and state types\n ContentPartRuntime: \"MessagePartRuntime\",\n ContentPartState: \"MessagePartState\",\n\n // Component types\n EmptyContentPartComponent: \"EmptyMessagePartComponent\",\n TextContentPartComponent: \"TextMessagePartComponent\",\n ReasoningContentPartComponent: \"ReasoningMessagePartComponent\",\n SourceContentPartComponent: \"SourceMessagePartComponent\",\n ImageContentPartComponent: \"ImageMessagePartComponent\",\n FileContentPartComponent: \"FileMessagePartComponent\",\n Unstable_AudioContentPartComponent: \"Unstable_AudioMessagePartComponent\",\n ToolCallContentPartComponent: \"ToolCallMessagePartComponent\",\n\n // Props types\n EmptyContentPartProps: \"EmptyMessagePartProps\",\n TextContentPartProps: \"TextMessagePartProps\",\n ReasoningContentPartProps: \"ReasoningMessagePartProps\",\n SourceContentPartProps: \"SourceMessagePartProps\",\n ImageContentPartProps: \"ImageMessagePartProps\",\n FileContentPartProps: \"FileMessagePartProps\",\n Unstable_AudioContentPartProps: \"Unstable_AudioMessagePartProps\",\n ToolCallContentPartProps: \"ToolCallMessagePartProps\",\n\n // Provider types\n TextContentPartProvider: \"TextMessagePartProvider\",\n TextContentPartProviderProps: \"TextMessagePartProviderProps\",\n ContentPartRuntimeProvider: \"MessagePartRuntimeProvider\",\n\n // Context types\n ContentPartContext: \"MessagePartContext\",\n ContentPartContextValue: \"MessagePartContextValue\",\n\n // Hook names\n useContentPart: \"useMessagePart\",\n useContentPartRuntime: \"useMessagePartRuntime\",\n useContentPartText: \"useMessagePartText\",\n useContentPartReasoning: \"useMessagePartReasoning\",\n useContentPartSource: \"useMessagePartSource\",\n useContentPartFile: \"useMessagePartFile\",\n useContentPartImage: \"useMessagePartImage\",\n useTextContentPart: \"useTextMessagePart\",\n\n // Primitive names\n ContentPartPrimitive: \"MessagePartPrimitive\",\n ContentPartPrimitiveText: \"MessagePartPrimitiveText\",\n ContentPartPrimitiveImage: \"MessagePartPrimitiveImage\",\n ContentPartPrimitiveInProgress: \"MessagePartPrimitiveInProgress\",\n};\n\nconst migrateContentPartToMessagePart = createTransformer(\n ({ j, root, markAsChanged }) => {\n // 1. Update imports\n root.find(j.ImportDeclaration).forEach((path: any) => {\n const source = path.value.source.value;\n\n // Only process imports from @assistant-ui packages\n if (typeof source === \"string\" && source.startsWith(\"@assistant-ui/\")) {\n path.value.specifiers?.forEach((specifier: any) => {\n if (j.ImportSpecifier.check(specifier)) {\n const oldName = specifier.imported.name as string;\n if (typeRenamingMap[oldName]) {\n specifier.imported.name = typeRenamingMap[oldName];\n if (specifier.local && specifier.local.name === oldName) {\n specifier.local.name = typeRenamingMap[oldName];\n }\n markAsChanged();\n }\n }\n });\n }\n });\n\n // 2. Update MessagePrimitive.Content to MessagePrimitive.Parts\n root.find(j.MemberExpression).forEach((path: any) => {\n if (\n path.value.object &&\n path.value.object.name === \"MessagePrimitive\" &&\n path.value.property &&\n path.value.property.name === \"Content\"\n ) {\n path.value.property.name = \"Parts\";\n markAsChanged();\n }\n });\n\n // 3. Update JSX member expressions (e.g., MessagePrimitive.Content in JSX)\n root.find(j.JSXMemberExpression).forEach((path: any) => {\n if (\n path.value.object &&\n path.value.object.name === \"MessagePrimitive\" &&\n path.value.property &&\n path.value.property.name === \"Content\"\n ) {\n path.value.property.name = \"Parts\";\n markAsChanged();\n }\n });\n\n // 4. Update all identifiers for types, hooks, and primitives\n Object.entries(typeRenamingMap).forEach(([oldName, newName]) => {\n // Update type references\n root.find(j.TSTypeReference).forEach((path: any) => {\n if (path.value.typeName && path.value.typeName.name === oldName) {\n path.value.typeName.name = newName;\n markAsChanged();\n }\n });\n\n // Update identifier references\n root.find(j.Identifier).forEach((path: any) => {\n if (path.value.name === oldName) {\n // Skip if this is part of an import declaration (already handled above)\n if (j.ImportSpecifier.check(path.parent.value)) {\n return;\n }\n\n // Skip if this is a property key in an object\n if (\n j.Property.check(path.parent.value) &&\n path.parent.value.key === path.value\n ) {\n return;\n }\n\n // Skip if this is a property in a member expression\n if (\n j.MemberExpression.check(path.parent.value) &&\n path.parent.value.property === path.value\n ) {\n return;\n }\n\n path.value.name = newName;\n markAsChanged();\n }\n });\n\n // Update JSX element names\n root.find(j.JSXIdentifier).forEach((path: any) => {\n if (path.value.name === oldName) {\n path.value.name = newName;\n markAsChanged();\n }\n });\n });\n },\n);\n\nexport default migrateContentPartToMessagePart;\n"],"mappings":"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"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
//#region src/codemods/v0-12/assistant-api-to-aui.d.ts
|
|
1
2
|
declare const migrateAssistantApiToAui: (fileInfo: import("jscodeshift/src/core").FileInfo, api: import("jscodeshift/src/core").API, options: any) => string | null;
|
|
2
|
-
|
|
3
|
+
//#endregion
|
|
4
|
+
export { migrateAssistantApiToAui as default };
|
|
3
5
|
//# sourceMappingURL=assistant-api-to-aui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-api-to-aui.d.ts","
|
|
1
|
+
{"version":3,"file":"assistant-api-to-aui.d.ts","names":[],"sources":["../../../src/codemods/v0-12/assistant-api-to-aui.ts"],"mappings":";cAsFM,wBAAA,GAAwB,QAAA,iCAAA,QAAA,EAAA,GAAA,iCAAA,GAAA,EAAA,OAAA"}
|