designsource 0.3.0 → 0.4.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 +8 -4
- package/dist/index.js +33 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
The command line for a [DS source](https://designsource.app) design system. Three things it does:
|
|
8
8
|
|
|
9
9
|
- **`integrate`** — add the design system to the app you already have: a `design-system/` folder with your tokens as CSS variables, a prompt that tells your coding agent how to wire them in, and the component kit as reference. Vue, Svelte, Angular or plain CSS.
|
|
10
|
-
- **`create`** — start a new Next.js project from it: tokens, all
|
|
10
|
+
- **`create`** — start a new Next.js project from it: tokens, all 61 components, the block pages (`/blocks`) and your mockup page, running after `pnpm install && pnpm dev`.
|
|
11
11
|
- **`mcp`** — serve the design system to your coding agent over MCP: tokens, every component's source, your mockup page and a step-by-step integration guide, read on demand instead of pasted. Claude Code, Cursor, Codex — any client that speaks MCP over stdio.
|
|
12
12
|
|
|
13
13
|
```sh
|
|
@@ -52,7 +52,7 @@ Writes `design-system/` into the folder (default: the current one). Refuses when
|
|
|
52
52
|
npx designsource create [folder] [--token <project token>] [--api <origin>] [--force]
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Writes a runnable Next.js app into a new or empty folder (default `my-design-system`): Tailwind v4 with the shadcn theme CSS built from your tokens,
|
|
55
|
+
Writes a runnable Next.js app into a new or empty folder (default `my-design-system`): Tailwind v4 with the shadcn theme CSS built from your tokens, 61 UI components under `components/ui`, your mockup page on `/`, a component gallery on `/components`, light and dark via `next-themes`. Next steps print in the dialect of the runner you used (`pnpm`, `npm`, `yarn` or `bun`); a pnpm run pins `packageManager`.
|
|
56
56
|
|
|
57
57
|
<p align="center">
|
|
58
58
|
<img src="https://designsource.app/designsource/starter-dark-home.png" alt="Generated Next.js starter, home page, dark" width="49%">
|
|
@@ -126,10 +126,14 @@ The workbench's Copy dialog hands out all three. Then ask the agent to integrate
|
|
|
126
126
|
| `get_tokens` | Tokens as `{path, $type, $value: {light, dark}, ref}`; filter by `tier`, `category`, `component`. |
|
|
127
127
|
| `get_css_variables` | Every token as plain CSS custom properties, light and dark — for any stack. |
|
|
128
128
|
| `get_shadcn_theme` | The shadcn/ui theme stylesheet for Tailwind v4. |
|
|
129
|
-
| `list_components` | The
|
|
129
|
+
| `list_components` | The 61 components and the CSS variables each reads. |
|
|
130
130
|
| `get_component_source` | One component's React source (`utils` for the `cn` helper): verbatim in React + Tailwind, the spec to port from elsewhere. |
|
|
131
131
|
| `get_mockup_page` | Your mockup page as a layout spec plus the renderer that paints it. |
|
|
132
132
|
| `get_integration_guide` | The steps: wire the tokens, bring in the components, migrate existing styles, document. |
|
|
133
|
+
| `list_blocks` | The 34 ready-made page layouts (login, signup, sidebars, a dashboard, chart sets) with the components and files of each. |
|
|
134
|
+
| `get_block_source` | Every file of one block, headed by the path it takes under `components/blocks/`. |
|
|
135
|
+
|
|
136
|
+
New in 0.4.0: `list_blocks` and `get_block_source`, the page layouts built from the components. `create` now also writes them as `/blocks` pages, and `integrate` drops them under `design-system/reference/blocks/`. Against an older server the two tools answer that the server sent no blocks.
|
|
133
137
|
|
|
134
138
|
Read-only: nothing an agent does here changes the design system. The project is fetched on the first tool call and refreshed every 60 seconds, so a Save in the workbench shows on the next call. Like every export, it needs the project's account on Pro; on the free plan every tool answers with one line saying so.
|
|
135
139
|
|
|
@@ -175,7 +179,7 @@ By the maintainer, through GitHub Actions with npm trusted publishing: no npm to
|
|
|
175
179
|
3. Tag the merge commit `designsource@<version>` and push the tag:
|
|
176
180
|
|
|
177
181
|
```sh
|
|
178
|
-
git tag designsource@0.
|
|
182
|
+
git tag designsource@0.4.0 && git push origin designsource@0.4.0
|
|
179
183
|
```
|
|
180
184
|
|
|
181
185
|
The workflow (`.github/workflows/release-designsource.yml`) refuses a tag that does not match `package.json`, runs the tests (which build `dist/` first), publishes, then installs the published version from npm and runs `--help` against it.
|
package/dist/index.js
CHANGED
|
@@ -504,7 +504,7 @@ async function runIntegrate(args, env, io) {
|
|
|
504
504
|
import { createInterface as createInterface2 } from "node:readline";
|
|
505
505
|
|
|
506
506
|
// src/version.ts
|
|
507
|
-
var VERSION = true ? "0.
|
|
507
|
+
var VERSION = true ? "0.4.0" : "0.0.0-dev";
|
|
508
508
|
|
|
509
509
|
// src/mcp/jsonrpc.ts
|
|
510
510
|
var PARSE_ERROR = -32700;
|
|
@@ -567,7 +567,13 @@ var TIERS = ["design", "semantic", "component"];
|
|
|
567
567
|
var CATEGORIES = ["color", "spacing", "radius", "typography", "shadow", "zIndex", "border"];
|
|
568
568
|
var NO_INPUT = { type: "object", properties: {}, additionalProperties: false };
|
|
569
569
|
var pretty = (v) => JSON.stringify(v, null, 2);
|
|
570
|
+
var NO_BLOCKS = "This server sent no blocks. Update designsource and the server.";
|
|
570
571
|
var SOURCE_HEADER = "// Reference implementation. Use verbatim in React + Tailwind; port to your stack otherwise, keeping every var() chain.";
|
|
572
|
+
var BLOCK_SOURCE_HEADER = `${SOURCE_HEADER}
|
|
573
|
+
// The block renders inside BlockStage (components/blocks/stage.tsx, below), which supplies the @container/stage its
|
|
574
|
+
// responsive classes query and the frame height its min-h-full fills: render <BlockStage><Block /></BlockStage> as a
|
|
575
|
+
// full-viewport page. components/ui/preview-portal.tsx is the portal context the stage provides; the kit components
|
|
576
|
+
// list_blocks names for this block come from get_component_source.`;
|
|
571
577
|
var UTILS_HEADER = "// The `cn` helper every component imports from `@/lib/utils`. Save as lib/utils.ts in React; port or drop elsewhere.";
|
|
572
578
|
var componentsIn = (snapshot) => [...new Set(snapshot.canonical.tokens.map((t) => t.component).filter((c) => c !== null))].sort();
|
|
573
579
|
function optionalEnum(args, key, allowed) {
|
|
@@ -664,6 +670,28 @@ ${files.join("\n")}`);
|
|
|
664
670
|
description: "Step-by-step instructions for integrating this design system into the current repository: wire the tokens, bring in the components, migrate existing styles, document. Read this before changing anything.",
|
|
665
671
|
inputSchema: NO_INPUT,
|
|
666
672
|
run: (snapshot) => textResult(snapshot.guide)
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
name: "list_blocks",
|
|
676
|
+
description: "Ready-made page layouts built from the kit (login, signup, sidebars, a dashboard, chart sets): id, title, family, components used and files. Follow with get_block_source.",
|
|
677
|
+
inputSchema: NO_INPUT,
|
|
678
|
+
run: (snapshot) => snapshot.blocks ? textResult(pretty(snapshot.blocks.index)) : errorResult(NO_BLOCKS)
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
name: "get_block_source",
|
|
682
|
+
description: "Every file of one block (see list_blocks), each headed by the path it takes in the app: the block under components/blocks/, plus BlockStage (components/blocks/stage.tsx), which supplies the @container/stage its responsive classes query and the frame height, and the portal context it provides (components/ui/preview-portal.tsx). Render <BlockStage><Block /></BlockStage> as a full-viewport page. Use verbatim in React + Tailwind; port elsewhere keeping every var() chain.",
|
|
683
|
+
inputSchema: { type: "object", properties: { id: { type: "string", description: "A block id from list_blocks." } }, required: ["id"], additionalProperties: false },
|
|
684
|
+
run: (snapshot, _at, args) => {
|
|
685
|
+
const blocks = snapshot.blocks;
|
|
686
|
+
if (!blocks) return errorResult(NO_BLOCKS);
|
|
687
|
+
const entry = blocks.index.find((b) => b.id === args.id);
|
|
688
|
+
if (!entry) return errorResult(`"id" must be one of: ${blocks.index.map((b) => b.id).join(", ")}.`);
|
|
689
|
+
const path = (f) => f.startsWith("kit/") ? `components/ui/${f.slice("kit/".length)}` : `components/${f}`;
|
|
690
|
+
const files = entry.files.map((f) => `--- file: ${path(f)}
|
|
691
|
+
${blocks.sources[f] ?? ""}`);
|
|
692
|
+
return textResult(`${BLOCK_SOURCE_HEADER}
|
|
693
|
+
${files.join("\n\n")}`);
|
|
694
|
+
}
|
|
667
695
|
}
|
|
668
696
|
];
|
|
669
697
|
var TOOL_NAMES = TOOLS.map((t) => t.name);
|
|
@@ -734,17 +762,19 @@ var malformed2 = () => new CliError("Unexpected response from the API \u2014 not
|
|
|
734
762
|
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
735
763
|
var isStringRecord = (v) => isObject(v) && Object.values(v).every((x) => typeof x === "string");
|
|
736
764
|
var isStringListRecord = (v) => isObject(v) && Object.values(v).every((x) => Array.isArray(x) && x.every((s) => typeof s === "string"));
|
|
765
|
+
var isBlockEntry = (v) => isObject(v) && typeof v.id === "string" && typeof v.title === "string" && typeof v.family === "string" && Array.isArray(v.components) && v.components.every((c) => typeof c === "string") && Array.isArray(v.files) && v.files.every((f) => typeof f === "string");
|
|
737
766
|
function validateSnapshot(json) {
|
|
738
767
|
if (!isObject(json)) throw malformed2();
|
|
739
768
|
if (typeof json.version !== "number") throw malformed2();
|
|
740
769
|
if (json.version !== 1) throw new CliError(UPDATE_MESSAGE);
|
|
741
|
-
const { project, canonical, cssVars, shadcnTheme, kit, mockup, guide } = json;
|
|
770
|
+
const { project, canonical, cssVars, shadcnTheme, kit, mockup, blocks, guide } = json;
|
|
742
771
|
if (!isObject(project) || typeof project.name !== "string" || typeof project.radiusStrategy !== "string" || typeof project.tokenCount !== "number" || typeof project.hasMockup !== "boolean" || !isStringRecord(project.fonts)) throw malformed2();
|
|
743
772
|
if (!isObject(canonical) || !Array.isArray(canonical.tokens) || !canonical.tokens.every(isObject)) throw malformed2();
|
|
744
773
|
if (typeof cssVars !== "string" || typeof shadcnTheme !== "string" || typeof guide !== "string") throw malformed2();
|
|
745
774
|
if (!isObject(kit) || !isStringRecord(kit.sources) || !isStringListRecord(kit.variables)) throw malformed2();
|
|
746
775
|
if (mockup !== null && !(isObject(mockup) && isObject(mockup.spec) && isStringRecord(mockup.renderer))) throw malformed2();
|
|
747
|
-
|
|
776
|
+
const validBlocks = isObject(blocks) && Array.isArray(blocks.index) && blocks.index.every(isBlockEntry) && isStringRecord(blocks.sources);
|
|
777
|
+
return validBlocks ? json : { ...json, blocks: void 0 };
|
|
748
778
|
}
|
|
749
779
|
var FETCH_TIMEOUT_MS = 3e4;
|
|
750
780
|
async function fetchSnapshot(opts, fetchImpl = fetch) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "designsource",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The DS source CLI: add a design system to an existing app (integrate), start a new Next.js project from it (create), or serve it to a coding agent over MCP (mcp) — tokens, every component and your mockup page.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|