synthesisui 0.4.10 → 0.4.12

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 CHANGED
@@ -1,48 +1,67 @@
1
1
  # synthesisui
2
2
 
3
- CLI to bring design systems published on [SynthesisUI](https://www.synthesisui.com)
4
- into any project. It materializes the system into `_synthesisui/ds/<slug>/` and injects
5
- a managed block into the root `CLAUDE.md`, so Claude Code builds components following the
6
- design system.
3
+ The CLI for [SynthesisUI](https://www.synthesisui.com) - where your design
4
+ system is born, scored against the classic design canon, and delivered to any
5
+ coding agent.
7
6
 
8
- ## Usage
7
+ Your AI writes UI. This gives it a design system to write it in: tokens, typed
8
+ components, whole pages and a `CLAUDE.md` manifest that Claude Code, Cursor,
9
+ Copilot or any coding agent reads before writing a single line.
9
10
 
10
- Without installing anything:
11
+ > This repository is a **read-only mirror** of `packages/cli` in the SynthesisUI
12
+ > monorepo, published so you can audit exactly what runs in your repo.
13
+ > Issues and bug reports are very welcome here; pull requests can't land on a
14
+ > mirror - open an issue instead.
15
+
16
+ ## Quickstart
11
17
 
12
18
  ```bash
13
- npx synthesisui login # connect the CLI to your account (device-flow in the browser)
14
- npx synthesisui list # list the available design systems
15
- npx synthesisui add <slug> # bring a DS into _synthesisui/ds/<slug>/
19
+ npx synthesisui@latest init --styles tailwind --ds <slug>
16
20
  ```
17
21
 
18
- Or install globally:
22
+ Pick any system from the [gallery](https://www.synthesisui.com) - or create
23
+ your own in two minutes.
19
24
 
20
- ```bash
21
- npm install -g synthesisui
22
- synthesisui add halogen
23
- ```
25
+ ## Commands
26
+
27
+ | Command | What it does |
28
+ | --- | --- |
29
+ | `init` | One-shot setup: materialize a system + wire your project for it |
30
+ | `login` | Connect to your account (device-flow in the browser) |
31
+ | `list` | List the design systems available to you |
32
+ | `add <slug>` | Materialize a system into `_synthesisui/ds/<slug>/` |
33
+ | `use <slug>` | Generate the agent prompt to apply the system to your app |
34
+ | `component <slug> <name>` | Bring one typed component into your components dir |
35
+ | `template <slug> <name>` | Generate a whole page (landing, dashboard, onboarding…) |
36
+ | `generate` | Generate a page from a saved guide structure |
37
+ | `advise` | Grounded design advice for this repo, from your system's rules |
38
+ | `refit <file>` | Send an app component back into your design system |
39
+ | `upgrade <slug>` | Diff your `.lock` against the latest version and migrate |
40
+ | `clean` | Remove materialized files and the managed CLAUDE.md block |
24
41
 
25
- ### What `add` materializes
42
+ ## What `add` materializes
26
43
 
27
- In `_synthesisui/ds/<slug>/`:
44
+ Inside `_synthesisui/ds/<slug>/`:
28
45
 
29
- - `design-system.json` the canonical source of truth of the design system
30
- - `tokens.css` CSS custom properties scoped by `data-ds`
31
- - `theme.css` optional Tailwind v4 `@theme` adapter (use `bg-primary`, `p-md`, … backed by the tokens)
32
- - `GUIDE.md` instructions for the agent (semantic roles, mood, recipes, how to add components)
33
- - `.lock` pinned slug + version (reproducible)
46
+ - `design-system.json` - the canonical source of truth
47
+ - `tokens.css` - CSS custom properties scoped by `data-ds`
48
+ - `theme.css` - optional Tailwind v4 `@theme` adapter (`bg-primary`, `p-md`, …)
49
+ - `GUIDE.md` - agent instructions: semantic roles, mood, recipes
50
+ - `rules.md` - the governance your agent must follow
51
+ - `.lock` - pinned slug + version (reproducible upgrades)
34
52
 
35
- And it injects an idempotent `<!-- synthesisui:start/end -->` block into the root `CLAUDE.md`,
36
- reflecting every installed DS.
53
+ Plus an idempotent `<!-- synthesisui:start/end -->` block in your root
54
+ `CLAUDE.md` listing every installed system and its component manifest.
37
55
 
38
56
  ## Authentication
39
57
 
40
- `synthesisui login` uses device-flow (RFC 8628): it opens the browser, you confirm a code,
41
- and the token is saved to `~/.synthesisui/credentials.json` (per machine). Logout = delete that file.
58
+ `synthesisui login` uses device-flow (RFC 8628): it opens the browser, you
59
+ confirm a code, and the token lands in `~/.synthesisui/credentials.json`
60
+ (per machine, chmod 600). Logout = delete that file.
42
61
 
43
62
  ## Registry
44
63
 
45
- By default it points to `https://www.synthesisui.com`. Override it with:
64
+ Defaults to `https://www.synthesisui.com`. Override with:
46
65
 
47
66
  ```bash
48
67
  synthesisui list --registry http://localhost:3000
@@ -90,7 +90,9 @@ export async function clean(opts) {
90
90
  // 4. Default README.
91
91
  const readmePath = join(root, "README.md");
92
92
  const readmeSrc = await readIf(readmePath);
93
- if (readmeSrc && /create-next-app/.test(readmeSrc) && /Getting Started/.test(readmeSrc)) {
93
+ if (readmeSrc &&
94
+ /create-next-app/.test(readmeSrc) &&
95
+ /Getting Started/.test(readmeSrc)) {
94
96
  actions.push({
95
97
  verb: "remove",
96
98
  path: "README.md",
@@ -16,14 +16,15 @@ export async function template(slug, name, opts) {
16
16
  const target = opts.target === "general" || opts.target === "next"
17
17
  ? opts.target
18
18
  : config.target;
19
- console.log(`→ generating "${name}" from "${slug}" (${target}) …`);
20
- const generated = await fetchTemplate(base, slug, name, target, opts.version);
19
+ const asName = opts.as && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(opts.as) ? opts.as : undefined;
20
+ console.log(`→ generating "${name}"${asName ? ` as "${asName}"` : ""} from "${slug}" (${target}) …`);
21
+ const generated = await fetchTemplate(base, slug, name, target, opts.version, asName);
21
22
  // --out targets the page (1st file); sibling files (e.g. the CSS) land in the
22
23
  // same directory. Without --out, everything goes under templates/<name>/ -
23
24
  // a loose landing.tsx at the app/ root read as a route without being one,
24
25
  // and a second template turned the app dir into soup.
25
26
  const [pageFile, ...siblings] = generated.files;
26
- const defaultDir = join("templates", name);
27
+ const defaultDir = join("templates", asName ?? name);
27
28
  const pageRel = opts.out ?? join(defaultDir, pageFile.filename);
28
29
  const pageDir = dirname(join(root, pageRel));
29
30
  await mkdir(pageDir, { recursive: true });
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ Usage - deterministic, FREE:
21
21
  synthesisui add <slug> [options] materialize a DS into _synthesisui/ds/<slug>/
22
22
  synthesisui component <slug> <name> bring one EXISTING component in as YOUR <Pascal>.tsx
23
23
  synthesisui template <slug> <name> materialize a whole page from a DS template
24
+ (--as landing-home names the output - multi-page safe)
24
25
  synthesisui upgrade <slug> update an installed DS + regenerate your components + migration brief
25
26
  synthesisui use <slug> "<intent>" print a ready-to-paste agent prompt to build/modify on-system
26
27
  synthesisui clean [--force] strip create-next-app boilerplate (dry run without --force)
@@ -178,7 +179,15 @@ async function main() {
178
179
  }
179
180
  const target = typeof flags.target === "string" ? flags.target : undefined;
180
181
  const out = typeof flags.out === "string" ? flags.out : undefined;
181
- await template(slug, name, { registry, dir, out, target, version });
182
+ const as_ = typeof flags.as === "string" ? flags.as : undefined;
183
+ await template(slug, name, {
184
+ registry,
185
+ dir,
186
+ out,
187
+ target,
188
+ version,
189
+ as: as_,
190
+ });
182
191
  break;
183
192
  }
184
193
  case "component": {
package/dist/registry.js CHANGED
@@ -46,12 +46,14 @@ export async function fetchDesignSystem(base, slug, version) {
46
46
  * Fetches a whole page generated from a DS template (`?template=&target=`). The
47
47
  * server codegens it from `document.layouts[<template>]`; the CLI just writes it.
48
48
  */
49
- export async function fetchTemplate(base, slug, template, target, version) {
49
+ export async function fetchTemplate(base, slug, template, target, version, as_) {
50
50
  const url = new URL(`${base}/api/registry/ds/${encodeURIComponent(slug)}`);
51
51
  url.searchParams.set("template", template);
52
52
  url.searchParams.set("target", target);
53
53
  if (version != null)
54
54
  url.searchParams.set("version", String(version));
55
+ if (as_)
56
+ url.searchParams.set("as", as_);
55
57
  const res = await request(url.toString());
56
58
  if (res.status === 404) {
57
59
  const body = (await res.json().catch(() => ({})));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.4.10",
4
- "description": "Traz design systems do SynthesisUI para qualquer projeto (materializa em _local/ds/).",
3
+ "version": "0.4.12",
4
+ "description": "Bring SynthesisUI design systems into any project - tokens, typed components, whole pages and an agent-ready CLAUDE.md manifest.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "synthesisui": "dist/index.js"
@@ -19,11 +19,10 @@
19
19
  "homepage": "https://www.synthesisui.com",
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "git+https://github.com/SynthesisUI/synthesisui-hub.git",
23
- "directory": "packages/cli"
22
+ "url": "git+https://github.com/SynthesisUI/cli.git"
24
23
  },
25
24
  "bugs": {
26
- "url": "https://github.com/SynthesisUI/synthesisui-hub/issues"
25
+ "url": "https://github.com/SynthesisUI/cli/issues"
27
26
  },
28
27
  "author": "SynthesisUI",
29
28
  "engines": {