@tscircuit/cli 0.0.393 → 0.1.1

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 (245) hide show
  1. package/.github/workflows/bun-formatcheck.yml +26 -0
  2. package/.github/workflows/bun-pver-release.yml +25 -0
  3. package/.github/workflows/{typecheck.yml → bun-typecheck.yml} +0 -3
  4. package/LICENSE +21 -0
  5. package/README.md +30 -36
  6. package/biome.json +9 -9
  7. package/bun.lockb +0 -0
  8. package/cli/CliContext.ts +8 -0
  9. package/cli/auth/login/register.ts +73 -0
  10. package/cli/auth/logout/register.ts +11 -0
  11. package/cli/auth/register.ts +5 -0
  12. package/cli/config/print/register.ts +12 -0
  13. package/cli/config/register.ts +5 -0
  14. package/cli/dev/register.ts +111 -0
  15. package/cli/main.ts +31 -0
  16. package/dist/main.js +473 -0
  17. package/docs/file-server-api-usage.md +57 -0
  18. package/docs/run-frame-usage.md +14 -0
  19. package/example-dir/manual-edits.json +1 -0
  20. package/example-dir/snippet.d.ts +13 -0
  21. package/example-dir/snippet.tsx +20 -0
  22. package/example-dir/types.d.ts +11 -0
  23. package/lib/cli-config/TypedConfigStore.ts +50 -0
  24. package/lib/cli-config/index.ts +16 -0
  25. package/lib/dependency-analysis/DependencyAnalyzer.ts +129 -0
  26. package/lib/dependency-analysis/getLocalFileDependencies.ts +101 -0
  27. package/lib/dependency-analysis/installNodeModuleTypes.ts +74 -0
  28. package/lib/index.ts +2 -0
  29. package/lib/project-config/index.ts +5 -0
  30. package/lib/registry-api/endpoint-types.ts +20 -0
  31. package/lib/registry-api/get-ky.ts +30 -0
  32. package/lib/server/EventsWatcher.ts +75 -0
  33. package/lib/server/createServer.ts +62 -0
  34. package/lib/site/getIndex.ts +18 -0
  35. package/package.json +27 -144
  36. package/tsconfig.json +25 -22
  37. package/.github/workflows/formatbot.yml +0 -63
  38. package/.github/workflows/release.yml +0 -40
  39. package/.github/workflows/test.yml +0 -32
  40. package/.github/workflows/windows-tests.yml +0 -32
  41. package/.prettierrc +0 -1
  42. package/DEVELOPMENT.md +0 -7
  43. package/api/README.md +0 -3
  44. package/api/db/generic-json-level.ts +0 -123
  45. package/api/db/get-db.ts +0 -26
  46. package/api/db/schema.ts +0 -65
  47. package/api/db/zod-level-db.ts +0 -148
  48. package/api/index.ts +0 -4
  49. package/api/lib/middlewares/with-db.ts +0 -18
  50. package/api/lib/middlewares/with-debug-request-logging.ts +0 -13
  51. package/api/lib/middlewares/with-error-response.ts +0 -37
  52. package/api/lib/with-winter-spec.ts +0 -9
  53. package/api/lib/zod/export_parameters.ts +0 -25
  54. package/api/routes/api/db/download.ts +0 -25
  55. package/api/routes/api/dev_package_examples/create.ts +0 -43
  56. package/api/routes/api/dev_package_examples/get.ts +0 -46
  57. package/api/routes/api/dev_package_examples/list.ts +0 -36
  58. package/api/routes/api/dev_package_examples/update.ts +0 -59
  59. package/api/routes/api/dev_server/reset.ts +0 -13
  60. package/api/routes/api/export_files/create.ts +0 -27
  61. package/api/routes/api/export_files/download.ts +0 -25
  62. package/api/routes/api/export_requests/create.ts +0 -30
  63. package/api/routes/api/export_requests/get.ts +0 -43
  64. package/api/routes/api/export_requests/list.ts +0 -26
  65. package/api/routes/api/export_requests/update.ts +0 -34
  66. package/api/routes/api/health.ts +0 -11
  67. package/api/routes/api/package_info/create.ts +0 -26
  68. package/api/routes/api/package_info/get.ts +0 -16
  69. package/api/routes/health.ts +0 -11
  70. package/api/routes/index.ts +0 -16
  71. package/api/server.ts +0 -20
  72. package/api/static-routes.ts +0 -24
  73. package/api/tests/fixtures/get-test-server.ts +0 -31
  74. package/api/tests/fixtures/start-server.ts +0 -41
  75. package/api/tests/routes/dev_package_examples/create.test.ts +0 -19
  76. package/api/tests/routes/dev_package_examples/get.test.ts +0 -25
  77. package/api/tests/routes/dev_package_examples/list.test.ts +0 -32
  78. package/api/tests/routes/dev_package_examples/update.test.ts +0 -38
  79. package/api/tests/routes/export_files/create.test.ts +0 -18
  80. package/api/tests/routes/export_files/download.test.ts +0 -29
  81. package/api/tests/routes/export_requests/create.test.ts +0 -24
  82. package/api/tests/routes/export_requests/get.test.ts +0 -41
  83. package/api/tests/routes/export_requests/list.test.ts +0 -35
  84. package/api/tests/routes/export_requests/update.test.ts +0 -50
  85. package/api/tests/routes/health.test.ts +0 -10
  86. package/bunfig.toml +0 -2
  87. package/cli/cli.ts +0 -13
  88. package/cli/lib/cmd-fns/add.ts +0 -34
  89. package/cli/lib/cmd-fns/auth-login.ts +0 -59
  90. package/cli/lib/cmd-fns/auth-logout.ts +0 -7
  91. package/cli/lib/cmd-fns/auth-sessions-create.ts +0 -3
  92. package/cli/lib/cmd-fns/auth-sessions-get.ts +0 -3
  93. package/cli/lib/cmd-fns/auth-sessions-list.ts +0 -5
  94. package/cli/lib/cmd-fns/config-clear.ts +0 -5
  95. package/cli/lib/cmd-fns/config-print-config.ts +0 -6
  96. package/cli/lib/cmd-fns/config-reveal-location.ts +0 -5
  97. package/cli/lib/cmd-fns/config-set-log-requests.ts +0 -7
  98. package/cli/lib/cmd-fns/config-set-registry.ts +0 -9
  99. package/cli/lib/cmd-fns/config-set-runtime.ts +0 -7
  100. package/cli/lib/cmd-fns/config-set-session.ts +0 -7
  101. package/cli/lib/cmd-fns/dev/check-if-initialized.ts +0 -22
  102. package/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +0 -23
  103. package/cli/lib/cmd-fns/dev/dev-server-request-handler.ts +0 -61
  104. package/cli/lib/cmd-fns/dev/find-available-port.ts +0 -32
  105. package/cli/lib/cmd-fns/dev/fulfill-export-requests.ts +0 -162
  106. package/cli/lib/cmd-fns/dev/get-dev-server-axios.ts +0 -29
  107. package/cli/lib/cmd-fns/dev/index.ts +0 -168
  108. package/cli/lib/cmd-fns/dev/infer-export-name-from-source.ts +0 -17
  109. package/cli/lib/cmd-fns/dev/mark-all-examples-loading.ts +0 -18
  110. package/cli/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +0 -62
  111. package/cli/lib/cmd-fns/dev/start-dev-server.ts +0 -34
  112. package/cli/lib/cmd-fns/dev/start-edit-event-watcher.ts +0 -347
  113. package/cli/lib/cmd-fns/dev/start-export-request-watcher.ts +0 -33
  114. package/cli/lib/cmd-fns/dev/start-fs-watcher.ts +0 -54
  115. package/cli/lib/cmd-fns/dev/upload-examples-from-directory.ts +0 -42
  116. package/cli/lib/cmd-fns/dev-server-fulfill-export-requests.ts +0 -43
  117. package/cli/lib/cmd-fns/dev-server-upload.ts +0 -56
  118. package/cli/lib/cmd-fns/export-gerbers.ts +0 -28
  119. package/cli/lib/cmd-fns/export-kicad-pcb.ts +0 -36
  120. package/cli/lib/cmd-fns/export-pnp-csv.ts +0 -32
  121. package/cli/lib/cmd-fns/gen-jlcpcb-component.ts +0 -64
  122. package/cli/lib/cmd-fns/go.ts +0 -14
  123. package/cli/lib/cmd-fns/index.ts +0 -46
  124. package/cli/lib/cmd-fns/init/create-or-modify-npmrc.ts +0 -21
  125. package/cli/lib/cmd-fns/init/get-generated-npmrc.ts +0 -8
  126. package/cli/lib/cmd-fns/init/get-generated-readme.ts +0 -41
  127. package/cli/lib/cmd-fns/init/get-generated-tsconfig.ts +0 -34
  128. package/cli/lib/cmd-fns/init/index.ts +0 -193
  129. package/cli/lib/cmd-fns/install.ts +0 -34
  130. package/cli/lib/cmd-fns/lint.ts +0 -43
  131. package/cli/lib/cmd-fns/open.ts +0 -19
  132. package/cli/lib/cmd-fns/package-examples-create.ts +0 -36
  133. package/cli/lib/cmd-fns/package-examples-get.ts +0 -20
  134. package/cli/lib/cmd-fns/package-examples-list.ts +0 -18
  135. package/cli/lib/cmd-fns/package-files-create.ts +0 -31
  136. package/cli/lib/cmd-fns/package-files-download.ts +0 -29
  137. package/cli/lib/cmd-fns/package-files-get.ts +0 -3
  138. package/cli/lib/cmd-fns/package-files-list.ts +0 -28
  139. package/cli/lib/cmd-fns/package-files-upload-directory.ts +0 -6
  140. package/cli/lib/cmd-fns/package-releases-create.ts +0 -35
  141. package/cli/lib/cmd-fns/package-releases-get.ts +0 -3
  142. package/cli/lib/cmd-fns/package-releases-list.ts +0 -32
  143. package/cli/lib/cmd-fns/package-releases-update.ts +0 -45
  144. package/cli/lib/cmd-fns/packages-create.ts +0 -16
  145. package/cli/lib/cmd-fns/packages-get.ts +0 -16
  146. package/cli/lib/cmd-fns/packages-list.ts +0 -16
  147. package/cli/lib/cmd-fns/publish/index.ts +0 -336
  148. package/cli/lib/cmd-fns/remove.ts +0 -31
  149. package/cli/lib/cmd-fns/render.ts +0 -45
  150. package/cli/lib/cmd-fns/soupify.ts +0 -31
  151. package/cli/lib/cmd-fns/uninstall.ts +0 -31
  152. package/cli/lib/cmd-fns/version.ts +0 -38
  153. package/cli/lib/create-config-manager.ts +0 -97
  154. package/cli/lib/export-fns/export-bom-csv.ts +0 -32
  155. package/cli/lib/export-fns/export-gerbers.ts +0 -108
  156. package/cli/lib/export-fns/export-kicad-pcb.ts +0 -32
  157. package/cli/lib/export-fns/export-pnp-csv.ts +0 -31
  158. package/cli/lib/get-program.ts +0 -387
  159. package/cli/lib/param-handlers/index.ts +0 -21
  160. package/cli/lib/param-handlers/interact-for-local-directory.ts +0 -58
  161. package/cli/lib/param-handlers/interact-for-local-file.ts +0 -59
  162. package/cli/lib/param-handlers/interact-for-package-example-id.ts +0 -25
  163. package/cli/lib/param-handlers/interact-for-package-name-with-version.ts +0 -63
  164. package/cli/lib/param-handlers/interact-for-package-name.ts +0 -45
  165. package/cli/lib/param-handlers/interact-for-package-release-id.ts +0 -15
  166. package/cli/lib/param-handlers/interact-for-registry-url.ts +0 -27
  167. package/cli/lib/param-handlers/interact-for-runtime.ts +0 -33
  168. package/cli/lib/param-handlers/param-handler-type.ts +0 -7
  169. package/cli/lib/posthog.ts +0 -23
  170. package/cli/lib/soupify/get-export-name-from-file.ts +0 -29
  171. package/cli/lib/soupify/get-tmp-entrpoint-filepath.ts +0 -15
  172. package/cli/lib/soupify/index.ts +0 -1
  173. package/cli/lib/soupify/run-entrypoint-file.ts +0 -59
  174. package/cli/lib/soupify/soupify-with-core.ts +0 -74
  175. package/cli/lib/soupify/soupify.ts +0 -6
  176. package/cli/lib/util/app-context.ts +0 -17
  177. package/cli/lib/util/create-context-and-run-program.ts +0 -168
  178. package/cli/lib/util/get-all-package-files.ts +0 -66
  179. package/cli/lib/util/lint-project.ts +0 -137
  180. package/cli/tests/export-gerber-keyboard.test.ts +0 -16
  181. package/cli/tests/export-gerber.test.ts +0 -49
  182. package/cli/tests/export-kicad-pcb.test.ts +0 -23
  183. package/cli/tests/export-pnp-csv.test.ts +0 -24
  184. package/cli/tests/fixtures/preload.ts +0 -54
  185. package/cli/tests/init.test.ts +0 -9
  186. package/cli/tests/open.test.ts +0 -9
  187. package/cli/tests/soupify-builder.test.ts +0 -9
  188. package/cli/tests/soupify-core.test.ts +0 -9
  189. package/dist/cli.js +0 -3676
  190. package/docs/EDIT_EVENT_PIPELINE.md +0 -34
  191. package/example-project/README.md +0 -18
  192. package/example-project/examples/basic-capacitor.tsx +0 -5
  193. package/example-project/examples/basic-chip.tsx +0 -26
  194. package/example-project/examples/basic-resistor.tsx +0 -3
  195. package/example-project/examples/macrokeypad.tsx +0 -59
  196. package/example-project/index.ts +0 -1
  197. package/example-project/package.json +0 -5
  198. package/example-project/src/ArduinoProMicroBreakout.tsx +0 -37
  199. package/example-project/src/Key.tsx +0 -46
  200. package/example-project/src/Keyswitch.tsx +0 -26
  201. package/example-project/src/KeyswitchSocket.tsx +0 -56
  202. package/example-project/src/MyCircuit.tsx +0 -38
  203. package/example-project/src/manual-edits.ts +0 -93
  204. package/frontend/README.md +0 -3
  205. package/frontend/bun.lockb +0 -0
  206. package/frontend/components/command-k.tsx +0 -86
  207. package/frontend/components/dialogs/generic-export-dialog.tsx +0 -189
  208. package/frontend/components/dialogs/gerber-export-dialog.tsx +0 -168
  209. package/frontend/components/global-context-providers.tsx +0 -11
  210. package/frontend/components/select-example-search.tsx +0 -118
  211. package/frontend/components/ui/alert-dialog.tsx +0 -139
  212. package/frontend/components/ui/alert.tsx +0 -59
  213. package/frontend/components/ui/breadcrumb.tsx +0 -115
  214. package/frontend/components/ui/button.tsx +0 -57
  215. package/frontend/components/ui/card.tsx +0 -76
  216. package/frontend/components/ui/command.tsx +0 -153
  217. package/frontend/components/ui/context-menu.tsx +0 -202
  218. package/frontend/components/ui/dialog.tsx +0 -120
  219. package/frontend/components/ui/menubar.tsx +0 -238
  220. package/frontend/components/ui/navigation-menu.tsx +0 -128
  221. package/frontend/components/ui/popover.tsx +0 -31
  222. package/frontend/components/ui/select.tsx +0 -162
  223. package/frontend/components/ui/tabs.tsx +0 -53
  224. package/frontend/components/ui/toggle-group.tsx +0 -59
  225. package/frontend/components/ui/toggle.tsx +0 -43
  226. package/frontend/components/ui/tooltip.tsx +0 -28
  227. package/frontend/components.json +0 -17
  228. package/frontend/hooks/toast-if-api-not-connected.ts +0 -23
  229. package/frontend/hooks/use-active-dev-package-example-lite.ts +0 -39
  230. package/frontend/hooks/use-dev-package-examples.tsx +0 -18
  231. package/frontend/hooks/use-global-store.ts +0 -42
  232. package/frontend/index.css +0 -76
  233. package/frontend/index.html +0 -13
  234. package/frontend/lib/utils.ts +0 -6
  235. package/frontend/main.tsx +0 -13
  236. package/frontend/tailwind.config.js +0 -74
  237. package/frontend/views/App.tsx +0 -22
  238. package/frontend/views/Header.tsx +0 -55
  239. package/frontend/views/HeaderMenu.tsx +0 -326
  240. package/frontend/views/MainContentView.tsx +0 -172
  241. package/frontend/vite-env.d.ts +0 -1
  242. package/frontend/vite.config.ts +0 -50
  243. package/renovate.json +0 -15
  244. package/scripts/build-cli.ts +0 -12
  245. package/tsup.config.ts +0 -7
package/package.json CHANGED
@@ -1,156 +1,39 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.0.393",
4
- "private": false,
3
+ "main": "dist/main.js",
5
4
  "type": "module",
6
- "description": "Command line tool for developing, publishing and installing tscircuit circuits",
7
- "main": "./dist/cli.js",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/tscircuit/cli"
5
+ "version": "0.1.1",
6
+ "bin": {
7
+ "tsci": "./dist/main.js"
11
8
  },
12
9
  "scripts": {
13
- "cli": "bun cli/cli.ts",
14
10
  "start": "bun run dev",
15
- "dev": "bun run build:dev-server && concurrently 'bun run dev:frontend' 'bun run dev:test-project'",
16
- "dev:fast": "concurrently 'bun run dev:frontend' 'bun run dev:test-project'",
17
- "dev:frontend": "vite dev --force --config frontend/vite.config.ts",
18
- "dev:test-project": "bun --hot cli/cli.ts dev --no-cleanup --cwd ./example-project",
19
- "start:dev-server": "bun build:dev-server && bun cli/cli.ts dev -y --cwd ./example-project",
20
- "build": "bun build:dev-server && npm run build:cli",
21
- "build:cli": "bun scripts/build-cli.ts",
22
- "build:dev-server": "bun run build:api && bun run build:frontend",
23
- "build:api": "cd api && winterspec bundle-routes -i ./routes -o ./static-routes.ts",
24
- "build:frontend": "vite build --config frontend/vite.config.ts && make-vfs --content-format string --dir frontend/dist --outfile ./frontend/dist/bundle.ts",
25
- "format": "biome format . --write"
26
- },
27
- "bin": {
28
- "tsci": "./dist/cli.js"
11
+ "dev": "bun --hot ./cli/main.ts dev ./example-dir/snippet.tsx",
12
+ "build": "tsup-node cli/main.ts --format esm --sourcemap inline",
13
+ "format": "biome format --write .",
14
+ "format:check": "biome format .",
15
+ "cli": "bun ./cli/main.ts"
29
16
  },
30
- "keywords": [
31
- "circuit",
32
- "react",
33
- "electronics",
34
- "pcb",
35
- "schematic"
36
- ],
37
- "author": "",
38
- "license": "ISC",
39
- "dependencies": {
40
- "@edge-runtime/primitives": "^4.1.0",
41
- "@hono/node-server": "^1.8.2",
42
- "@tscircuit/core": "^0.0.250",
43
- "@tscircuit/props": "^0.0.108",
44
- "@tscircuit/soup": "^0.0.73",
45
- "archiver": "^7.0.1",
46
- "axios": "^1.6.7",
47
- "chokidar": "^3.6.0",
48
- "circuit-json": "^0.0.77",
49
- "circuit-json-to-bom-csv": "^0.0.4",
50
- "circuit-json-to-connectivity-map": "^0.0.16",
51
- "circuit-json-to-gerber": "^0.0.4",
52
- "circuit-json-to-pnp-csv": "^0.0.5",
53
- "circuit-to-png": "^0.0.3",
54
- "circuit-to-svg": "^0.0.39",
55
- "commander": "^12.0.0",
56
- "configstore": "^6.0.0",
57
- "dargs": "^8.1.0",
58
- "dax-sh": "^0.39.2",
59
- "debug": "^4.3.4",
60
- "delay": "^6.0.0",
61
- "easyeda": "^0.0.36",
62
- "esbuild": "^0.20.2",
63
- "fast-glob": "^3.3.2",
64
- "glob": "^10.4.5",
65
- "hono": "^4.1.0",
66
- "ignore": "^5.3.1",
67
- "json5": "^2.2.3",
68
- "kicad-converter": "^0.0.14",
69
- "kleur": "^4.1.5",
70
- "lodash": "^4.17.21",
71
- "memory-level": "^1.0.0",
72
- "mime-types": "^2.1.35",
73
- "minimist": "^1.2.8",
74
- "node-persist": "^4.0.1",
75
- "open": "^10.1.0",
76
- "perfect-cli": "^1.0.20",
77
- "performance-now": "^2.1.0",
78
- "posthog-node": "^4.0.1",
79
- "prompts": "^2.4.2",
80
- "redaxios": "^0.5.1",
81
- "semver": "^7.6.0",
82
- "tempy": "^3.1.0",
83
- "ts-morph": "^22.0.0",
84
- "tsup": "^8.0.2",
85
- "winterspec": "0.0.89",
86
- "zod": "^3.22.4"
17
+ "devDependencies": {
18
+ "@biomejs/biome": "^1.9.4",
19
+ "@tscircuit/core": "^0.0.249",
20
+ "@types/bun": "latest",
21
+ "@types/configstore": "^6.0.2",
22
+ "@types/react": "^19.0.1",
23
+ "tsup": "^8.3.5"
87
24
  },
88
25
  "peerDependencies": {
89
- "@tscircuit/layout": "*",
90
- "@tscircuit/manual-edit-events": "*",
91
- "@tscircuit/soup-util": "*"
26
+ "typescript": "^5.0.0"
92
27
  },
93
- "devDependencies": {
94
- "@biomejs/biome": "^1.9.2",
95
- "@headlessui/react": "^1.7.18",
96
- "@radix-ui/react-alert-dialog": "^1.0.5",
97
- "@radix-ui/react-context-menu": "^2.1.5",
98
- "@radix-ui/react-dialog": "^1.0.5",
99
- "@radix-ui/react-icons": "^1.3.0",
100
- "@radix-ui/react-menubar": "^1.0.4",
101
- "@radix-ui/react-navigation-menu": "^1.1.4",
102
- "@radix-ui/react-popover": "^1.0.7",
103
- "@radix-ui/react-select": "^2.0.0",
104
- "@radix-ui/react-slot": "^1.0.2",
105
- "@radix-ui/react-tabs": "^1.0.4",
106
- "@radix-ui/react-toggle": "^1.0.3",
107
- "@radix-ui/react-toggle-group": "^1.0.4",
108
- "@radix-ui/react-tooltip": "^1.0.7",
109
- "@tscircuit/3d-viewer": "^0.0.79",
110
- "@tscircuit/layout": "^0.0.29",
111
- "@tscircuit/manual-edit-events": "^0.0.6",
112
- "@tscircuit/pcb-viewer": "^1.10.8",
113
- "@tscircuit/schematic-viewer": "^1.2.14",
114
- "@tscircuit/soup-util": "^0.0.41",
115
- "@tscircuit/table-viewer": "0.0.8",
116
- "@types/archiver": "^6.0.2",
117
- "@types/bun": "^1.0.8",
118
- "@types/chokidar": "^2.1.3",
119
- "@types/configstore": "^6.0.2",
120
- "@types/debug": "^4.1.12",
121
- "@types/lodash": "^4.14.202",
122
- "@types/mime-types": "^2.1.4",
123
- "@types/minimist": "^1.2.5",
124
- "@types/node": "^20.10.6",
125
- "@types/prompts": "^2.4.9",
126
- "@types/react": "^18.2.64",
127
- "@types/react-dom": "^18.3.0",
128
- "@types/semver": "^7.5.8",
129
- "@vitejs/plugin-react": "^4.3.1",
130
- "autoprefixer": "^10.4.20",
131
- "ava": "^6.1.1",
132
- "bun-match-svg": "^0.0.3",
133
- "class-variance-authority": "^0.7.0",
134
- "clsx": "^2.1.0",
135
- "cmdk": "^1.0.0",
136
- "concurrently": "^8.2.2",
137
- "extract-zip": "^2.0.1",
138
- "make-vfs": "^1.0.10",
139
- "pcb-stackup": "^4.2.8",
140
- "postcss": "^8.4.41",
141
- "react": "^18.2.0",
142
- "react-data-grid": "7.0.0-beta.37",
143
- "react-dom": "^18.2.0",
144
- "react-error-boundary": "^4.0.13",
145
- "react-hot-toast": "^2.4.1",
146
- "react-query": "^3.39.3",
147
- "rimraf": "^5.0.7",
148
- "tailwind-merge": "^2.2.1",
149
- "tailwindcss": "^3.4.9",
150
- "tailwindcss-animate": "^1.0.7",
151
- "tsx": "^4.7.1",
152
- "typescript": "^5.5.4",
153
- "vite": "^5.4.0",
154
- "zustand": "^4.5.2"
28
+ "dependencies": {
29
+ "@tscircuit/file-server": "^0.0.11",
30
+ "@tscircuit/runframe": "^0.0.47",
31
+ "chokidar": "^4.0.1",
32
+ "commander": "^12.1.0",
33
+ "configstore": "^7.0.0",
34
+ "cosmiconfig": "^9.0.0",
35
+ "delay": "^6.0.0",
36
+ "ky": "^1.7.4",
37
+ "perfect-cli": "^1.0.20"
155
38
  }
156
39
  }
package/tsconfig.json CHANGED
@@ -1,29 +1,32 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
4
- "jsx": "react-jsxdev" /* Specify what JSX code is generated. */,
5
-
6
- "module": "ESNext" /* Specify what module code is generated. */,
7
- "moduleResolution": "Bundler" /* Specify how TypeScript looks up a file from a given module specifier. */,
8
- "baseUrl": "./" /* Specify the base directory to resolve non-relative module names. */,
9
- "allowImportingTsExtensions": true /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */,
10
-
11
- "resolveJsonModule": true /* Enable importing .json files. */,
12
- "noEmit": true /* Disable emitting files from a compilation. */,
13
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
14
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
15
-
3
+ // Enable latest features
4
+ "lib": ["ESNext", "DOM"],
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+ "baseUrl": ".",
16
11
  "paths": {
17
- "cli/*": ["cli/*"],
18
- "frontend/*": ["frontend/*"],
19
- "api/*": ["api/*"],
20
- "scripts/*": ["scripts/*"],
12
+ "lib/*": ["lib/*"],
13
+ "cli/*": ["cli/*"]
21
14
  },
22
15
 
23
- "strict": true /* Enable all strict type-checking options. */,
24
- "skipLibCheck": true,
16
+ // Bundler mode
17
+ "moduleResolution": "bundler",
18
+ "allowImportingTsExtensions": true,
25
19
  "verbatimModuleSyntax": false,
26
- },
27
- "include": ["src/**/*", "cli/**/*", "frontend/**/*", "api/**/*", "scripts/**/*", "example-project/**/*"],
28
- "exclude": ["node_modules"]
20
+ "noEmit": true,
21
+
22
+ // Best practices
23
+ "strict": true,
24
+ "skipLibCheck": true,
25
+ "noFallthroughCasesInSwitch": true,
26
+
27
+ // Some stricter flags (disabled by default)
28
+ "noUnusedLocals": false,
29
+ "noUnusedParameters": false,
30
+ "noPropertyAccessFromIndexSignature": false
31
+ }
29
32
  }
@@ -1,63 +0,0 @@
1
- name: Format PR
2
-
3
- on:
4
- pull_request:
5
- types: [opened, synchronize, reopened, ready_for_review]
6
-
7
- jobs:
8
- format:
9
- name: Format code
10
- runs-on: ubuntu-latest
11
- if: github.event.pull_request.draft == false
12
-
13
- steps:
14
- - name: Determine if fork
15
- id: check_fork
16
- run: |
17
- if [ "${{ github.event.pull_request.head.repo.full_name }}" = "${{ github.repository }}" ]; then
18
- echo "is_fork=false" >> $GITHUB_OUTPUT
19
- else
20
- echo "is_fork=true" >> $GITHUB_OUTPUT
21
- fi
22
-
23
- - name: Checkout code
24
- uses: actions/checkout@v3
25
- with:
26
- token: ${{ steps.check_fork.outputs.is_fork == 'true' && secrets.GITHUB_TOKEN || secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
27
-
28
- - name: Setup bun
29
- uses: oven-sh/setup-bun@v1
30
- with:
31
- bun-version: latest
32
-
33
- - name: Get @biomejs/biome version
34
- id: get-biome-version
35
- run: echo "BIOME_VERSION=$(node -p "require('./package.json').devDependencies['@biomejs/biome']")" >> $GITHUB_OUTPUT
36
-
37
- - name: Install @biomejs/biome
38
- run: bun install
39
-
40
- - name: Run Formatter and autofix
41
- if: steps.check_fork.outputs.is_fork == 'false'
42
- run: bunx biome format . --write
43
-
44
- - name: Format Check (cannot autofix against forks)
45
- if: steps.check_fork.outputs.is_fork == 'true'
46
- run: bunx biome format .
47
-
48
- - name: Restore lock files
49
- if: steps.check_fork.outputs.is_fork == 'false'
50
- run: |
51
- git checkout -- *lock.json || true
52
- git checkout -- *.lock || true
53
- git checkout -- *.lockb || true
54
-
55
- - name: Commit changes
56
- if: steps.check_fork.outputs.is_fork == 'false'
57
- uses: stefanzweifel/git-auto-commit-action@v4
58
- with:
59
- commit_message: "formatbot: Automatically format code"
60
- branch: ${{ github.head_ref }}
61
- commit_user_name: tscircuitbot
62
- commit_user_email: tscircuitbot@users.noreply.github.com
63
- commit_author: tscircuitbot <tscircuitbot@users.noreply.github.com>
@@ -1,40 +0,0 @@
1
- name: Release Workflow
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- jobs:
9
- build_and_release:
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - name: Checkout code
14
- uses: actions/checkout@v2
15
-
16
- - uses: actions/setup-node@v4
17
- with:
18
- node-version: 20
19
- registry-url: https://registry.npmjs.org/
20
-
21
- - name: Setup bun
22
- uses: oven-sh/setup-bun@v1
23
- with:
24
- bun-version: latest
25
-
26
- - name: Install project dependencies
27
- run: |
28
- bun install
29
-
30
- # Undo changes to the lockfile that might block release
31
- # when this project is more mature use "bun install --frozen-lockfile"
32
- git checkout -- bun.lockb
33
-
34
- - name: Build project
35
- run: bun run build
36
-
37
- - name: Run pver release
38
- run: npx pver release --npm
39
- env:
40
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,32 +0,0 @@
1
- name: CLI Tests
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- pull_request:
8
- branches:
9
- - main
10
-
11
- jobs:
12
- tests:
13
- runs-on: ubuntu-latest
14
- timeout-minutes: 5
15
-
16
- steps:
17
- - name: Checkout code
18
- uses: actions/checkout@v2
19
-
20
- - name: Setup bun
21
- uses: oven-sh/setup-bun@v1
22
- with:
23
- bun-version: latest
24
-
25
- - name: Install dependencies
26
- run: bun install
27
-
28
- - name: Build
29
- run: bun run build
30
-
31
- - name: Run tests
32
- run: bun test --timeout 15000
@@ -1,32 +0,0 @@
1
- name: Windows Tests
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- pull_request:
8
- branches:
9
- - main
10
-
11
- jobs:
12
- tests:
13
- runs-on: windows-latest
14
- timeout-minutes: 10
15
-
16
- steps:
17
- - name: Checkout code
18
- uses: actions/checkout@v2
19
-
20
- - name: Setup bun
21
- uses: oven-sh/setup-bun@v1
22
- with:
23
- bun-version: latest
24
-
25
- - name: Install dependencies
26
- run: bun install
27
-
28
- - name: Build
29
- run: bun run build
30
-
31
- - name: Run tests
32
- run: bun test --timeout 15000
package/.prettierrc DELETED
@@ -1 +0,0 @@
1
- { "semi": false }
package/DEVELOPMENT.md DELETED
@@ -1,7 +0,0 @@
1
- # Getting Started with Development for @tscircuit/cli
2
-
3
- 1. Run `bun install`
4
- 2. Run `bun run dev`
5
-
6
- You now have a development server running on http://localhost:5173 (don't use
7
- the one on port 3020, it won't auto-reload frontend changes)
package/api/README.md DELETED
@@ -1,3 +0,0 @@
1
- # @tscircuit/dev-server-api
2
-
3
- API for the development server.
@@ -1,123 +0,0 @@
1
- import {
2
- AbstractLevel,
3
- AbstractIterator,
4
- AbstractKeyIterator,
5
- AbstractValueIterator,
6
- } from "abstract-level"
7
- import { promises as fs } from "fs"
8
- import path from "path/posix"
9
-
10
- interface JSONLevelOptions {}
11
-
12
- /**
13
- * This is not totally tested yet, but is basically a NodeJS level that doesn't
14
- * use C-bindings. It could be used as a replacement for memory-level to store
15
- * to disk.
16
- */
17
- class GenericJsonLevel extends AbstractLevel<string, any> {
18
- private location: string
19
-
20
- constructor(location: string, options?: JSONLevelOptions) {
21
- super({ ...options, encodings: { utf8: true } })
22
- this.location = location
23
- }
24
-
25
- async _open(): Promise<void> {
26
- await fs.mkdir(this.location, { recursive: true })
27
- }
28
-
29
- async _put(key: string, value: any): Promise<void> {
30
- const filePath = path.join(this.location, `${key}.json`)
31
- console.log("writing file", filePath)
32
- await fs.writeFile(filePath, JSON.stringify(value))
33
- }
34
-
35
- async _get(key: string): Promise<any> {
36
- const filePath = path.join(this.location, `${key}.json`)
37
- try {
38
- const data = await fs.readFile(filePath, "utf8")
39
- return JSON.parse(data)
40
- } catch (error) {
41
- if ((error as NodeJS.ErrnoException).code === "ENOENT") {
42
- throw new Error("NotFoundError")
43
- }
44
- throw error
45
- }
46
- }
47
-
48
- async _del(key: string): Promise<void> {
49
- const filePath = path.join(this.location, `${key}.json`)
50
- try {
51
- await fs.unlink(filePath)
52
- } catch (error) {
53
- if ((error as NodeJS.ErrnoException).code !== "ENOENT") {
54
- throw error
55
- }
56
- }
57
- }
58
-
59
- async _batch(
60
- operations: Array<{ type: "put" | "del"; key: string; value?: any }>,
61
- ): Promise<void> {
62
- for (const op of operations) {
63
- if (op.type === "put") {
64
- await this._put(op.key, op.value)
65
- } else if (op.type === "del") {
66
- await this._del(op.key)
67
- }
68
- }
69
- }
70
-
71
- async _clear(): Promise<void> {
72
- const files = await fs.readdir(this.location)
73
- for (const file of files) {
74
- if (file.endsWith(".json")) {
75
- await fs.unlink(path.join(this.location, file))
76
- }
77
- }
78
- }
79
-
80
- _iterator(): AbstractIterator<this, string, any> {
81
- let files: string[] = []
82
- let index = 0
83
-
84
- const nextFile = async (): Promise<{ key: string; value: any } | null> => {
85
- if (index >= files.length) {
86
- return null
87
- }
88
-
89
- const file = files[index++]
90
- const key = path.basename(file, ".json")
91
- const filePath = path.join(this.location, file)
92
- const data = await fs.readFile(filePath, "utf8")
93
- const value = JSON.parse(data)
94
-
95
- return { key, value }
96
- }
97
-
98
- return {
99
- async next() {
100
- if (files.length === 0) {
101
- files = (await fs.readdir(this.db.location)).filter((file) =>
102
- file.endsWith(".json"),
103
- )
104
- }
105
-
106
- const entry = await nextFile()
107
- if (entry === null) {
108
- return undefined
109
- }
110
-
111
- return [entry.key, entry.value] as [string, any]
112
- },
113
- async seek(target: string) {
114
- index = files.findIndex((file) => file.startsWith(target))
115
- if (index === -1) {
116
- index = files.length
117
- }
118
- },
119
- } as any
120
- }
121
- }
122
-
123
- export { GenericJsonLevel }
package/api/db/get-db.ts DELETED
@@ -1,26 +0,0 @@
1
- import { mkdirSync } from "fs"
2
- import * as Path from "path/posix"
3
- import { ZodLevelDatabase } from "./zod-level-db"
4
-
5
- let globalDb: ZodLevelDatabase | undefined
6
-
7
- export const getDbFilePath = () =>
8
- process.env.TSCI_DEV_SERVER_DB ?? "./.tscircuit/devdb"
9
-
10
- export const getDb = async (): Promise<ZodLevelDatabase> => {
11
- if (globalDb) {
12
- return globalDb
13
- }
14
-
15
- const devServerDbPath = getDbFilePath()
16
-
17
- mkdirSync(devServerDbPath, { recursive: true })
18
-
19
- const db = new ZodLevelDatabase(devServerDbPath)
20
-
21
- db.open()
22
-
23
- globalDb = db
24
-
25
- return db
26
- }
package/api/db/schema.ts DELETED
@@ -1,65 +0,0 @@
1
- import { z } from "zod"
2
-
3
- // Helper function for nullable fields
4
- const nullableText = () => z.string().nullable().default(null)
5
- const id = () => z.any().pipe(z.number().int())
6
-
7
- // PackageInfo schema
8
- export const PackageInfoSchema = z.object({
9
- package_info_id: id(),
10
- name: z.string(),
11
- })
12
-
13
- // DevPackageExample schema
14
- export const DevPackageExampleSchema = z.object({
15
- dev_package_example_id: id(),
16
- file_path: z.string(),
17
- export_name: nullableText(),
18
- tscircuit_soup: z.any().nullable(), // Using any for JSON type
19
- completed_edit_events: z.array(z.any()).default([]), // Using any for JSON type
20
- error: nullableText(),
21
- is_loading: z.boolean(),
22
- soup_last_updated_at: nullableText(),
23
- edit_events_last_updated_at: nullableText(),
24
- edit_events_last_applied_at: nullableText(),
25
- last_updated_at: nullableText(),
26
- })
27
-
28
- // ExportRequest schema
29
- export const ExportRequestSchema = z.object({
30
- export_request_id: id(),
31
- example_file_path: nullableText(),
32
- export_parameters: z.any().nullable(), // Using any for JSON type
33
- export_name: nullableText(),
34
- is_complete: z.boolean(),
35
- has_error: z.boolean(),
36
- error: nullableText(),
37
- created_at: nullableText(),
38
- })
39
-
40
- // ExportFile schema
41
- export const ExportFileSchema = z.object({
42
- export_file_id: id(),
43
- file_name: nullableText(),
44
- file_content_base64: z.string().nullable(),
45
- export_request_id: z.number().int().nullable(),
46
- created_at: nullableText(),
47
- })
48
-
49
- // Combined DBSchema
50
- export const DBSchema = z.object({
51
- package_info: PackageInfoSchema,
52
- dev_package_example: DevPackageExampleSchema,
53
- export_request: ExportRequestSchema,
54
- export_file: ExportFileSchema,
55
- })
56
-
57
- // TypeScript type inference
58
- export type DBSchemaType = z.infer<typeof DBSchema>
59
- export type DBInputSchemaType = z.input<typeof DBSchema>
60
-
61
- // You can also export individual types if needed
62
- export type PackageInfo = z.infer<typeof PackageInfoSchema>
63
- export type DevPackageExample = z.infer<typeof DevPackageExampleSchema>
64
- export type ExportRequest = z.infer<typeof ExportRequestSchema>
65
- export type ExportFile = z.infer<typeof ExportFileSchema>