onsystem 0.10.0 → 0.10.2
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 +16 -1
- package/dist/cli.js +8 -10
- package/dist/{config-BbTW1jKU.d.ts → config-JaNAiR9Z.d.ts} +6 -8
- package/dist/{design-system-D53Jxybo.js → design-system-rl__N6tw.js} +399 -204
- package/dist/eslint-worker.d.ts +2 -4
- package/dist/eslint-worker.js +3 -4
- package/dist/eslint.d.ts +0 -2
- package/dist/eslint.js +3 -5
- package/dist/index.d.ts +18 -52
- package/dist/index.js +2 -2
- package/dist/{stdio-ha4IF0CU.js → stdio-CkczPt_1.js} +810 -380
- package/dist/{workspace-DAa_08uB.js → workspace-INef0Yqt.js} +10 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ npx -y onsystem check . # the same check the agent and CI run
|
|
|
69
69
|
npx -y onsystem init # write the config, and offer a baseline
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
At a [monorepo root](https://onsystem.vercel.app/docs/configuration#monorepo-roots), `inspect` lists every app and design-system package, and `check` checks each file by its own project's design system. In a [design-system package](https://onsystem.vercel.app/docs/design-system-packages), `init` sets it up for every app that depends on it, with no config in the apps: as a workspace package, or installed from npm when it publishes
|
|
72
|
+
At a [monorepo root](https://onsystem.vercel.app/docs/configuration#monorepo-roots), `inspect` lists every app and design-system package, and `check` checks each file by its own project's design system. In a [design-system package](https://onsystem.vercel.app/docs/design-system-packages), `init` sets it up for every app that depends on it, with no config in the apps: as a workspace package, or installed from npm. Installed apps read the components from the sources the package publishes, or from its type declarations (`.d.ts`) when it publishes only compiled `dist/`, and get every rule either way (`init` checks its `files` list). From a package that publishes compiled code and no type declarations, they get the token rules but no component, prop, variant or native-element checks.
|
|
73
73
|
|
|
74
74
|
In a new create-next-app, the template page's hardcoded colors already make the first `check .` fail; `init` offers to record them as a baseline, so only new findings fail. Folders installed from a shadcn registry, such as `components/ai-elements`, are someone else's code: [Code from shadcn registries](https://onsystem.vercel.app/docs/configuration#code-from-shadcn-registries) says how to check them or leave them out.
|
|
75
75
|
|
|
@@ -128,6 +128,21 @@ steps:
|
|
|
128
128
|
|
|
129
129
|
That count is onsystem's own, and the MCP server and the hook show the agent the same errors to fix. In tasks that ask for a green status label in a design system with no success token, agents with onsystem often used `chart-*` tokens, which it counts as clean. The blind labels by an AI reviewer, 12 files per arm, are too few to confirm the count either way, and every violation they found with the hook or all three is a palette color in Dub, whose tokens 0.5.0 did not read. The [benchmark page](https://onsystem.vercel.app/benchmark) has every table, and [bench/v2](bench/v2) the method, the per-run data and every generated file.
|
|
130
130
|
|
|
131
|
+
## Compatibility
|
|
132
|
+
|
|
133
|
+
What `package.json` declares and CI runs:
|
|
134
|
+
|
|
135
|
+
| With | Supported |
|
|
136
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
137
|
+
| Node.js | Node.js 20.19 or later (`engines`). CI runs the tests on Node.js 22, 24 and 26, and the built package on 20.19 |
|
|
138
|
+
| Operating system | Linux, macOS and Windows: CI runs the tests and the pack test on each |
|
|
139
|
+
| ESLint | ESLint 8.57, 9 and 10, for the ESLint plugin only: `eslint` is an optional peer, and the CLI, the MCP server, the hook and the Action do not need it |
|
|
140
|
+
| TypeScript | Your project's TypeScript is not used, and a JavaScript project needs none: onsystem reads `.tsx` and `.jsx` with its own TypeScript 6.0, a dependency, not a peer |
|
|
141
|
+
| React | Components written for React 18 (`forwardRef`) or React 19 (`ref` as a prop), read from source or type declarations. onsystem does not depend on React |
|
|
142
|
+
| Tailwind CSS | v4 (`@theme`) and v3 (`tailwind.config`, read without running it). Without Tailwind, tokens come from CSS custom properties, DTCG files or a DESIGN.md |
|
|
143
|
+
| shadcn/ui | Both bases, Radix (`asChild`) and Base UI (`render`), on Tailwind v3 or v4, with no config |
|
|
144
|
+
| MCP clients | Any client that starts a stdio server; CI connects on the 2025-11-25 and 2026-07-28 protocols. [Set up your agent](https://onsystem.vercel.app/docs/clients) has each client's config and support tier |
|
|
145
|
+
|
|
131
146
|
## Docs
|
|
132
147
|
|
|
133
148
|
On the [website](https://onsystem.vercel.app/docs), and as Markdown in [docs/](docs):
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as DEFAULT_TOKENS, A as unrecordedRules, At as
|
|
3
|
-
import { a as notReadNotices, i as missingDependencies, o as explainProject, s as librariesLeftOut, t as serveStdio } from "./stdio-
|
|
4
|
-
import { r as loadTarget } from "./workspace-
|
|
2
|
+
import { $ as DEFAULT_TOKENS, A as unrecordedRules, At as relativePath, B as statusKinds, C as countBaseline, D as pruneBaseline, Dt as isInside, E as onLines, Et as SCRIPT_FILE, It as unique, J as ConfigError, L as toDesignMd, M as writeBaseline, O as readBaseline, Ot as matchesGlob, Pt as plural, R as toDtcg, Rt as readProjectConfig, S as applyBaseline, St as isDesignSystemName, T as goneFiles, Y as DEFAULT_DOCS, _ as formatDiagnostics, _t as PACKAGE_FIELD, b as BASELINE_FILE, bt as detectProject, c as silentLogger, et as FALLBACK_TOKENS, g as escapeData, gt as notReadYet, h as uncheckedNotice, ht as libraryTitle, i as componentFiles, j as updateBaseline, jt as toPosix, k as rulesRun, l as stderrLogger, o as loadDesignSystem, ot as excludedBy, q as CONFIG_FILES, rt as RULE_IDS, s as tokenFiles, tt as LEGACY_CONFIG_FILES, ut as rulesFor, v as NAME, w as findMoves, x as LEGACY_BASELINE_FILE, y as VERSION, yt as declaredConfig } from "./design-system-rl__N6tw.js";
|
|
3
|
+
import { a as notReadNotices, i as missingDependencies, o as explainProject, s as librariesLeftOut, t as serveStdio } from "./stdio-CkczPt_1.js";
|
|
4
|
+
import { r as loadTarget } from "./workspace-INef0Yqt.js";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { escapePath, glob } from "tinyglobby";
|
|
@@ -10,7 +10,7 @@ import fsp from "node:fs/promises";
|
|
|
10
10
|
import { spawnSync } from "node:child_process";
|
|
11
11
|
import readline from "node:readline/promises";
|
|
12
12
|
import { parseArgs } from "node:util";
|
|
13
|
-
|
|
13
|
+
// src/init.ts
|
|
14
14
|
const SCHEMA = "https://unpkg.com/onsystem/schema.json";
|
|
15
15
|
/** More detected globs than this are files, not folders: zero config keeps them. */
|
|
16
16
|
const MAX_GLOBS = 6;
|
|
@@ -685,8 +685,7 @@ function count$1(n, word) {
|
|
|
685
685
|
function andList(items, conjunction = "and") {
|
|
686
686
|
return items.length > 1 ? `${items.slice(0, -1).join(", ")} ${conjunction} ${items.at(-1) ?? ""}` : items.join("");
|
|
687
687
|
}
|
|
688
|
-
|
|
689
|
-
//#region src/cli.ts
|
|
688
|
+
// src/cli.ts
|
|
690
689
|
const DOCS = "https://onsystem.vercel.app/docs";
|
|
691
690
|
const HELP = `${NAME} ${VERSION}
|
|
692
691
|
|
|
@@ -944,7 +943,8 @@ async function main(argv, io = defaultIo) {
|
|
|
944
943
|
io.stderr(error.message);
|
|
945
944
|
return 2;
|
|
946
945
|
}
|
|
947
|
-
|
|
946
|
+
io.stderr(error.stack ?? String(error));
|
|
947
|
+
return 2;
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
950
|
async function check(patterns, configOptions, values, io) {
|
|
@@ -1880,13 +1880,11 @@ function displayPath(cwd, file) {
|
|
|
1880
1880
|
const rel = path.relative(cwd, file);
|
|
1881
1881
|
return rel && !rel.startsWith("..") && !path.isAbsolute(rel) ? rel : file;
|
|
1882
1882
|
}
|
|
1883
|
-
|
|
1884
|
-
//#region src/bin.ts
|
|
1883
|
+
// src/bin.ts
|
|
1885
1884
|
main(process.argv.slice(2)).then((code) => {
|
|
1886
1885
|
process.exitCode = code;
|
|
1887
1886
|
}, (error) => {
|
|
1888
1887
|
process.stderr.write(`${error.stack ?? String(error)}\n`);
|
|
1889
1888
|
process.exitCode = 1;
|
|
1890
1889
|
});
|
|
1891
|
-
//#endregion
|
|
1892
1890
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
//#region src/detect.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* How apps import a design-system module, from a package's `exports`:
|
|
5
4
|
* `@midday/ui/button` → `../../packages/ui/src/components/button.tsx`, or a
|
|
@@ -45,8 +44,6 @@ interface DesignSystemSource {
|
|
|
45
44
|
*/
|
|
46
45
|
registry?: string | undefined;
|
|
47
46
|
}
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/types.d.ts
|
|
50
47
|
/**
|
|
51
48
|
* The design-system model the server exposes. Everything here is plain JSON so
|
|
52
49
|
* it can be cached on disk and returned as MCP structured content.
|
|
@@ -269,8 +266,6 @@ interface CheckResult {
|
|
|
269
266
|
*/
|
|
270
267
|
skipped?: string;
|
|
271
268
|
}
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/libraries/index.d.ts
|
|
274
269
|
/** The ids of the libraries onsystem can read, for the config's `libraries` list. */
|
|
275
270
|
declare const LIBRARY_IDS: readonly ["mui"];
|
|
276
271
|
type LibraryId = (typeof LIBRARY_IDS)[number];
|
|
@@ -287,8 +282,6 @@ interface LibrarySource {
|
|
|
287
282
|
*/
|
|
288
283
|
designSystem?: true | undefined;
|
|
289
284
|
}
|
|
290
|
-
//#endregion
|
|
291
|
-
//#region src/config.d.ts
|
|
292
285
|
declare const RULE_IDS: readonly ["no-hardcoded-color", "no-hardcoded-spacing", "no-hardcoded-radius", "prefer-design-system-component", "no-unknown-component", "no-unknown-prop", "no-unknown-variant", "icon-button-accessible-name"];
|
|
293
286
|
type RuleId = (typeof RULE_IDS)[number];
|
|
294
287
|
declare const severitySchema: z.ZodEnum<{
|
|
@@ -504,9 +497,14 @@ interface LoadConfigOptions {
|
|
|
504
497
|
* choose, unlike the folder the server was started in.
|
|
505
498
|
*/
|
|
506
499
|
jsonConfigOnly?: boolean | undefined;
|
|
500
|
+
/**
|
|
501
|
+
* With `jsonConfigOnly`: the folder the MCP server was started for (its `--root` or the
|
|
502
|
+
* client's root) when that folder is no project but holds the one read, which the error for a
|
|
503
|
+
* JavaScript or TypeScript config names.
|
|
504
|
+
*/
|
|
505
|
+
jsonConfigWithin?: string | undefined;
|
|
507
506
|
}
|
|
508
507
|
declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedConfig>;
|
|
509
508
|
/** JSON Schema for editor completion in `onsystem.config.json`. */
|
|
510
509
|
declare function configJsonSchema(): Record<string, unknown>;
|
|
511
|
-
//#endregion
|
|
512
510
|
export { TOKEN_CATEGORIES as C, VariantInfo as D, TokenCategory as E, ImportMapping as O, SourceLocation as S, Token as T, DocSection as _, ResolvedRule as a, PropInfo as b, configJsonSchema as c, CheckResult as d, ComponentDocs as f, Diagnostic as g, DesignSystemModel as h, ResolvedConfig as i, defineConfig as l, CompoundVariantInfo as m, LoadConfigOptions as n, RuleId as o, ComponentInfo as p, RULE_IDS as r, RuleOptions as s, Config as t, loadConfig as u, ExampleInfo as v, TextEdit as w, Severity as x, InheritedProps as y };
|