onsystem 0.5.0 → 0.7.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 +41 -17
- package/dist/cli.js +476 -126
- package/dist/{types-DJtccu3A.d.ts → config-1XSTYI44.d.ts} +271 -167
- package/dist/{design-system-CnEv5sIL.js → design-system-C4bhqLLw.js} +4426 -679
- package/dist/eslint-worker.d.ts +1 -1
- package/dist/eslint-worker.js +9 -2
- package/dist/eslint.js +66 -5
- package/dist/index.d.ts +74 -1
- package/dist/index.js +3 -3
- package/dist/{stdio-DjfkiDMV.js → stdio-BojAQ6JP.js} +230 -24
- package/dist/{workspace-DzWQ4L8R.js → workspace-Z0tZf_Dv.js} +44 -10
- package/package.json +11 -10
- package/schema.json +19 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as loadConfig, Ct as relativePath, H as CONFIG_FILES, J as LEGACY_CONFIG_FILES, Q as hasOwnConfig, et as loadConfigWith, ft as findDesignSystemPackage, gt as workspacePatterns, ht as workspacePackageDirs, i as componentFiles, lt as PackageFinder, mt as isWorkspaceRoot, xt as isInside } from "./design-system-C4bhqLLw.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import os from "node:os";
|
|
@@ -18,7 +18,8 @@ const PROJECT_MARKERS = [
|
|
|
18
18
|
];
|
|
19
19
|
/**
|
|
20
20
|
* A monorepo seen from its root: every workspace package with a design system (an app
|
|
21
|
-
* that uses one, or
|
|
21
|
+
* that uses one, from source or a published library, or the design-system package
|
|
22
|
+
* itself), and how to find the project of
|
|
22
23
|
* any file in it. Without a design system at the root, `check`, `inspect` and the MCP
|
|
23
24
|
* server work from here, each file checked by its own project's design system.
|
|
24
25
|
*/
|
|
@@ -30,8 +31,9 @@ var Workspace = class {
|
|
|
30
31
|
configFile;
|
|
31
32
|
options;
|
|
32
33
|
rootConfig;
|
|
34
|
+
otherConfigs;
|
|
33
35
|
bare = /* @__PURE__ */ new Map();
|
|
34
|
-
constructor(root, source, projects, others, configFile, options, rootConfig) {
|
|
36
|
+
constructor(root, source, projects, others, configFile, options, rootConfig, otherConfigs = []) {
|
|
35
37
|
this.root = root;
|
|
36
38
|
this.source = source;
|
|
37
39
|
this.projects = projects;
|
|
@@ -39,6 +41,19 @@ var Workspace = class {
|
|
|
39
41
|
this.configFile = configFile;
|
|
40
42
|
this.options = options;
|
|
41
43
|
this.rootConfig = rootConfig;
|
|
44
|
+
this.otherConfigs = otherConfigs;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* What the configs of the workspace's packages have to say ({@link ResolvedConfig.warnings}),
|
|
48
|
+
* each once, as they were read when the workspace was found.
|
|
49
|
+
*/
|
|
50
|
+
get warnings() {
|
|
51
|
+
const configs = [
|
|
52
|
+
this.rootConfig,
|
|
53
|
+
...this.projects.map((p) => p.config),
|
|
54
|
+
...this.otherConfigs
|
|
55
|
+
];
|
|
56
|
+
return [...new Set(configs.flatMap((c) => c.warnings ?? []))];
|
|
42
57
|
}
|
|
43
58
|
/**
|
|
44
59
|
* The project `target` (a file or a folder) belongs to: the nearest folder at or above
|
|
@@ -102,24 +117,31 @@ async function discoverWorkspace(rootConfig, options) {
|
|
|
102
117
|
].filter(Boolean).join(", ");
|
|
103
118
|
const projects = [];
|
|
104
119
|
const others = [];
|
|
120
|
+
const otherConfigs = [];
|
|
105
121
|
for (const dir of workspacePackageDirs(root)) {
|
|
106
122
|
const config = await loadProjectConfig(dir, root, rootConfig.configFile, options);
|
|
107
123
|
const files = (await componentFiles(config)).length;
|
|
108
124
|
const own = config.configFile !== void 0 && config.configFile !== rootConfig.configFile;
|
|
109
|
-
|
|
125
|
+
const library = config.libraries?.some((l) => l.dir !== void 0) ?? false;
|
|
126
|
+
if (files || own || library) projects.push({
|
|
110
127
|
root: dir,
|
|
111
128
|
dir: relativePath(root, dir),
|
|
112
129
|
name: packageName(dir),
|
|
113
130
|
config,
|
|
114
131
|
componentFiles: files
|
|
115
132
|
});
|
|
116
|
-
else
|
|
133
|
+
else {
|
|
134
|
+
others.push(relativePath(root, dir));
|
|
135
|
+
if (config.warnings) otherConfigs.push(config);
|
|
136
|
+
}
|
|
117
137
|
}
|
|
118
|
-
return new Workspace(root, source, projects, others, rootConfig.configFile, options, rootConfig);
|
|
138
|
+
return new Workspace(root, source, projects, others, rootConfig.configFile, options, rootConfig, otherConfigs);
|
|
119
139
|
}
|
|
120
140
|
/**
|
|
121
|
-
* A project's config: its own config file,
|
|
122
|
-
*
|
|
141
|
+
* A project's config: its own config file, else the config its design-system package declares
|
|
142
|
+
* (a dependency with `"onsystem"` in its package.json), else the workspace root's, with paths
|
|
143
|
+
* relative to the workspace root, else zero config. `loadConfig` from the project's folder finds
|
|
144
|
+
* the first two the same way. CLI flags that apply to every project carry over.
|
|
123
145
|
*/
|
|
124
146
|
function loadProjectConfig(dir, workspaceRoot, rootConfigFile, options) {
|
|
125
147
|
const shared = {
|
|
@@ -127,15 +149,27 @@ function loadProjectConfig(dir, workspaceRoot, rootConfigFile, options) {
|
|
|
127
149
|
includeDesignSystem: options.includeDesignSystem,
|
|
128
150
|
jsonConfigOnly: options.jsonConfigOnly
|
|
129
151
|
};
|
|
130
|
-
|
|
152
|
+
const packages = new PackageFinder(dir);
|
|
153
|
+
if (!rootConfigFile || hasOwnConfig(dir)) return loadConfigWith({
|
|
154
|
+
...shared,
|
|
155
|
+
root: dir
|
|
156
|
+
}, { packages });
|
|
157
|
+
const lookup = findDesignSystemPackage(dir, packages);
|
|
158
|
+
if (lookup?.found || lookup?.problems.length) return loadConfigWith({
|
|
131
159
|
...shared,
|
|
132
160
|
root: dir
|
|
161
|
+
}, {
|
|
162
|
+
packages,
|
|
163
|
+
lookup
|
|
133
164
|
});
|
|
134
|
-
return
|
|
165
|
+
return loadConfigWith({
|
|
135
166
|
...shared,
|
|
136
167
|
root: dir,
|
|
137
168
|
config: rootConfigFile,
|
|
138
169
|
base: workspaceRoot
|
|
170
|
+
}, {
|
|
171
|
+
packages,
|
|
172
|
+
lookup
|
|
139
173
|
});
|
|
140
174
|
}
|
|
141
175
|
/** The nearest folder at or above `target` (a file or folder) with a project marker, up to `root`. */
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onsystem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"mcpName": "io.github.dgesteves/onsystem",
|
|
5
|
-
"description": "Keeps coding agents on your design system:
|
|
5
|
+
"description": "Keeps coding agents on your design system: catches palette colors, native elements and APIs your system lacks, at every edit and pull request, with the fix. Set it up once in your design-system package; every app in your monorepo gets it.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"design-system",
|
|
8
8
|
"design-system-lint",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"mcp",
|
|
26
26
|
"model-context-protocol"
|
|
27
27
|
],
|
|
28
|
-
"homepage": "https://
|
|
28
|
+
"homepage": "https://onsystem.vercel.app",
|
|
29
29
|
"bugs": "https://github.com/dgesteves/onsystem/issues",
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
@@ -68,10 +68,11 @@
|
|
|
68
68
|
"stemmer": "^2.0.1",
|
|
69
69
|
"tinyglobby": "^0.2.17",
|
|
70
70
|
"typescript": "~6.0.3",
|
|
71
|
-
"
|
|
71
|
+
"yaml": "^2.9.1",
|
|
72
|
+
"zod": "^4.6.6"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
|
-
"eslint": ">=
|
|
75
|
+
"eslint": ">=8.57.0"
|
|
75
76
|
},
|
|
76
77
|
"peerDependenciesMeta": {
|
|
77
78
|
"eslint": {
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
"@modelcontextprotocol/client": "^2.3.1",
|
|
86
87
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
87
88
|
"@types/culori": "^4.0.1",
|
|
88
|
-
"@types/node": "^24.19.
|
|
89
|
+
"@types/node": "^24.19.2",
|
|
89
90
|
"ajv": "^8.20.0",
|
|
90
91
|
"ajv-draft-04": "^1.0.0",
|
|
91
92
|
"ajv-formats": "^3.0.1",
|
|
@@ -95,11 +96,11 @@
|
|
|
95
96
|
"geist": "^1.7.2",
|
|
96
97
|
"globals": "^17.13.0",
|
|
97
98
|
"opentype.js": "^2.0.0",
|
|
98
|
-
"prettier": "^3.9.
|
|
99
|
+
"prettier": "^3.9.10",
|
|
99
100
|
"publint": "^0.3.25",
|
|
100
|
-
"react-aria-components": "^1.
|
|
101
|
+
"react-aria-components": "^1.22.1",
|
|
101
102
|
"tailwind-variants": "^3.3.1",
|
|
102
|
-
"tsdown": "^0.23.
|
|
103
|
+
"tsdown": "^0.23.1",
|
|
103
104
|
"typescript-eslint": "^8.71.1",
|
|
104
105
|
"vitest": "^5.0.3"
|
|
105
106
|
},
|
|
@@ -113,7 +114,7 @@
|
|
|
113
114
|
"test": "vitest run",
|
|
114
115
|
"test:watch": "vitest",
|
|
115
116
|
"smoke": "node scripts/smoke.mjs",
|
|
116
|
-
"pack-test": "node scripts/pack-test.mjs",
|
|
117
|
+
"pack-test": "node scripts/pack-test.mjs && node scripts/pack-test-eslint8.mjs",
|
|
117
118
|
"assets": "node scripts/build-assets.mjs",
|
|
118
119
|
"palette": "node scripts/build-palette.mjs",
|
|
119
120
|
"sync-plugins": "node scripts/sync-plugins.mjs",
|
package/schema.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"tokens": {
|
|
32
|
-
"description": "Token files: W3C DTCG JSON (*.json)
|
|
32
|
+
"description": "Token files: W3C DTCG JSON (*.json), CSS custom properties (*.css) or a DESIGN.md's front matter (*.md).",
|
|
33
33
|
"anyOf": [
|
|
34
34
|
{
|
|
35
35
|
"anyOf": [
|
|
@@ -116,6 +116,24 @@
|
|
|
116
116
|
"type": "string"
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
|
+
"libraries": {
|
|
120
|
+
"description": "Published component libraries to read from their type declarations when the project depends on them. Omitted: every one onsystem reads (mui). false: none. A list: only those, e.g. [\"mui\"].",
|
|
121
|
+
"anyOf": [
|
|
122
|
+
{
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"const": false
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"type": "array",
|
|
128
|
+
"items": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"enum": [
|
|
131
|
+
"mui"
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
119
137
|
"includeDesignSystem": {
|
|
120
138
|
"description": "check: lint the design system's own component files too. Off by default: they implement the scale and primitives the rules enforce.",
|
|
121
139
|
"type": "boolean"
|