@antigenic-oss/paint 0.2.0 → 0.2.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 (65) hide show
  1. package/README.md +32 -17
  2. package/bin/bridge-server.js +36 -0
  3. package/bin/paint.js +542 -102
  4. package/bin/terminal-server.js +105 -0
  5. package/package.json +7 -8
  6. package/public/dev-editor-inspector.js +92 -104
  7. package/src/app/api/claude/apply/route.ts +2 -2
  8. package/src/app/api/project/scan/route.ts +1 -1
  9. package/src/app/api/proxy/[[...path]]/route.ts +4 -4
  10. package/src/app/docs/DocsClient.tsx +1 -1
  11. package/src/app/docs/page.tsx +0 -1
  12. package/src/app/page.tsx +1 -1
  13. package/src/bridge/api-handlers.ts +1 -1
  14. package/src/bridge/proxy-handler.ts +4 -4
  15. package/src/bridge/server.ts +135 -39
  16. package/src/components/ConnectModal.tsx +1 -2
  17. package/src/components/PreviewFrame.tsx +2 -2
  18. package/src/components/ResponsiveToolbar.tsx +1 -2
  19. package/src/components/common/ColorPicker.tsx +7 -9
  20. package/src/components/common/UnitInput.tsx +1 -1
  21. package/src/components/common/VariableColorPicker.tsx +0 -1
  22. package/src/components/left-panel/ComponentsPanel.tsx +3 -3
  23. package/src/components/left-panel/LayerNode.tsx +1 -1
  24. package/src/components/left-panel/icons.tsx +1 -1
  25. package/src/components/left-panel/terminal/TerminalPanel.tsx +2 -2
  26. package/src/components/right-panel/ElementLogBox.tsx +1 -3
  27. package/src/components/right-panel/changes/ChangesPanel.tsx +12 -12
  28. package/src/components/right-panel/claude/ClaudeIntegrationPanel.tsx +2 -2
  29. package/src/components/right-panel/claude/DiffViewer.tsx +1 -1
  30. package/src/components/right-panel/claude/ProjectRootSelector.tsx +7 -7
  31. package/src/components/right-panel/claude/SetupFlow.tsx +1 -1
  32. package/src/components/right-panel/console/ConsolePanel.tsx +4 -4
  33. package/src/components/right-panel/design/BackgroundSection.tsx +2 -2
  34. package/src/components/right-panel/design/GradientEditor.tsx +6 -6
  35. package/src/components/right-panel/design/LayoutSection.tsx +4 -4
  36. package/src/components/right-panel/design/PositionSection.tsx +2 -2
  37. package/src/components/right-panel/design/SVGSection.tsx +2 -3
  38. package/src/components/right-panel/design/ShadowBlurSection.tsx +5 -5
  39. package/src/components/right-panel/design/TextSection.tsx +5 -5
  40. package/src/components/right-panel/design/icons.tsx +1 -1
  41. package/src/components/right-panel/design/inputs/BoxModelPreview.tsx +2 -2
  42. package/src/components/right-panel/design/inputs/CompactInput.tsx +2 -2
  43. package/src/components/right-panel/design/inputs/DraggableLabel.tsx +2 -1
  44. package/src/components/right-panel/design/inputs/IconToggleGroup.tsx +1 -1
  45. package/src/components/right-panel/design/inputs/LinkedInputPair.tsx +3 -3
  46. package/src/components/right-panel/design/inputs/SectionHeader.tsx +2 -1
  47. package/src/hooks/useDOMTree.ts +0 -1
  48. package/src/hooks/usePostMessage.ts +4 -3
  49. package/src/hooks/useTargetUrl.ts +1 -1
  50. package/src/inspector/DOMTraverser.ts +2 -2
  51. package/src/inspector/HoverHighlighter.ts +6 -6
  52. package/src/inspector/SelectionHighlighter.ts +4 -4
  53. package/src/lib/classifyElement.ts +1 -2
  54. package/src/lib/claude-bin.ts +1 -1
  55. package/src/lib/clientProjectScanner.ts +13 -13
  56. package/src/lib/cssVariableUtils.ts +1 -1
  57. package/src/lib/folderPicker.ts +4 -1
  58. package/src/lib/projectScanner.ts +15 -15
  59. package/src/lib/tailwindClassParser.ts +1 -1
  60. package/src/lib/textShadowUtils.ts +1 -1
  61. package/src/lib/utils.ts +4 -4
  62. package/src/proxy.ts +1 -1
  63. package/src/store/treeSlice.ts +2 -2
  64. package/src/server/terminal-server.ts +0 -104
  65. package/tsconfig.server.json +0 -12
package/README.md CHANGED
@@ -3,7 +3,10 @@
3
3
  [![License](https://img.shields.io/github/license/Antigenic-OSS/pAInt)](https://github.com/Antigenic-OSS/pAInt/blob/main/LICENSE)
4
4
  [![Stars](https://img.shields.io/github/stars/Antigenic-OSS/pAInt?style=social)](https://github.com/Antigenic-OSS/pAInt/stargazers)
5
5
  [![Issues](https://img.shields.io/github/issues/Antigenic-OSS/pAInt)](https://github.com/Antigenic-OSS/pAInt/issues)
6
- [![Bun](https://img.shields.io/badge/runtime-Bun-000000)](https://bun.sh)
6
+ [![npm version](https://img.shields.io/npm/v/@antigenic-oss/paint)](https://www.npmjs.com/package/@antigenic-oss/paint)
7
+ [![npm downloads](https://img.shields.io/npm/dm/@antigenic-oss/paint)](https://www.npmjs.com/package/@antigenic-oss/paint)
8
+ [![Bun](https://img.shields.io/badge/local%20dev-Bun-000000)](https://bun.sh)
9
+ [![Node.js](https://img.shields.io/badge/runtime-Node.js-5FA04E)](https://nodejs.org)
7
10
  [![Next.js](https://img.shields.io/badge/framework-Next.js-000000)](https://nextjs.org)
8
11
  [![TypeScript](https://img.shields.io/badge/language-TypeScript-3178C6)](https://www.typescriptlang.org)
9
12
 
@@ -43,17 +46,28 @@ pnpm add -g @antigenic-oss/paint
43
46
  bun add -g @antigenic-oss/paint
44
47
  ```
45
48
 
49
+ Requires Node.js `>=20.9.0`.
50
+
46
51
  Then use:
47
52
 
48
53
  ```bash
49
- paint start # Builds on first run, then starts server
50
- paint status # Show pid, URL, and log path
51
- paint stop # Stop background server
54
+ paint start # Builds on first run, then starts web server
55
+ paint status # Show web status
56
+ paint stop # Stop web server
52
57
  paint restart --rebuild # Force a rebuild before start
53
- paint logs # Print server logs
58
+ paint logs # Print web logs
59
+ paint terminal start # Start terminal websocket server
60
+ paint terminal restart
61
+ paint terminal status
62
+ paint terminal stop
63
+ paint bridge start # Start bridge server
64
+ paint bridge restart
65
+ paint bridge status
66
+ paint bridge stop
54
67
  ```
55
68
 
56
69
  Default URL: `http://127.0.0.1:4000`
70
+ Terminal WS (when started): `ws://localhost:4001/ws`
57
71
 
58
72
  ## What You Can Do
59
73
 
@@ -68,7 +82,8 @@ Default URL: `http://127.0.0.1:4000`
68
82
 
69
83
  ## Prerequisites
70
84
 
71
- - [Bun](https://bun.sh)
85
+ - Local repository development: Bun `>=1.3`
86
+ - Global CLI runtime: Node.js `>=20.9.0`
72
87
  - A localhost app running in development mode (Next.js, Vite, Astro, CRA, etc.)
73
88
 
74
89
  ## Quick Start
@@ -104,7 +119,7 @@ If auto-injection is not detected, add this script tag to your app layout and re
104
119
  If the UI is hosted on Vercel, run the local bridge server:
105
120
 
106
121
  ```bash
107
- bun run bridge
122
+ paint bridge start
108
123
  ```
109
124
 
110
125
  Bridge default: `http://localhost:4002`
@@ -126,19 +141,19 @@ Bridge default: `http://localhost:4002`
126
141
  ## Commands
127
142
 
128
143
  ```bash
129
- bun install # Install dependencies
130
- bun dev # Start UI (localhost:4000)
131
- bun run bridge # Start bridge server (localhost:4002)
132
- bun run dev:terminal # Start terminal server
133
- bun run dev:all # Start terminal + bridge + next dev
134
- bun run build # Production build
135
- bun run start # Production server (port 4000)
136
- bun run lint # Biome check
144
+ bun install # Install dependencies for local repo development
145
+ bun dev # Start UI (localhost:4000)
146
+ bun run bridge # Start bridge server (localhost:4002)
147
+ bun run dev:terminal # Start terminal server
148
+ bun run dev:all # Start terminal + bridge + Next.js dev server
149
+ bun run build # Production build
150
+ bun run start # Production server (port 4000)
151
+ bun run lint # Biome check
137
152
  ```
138
153
 
139
154
  ## Architecture Summary
140
155
 
141
- - Next.js App Router frontend running on Bun
156
+ - Next.js App Router frontend (develop locally with Bun, run globally via Node.js CLI)
142
157
  - Proxy API route at `/api/proxy/*` for target-page loading and injection
143
158
  - Inspector script communicates with editor via `window.postMessage`
144
159
  - State managed with Zustand slices
@@ -168,7 +183,7 @@ See `CONTRIBUTING.md` for setup, workflow, and pull request expectations.
168
183
  - Versioning and release PRs are managed with Changesets.
169
184
  - CI workflow: `.github/workflows/ci.yml`
170
185
  - Release workflow: `.github/workflows/release.yml`
171
- - Publishing requires `NPM_TOKEN` in GitHub repository secrets.
186
+ - Publishing uses npm Trusted Publishing (OIDC) from the `release` GitHub Environment.
172
187
  - To queue a release, add a changeset:
173
188
 
174
189
  ```bash
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('node:path')
4
+ const { spawn, spawnSync } = require('node:child_process')
5
+
6
+ const APP_ROOT = path.resolve(__dirname, '..')
7
+ const TSX_CLI = path.join(APP_ROOT, 'node_modules', 'tsx', 'dist', 'cli.mjs')
8
+
9
+ const nodeCheck = spawnSync(process.execPath, ['--version'], {
10
+ stdio: 'ignore',
11
+ })
12
+ if (nodeCheck.status !== 0) {
13
+ console.error('Node.js runtime check failed.')
14
+ process.exit(1)
15
+ }
16
+
17
+ if (!require('node:fs').existsSync(TSX_CLI)) {
18
+ console.error(
19
+ 'Missing runtime dependency: tsx. Reinstall @antigenic-oss/paint.',
20
+ )
21
+ process.exit(1)
22
+ }
23
+
24
+ const child = spawn(process.execPath, [TSX_CLI, 'src/bridge/server.ts'], {
25
+ cwd: APP_ROOT,
26
+ env: process.env,
27
+ stdio: 'inherit',
28
+ })
29
+
30
+ child.on('exit', (code, signal) => {
31
+ if (signal) {
32
+ process.kill(process.pid, signal)
33
+ } else {
34
+ process.exit(code || 0)
35
+ }
36
+ })