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.
Files changed (124) hide show
  1. package/README.md +32 -108
  2. package/dist/codemods/utils/createTransformer.d.ts +17 -13
  3. package/dist/codemods/utils/createTransformer.d.ts.map +1 -1
  4. package/dist/codemods/utils/createTransformer.js +18 -15
  5. package/dist/codemods/utils/createTransformer.js.map +1 -1
  6. package/dist/codemods/v0-11/content-part-to-message-part.d.ts +3 -1
  7. package/dist/codemods/v0-11/content-part-to-message-part.d.ts.map +1 -1
  8. package/dist/codemods/v0-11/content-part-to-message-part.js +98 -135
  9. package/dist/codemods/v0-11/content-part-to-message-part.js.map +1 -1
  10. package/dist/codemods/v0-12/assistant-api-to-aui.d.ts +3 -1
  11. package/dist/codemods/v0-12/assistant-api-to-aui.d.ts.map +1 -1
  12. package/dist/codemods/v0-12/assistant-api-to-aui.js +126 -213
  13. package/dist/codemods/v0-12/assistant-api-to-aui.js.map +1 -1
  14. package/dist/codemods/v0-12/event-names-to-camelcase.d.ts +3 -1
  15. package/dist/codemods/v0-12/event-names-to-camelcase.d.ts.map +1 -1
  16. package/dist/codemods/v0-12/event-names-to-camelcase.js +33 -38
  17. package/dist/codemods/v0-12/event-names-to-camelcase.js.map +1 -1
  18. package/dist/codemods/v0-12/primitive-if-to-aui-if.d.ts +3 -1
  19. package/dist/codemods/v0-12/primitive-if-to-aui-if.d.ts.map +1 -1
  20. package/dist/codemods/v0-12/primitive-if-to-aui-if.js +212 -297
  21. package/dist/codemods/v0-12/primitive-if-to-aui-if.js.map +1 -1
  22. package/dist/codemods/v0-8/ui-package-split.d.ts +3 -1
  23. package/dist/codemods/v0-8/ui-package-split.d.ts.map +1 -1
  24. package/dist/codemods/v0-8/ui-package-split.js +121 -164
  25. package/dist/codemods/v0-8/ui-package-split.js.map +1 -1
  26. package/dist/codemods/v0-9/edge-package-split.d.ts +3 -1
  27. package/dist/codemods/v0-9/edge-package-split.d.ts.map +1 -1
  28. package/dist/codemods/v0-9/edge-package-split.js +96 -140
  29. package/dist/codemods/v0-9/edge-package-split.js.map +1 -1
  30. package/dist/commands/add.d.ts +18 -1
  31. package/dist/commands/add.d.ts.map +1 -1
  32. package/dist/commands/add.js +54 -49
  33. package/dist/commands/add.js.map +1 -1
  34. package/dist/commands/agent.d.ts +5 -1
  35. package/dist/commands/agent.d.ts.map +1 -1
  36. package/dist/commands/agent.js +16 -25
  37. package/dist/commands/agent.js.map +1 -1
  38. package/dist/commands/create.d.ts +36 -26
  39. package/dist/commands/create.d.ts.map +1 -1
  40. package/dist/commands/create.js +458 -519
  41. package/dist/commands/create.js.map +1 -1
  42. package/dist/commands/info.d.ts +5 -1
  43. package/dist/commands/info.d.ts.map +1 -1
  44. package/dist/commands/info.js +233 -314
  45. package/dist/commands/info.js.map +1 -1
  46. package/dist/commands/init.d.ts +12 -9
  47. package/dist/commands/init.d.ts.map +1 -1
  48. package/dist/commands/init.js +98 -136
  49. package/dist/commands/init.js.map +1 -1
  50. package/dist/commands/mcp.d.ts +5 -1
  51. package/dist/commands/mcp.d.ts.map +1 -1
  52. package/dist/commands/mcp.js +175 -214
  53. package/dist/commands/mcp.js.map +1 -1
  54. package/dist/commands/update.d.ts +5 -1
  55. package/dist/commands/update.d.ts.map +1 -1
  56. package/dist/commands/update.js +46 -55
  57. package/dist/commands/update.js.map +1 -1
  58. package/dist/commands/upgrade.d.ts +11 -7
  59. package/dist/commands/upgrade.d.ts.map +1 -1
  60. package/dist/commands/upgrade.js +26 -38
  61. package/dist/commands/upgrade.js.map +1 -1
  62. package/dist/index.d.ts +1 -3
  63. package/dist/index.js +15 -14
  64. package/dist/index.js.map +1 -1
  65. package/dist/lib/create-project.d.ts +27 -10
  66. package/dist/lib/create-project.d.ts.map +1 -1
  67. package/dist/lib/create-project.js +239 -277
  68. package/dist/lib/create-project.js.map +1 -1
  69. package/dist/lib/install-ai-sdk-lib.d.ts +4 -1
  70. package/dist/lib/install-ai-sdk-lib.d.ts.map +1 -1
  71. package/dist/lib/install-ai-sdk-lib.js +12 -8
  72. package/dist/lib/install-ai-sdk-lib.js.map +1 -1
  73. package/dist/lib/install-edge-lib.d.ts +4 -1
  74. package/dist/lib/install-edge-lib.d.ts.map +1 -1
  75. package/dist/lib/install-edge-lib.js +16 -12
  76. package/dist/lib/install-edge-lib.js.map +1 -1
  77. package/dist/lib/install-ui-lib.d.ts +4 -1
  78. package/dist/lib/install-ui-lib.d.ts.map +1 -1
  79. package/dist/lib/install-ui-lib.js +12 -8
  80. package/dist/lib/install-ui-lib.js.map +1 -1
  81. package/dist/lib/run-spawn.d.ts +9 -0
  82. package/dist/lib/run-spawn.d.ts.map +1 -0
  83. package/dist/lib/run-spawn.js +26 -0
  84. package/dist/lib/run-spawn.js.map +1 -0
  85. package/dist/lib/transform-options.d.ts +8 -5
  86. package/dist/lib/transform-options.d.ts.map +1 -1
  87. package/dist/lib/transform-options.js +0 -2
  88. package/dist/lib/transform.d.ts +15 -11
  89. package/dist/lib/transform.d.ts.map +1 -1
  90. package/dist/lib/transform.js +97 -114
  91. package/dist/lib/transform.js.map +1 -1
  92. package/dist/lib/upgrade.d.ts +6 -2
  93. package/dist/lib/upgrade.d.ts.map +1 -1
  94. package/dist/lib/upgrade.js +62 -64
  95. package/dist/lib/upgrade.js.map +1 -1
  96. package/dist/lib/utils/config.d.ts +21 -18
  97. package/dist/lib/utils/config.d.ts.map +1 -1
  98. package/dist/lib/utils/config.js +24 -28
  99. package/dist/lib/utils/config.js.map +1 -1
  100. package/dist/lib/utils/file-scanner.d.ts +9 -6
  101. package/dist/lib/utils/file-scanner.d.ts.map +1 -1
  102. package/dist/lib/utils/file-scanner.js +44 -51
  103. package/dist/lib/utils/file-scanner.js.map +1 -1
  104. package/dist/lib/utils/logger.d.ts +10 -7
  105. package/dist/lib/utils/logger.d.ts.map +1 -1
  106. package/dist/lib/utils/logger.js +23 -19
  107. package/dist/lib/utils/logger.js.map +1 -1
  108. package/dist/lib/utils/package-installer.d.ts +10 -7
  109. package/dist/lib/utils/package-installer.d.ts.map +1 -1
  110. package/dist/lib/utils/package-installer.js +18 -19
  111. package/dist/lib/utils/package-installer.js.map +1 -1
  112. package/dist/lib/utils/package-manager.d.ts +10 -7
  113. package/dist/lib/utils/package-manager.d.ts.map +1 -1
  114. package/dist/lib/utils/package-manager.js +68 -59
  115. package/dist/lib/utils/package-manager.js.map +1 -1
  116. package/package.json +7 -7
  117. package/plugin/skills/assistant-ui/SKILL.md +2 -2
  118. package/src/commands/add.ts +67 -30
  119. package/src/commands/create.ts +116 -84
  120. package/src/commands/init.ts +9 -42
  121. package/src/lib/create-project.ts +123 -74
  122. package/src/lib/run-spawn.ts +32 -0
  123. package/dist/index.d.ts.map +0 -1
  124. 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
- The `assistant-ui` CLI for adding components and dependencies to your project.
3
+ [![npm version](https://img.shields.io/npm/v/assistant-ui)](https://www.npmjs.com/package/assistant-ui)
4
+ [![npm downloads](https://img.shields.io/npm/dm/assistant-ui)](https://www.npmjs.com/package/assistant-ui)
5
+ [![GitHub stars](https://img.shields.io/github/stars/assistant-ui/assistant-ui)](https://github.com/assistant-ui/assistant-ui)
4
6
 
5
- ## Usage
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
- Use the `init` command to initialize assistant-ui in an existing project.
9
+ ## Installation
8
10
 
9
- The `init` command installs dependencies, adds components, and configures your project for assistant-ui.
11
+ Run via your package manager of choice; nothing to install globally:
10
12
 
11
13
  ```bash
12
- npx assistant-ui@latest init
13
- npx assistant-ui@latest init --yes # non-interactive / CI / agent mode
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
- If no existing project is found (no `package.json`), `init` forwards to `create`.
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
- You can choose from multiple templates:
26
+ # scaffold a minimal project
27
+ npx assistant-ui@latest create my-app --template minimal
30
28
 
31
- ```bash
32
- # Default template with Vercel AI SDK
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
- # With Assistant Cloud + Clerk auth
42
- npx assistant-ui@latest create my-app -t cloud-clerk
32
+ # scaffold an Expo / React Native project
33
+ npx assistant-ui@latest create my-app --native
43
34
 
44
- # With LangGraph starter template
45
- npx assistant-ui@latest create my-app -t langgraph
35
+ # scaffold a React Ink terminal project
36
+ npx assistant-ui@latest create my-app --ink
46
37
 
47
- # With MCP starter template
48
- npx assistant-ui@latest create my-app -t mcp
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
- ### Example
41
+ # initialize non-interactively for CI or agent flows
42
+ npx assistant-ui@latest init --yes
65
43
 
66
- ```bash
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
- ```bash
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
- The `upgrade` command runs codemods to transform your code and prompts to install new dependencies.
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
- ```bash
53
+ # print env + version info for a bug report
99
54
  npx assistant-ui info
100
55
  ```
101
56
 
102
- This command collects and prints:
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
- **Options:**
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
- Visit https://assistant-ui.com/docs/cli to view the full documentation.
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 type { FileInfo, API, JSCodeshift, Collection } from "jscodeshift";
2
- export type TransformerFunction = (context: TransformContext, fileInfo: FileInfo, api: API, options: any) => void;
3
- export interface TransformContext {
4
- /**
5
- * The jscodeshift API object.
6
- */
7
- j: JSCodeshift;
8
- /**
9
- * The root collection of the AST.
10
- */
11
- root: Collection<any>;
12
- markAsChanged: () => void;
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
- export declare function createTransformer(transformFn: TransformerFunction): (fileInfo: FileInfo, api: API, options: any) => string | null;
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","sourceRoot":"","sources":["../../../src/codemods/utils/createTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1E,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,GAAG,KACT,IAAI,CAAC;AAEV,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,CAAC,EAAE,WAAW,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAEtB,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,mBAAmB,IACpC,UAAU,QAAQ,EAAE,KAAK,GAAG,EAAE,SAAS,GAAG,mBAgBvE"}
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
- export function createTransformer(transformFn) {
2
- return function transformer(fileInfo, api, options) {
3
- const j = api.jscodeshift;
4
- const root = j(fileInfo.source);
5
- let isChanged = false;
6
- const context = {
7
- j,
8
- root,
9
- markAsChanged: () => {
10
- isChanged = true;
11
- },
12
- };
13
- transformFn(context, fileInfo, api, options);
14
- return isChanged ? root.toSource() : null;
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","sourceRoot":"","sources":["../../../src/codemods/utils/createTransformer.ts"],"names":[],"mappings":"AAuBA,MAAM,UAAU,iBAAiB,CAAC,WAAgC;IAChE,OAAO,SAAS,WAAW,CAAC,QAAkB,EAAE,GAAQ,EAAE,OAAY;QACpE,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;QAC1B,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEhC,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,MAAM,OAAO,GAAqB;YAChC,CAAC;YACD,IAAI;YACJ,aAAa,EAAE,GAAG,EAAE;gBAClB,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC;SACF,CAAC;QAEF,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC"}
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
- export default migrateContentPartToMessagePart;
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","sourceRoot":"","sources":["../../../src/codemods/v0-11/content-part-to-message-part.ts"],"names":[],"mappings":"AAuEA,QAAA,MAAM,+BAA+B,6HAiGpC,CAAC;AAEF,eAAe,+BAA+B,CAAC"}
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
- // Map of old ContentPart names to new MessagePart names
2
+ //#region src/codemods/v0-11/content-part-to-message-part.ts
3
3
  const typeRenamingMap = {
4
- // Core types
5
- TextContentPart: "TextMessagePart",
6
- ReasoningContentPart: "ReasoningMessagePart",
7
- SourceContentPart: "SourceMessagePart",
8
- ImageContentPart: "ImageMessagePart",
9
- FileContentPart: "FileMessagePart",
10
- Unstable_AudioContentPart: "Unstable_AudioMessagePart",
11
- ToolCallContentPart: "ToolCallMessagePart",
12
- // Status types
13
- ContentPartStatus: "MessagePartStatus",
14
- ToolCallContentPartStatus: "ToolCallMessagePartStatus",
15
- // Thread message parts
16
- ThreadUserContentPart: "ThreadUserMessagePart",
17
- ThreadAssistantContentPart: "ThreadAssistantMessagePart",
18
- // Runtime and state types
19
- ContentPartRuntime: "MessagePartRuntime",
20
- ContentPartState: "MessagePartState",
21
- // Component types
22
- EmptyContentPartComponent: "EmptyMessagePartComponent",
23
- TextContentPartComponent: "TextMessagePartComponent",
24
- ReasoningContentPartComponent: "ReasoningMessagePartComponent",
25
- SourceContentPartComponent: "SourceMessagePartComponent",
26
- ImageContentPartComponent: "ImageMessagePartComponent",
27
- FileContentPartComponent: "FileMessagePartComponent",
28
- Unstable_AudioContentPartComponent: "Unstable_AudioMessagePartComponent",
29
- ToolCallContentPartComponent: "ToolCallMessagePartComponent",
30
- // Props types
31
- EmptyContentPartProps: "EmptyMessagePartProps",
32
- TextContentPartProps: "TextMessagePartProps",
33
- ReasoningContentPartProps: "ReasoningMessagePartProps",
34
- SourceContentPartProps: "SourceMessagePartProps",
35
- ImageContentPartProps: "ImageMessagePartProps",
36
- FileContentPartProps: "FileMessagePartProps",
37
- Unstable_AudioContentPartProps: "Unstable_AudioMessagePartProps",
38
- ToolCallContentPartProps: "ToolCallMessagePartProps",
39
- // Provider types
40
- TextContentPartProvider: "TextMessagePartProvider",
41
- TextContentPartProviderProps: "TextMessagePartProviderProps",
42
- ContentPartRuntimeProvider: "MessagePartRuntimeProvider",
43
- // Context types
44
- ContentPartContext: "MessagePartContext",
45
- ContentPartContextValue: "MessagePartContextValue",
46
- // Hook names
47
- useContentPart: "useMessagePart",
48
- useContentPartRuntime: "useMessagePartRuntime",
49
- useContentPartText: "useMessagePartText",
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
- // 1. Update imports
63
- root.find(j.ImportDeclaration).forEach((path) => {
64
- const source = path.value.source.value;
65
- // Only process imports from @assistant-ui packages
66
- if (typeof source === "string" && source.startsWith("@assistant-ui/")) {
67
- path.value.specifiers?.forEach((specifier) => {
68
- if (j.ImportSpecifier.check(specifier)) {
69
- const oldName = specifier.imported.name;
70
- if (typeRenamingMap[oldName]) {
71
- specifier.imported.name = typeRenamingMap[oldName];
72
- if (specifier.local && specifier.local.name === oldName) {
73
- specifier.local.name = typeRenamingMap[oldName];
74
- }
75
- markAsChanged();
76
- }
77
- }
78
- });
79
- }
80
- });
81
- // 2. Update MessagePrimitive.Content to MessagePrimitive.Parts
82
- root.find(j.MemberExpression).forEach((path) => {
83
- if (path.value.object &&
84
- path.value.object.name === "MessagePrimitive" &&
85
- path.value.property &&
86
- path.value.property.name === "Content") {
87
- path.value.property.name = "Parts";
88
- markAsChanged();
89
- }
90
- });
91
- // 3. Update JSX member expressions (e.g., MessagePrimitive.Content in JSX)
92
- root.find(j.JSXMemberExpression).forEach((path) => {
93
- if (path.value.object &&
94
- path.value.object.name === "MessagePrimitive" &&
95
- path.value.property &&
96
- path.value.property.name === "Content") {
97
- path.value.property.name = "Parts";
98
- markAsChanged();
99
- }
100
- });
101
- // 4. Update all identifiers for types, hooks, and primitives
102
- Object.entries(typeRenamingMap).forEach(([oldName, newName]) => {
103
- // Update type references
104
- root.find(j.TSTypeReference).forEach((path) => {
105
- if (path.value.typeName && path.value.typeName.name === oldName) {
106
- path.value.typeName.name = newName;
107
- markAsChanged();
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
- export default migrateContentPartToMessagePart;
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","sourceRoot":"","sources":["../../../src/codemods/v0-11/content-part-to-message-part.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sCAAmC;AAE/D,wDAAwD;AACxD,MAAM,eAAe,GAA2B;IAC9C,aAAa;IACb,eAAe,EAAE,iBAAiB;IAClC,oBAAoB,EAAE,sBAAsB;IAC5C,iBAAiB,EAAE,mBAAmB;IACtC,gBAAgB,EAAE,kBAAkB;IACpC,eAAe,EAAE,iBAAiB;IAClC,yBAAyB,EAAE,2BAA2B;IACtD,mBA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C"}
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":";;AAGA,MAAM,kBAA0C;CAE9C,iBAAiB;CACjB,sBAAsB;CACtB,mBAAmB;CACnB,kBAAkB;CAClB,iBAAiB;CACjB,2BAA2B;CAC3B,qBAAqB;CAGrB,mBAAmB;CACnB,2BAA2B;CAG3B,uBAAuB;CACvB,4BAA4B;CAG5B,oBAAoB;CACpB,kBAAkB;CAGlB,2BAA2B;CAC3B,0BAA0B;CAC1B,+BAA+B;CAC/B,4BAA4B;CAC5B,2BAA2B;CAC3B,0BAA0B;CAC1B,oCAAoC;CACpC,8BAA8B;CAG9B,uBAAuB;CACvB,sBAAsB;CACtB,2BAA2B;CAC3B,wBAAwB;CACxB,uBAAuB;CACvB,sBAAsB;CACtB,gCAAgC;CAChC,0BAA0B;CAG1B,yBAAyB;CACzB,8BAA8B;CAC9B,4BAA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AE,SAAS,SAAc;GAClD,IAAI,KAAK,MAAM,YAAY,KAAK,MAAM,SAAS,SAAS,SAAS;IAC/D,KAAK,MAAM,SAAS,OAAO;IAC3B,cAAc;GAChB;EACF,CAAC;EAGD,KAAK,KAAK,EAAE,UAAU,EAAE,SAAS,SAAc;GAC7C,IAAI,KAAK,MAAM,SAAS,SAAS;IAE/B,IAAI,EAAE,gBAAgB,MAAM,KAAK,OAAO,KAAK,GAC3C;IAIF,IACE,EAAE,SAAS,MAAM,KAAK,OAAO,KAAK,KAClC,KAAK,OAAO,MAAM,QAAQ,KAAK,OAE/B;IAIF,IACE,EAAE,iBAAiB,MAAM,KAAK,OAAO,KAAK,KAC1C,KAAK,OAAO,MAAM,aAAa,KAAK,OAEpC;IAGF,KAAK,MAAM,OAAO;IAClB,cAAc;GAChB;EACF,CAAC;EAGD,KAAK,KAAK,EAAE,aAAa,EAAE,SAAS,SAAc;GAChD,IAAI,KAAK,MAAM,SAAS,SAAS;IAC/B,KAAK,MAAM,OAAO;IAClB,cAAc;GAChB;EACF,CAAC;CACH,CAAC;AACH,CACF"}
@@ -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
- export default migrateAssistantApiToAui;
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","sourceRoot":"","sources":["../../../src/codemods/v0-12/assistant-api-to-aui.ts"],"names":[],"mappings":"AAsFA,QAAA,MAAM,wBAAwB,6HAyL7B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
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"}