@design-twin/dtwin 0.1.0-alpha.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -3
- package/figma-plugin/code.js +4207 -0
- package/figma-plugin/manifest.json +28 -0
- package/figma-plugin/ui.html +686 -0
- package/layer/cross-check.js +2746 -0
- package/layer/drift-lint.js +1526 -0
- package/layer/get-component.js +553 -0
- package/layer/map-bootstrap.js +1404 -0
- package/layer/map-validate.js +397 -0
- package/package.json +5 -1
- package/src/figma-mcp.ts +16 -14
- package/src/init.ts +6 -6
package/README.md
CHANGED
|
@@ -7,13 +7,23 @@ The plugin's hidden UI iframe is a WebSocket **client**; these processes are the
|
|
|
7
7
|
(`127.0.0.1:8787`). Nothing touches the internet. See `../ARCHITECTURE.md` for the full design.
|
|
8
8
|
|
|
9
9
|
## Install (once)
|
|
10
|
-
|
|
10
|
+
It needs [Bun](https://bun.sh/install) ≥ 1.4.2 (`engines.bun`) on your PATH; Node is not supported. Install Bun
|
|
11
|
+
first (`curl -fsSL https://bun.sh/install | bash`, or `powershell -c "irm bun.sh/install.ps1 | iex"` on Windows), then
|
|
12
|
+
the package, `@design-twin/dtwin`, from npm:
|
|
13
|
+
```
|
|
14
|
+
bun add -g @design-twin/dtwin # puts `dtwin` in ~/.bun/bin (on your PATH via the Bun installer)
|
|
15
|
+
```
|
|
16
|
+
`npm i -g @design-twin/dtwin` installs the same thing, but `dtwin` still runs on Bun: without Bun on PATH it stops at
|
|
17
|
+
`env: bun: No such file or directory`. The package also carries the built Figma plugin (`figma-plugin/manifest.json`
|
|
18
|
+
inside it — `dtwin init` prints the full path to import) and the design-to-code bundles the MCP server's
|
|
19
|
+
`design_get_component` / `design_drift_lint` load (`layer/`).
|
|
20
|
+
|
|
21
|
+
Or from a clone (to work on the code):
|
|
11
22
|
```
|
|
12
23
|
git clone https://github.com/its-magdy/design-twin.git && cd design-twin
|
|
13
24
|
bun install # @modelcontextprotocol/sdk (+ zod), for every workspace
|
|
14
25
|
cd bridge && bun link # puts `dtwin` in ~/.bun/bin (on your PATH); nothing to build
|
|
15
26
|
```
|
|
16
|
-
It needs [Bun](https://bun.sh/install) ≥ 1.4.2 (`engines.bun`); Node is not supported.
|
|
17
27
|
Or skip the link and run `bun --no-install --no-env-file /path/to/design-twin/bridge/src/figma-pull.ts` wherever
|
|
18
28
|
this README says `dtwin` (those two flags are what the bin's shebang adds: without them, Bun loads the `.env` of the
|
|
19
29
|
project you run it in and may fetch a missing package from the registry).
|
|
@@ -34,7 +44,7 @@ validated against them and exits rather than binding a port nothing could ever r
|
|
|
34
44
|
**Languages:** the whole bridge is **TypeScript** (ESM) under `src/` — `figma-pull.ts` (read CLI),
|
|
35
45
|
`server-core.ts` (WS core), `figma-mcp.ts` (MCP server), and the modules they share. From a checkout,
|
|
36
46
|
Bun runs it directly with **zero build** (`bun bridge/src/figma-pull.ts …`, `bun bridge/src/figma-mcp.ts`), and the
|
|
37
|
-
package ships the same TypeScript: its `dtwin` bin — what `bun link` puts on your PATH — is `src/figma-pull.ts`,
|
|
47
|
+
package ships the same TypeScript: its `dtwin` bin — what `bun add -g` or `bun link` puts on your PATH — is `src/figma-pull.ts`,
|
|
38
48
|
whose shebang is `#!/usr/bin/env -S bun --no-install --no-env-file` (so a `.env` or a missing package in the
|
|
39
49
|
project you run it from can neither change its environment nor make Bun fetch a module from the registry;
|
|
40
50
|
`env -S` needs GNU coreutils ≥ 8.30 or a BSD/macOS `env` — on BusyBox, call `bun --no-install --no-env-file` on
|