@x12i/kit-cli 0.0.0-stage → 1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 x12i
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,119 @@
1
- # Temporary Holding Version
1
+ # @x12i/kit-cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Command line for the Unified UI Kit. The binary is called `kit`.
4
+
5
+ ```sh
6
+ npx @x12i/kit-cli doctor
7
+ ```
8
+
9
+ | Command | Status |
10
+ | --- | --- |
11
+ | `kit init` | Writes `kit.config.json` (`--theme`, `--density`, `--force`). |
12
+ | `kit doctor [paths...]` | Checks CSS, SCSS, TS, JS, HTML, Vue, Svelte and MDX files against the kit's conventions: tokens instead of hard-coded values, restrained motion, logical properties, visible focus. Exits with 1 on an error, or on any finding with `--strict`, so it can gate CI. |
13
+ | `kit design` | Writes a `DESIGN.md` that tells a coding agent what the kit looks like (`--theme`, `--out`, `--force`). |
14
+ | `kit theme [name]` | Lists the built-in themes and densities. Generating a theme is planned. |
15
+ | `kit add <component...>` | Stub. The component registry is planned, so it exits with 1 and says so. |
16
+
17
+ Exit codes: `0` success, `1` the command ran and found a problem, `2` bad usage
18
+ (unknown command, option, theme, rule or path).
19
+
20
+ ## doctor
21
+
22
+ ```sh
23
+ kit doctor src # scan a folder
24
+ kit doctor --strict # a warning also fails the run
25
+ kit doctor --json # findings as JSON
26
+ kit doctor --list-rules # every rule, its default severity and what it checks
27
+ ```
28
+
29
+ Each line is `file:line:col match message (severity rule)`, and the run ends
30
+ with a count of errors and warnings. A hard-coded hex color is an **error**, as it
31
+ always was. Every other rule is a **warning** by default, so adding the new rules
32
+ to an existing project does not turn a passing build red.
33
+
34
+ | Group | Rules |
35
+ | --- | --- |
36
+ | Tokens | `hardcoded-color` (error), `hardcoded-color-function`, `hardcoded-font-size`, `hardcoded-font-family`, `hardcoded-spacing`, `hardcoded-radius` |
37
+ | Motion | `hardcoded-duration`, `hardcoded-easing`, `bounce-easing`, `transition-all`, `layout-animation`, `missing-reduced-motion` |
38
+ | Layout and focus | `physical-property`, `outline-none`, `important` |
39
+
40
+ A value that uses a token is fine, and so is a mix such as
41
+ `calc(var(--kit-space-2) * 3)`. The scan reads CSS declarations, `<style>` blocks
42
+ and `style` attributes in markup, template literals, and string values in style
43
+ objects. It skips `node_modules`, `dist`, `build`, `coverage` and other build
44
+ folders, minified files and `.d.ts` files, and it does not flag URL fragments,
45
+ `href="#anchor"` links or HTML entities.
46
+
47
+ Some limits to know about:
48
+
49
+ - `left` and `right` with a percentage (`left: 50%`) are not flagged. Centering and
50
+ anchoring use them with a physical `translate`, and the logical twin would break
51
+ in right to left.
52
+ - `physical-property` is not reported inside a selector that names a side
53
+ (`.panel.left`, `.handle-right`, `[data-side="left"]`, `.text-left`), because
54
+ that code places things on that side on purpose.
55
+ - `missing-reduced-motion` is one finding for the whole scan: it fires when
56
+ something animates and no scanned file handles `prefers-reduced-motion`.
57
+ - It reads text. It does not resolve imports or compute styles, so a value built
58
+ at runtime is not seen.
59
+
60
+ Configure it in `kit.config.json`. A rule is `"off"`, `"warn"` or `"error"`:
61
+
62
+ ```json
63
+ {
64
+ "version": 1,
65
+ "theme": "light",
66
+ "density": "default",
67
+ "doctor": {
68
+ "ignore": ["legacy", "src/vendor"],
69
+ "rules": {
70
+ "physical-property": "off",
71
+ "hardcoded-spacing": "error"
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ - Add `kit-ignore` to a line (in a comment) to keep a value on purpose, such as a
78
+ brand logo color.
79
+ - `ignore` lists paths to skip, for example generated files.
80
+ - `--json` prints an array of findings. Each has `file`, `line`, `column`,
81
+ `match`, `rule`, `severity` and `message`.
82
+
83
+ The text output has more on each line than it used to. Parse `--json`, not the
84
+ text.
85
+
86
+ ## design
87
+
88
+ `kit design` writes the kit's `DESIGN.md` into your project, so a coding agent
89
+ that reads it builds with the kit's colors, type, spacing and motion instead of
90
+ inventing its own. It follows the [DESIGN.md format](https://github.com/google-labs-code/design.md)
91
+ and is generated from the same tokens as the CSS, so it cannot drift from them.
92
+
93
+ ```sh
94
+ kit design # writes ./DESIGN.md, using the theme in kit.config.json
95
+ kit design --theme dark
96
+ kit design --out docs/DESIGN.md
97
+ kit design --out - # print instead of writing
98
+ ```
99
+
100
+ It will not overwrite a file that exists unless you pass `--force`. The file ends
101
+ by telling the agent to run `kit doctor` before it finishes, which is what catches
102
+ the values an agent hard-codes anyway.
103
+
104
+ ## API
105
+
106
+ ```ts
107
+ import { scanForHardcodedColors, scanProject, RULES } from "@x12i/kit-cli";
108
+
109
+ // The original scan: hex colors only.
110
+ const colors = await scanForHardcodedColors(process.cwd(), ["src"]);
111
+
112
+ // Every rule. Pass `rules` to change severities and `ignore` to skip paths.
113
+ const findings = await scanProject(process.cwd(), ["src"], {
114
+ rules: { "physical-property": "off" },
115
+ });
116
+ ```
117
+
118
+ The same text is available from code as `createDesignMd({ theme })` in
119
+ `@x12i/tokens/design-md`.