skybridge 0.0.0-dev.f5a2ffe → 0.0.0-dev.f6bca06

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 (301) hide show
  1. package/LICENSE +21 -674
  2. package/README.md +89 -142
  3. package/bin/run.js +5 -0
  4. package/dist/cli/header.d.ts +4 -0
  5. package/dist/cli/header.js +6 -0
  6. package/dist/cli/header.js.map +1 -0
  7. package/dist/cli/run-command.d.ts +2 -0
  8. package/dist/cli/run-command.js +43 -0
  9. package/dist/cli/run-command.js.map +1 -0
  10. package/dist/cli/telemetry.d.ts +7 -0
  11. package/dist/cli/telemetry.js +123 -0
  12. package/dist/cli/telemetry.js.map +1 -0
  13. package/dist/cli/use-execute-steps.d.ts +11 -0
  14. package/dist/cli/use-execute-steps.js +36 -0
  15. package/dist/cli/use-execute-steps.js.map +1 -0
  16. package/dist/cli/use-nodemon.d.ts +6 -0
  17. package/dist/cli/use-nodemon.js +61 -0
  18. package/dist/cli/use-nodemon.js.map +1 -0
  19. package/dist/cli/use-typescript-check.d.ts +8 -0
  20. package/dist/cli/use-typescript-check.js +59 -0
  21. package/dist/cli/use-typescript-check.js.map +1 -0
  22. package/dist/commands/build.d.ts +9 -0
  23. package/dist/commands/build.js +46 -0
  24. package/dist/commands/build.js.map +1 -0
  25. package/dist/commands/dev.d.ts +9 -0
  26. package/dist/commands/dev.js +31 -0
  27. package/dist/commands/dev.js.map +1 -0
  28. package/dist/commands/start.d.ts +7 -0
  29. package/dist/commands/start.js +28 -0
  30. package/dist/commands/start.js.map +1 -0
  31. package/dist/commands/telemetry/disable.d.ts +5 -0
  32. package/dist/commands/telemetry/disable.js +14 -0
  33. package/dist/commands/telemetry/disable.js.map +1 -0
  34. package/dist/commands/telemetry/enable.d.ts +5 -0
  35. package/dist/commands/telemetry/enable.js +14 -0
  36. package/dist/commands/telemetry/enable.js.map +1 -0
  37. package/dist/commands/telemetry/status.d.ts +5 -0
  38. package/dist/commands/telemetry/status.js +14 -0
  39. package/dist/commands/telemetry/status.js.map +1 -0
  40. package/dist/server/asset-base-url-transform-plugin.d.ts +11 -0
  41. package/dist/server/asset-base-url-transform-plugin.js +34 -0
  42. package/dist/server/asset-base-url-transform-plugin.js.map +1 -0
  43. package/dist/server/asset-base-url-transform-plugin.test.js +56 -0
  44. package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -0
  45. package/dist/server/express.d.ts +5 -0
  46. package/dist/server/express.js +63 -0
  47. package/dist/server/express.js.map +1 -0
  48. package/dist/server/index.d.ts +4 -0
  49. package/dist/server/index.js.map +1 -0
  50. package/dist/server/inferUtilityTypes.d.ts +64 -0
  51. package/dist/server/inferUtilityTypes.js +2 -0
  52. package/dist/server/inferUtilityTypes.js.map +1 -0
  53. package/dist/server/server.d.ts +109 -0
  54. package/dist/server/server.js +201 -0
  55. package/dist/server/server.js.map +1 -0
  56. package/dist/{src/server → server}/templateHelper.d.ts +4 -0
  57. package/dist/{src/server → server}/templateHelper.js +5 -4
  58. package/dist/server/templateHelper.js.map +1 -0
  59. package/dist/server/templates/development.hbs +67 -0
  60. package/dist/{src/server → server}/templates/production.hbs +1 -1
  61. package/dist/{src/server → server}/widgetsDevServer.d.ts +2 -2
  62. package/dist/server/widgetsDevServer.js +57 -0
  63. package/dist/server/widgetsDevServer.js.map +1 -0
  64. package/dist/test/utils.d.ts +355 -0
  65. package/dist/test/utils.js +242 -0
  66. package/dist/test/utils.js.map +1 -0
  67. package/dist/test/widget.test.js +261 -0
  68. package/dist/test/widget.test.js.map +1 -0
  69. package/dist/web/bridges/apps-sdk/adaptor.d.ts +22 -0
  70. package/dist/web/bridges/apps-sdk/adaptor.js +64 -0
  71. package/dist/web/bridges/apps-sdk/adaptor.js.map +1 -0
  72. package/dist/web/bridges/apps-sdk/bridge.d.ts +10 -0
  73. package/dist/web/bridges/apps-sdk/bridge.js +46 -0
  74. package/dist/web/bridges/apps-sdk/bridge.js.map +1 -0
  75. package/dist/web/bridges/apps-sdk/index.d.ts +5 -0
  76. package/dist/web/bridges/apps-sdk/index.js +5 -0
  77. package/dist/web/bridges/apps-sdk/index.js.map +1 -0
  78. package/dist/{src/web → web/bridges/apps-sdk}/types.d.ts +48 -37
  79. package/dist/web/bridges/apps-sdk/types.js.map +1 -0
  80. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +2 -0
  81. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +7 -0
  82. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -0
  83. package/dist/web/bridges/get-adaptor.d.ts +2 -0
  84. package/dist/web/bridges/get-adaptor.js +8 -0
  85. package/dist/web/bridges/get-adaptor.js.map +1 -0
  86. package/dist/web/bridges/index.d.ts +5 -0
  87. package/dist/web/bridges/index.js +6 -0
  88. package/dist/web/bridges/index.js.map +1 -0
  89. package/dist/web/bridges/mcp-app/adaptor.d.ts +36 -0
  90. package/dist/web/bridges/mcp-app/adaptor.js +188 -0
  91. package/dist/web/bridges/mcp-app/adaptor.js.map +1 -0
  92. package/dist/web/bridges/mcp-app/bridge.d.ts +43 -0
  93. package/dist/web/bridges/mcp-app/bridge.js +255 -0
  94. package/dist/web/bridges/mcp-app/bridge.js.map +1 -0
  95. package/dist/web/bridges/mcp-app/index.d.ts +4 -0
  96. package/dist/web/bridges/mcp-app/index.js +4 -0
  97. package/dist/web/bridges/mcp-app/index.js.map +1 -0
  98. package/dist/web/bridges/mcp-app/types.d.ts +8 -0
  99. package/dist/web/bridges/mcp-app/types.js +2 -0
  100. package/dist/web/bridges/mcp-app/types.js.map +1 -0
  101. package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +5 -0
  102. package/dist/web/bridges/mcp-app/use-mcp-app-context.js +7 -0
  103. package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -0
  104. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +66 -0
  105. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -0
  106. package/dist/web/bridges/types.d.ts +98 -0
  107. package/dist/web/bridges/types.js +2 -0
  108. package/dist/web/bridges/types.js.map +1 -0
  109. package/dist/web/bridges/use-host-context.d.ts +2 -0
  110. package/dist/web/bridges/use-host-context.js +8 -0
  111. package/dist/web/bridges/use-host-context.js.map +1 -0
  112. package/dist/web/components/modal-provider.d.ts +4 -0
  113. package/dist/web/components/modal-provider.js +47 -0
  114. package/dist/web/components/modal-provider.js.map +1 -0
  115. package/dist/web/create-store.d.ts +3 -0
  116. package/dist/web/create-store.js +24 -0
  117. package/dist/web/create-store.js.map +1 -0
  118. package/dist/web/create-store.test.js +126 -0
  119. package/dist/web/create-store.test.js.map +1 -0
  120. package/dist/web/data-llm.d.ts +14 -0
  121. package/dist/web/data-llm.js +72 -0
  122. package/dist/web/data-llm.js.map +1 -0
  123. package/dist/web/data-llm.test.js +139 -0
  124. package/dist/web/data-llm.test.js.map +1 -0
  125. package/dist/web/generate-helpers.d.ts +116 -0
  126. package/dist/web/generate-helpers.js +111 -0
  127. package/dist/web/generate-helpers.js.map +1 -0
  128. package/dist/web/generate-helpers.test-d.js +209 -0
  129. package/dist/web/generate-helpers.test-d.js.map +1 -0
  130. package/dist/web/generate-helpers.test.d.ts +1 -0
  131. package/dist/web/generate-helpers.test.js +17 -0
  132. package/dist/web/generate-helpers.test.js.map +1 -0
  133. package/dist/web/helpers/state.d.ts +7 -0
  134. package/dist/web/helpers/state.js +45 -0
  135. package/dist/web/helpers/state.js.map +1 -0
  136. package/dist/web/helpers/state.test.d.ts +1 -0
  137. package/dist/web/helpers/state.test.js +53 -0
  138. package/dist/web/helpers/state.test.js.map +1 -0
  139. package/dist/web/hooks/index.d.ts +11 -0
  140. package/dist/web/hooks/index.js +12 -0
  141. package/dist/web/hooks/index.js.map +1 -0
  142. package/dist/web/hooks/test/utils.d.ts +16 -0
  143. package/dist/web/hooks/test/utils.js +60 -0
  144. package/dist/web/hooks/test/utils.js.map +1 -0
  145. package/dist/web/hooks/use-call-tool.d.ts +101 -0
  146. package/dist/web/hooks/use-call-tool.js +68 -0
  147. package/dist/web/hooks/use-call-tool.js.map +1 -0
  148. package/dist/web/hooks/use-call-tool.test-d.d.ts +1 -0
  149. package/dist/web/hooks/use-call-tool.test-d.js +104 -0
  150. package/dist/web/hooks/use-call-tool.test-d.js.map +1 -0
  151. package/dist/web/hooks/use-call-tool.test.d.ts +1 -0
  152. package/dist/web/hooks/use-call-tool.test.js +190 -0
  153. package/dist/web/hooks/use-call-tool.test.js.map +1 -0
  154. package/dist/{src/web → web}/hooks/use-display-mode.d.ts +1 -1
  155. package/dist/web/hooks/use-display-mode.js +9 -0
  156. package/dist/web/hooks/use-display-mode.js.map +1 -0
  157. package/dist/web/hooks/use-display-mode.test.d.ts +1 -0
  158. package/dist/{src/web → web}/hooks/use-display-mode.test.js +3 -2
  159. package/dist/web/hooks/use-display-mode.test.js.map +1 -0
  160. package/dist/web/hooks/use-files.d.ts +6 -0
  161. package/dist/web/hooks/use-files.js +9 -0
  162. package/dist/web/hooks/use-files.js.map +1 -0
  163. package/dist/web/hooks/use-files.test.d.ts +1 -0
  164. package/dist/web/hooks/use-files.test.js +30 -0
  165. package/dist/web/hooks/use-files.test.js.map +1 -0
  166. package/dist/web/hooks/use-layout.d.ts +22 -0
  167. package/dist/web/hooks/use-layout.js +23 -0
  168. package/dist/web/hooks/use-layout.js.map +1 -0
  169. package/dist/web/hooks/use-layout.test.d.ts +1 -0
  170. package/dist/web/hooks/use-layout.test.js +96 -0
  171. package/dist/web/hooks/use-layout.test.js.map +1 -0
  172. package/dist/web/hooks/use-open-external.d.ts +1 -0
  173. package/dist/web/hooks/use-open-external.js +8 -0
  174. package/dist/web/hooks/use-open-external.js.map +1 -0
  175. package/dist/web/hooks/use-open-external.test.d.ts +1 -0
  176. package/dist/web/hooks/use-open-external.test.js +50 -0
  177. package/dist/web/hooks/use-open-external.test.js.map +1 -0
  178. package/dist/web/hooks/use-request-modal.d.ts +9 -0
  179. package/dist/web/hooks/use-request-modal.js +16 -0
  180. package/dist/web/hooks/use-request-modal.js.map +1 -0
  181. package/dist/web/hooks/use-request-modal.test.d.ts +1 -0
  182. package/dist/web/hooks/use-request-modal.test.js +57 -0
  183. package/dist/web/hooks/use-request-modal.test.js.map +1 -0
  184. package/dist/web/hooks/use-send-follow-up-message.d.ts +1 -0
  185. package/dist/web/hooks/use-send-follow-up-message.js +8 -0
  186. package/dist/web/hooks/use-send-follow-up-message.js.map +1 -0
  187. package/dist/web/hooks/use-set-open-in-app-url.d.ts +1 -0
  188. package/dist/web/hooks/use-set-open-in-app-url.js +8 -0
  189. package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -0
  190. package/dist/web/hooks/use-set-open-in-app-url.test.d.ts +1 -0
  191. package/dist/web/hooks/use-set-open-in-app-url.test.js +49 -0
  192. package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -0
  193. package/dist/web/hooks/use-tool-info.d.ts +36 -0
  194. package/dist/web/hooks/use-tool-info.js +26 -0
  195. package/dist/web/hooks/use-tool-info.js.map +1 -0
  196. package/dist/web/hooks/use-tool-info.test-d.d.ts +1 -0
  197. package/dist/web/hooks/use-tool-info.test-d.js +109 -0
  198. package/dist/web/hooks/use-tool-info.test-d.js.map +1 -0
  199. package/dist/web/hooks/use-tool-info.test.d.ts +1 -0
  200. package/dist/web/hooks/use-tool-info.test.js +130 -0
  201. package/dist/web/hooks/use-tool-info.test.js.map +1 -0
  202. package/dist/web/hooks/use-user.d.ts +18 -0
  203. package/dist/web/hooks/use-user.js +19 -0
  204. package/dist/web/hooks/use-user.js.map +1 -0
  205. package/dist/web/hooks/use-user.test.d.ts +1 -0
  206. package/dist/web/hooks/use-user.test.js +94 -0
  207. package/dist/web/hooks/use-user.test.js.map +1 -0
  208. package/dist/web/hooks/use-widget-state.js +32 -0
  209. package/dist/web/hooks/use-widget-state.js.map +1 -0
  210. package/dist/web/hooks/use-widget-state.test.d.ts +1 -0
  211. package/dist/{src/web → web}/hooks/use-widget-state.test.js +3 -3
  212. package/dist/web/hooks/use-widget-state.test.js.map +1 -0
  213. package/dist/web/index.d.ts +8 -0
  214. package/dist/web/index.js +9 -0
  215. package/dist/web/index.js.map +1 -0
  216. package/dist/web/mount-widget.js +27 -0
  217. package/dist/web/mount-widget.js.map +1 -0
  218. package/dist/web/plugin/data-llm.test.d.ts +1 -0
  219. package/dist/web/plugin/data-llm.test.js +81 -0
  220. package/dist/web/plugin/data-llm.test.js.map +1 -0
  221. package/dist/web/plugin/plugin.js +46 -0
  222. package/dist/web/plugin/plugin.js.map +1 -0
  223. package/dist/web/plugin/transform-data-llm.d.ts +12 -0
  224. package/dist/web/plugin/transform-data-llm.js +96 -0
  225. package/dist/web/plugin/transform-data-llm.js.map +1 -0
  226. package/dist/web/plugin/transform-data-llm.test.d.ts +1 -0
  227. package/dist/web/plugin/transform-data-llm.test.js +81 -0
  228. package/dist/web/plugin/transform-data-llm.test.js.map +1 -0
  229. package/dist/web/proxy.d.ts +1 -0
  230. package/dist/web/proxy.js +52 -0
  231. package/dist/web/proxy.js.map +1 -0
  232. package/dist/web/types.d.ts +16 -0
  233. package/dist/web/types.js +2 -0
  234. package/dist/web/types.js.map +1 -0
  235. package/package.json +65 -31
  236. package/dist/src/server/index.d.ts +0 -2
  237. package/dist/src/server/index.js.map +0 -1
  238. package/dist/src/server/server.d.ts +0 -13
  239. package/dist/src/server/server.js +0 -54
  240. package/dist/src/server/server.js.map +0 -1
  241. package/dist/src/server/templateHelper.js.map +0 -1
  242. package/dist/src/server/templates/development.hbs +0 -12
  243. package/dist/src/server/widgetsDevServer.js +0 -39
  244. package/dist/src/server/widgetsDevServer.js.map +0 -1
  245. package/dist/src/test/setup.js +0 -9
  246. package/dist/src/test/setup.js.map +0 -1
  247. package/dist/src/test/utils.d.ts +0 -28
  248. package/dist/src/test/utils.js +0 -43
  249. package/dist/src/test/utils.js.map +0 -1
  250. package/dist/src/test/widget.test.js +0 -90
  251. package/dist/src/test/widget.test.js.map +0 -1
  252. package/dist/src/web/hooks/index.d.ts +0 -7
  253. package/dist/src/web/hooks/index.js +0 -8
  254. package/dist/src/web/hooks/index.js.map +0 -1
  255. package/dist/src/web/hooks/use-call-tool.d.ts +0 -54
  256. package/dist/src/web/hooks/use-call-tool.js +0 -44
  257. package/dist/src/web/hooks/use-call-tool.js.map +0 -1
  258. package/dist/src/web/hooks/use-call-tool.test.js +0 -66
  259. package/dist/src/web/hooks/use-call-tool.test.js.map +0 -1
  260. package/dist/src/web/hooks/use-display-mode.js +0 -7
  261. package/dist/src/web/hooks/use-display-mode.js.map +0 -1
  262. package/dist/src/web/hooks/use-display-mode.test.js.map +0 -1
  263. package/dist/src/web/hooks/use-openai-global.d.ts +0 -2
  264. package/dist/src/web/hooks/use-openai-global.js +0 -21
  265. package/dist/src/web/hooks/use-openai-global.js.map +0 -1
  266. package/dist/src/web/hooks/use-tool-info.d.ts +0 -5
  267. package/dist/src/web/hooks/use-tool-info.js +0 -9
  268. package/dist/src/web/hooks/use-tool-info.js.map +0 -1
  269. package/dist/src/web/hooks/use-tool-info.test.js +0 -38
  270. package/dist/src/web/hooks/use-tool-info.test.js.map +0 -1
  271. package/dist/src/web/hooks/use-tool-output.d.ts +0 -4
  272. package/dist/src/web/hooks/use-tool-output.js +0 -9
  273. package/dist/src/web/hooks/use-tool-output.js.map +0 -1
  274. package/dist/src/web/hooks/use-tool-response-metadata.d.ts +0 -4
  275. package/dist/src/web/hooks/use-tool-response-metadata.js +0 -8
  276. package/dist/src/web/hooks/use-tool-response-metadata.js.map +0 -1
  277. package/dist/src/web/hooks/use-widget-state.js +0 -30
  278. package/dist/src/web/hooks/use-widget-state.js.map +0 -1
  279. package/dist/src/web/hooks/use-widget-state.test.js.map +0 -1
  280. package/dist/src/web/index.d.ts +0 -4
  281. package/dist/src/web/index.js +0 -5
  282. package/dist/src/web/index.js.map +0 -1
  283. package/dist/src/web/mount-widget.js +0 -14
  284. package/dist/src/web/mount-widget.js.map +0 -1
  285. package/dist/src/web/plugin.js +0 -28
  286. package/dist/src/web/plugin.js.map +0 -1
  287. package/dist/src/web/types.js.map +0 -1
  288. package/dist/vitest.config.d.ts +0 -2
  289. package/dist/vitest.config.js +0 -9
  290. package/dist/vitest.config.js.map +0 -1
  291. /package/dist/{src/test/setup.d.ts → server/asset-base-url-transform-plugin.test.d.ts} +0 -0
  292. /package/dist/{src/server → server}/index.js +0 -0
  293. /package/dist/{src/test → test}/widget.test.d.ts +0 -0
  294. /package/dist/{src/web → web/bridges/apps-sdk}/types.js +0 -0
  295. /package/dist/{src/web/hooks/use-call-tool.test.d.ts → web/bridges/mcp-app/use-mcp-app-context.test.d.ts} +0 -0
  296. /package/dist/{src/web/hooks/use-display-mode.test.d.ts → web/create-store.test.d.ts} +0 -0
  297. /package/dist/{src/web/hooks/use-tool-info.test.d.ts → web/data-llm.test.d.ts} +0 -0
  298. /package/dist/{src/web/hooks/use-widget-state.test.d.ts → web/generate-helpers.test-d.d.ts} +0 -0
  299. /package/dist/{src/web → web}/hooks/use-widget-state.d.ts +0 -0
  300. /package/dist/{src/web → web}/mount-widget.d.ts +0 -0
  301. /package/dist/{src/web → web/plugin}/plugin.d.ts +0 -0
package/README.md CHANGED
@@ -1,198 +1,145 @@
1
1
  <div align="center">
2
2
 
3
- # Skybridge
4
-
5
- **Skybridge is the TypeScript framework for building ChatGPT apps**
3
+ <img alt="Skybridge" src="https://raw.githubusercontent.com/alpic-ai/skybridge/main/docs/images/github-banner.png" width="100%">
6
4
 
7
- [![By Alpic](https://img.shields.io/badge/Made%20by%20Alpic-f6ffed?logo=alpic)](https://alpic.ai)
5
+ <br />
8
6
 
9
- ![NPM Downloads](https://img.shields.io/npm/dm/skybridge?color=e90060)
10
- ![NPM Version](https://img.shields.io/npm/v/skybridge?color=e90060)
11
- ![GitHub License](https://img.shields.io/github/license/alpic-ai/skybridge?color=e90060)
7
+ # Skybridge
12
8
 
13
- </div>
9
+ **Build ChatGPT & MCP Apps. The Modern TypeScript Way.**
14
10
 
15
- Skybridge comes with 2 packages:
11
+ The fullstack TypeScript framework for AI-embedded widgets.<br />
12
+ **Type-safe. React-powered. Platform-agnostic.**
16
13
 
17
- - `skybridge/server`: A drop-in replacement of the `@modelcontextprotocol/sdk` official `McpServer` class with extra features for widget development.
18
- - `skybridge/web`: A react library with hooks and components to build widgets on the underlying _OpenAI iFrame skybridge_ runtime.
14
+ <br />
19
15
 
20
- ## Quick start
16
+ [![NPM Version](https://img.shields.io/npm/v/skybridge?color=e90060&style=for-the-badge)](https://www.npmjs.com/package/skybridge)
17
+ [![NPM Downloads](https://img.shields.io/npm/dm/skybridge?color=e90060&style=for-the-badge)](https://www.npmjs.com/package/skybridge)
18
+ [![GitHub License](https://img.shields.io/github/license/alpic-ai/skybridge?color=e90060&style=for-the-badge)](https://github.com/alpic-ai/skybridge/blob/main/LICENSE)
21
19
 
22
- To get started in less than a minute, you can [create a new repository](https://github.com/new?template_name=apps-sdk-template&template_owner=alpic-ai) using our [ChatGPT SDK template](https://github.com/alpic-ai/apps-sdk-template). This template includes a basic setup for both the server and the widgets.
20
+ <br />
23
21
 
24
- ## Installation
22
+ [Documentation](https://docs.skybridge.tech) · [Quick Start](https://docs.skybridge.tech/quickstart/create-new-app) · [Showcase](https://docs.skybridge.tech/showcase)
25
23
 
26
- ```bash
27
- pnpm add skybridge
28
- ```
29
-
30
- ## Concepts
31
-
32
- ### Widgets
24
+ </div>
33
25
 
34
- > A widget is a UI component that turns structured tool results into a human-friendly UI. Those are built using React components. They are rendered inside an iframe inline with the conversation on ChatGPT.
26
+ <br />
35
27
 
36
- Each widget in your app must have a unique name. The name is used to bridge the tool invocation result with the widget React component.
28
+ ## Why Skybridge?
37
29
 
38
- For example, in order to register a new widget named `pokemon` on your ChatGPT app. You should have the following file structure and file contents:
30
+ ChatGPT Apps and MCP Apps let you embed **rich, interactive UIs** directly in AI conversations. But the raw SDKs are low-level—no hooks, no type safety, no dev tools, and no HMR.
39
31
 
40
- _Project structure_
32
+ **Skybridge fixes that.**
41
33
 
42
- ```
43
- server/
44
- └── src/
45
- └── index.ts // Register the widget with McpServer.widget()
46
- web/
47
- └── src/
48
- └── widgets/
49
- └── pokemon.tsx // Use the same widget name as the file name
50
- ```
34
+ | | |
35
+ |:--|:--|
36
+ | 👨‍💻 **Full Dev Environment** — HMR, debug traces, and local devtools. No more refresh loops. | ✅ **End-to-End Type Safety** — tRPC-style inference from server to widget. Autocomplete everywhere. |
37
+ | 🔄 **Widget-to-Model Sync** — Keep the model aware of UI state with `data-llm`. Dual surfaces, one source of truth. | ⚒️ **React Query-style Hooks** — `isPending`, `isError`, callbacks. State management you already know. |
38
+ | 🌐 **Platform Agnostic** — Write once, run anywhere. Works with ChatGPT (Apps SDK) and MCP-compatible clients. | 📦 **Showcase Examples** — Production-ready examples to learn from and build upon. |
51
39
 
52
- _server/src/index.ts_
40
+ <br />
53
41
 
54
- ```ts
55
- import { McpServer } from "skybridge/server";
42
+ ## 🚀 Get Started
56
43
 
57
- const server = new McpServer();
44
+ **Create a new app:**
58
45
 
59
- server.widget(
60
- "pokemon"
61
- // Remaining arguments...
62
- );
46
+ ```bash
47
+ npm create skybridge@latest
63
48
  ```
64
49
 
65
- _web/src/widgets/pokemon.tsx_
66
-
67
- ```ts
68
- import { mountWidget } from "skybridge/web";
50
+ **Or add to an existing project:**
69
51
 
70
- const Pokemon: React.FunctionComponent = () => {
71
- // Your React component code goes here...
72
- };
73
-
74
- mountWidget(<Pokemon />);
52
+ ```bash
53
+ npm i skybridge
54
+ yarn add skybridge
55
+ pnpm add skybridge
56
+ bun add skybridge
57
+ deno add skybridge
75
58
  ```
76
59
 
77
- ## Packages
60
+ <div align="center">
78
61
 
79
- ### skybridge/server
62
+ **👉 [Read the Docs](https://docs.skybridge.tech) 👈**
80
63
 
81
- The `skybridge/server` package is a drop-in replacement of the `@modelcontextprotocol/sdk` official `McpServer` class with extra features for widget development. If you're already using the `@modelcontextprotocol/sdk`, you can simply replace your `McpServer` import with `skybridge/server` and you're good to go.
64
+ </div>
82
65
 
83
- ### skybridge/web
66
+ <br />
84
67
 
85
- The `skybridge/web` package is a react library with hooks and components to build widgets on the underlying _OpenAI iFrame skybridge_ runtime.
68
+ ## 📦 Architecture
86
69
 
87
- **Vite plugin**
70
+ Skybridge is a fullstack framework with unified server and client modules:
88
71
 
89
- The `skybridge/web` package comes with a Vite plugin that allows you to build your widgets as regular Vite apps.
72
+ - **`skybridge/server`** Define tools and widgets with full type inference. Extends the MCP SDK.
73
+ - **`skybridge/web`** — React hooks that consume your server types. Works with Apps SDK (ChatGPT) and MCP Apps.
74
+ - **Dev Environment** — Vite plugin with HMR, DevTools emulator, and optimized builds.
75
+
76
+ ### Server
90
77
 
91
78
  ```ts
92
- import { defineConfig } from "vite";
93
- import { skybridge } from "skybridge/web";
79
+ import { McpServer } from "skybridge/server";
94
80
 
95
- export default defineConfig({
96
- plugins: [skybridge()],
81
+ server.registerWidget("flights", {}, {
82
+ inputSchema: { destination: z.string() },
83
+ }, async ({ destination }) => {
84
+ const flights = await searchFlights(destination);
85
+ return { structuredContent: { flights } };
97
86
  });
98
87
  ```
99
88
 
100
- **Hooks**
101
-
102
- The `skybridge/web` package comes with a set of hooks to help you build your widgets :
89
+ ### Widget
103
90
 
104
- - `useOpenAiGlobal`: A generic hook to get any global data from the OpenAI iFrame skybridge runtime (in `window.openai`).
105
- - `useToolOutput`: A hook to get the initial tool `structuredContent` returned when rendering the widget for the first time. The data inside this hook is not updated when the tool is called again.
106
- - `useToolResponseMetadata`: A hook to get the initial tool `meta` returned when rendering the widget for the first time. The data inside this hook is not updated when the tool is called again.
107
- - `useCallTool`: A @tanstack/react-query inspired hook to send make additional tool calls inside a widget.
91
+ ```tsx
92
+ import { useToolInfo } from "skybridge/web";
108
93
 
109
- _useOpenAiGlobal_
94
+ function FlightsWidget() {
95
+ const { output } = useToolInfo();
110
96
 
111
- ```ts
112
- import { useOpenAiGlobal } from "skybridge/web";
113
-
114
- const theme = useOpenAiGlobal("theme");
97
+ return output.structuredContent.flights.map(flight =>
98
+ <FlightCard key={flight.id} flight={flight} />
99
+ );
100
+ }
115
101
  ```
116
102
 
117
- _useToolOutput_
103
+ <br />
118
104
 
119
- ```ts
120
- import { useToolOutput } from "skybridge/web";
105
+ ## 🎯 Features at a Glance
121
106
 
122
- const toolOutput = useToolOutput();
123
- ```
107
+ - **Live Reload** — Vite HMR. See changes instantly without reinstalling.
108
+ - **Typed Hooks** — Full autocomplete for tools, inputs, outputs.
109
+ - **Widget → Tool Calls** — Trigger server actions from UI.
110
+ - **Dual Surface Sync** — Keep model aware of what users see with `data-llm`.
111
+ - **React Query-style API** — `isPending`, `isError`, callbacks.
112
+ - **Platform Agnostic** — Works with ChatGPT (Apps SDK) and MCP Apps clients (Goose, VSCode, etc.).
113
+ - **MCP Compatible** — Extends the official SDK. Works with any MCP client.
124
114
 
125
- _useToolResponseMetadata_
115
+ <br />
126
116
 
127
- ```ts
128
- import { useToolResponseMetadata } from "skybridge/web";
117
+ ## 📖 Showcase
129
118
 
130
- const toolResponseMetadata = useToolResponseMetadata();
131
- ```
119
+ Explore production-ready examples:
132
120
 
133
- _useCallTool_ in synchronous mode
121
+ | Example | Description | Demo | Code |
122
+ |------------------------|----------------------------------------------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------------------------------|
123
+ | **Capitals Explorer** | Interactive world map with geolocation and Wikipedia integration | [Try Demo](https://capitals.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/capitals) |
124
+ | **Ecommerce Carousel** | Product carousel with cart, localization, and modals | [Try Demo](https://ecommerce.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/ecom-carousel) |
125
+ | **Everything** | Comprehensive playground showcasing all hooks and features | [Try Demo](https://everything.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/everything) |
126
+ | **Productivity** | Data visualization dashboard demonstrating Skybridge capabilities for MCP Apps | [Try Demo](https://productivity.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/productivity) |
127
+ | **Manifest Starter** | Starter app with Manifest UI agentic components out-of-the-box | [Try Demo](https://manifest-ui.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/manifest-ui) |
134
128
 
135
- ```ts
136
- import { useCallTool } from "skybridge/web";
137
-
138
- export const TestTool: React.FunctionComponent = () => {
139
- const { callTool, isPending } = useCallTool("myToolName");
140
-
141
- return (
142
- <div>
143
- <button
144
- disabled={isPending}
145
- onClick={() => {
146
- callTool({ input: "test input" }, {
147
- onSuccess: (data) => {
148
- alert("Tool returned: " + data);
149
- },
150
- });
151
- >
152
- Call Tool inside a widget
153
- </button>
154
- </div>
155
- );
156
- };
157
- ```
129
+ See all examples in the [Showcase](https://docs.skybridge.tech/showcase) or browse the [examples/](examples/) directory.
158
130
 
159
- _useCallTool_ in asynchronous mode
131
+ <br />
160
132
 
161
- ```ts
162
- import { useCallTool } from "skybridge/web";
163
-
164
- export const TestTool: React.FunctionComponent = () => {
165
- const { callToolAsync, isPending } = useCallTool("myToolName");
166
-
167
- return (
168
- <div>
169
- <button
170
- disabled={isPending}
171
- onClick={async () => {
172
- const data = await callToolAsync({ input: "test input" });
173
- alert("Tool returned: " + data);
174
- }}
175
- >
176
- Call Tool inside a widget
177
- </button>
178
- </div>
179
- );
180
- };
181
- ```
133
+ <div align="center">
182
134
 
183
- ## Migrate your existing MCP server to a ChatGPT app
135
+ [![GitHub Discussions](https://img.shields.io/badge/Discussions-Ask%20Questions-blue?style=flat-square&logo=github)](https://github.com/alpic-ai/skybridge/discussions)
136
+ [![GitHub Issues](https://img.shields.io/badge/Issues-Report%20Bugs-red?style=flat-square&logo=github)](https://github.com/alpic-ai/skybridge/issues)
137
+ [![Discord](https://img.shields.io/badge/Discord-Chat-5865F2?style=flat-square&logo=discord&logoColor=white)](https://discord.com/invite/gNAazGueab)
184
138
 
185
- If you're already using the `@modelcontextprotocol/sdk` to build a MCP server, you can migrate to a ChatGPT app by following these steps:
139
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions
186
140
 
187
- 1. Replace your `McpServer` import from `@modelcontextprotocol/sdk` with the same import from `skybridge/server`
188
- 2. Create a new vite project in a folder named `web` and install the `skybridge` package
189
- 3. Replace the `vite.config.ts` file with the following:
141
+ <br />
190
142
 
191
- ```ts
192
- import { defineConfig } from "vite";
193
- import { skybridge } from "skybridge/web";
143
+ **[MIT License](LICENSE)** · Made with ❤️ by **[Alpic](https://alpic.ai)**
194
144
 
195
- export default defineConfig({
196
- plugins: [skybridge()],
197
- });
198
- ```
145
+ </div>
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execute } from "@oclif/core";
4
+
5
+ await execute({ dir: import.meta.url });
@@ -0,0 +1,4 @@
1
+ export declare const Header: ({ version, children, }: {
2
+ version: string;
3
+ children?: React.ReactNode;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from "ink";
3
+ export const Header = ({ version, children, }) => {
4
+ return (_jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { color: "cyan", bold: true, children: ["\u26F0", " ", "Welcome to Skybridge"] }), _jsxs(Text, { color: "cyan", children: [" v", version] }), children] }));
5
+ };
6
+ //# sourceMappingURL=header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/cli/header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EACrB,OAAO,EACP,QAAQ,GAIT,EAAE,EAAE;IACH,OAAO,CACL,MAAC,GAAG,IAAC,YAAY,EAAE,CAAC,aAClB,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,6BACnB,IAAI,4BACD,EACP,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,mBAAI,OAAO,IAAQ,EACpC,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type SpawnOptions } from "node:child_process";
2
+ export declare function runCommand(command: string, options?: SpawnOptions): Promise<void>;
@@ -0,0 +1,43 @@
1
+ import { spawn } from "node:child_process";
2
+ export function runCommand(command, options = {
3
+ stdio: ["ignore", "inherit", "inherit"],
4
+ }) {
5
+ return new Promise((resolve, reject) => {
6
+ const stdoutChunks = [];
7
+ const stderrChunks = [];
8
+ const proc = spawn(command, {
9
+ ...options,
10
+ shell: true,
11
+ });
12
+ if (proc.stdout) {
13
+ proc.stdout.on("data", (chunk) => {
14
+ stdoutChunks.push(chunk);
15
+ });
16
+ }
17
+ if (proc.stderr) {
18
+ proc.stderr.on("data", (chunk) => {
19
+ stderrChunks.push(chunk);
20
+ });
21
+ }
22
+ proc.on("close", (code) => {
23
+ if (code === 0) {
24
+ resolve();
25
+ }
26
+ else {
27
+ const stdoutOutput = Buffer.concat(stdoutChunks).toString();
28
+ const stderrOutput = Buffer.concat(stderrChunks).toString();
29
+ const allOutput = [stdoutOutput, stderrOutput]
30
+ .filter((output) => output.trim())
31
+ .join("\n");
32
+ const errorMessage = allOutput
33
+ ? `Command failed with exit code ${code}\n${allOutput}`
34
+ : `Command failed with exit code ${code}`;
35
+ reject(new Error(errorMessage));
36
+ }
37
+ });
38
+ proc.on("error", (error) => {
39
+ reject(error);
40
+ });
41
+ });
42
+ }
43
+ //# sourceMappingURL=run-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-command.js","sourceRoot":"","sources":["../../src/cli/run-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,UAAU,UAAU,CACxB,OAAe,EACf,UAAwB;IACtB,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;CACxC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OA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iC,IAAI,EAAE,CAAC;gBAC5C,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Hook } from "@oclif/core";
2
+ export declare function isEnabled(): boolean;
3
+ export declare function isDebugMode(): boolean;
4
+ export declare function setEnabled(enabled: boolean): void;
5
+ export declare function getMachineId(): string;
6
+ declare const hook: Hook<"finally">;
7
+ export default hook;
@@ -0,0 +1,123 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ import ci from "ci-info";
5
+ import { PostHog } from "posthog-node";
6
+ const POSTHOG_API_KEY = "phc_rQdkCYr0DO4NcZBQXZnUwsHAbau9zuNwKIpil9FQP6v";
7
+ const POSTHOG_HOST = "https://us.i.posthog.com";
8
+ const ENV_TELEMETRY_DISABLED = "SKYBRIDGE_TELEMETRY_DISABLED";
9
+ const ENV_TELEMETRY_DEBUG = "SKYBRIDGE_TELEMETRY_DEBUG";
10
+ const ENV_DO_NOT_TRACK = "DO_NOT_TRACK";
11
+ const GLOBAL_CONFIG_DIR = join(homedir(), ".skybridge");
12
+ const GLOBAL_CONFIG_FILE = join(GLOBAL_CONFIG_DIR, "config.json");
13
+ let posthogClient = null;
14
+ function getPostHogClient() {
15
+ if (!posthogClient) {
16
+ posthogClient = new PostHog(POSTHOG_API_KEY, {
17
+ host: POSTHOG_HOST,
18
+ flushAt: 1,
19
+ flushInterval: 0,
20
+ });
21
+ }
22
+ return posthogClient;
23
+ }
24
+ function readJsonFile(filePath) {
25
+ try {
26
+ if (existsSync(filePath)) {
27
+ const content = readFileSync(filePath, "utf-8");
28
+ return JSON.parse(content);
29
+ }
30
+ }
31
+ catch {
32
+ // Ignore errors reading config
33
+ }
34
+ return null;
35
+ }
36
+ function writeJsonFile(filePath, data) {
37
+ try {
38
+ const dir = join(filePath, "..");
39
+ if (!existsSync(dir)) {
40
+ mkdirSync(dir, { recursive: true });
41
+ }
42
+ writeFileSync(filePath, JSON.stringify(data, null, 2), "utf-8");
43
+ }
44
+ catch {
45
+ // Ignore errors writing config
46
+ }
47
+ }
48
+ function getGlobalConfig() {
49
+ const existing = readJsonFile(GLOBAL_CONFIG_FILE);
50
+ if (existing?.machineId && existing?.telemetry !== undefined) {
51
+ return existing;
52
+ }
53
+ const config = {
54
+ machineId: existing?.machineId || crypto.randomUUID(),
55
+ telemetry: {
56
+ enabled: existing?.telemetry?.enabled ?? true,
57
+ },
58
+ };
59
+ writeJsonFile(GLOBAL_CONFIG_FILE, config);
60
+ return config;
61
+ }
62
+ export function isEnabled() {
63
+ if (process.env[ENV_TELEMETRY_DISABLED] === "1" ||
64
+ process.env[ENV_TELEMETRY_DISABLED]?.toLowerCase() === "true") {
65
+ return false;
66
+ }
67
+ if (process.env[ENV_DO_NOT_TRACK] === "1" ||
68
+ process.env[ENV_DO_NOT_TRACK]?.toLowerCase() === "true") {
69
+ return false;
70
+ }
71
+ if (ci.isCI) {
72
+ return true;
73
+ }
74
+ const config = getGlobalConfig();
75
+ return config.telemetry.enabled;
76
+ }
77
+ export function isDebugMode() {
78
+ return (process.env[ENV_TELEMETRY_DEBUG] === "1" ||
79
+ process.env[ENV_TELEMETRY_DEBUG]?.toLowerCase() === "true");
80
+ }
81
+ export function setEnabled(enabled) {
82
+ const config = getGlobalConfig();
83
+ config.telemetry.enabled = enabled;
84
+ writeJsonFile(GLOBAL_CONFIG_FILE, config);
85
+ }
86
+ export function getMachineId() {
87
+ if (ci.isCI) {
88
+ return ci.name ?? "unknown-ci";
89
+ }
90
+ return getGlobalConfig().machineId;
91
+ }
92
+ const hook = async ({ id: command, config: { version }, error, }) => {
93
+ if (!isEnabled()) {
94
+ return;
95
+ }
96
+ const event = {
97
+ version,
98
+ machineId: getMachineId(),
99
+ sessionId: crypto.randomUUID(),
100
+ isCI: ci.isCI,
101
+ nodeVersion: process.version,
102
+ platform: process.platform,
103
+ outcome: error ? "failure" : "success",
104
+ error: error?.message,
105
+ };
106
+ if (isDebugMode()) {
107
+ console.error("[Telemetry Debug] Would send event:", JSON.stringify(event, null, 2));
108
+ return;
109
+ }
110
+ try {
111
+ const client = getPostHogClient();
112
+ client.capture({
113
+ distinctId: event.machineId,
114
+ event: command,
115
+ properties: event,
116
+ });
117
+ }
118
+ catch {
119
+ // Silently ignore telemetry errors - never block CLI operation
120
+ }
121
+ };
122
+ export default hook;
123
+ //# sourceMappingURL=telemetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/cli/telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,eAAe,GAAG,iDAAiD,CAAC;AAC1E,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,MAAM,sBAAsB,GAAG,8BAA8B,CAAC;AAC9D,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AACxD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AACxD,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAoBlE,IAAI,aAAa,GAAmB,IAAI,CAA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are const useExecuteSteps: (steps: CommandStep[]) => {
7
+ currentStep: number;
8
+ status: "error" | "success" | "running";
9
+ error: string | null;
10
+ execute: () => Promise<void>;
11
+ };
@@ -0,0 +1,36 @@
1
+ import { useCallback, useState } from "react";
2
+ import { runCommand } from "./run-command.js";
3
+ export const useExecuteSteps = (steps) => {
4
+ const [currentStep, setCurrentStep] = useState(0);
5
+ const [status, setStatus] = useState("running");
6
+ const [error, setError] = useState(null);
7
+ const execute = useCallback(async () => {
8
+ try {
9
+ for (let i = 0; i < steps.length; i++) {
10
+ const step = steps[i];
11
+ if (step) {
12
+ setCurrentStep(i);
13
+ if (step.run) {
14
+ await step.run();
15
+ }
16
+ if (step.command) {
17
+ await runCommand(step.command);
18
+ }
19
+ }
20
+ }
21
+ setStatus("success");
22
+ setImmediate(() => {
23
+ process.exit(0);
24
+ });
25
+ }
26
+ catch (err) {
27
+ setStatus("error");
28
+ setError(err instanceof Error ? err.message : String(err));
29
+ setImmediate(() => {
30
+ process.exit(1);
31
+ });
32
+ }
33
+ }, [steps]);
34
+ return { currentStep, status, error, execute };
35
+ };
36
+ //# sourceMappingURL=use-execute-steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-execute-steps.js","sourceRoot":"","sources":["../../src/cli/use-execute-steps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQ9C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAoB,EAAE,EAAE;IACtD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAC;IAC1D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAClC,SAAS,CACV,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,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Message>;
6
+ export {};
@@ -0,0 +1,61 @@
1
+ import nodemonOriginal from "nodemon";
2
+ import { useEffect, useState } from "react";
3
+ const nodemon = nodemonOriginal;
4
+ export function useNodemon(env) {
5
+ const [messages, setMessages] = useState([]);
6
+ useEffect(() => {
7
+ nodemon({
8
+ env,
9
+ configFile: "nodemon.json",
10
+ stdout: false,
11
+ });
12
+ const handleStdoutData = (chunk) => {
13
+ const message = chunk.toString().trim();
14
+ if (message) {
15
+ setMessages((prev) => [...prev, { text: message, type: "log" }]);
16
+ }
17
+ };
18
+ const handleStderrData = (chunk) => {
19
+ const message = chunk.toString().trim();
20
+ if (message) {
21
+ setMessages((prev) => [...prev, { text: message, type: "error" }]);
22
+ }
23
+ };
24
+ const setupStdoutListener = () => {
25
+ if (nodemon.stdout) {
26
+ nodemon.stdout.off("data", handleStdoutData);
27
+ nodemon.stdout.on("data", handleStdoutData);
28
+ }
29
+ };
30
+ const setupStderrListener = () => {
31
+ if (nodemon.stderr) {
32
+ nodemon.stderr.off("data", handleStderrData);
33
+ nodemon.stderr.on("data", handleStderrData);
34
+ }
35
+ };
36
+ nodemon.on("readable", () => {
37
+ setupStdoutListener();
38
+ setupStderrListener();
39
+ });
40
+ nodemon.on("restart", (files) => {
41
+ const restartMessage = `Server restarted due to file changes: ${files.join(", ")}`;
42
+ setMessages((prev) => [
43
+ ...prev,
44
+ { text: restartMessage, type: "restart" },
45
+ ]);
46
+ setupStdoutListener();
47
+ setupStderrListener();
48
+ });
49
+ return () => {
50
+ if (nodemon.stdout) {
51
+ nodemon.stdout.off("data", handleStdoutData);
52
+ }
53
+ if (nodemon.stderr) {
54
+ nodemon.stderr.off("data", handleStderrData);
55
+ }
56
+ nodemon.emit("quit");
57
+ };
58
+ }, [env]);
59
+ return messages;
60
+ }
61
+ //# sourceMappingURL=use-nodemon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-nodemon.js","sourceRoot":"","sources":["../../src/cli/use-nodemon.ts"],"names":[],"mappings":"A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;IAEV,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,8 @@
1
+ type TsError = {
2
+ file: string;
3
+ line: number;
4
+ col: number;
5
+ message: string;
6
+ };
7
+ export declare function useTypeScriptCheck(): Array<TsError>;
8
+ export {};