@kerfjs/ui 5.0.0-beta.117 → 5.0.0-beta.118
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/ai/component-composition.d.ts +6 -1
- package/ai/component-composition.schema.json +2 -1
- package/ai/public-api-signatures-v1.md +1 -1
- package/ai/skill.md +8 -2
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/docs/dark-mode-checklist.md +15 -0
- package/docs/data-tables-and-lists.md +18 -0
- package/docs/forms-and-validation.md +9 -0
- package/docs/interaction-conventions.md +51 -0
- package/docs/testing-applications.md +25 -0
- package/docs/ui-doctor.md +24 -1
- package/docs/upgrading.md +14 -0
- package/doctor/eslint-diagnostics.d.mts +4 -0
- package/doctor/eslint-diagnostics.mjs +6 -1
- package/doctor/index.mjs +13 -0
- package/doctor/project-guidance-checks.d.mts +11 -0
- package/doctor/project-guidance-checks.mjs +97 -0
- package/llms.txt +11 -0
- package/package.json +1 -1
|
@@ -97,7 +97,12 @@ export interface CatalogCompositionEntry {
|
|
|
97
97
|
required: boolean;
|
|
98
98
|
helpers: string[];
|
|
99
99
|
/** Defining source files for application-owned helpers, relative to the catalog package root. */
|
|
100
|
-
sources?: Array<{
|
|
100
|
+
sources?: Array<{
|
|
101
|
+
export: string;
|
|
102
|
+
source: string;
|
|
103
|
+
/** Defaults to true. Set false for a void helper with no cleanup handle. */
|
|
104
|
+
returnsDisposer?: boolean;
|
|
105
|
+
}>;
|
|
101
106
|
/** `data-action` values the application handles with a root-delegated
|
|
102
107
|
* listener (`delegate` / `delegateActions`) instead of a named helper. */
|
|
103
108
|
actions?: string[];
|
|
@@ -246,7 +246,8 @@
|
|
|
246
246
|
"required": ["export", "source"],
|
|
247
247
|
"properties": {
|
|
248
248
|
"export": { "type": "string", "minLength": 1 },
|
|
249
|
-
"source": { "type": "string", "minLength": 1 }
|
|
249
|
+
"source": { "type": "string", "minLength": 1 },
|
|
250
|
+
"returnsDisposer": { "type": "boolean" }
|
|
250
251
|
},
|
|
251
252
|
"additionalProperties": false
|
|
252
253
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Public API signatures for the UI authoring corpus
|
|
2
2
|
|
|
3
|
-
Generated from emitted declarations for `@kerfjs/ui@5.0.0-beta.
|
|
3
|
+
Generated from emitted declarations for `@kerfjs/ui@5.0.0-beta.118` and `kerfjs@5.0.0-beta.118`. This bounded reference covers only APIs used by the seven-task corpus. It is interface evidence, not an implementation or runtime guarantee.
|
|
4
4
|
|
|
5
5
|
## `@kerfjs/ui/css-values`
|
|
6
6
|
|
package/ai/skill.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: kerf-ui
|
|
3
3
|
description: Build interfaces with kerfjs and the @kerfjs/ui production component package. Use whenever code imports @kerfjs/ui or a task asks for Kerf UI components.
|
|
4
|
-
kerf-ui-skill-version: 1.
|
|
4
|
+
kerf-ui-skill-version: 1.65.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Building with @kerfjs/ui
|
|
8
8
|
|
|
9
|
+
Read the [consumer house grammar](../docs/interaction-conventions.md) before
|
|
10
|
+
composing a screen. Its defaults govern chrome, actions, lists, input, latency,
|
|
11
|
+
responsive layout, and roles. A project may deviate for a compelling reason
|
|
12
|
+
recorded in its own UI conventions document.
|
|
13
|
+
|
|
9
14
|
Read `../docs/component-selection.md` first, then the component reference index
|
|
10
15
|
`./components/README.md` and the `./components/<id>.md` page of every component
|
|
11
16
|
you use (selection, imports, props link, composition, state and wiring,
|
|
@@ -158,7 +163,8 @@ Pane override to imitate the Kerf UI UX demo.
|
|
|
158
163
|
children are custom properties named after the parent.
|
|
159
164
|
- **Missing configuration is a component gap.** When no prop gives you what
|
|
160
165
|
you need, report it (open an upstream feature request) instead of
|
|
161
|
-
overriding.
|
|
166
|
+
overriding. Follow the [consumer gap and exception workflow](../docs/ui-doctor.md#component-gaps-and-exception-budgets), including the shrinking doctor budget.
|
|
167
|
+
Your own components follow the same rule: expose configuration,
|
|
162
168
|
and let each component own its styles.
|
|
163
169
|
- **Thin compositions usually need no CSS.** A component that only chooses and
|
|
164
170
|
connects other components should configure their props and slots without a
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Web Awesome JSX signatures for the UI authoring corpus
|
|
2
2
|
|
|
3
|
-
Generated from the emitted `@kerfjs/ui@5.0.0-beta.
|
|
3
|
+
Generated from the emitted `@kerfjs/ui@5.0.0-beta.118` declaration boundary. Import `@kerfjs/ui/webawesome` for type effects when authoring direct `wa-*` JSX. The module emits no runtime behavior and does not register custom elements.
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
import { KerfCustomElement } from 'kerfjs/jsx-runtime';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Dark mode and theming checklist
|
|
2
|
+
|
|
3
|
+
Start with the package's semantic colors. Set one brand input with `--kui-color-brand` on `:root` and let the theme derive the ramp. When overriding a loud fill, set its matching `on-loud` foreground and check text and focus contrast in **both** schemes; `KUI-L018` catches an unpaired override but cannot judge the rendered contrast.
|
|
4
|
+
|
|
5
|
+
Use a component's `background`, `tint`, `tone`, or appearance prop for the surface it owns. A `Pane` tint needs an explicit `scheme`; Kerf does not infer it from the image or color. Do not recolor a component through its private variables or add a second lowered surface behind an already sunken component. Translucent lowered colors change when layered over another surface, so inspect the actual backdrop, including content scrolling beneath sticky chrome.
|
|
6
|
+
|
|
7
|
+
Before shipping, check:
|
|
8
|
+
|
|
9
|
+
- Light and dark appearance on the real page background, including raised, lowered, tinted, and image-backed regions.
|
|
10
|
+
- Normal, quiet, link, disabled, selected, danger, and `on-loud` text; focus rings and icons must remain visible over their actual fills.
|
|
11
|
+
- Sticky headers, menus, dialogs, and floating controls while content scrolls beneath them; a transparent or sunken token must not reveal distracting content or lose contrast.
|
|
12
|
+
- Forced colors, increased contrast, reduced transparency, and a scheme switch while a view is open. Drafts, focus, and scroll position should survive.
|
|
13
|
+
- Narrow and wide layouts, including clipping, overflow, and any appearance scope applied by an overlay.
|
|
14
|
+
|
|
15
|
+
See [theme tokens and color scopes](./webawesome-theme.md), [Pane background and tint](./layout.md#background-colors), [the evaluator's limits](./ui-evaluator.md#human-visual-review-stays-human), and [application testing](./testing-applications.md). A green analyzer or doctor run does not replace this visual pass.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Choosing a table or list
|
|
2
|
+
|
|
3
|
+
Choose by the relationship between items, not by the presence of rows:
|
|
4
|
+
|
|
5
|
+
| Need | Use |
|
|
6
|
+
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| Label–value facts about one object | `ValueTable` and `ValueTableRow`. Use `density="compact"` when the facts belong in a compact inspector. |
|
|
8
|
+
| A framed group of settings or actions with row dividers | `FramedList`. |
|
|
9
|
+
| Selectable summaries in a listbox | `SummaryRow`; let the owning listbox handle selection and keyboard movement. |
|
|
10
|
+
| Navigation, actions, or grouped content | `List` with the appropriate row component. `List` alone is layout, not an ARIA list or data grid. |
|
|
11
|
+
| Repeating records with aligned column headers and cells | A native `<table>` with `<th>` and `<td>`. Import `@kerfjs/ui/document.css` for the opt-in font baseline. |
|
|
12
|
+
| Many keyed, independently reactive rows | `bindList` from `kerfjs/list` when its row ownership or virtualization solves a measured need; compose the visible row with Kerf UI primitives. |
|
|
13
|
+
|
|
14
|
+
For a columnar table, keep semantic headers associated with their cells and give the table one horizontal scroll owner when it cannot fit. Preserve the first useful columns and make overflow discoverable; do not shrink labels and hit targets until they are illegible. A sticky header belongs to that scroll container, with an opaque surface over scrolling rows. Test it in WebKit as well as Chromium, including horizontal overflow and focus rings near the clip. At narrow widths, choose a deliberate column priority or an alternate summary presentation rather than hiding data silently.
|
|
15
|
+
|
|
16
|
+
Selection is application state. Use an ordinary selected row for one-item selection; use multiple-selection controls only when the task genuinely selects a set. Keep row actions in a `PopupMenu` and offer the same actions by context menu when the interaction calls for it. A row that merely navigates should remain a link. Preserve focus and selection through keyed updates, sorting, and filtering; show loading separately from an empty result.
|
|
17
|
+
|
|
18
|
+
See [component selection](./component-selection.md), [List geometry](./layout.md), [document baseline](./document-baseline.md), and [application testing](./testing-applications.md).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Forms and validation
|
|
2
|
+
|
|
3
|
+
Start with the [Composer Form recipe](./recipes.md#composer-form). Use one `List` for major section rhythm; give each field its own visible label and nearby hint. A `TextField` owns its label, hint, error, native input, and focus. Use `FieldLabel` for a read-only or click-to-edit field preview, and `ListInsetText` for supporting copy that needs the same text column. Let fields and action rows own their insets instead of wrapping the form in another padded card.
|
|
4
|
+
|
|
5
|
+
The application owns validation, draft state, permissions, and submission. Validate at the point where the person can act on a problem, keep an invalid field's specific error beside that field, and move focus to the first actionable error after a failed submit. Use a header-area `StateBanner` for a persistent form-level failure or recovery path. A toast suits a short confirmation, not an error that must remain available while the person edits. Never clear a draft or close a popup because unrelated state rerendered.
|
|
6
|
+
|
|
7
|
+
Keep an unavailable choice or action visible and disabled when that helps explain the current state; hide it only when the person has no access to the feature. Put Cancel before the trailing primary or destructive submit action, with space separating them. Use a native form submit button so Enter and browser form behavior work; preserve the draft on transport failure and prevent duplicate submissions while one is in flight. Test live values, `aria-invalid`, focus, and emitted events, not attributes alone.
|
|
8
|
+
|
|
9
|
+
See [accessibility contracts](./accessibility.md#textfield) for field behavior, [interaction conventions](./interaction-conventions.md) for dialog and action order, and [application testing](./testing-applications.md) for form assertions.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Kerf UI consumer house grammar
|
|
2
|
+
|
|
3
|
+
Use these defaults when composing an application with `@kerfjs/ui`. They govern the interface a person sees and uses; [component selection](component-selection.md) and the [component catalog](../ai/components/README.md) govern the exact exports and props. A project may deviate for a compelling product reason, recorded in its own UI conventions document. A local screenshot or one screen's CSS is not a new shared rule.
|
|
4
|
+
|
|
5
|
+
## Plan the surface
|
|
6
|
+
|
|
7
|
+
Name the person's task, the primary action, the regions, and each region's state and scroll owner before writing JSX. Choose the existing Kerf component for each role and compose it through public props, variants, and theme tokens. Give application components only domain behavior or structure the package does not provide. Components own their own styling; consumer CSS does not target `.kui-*` classes, rendered parts, or private variables. When a needed variation has no public API, request the prop, token, variant, or component in Kerf and keep the gap visible.
|
|
8
|
+
|
|
9
|
+
Use the spacing scale by relationship: 8px within a group, 16px between like groups, and 24px between distinct regions. Do not pad a `Pane` and its `ContentItem` children twice. Align text with text and icons with icons. Let empty space remain empty when it clarifies hierarchy. Read [layout](layout.md), [component contract](component-contract.md), and [design philosophy](design-philosophy.md) for the ownership and rationale.
|
|
10
|
+
|
|
11
|
+
## Chrome and hierarchy
|
|
12
|
+
|
|
13
|
+
- The primary toolbar owns page identity, navigation, the view switcher, and global actions. A secondary toolbar owns a section title and its nearby actions. The pane beneath them owns content. Do not repeat a toolbar title as an in-page heading.
|
|
14
|
+
- Compose headings with `Toolbar` and direct `ToolbarText`; group related controls with `ToolbarControlGroup`. Keep a control near the surface it affects. A panel's collapse toggle belongs with that panel, and exactly one control owns the action.
|
|
15
|
+
- A toolbar or dialog header has no decorative divider by default. Use a divider only for a real boundary, such as pinned chrome over scrolling content, with the component's documented API. Do not add persistent instruction copy to explain an ordinary control.
|
|
16
|
+
- Keep controls mounted when a capability or state temporarily disables them, so neighboring groups do not jump. Disable with a truthful explanation. Hide a control only when the whole capability is absent or the responsive composition deliberately moves it.
|
|
17
|
+
- Use `SegmentedControl` for a short exclusive view choice, in its own group. Put `SearchField` in the relevant toolbar and make it filter the visible collection. A search control is not a substitute for navigation.
|
|
18
|
+
|
|
19
|
+
## Actions, feedback, and dialogs
|
|
20
|
+
|
|
21
|
+
- Label a command that opens a dialog with an ellipsis: “Add Ticket…”. The dialog title names the task. For adding an object, use a “+ Thing” toolbar action and a dialog; do not leave an inline creation form in a collection view.
|
|
22
|
+
- Order dialog actions consistently. Cancel is the leading action, separated from the trailing primary action by a spacer. Negative actions precede positive actions. Mark a destructive action clearly and require confirmation only when undo or recovery cannot safely cover it.
|
|
23
|
+
- Use a toast for a transient confirmation. Use `StateBanner` in the affected region's header area for a persistent problem or status that requires attention. Show recovery beside the problem. Do not use a toast as the only record of failure.
|
|
24
|
+
- Distinguish an empty collection, no search matches, loading, missing setup, offline state, and an error. Never show “no items” while loading. The empty state states what can happen next and offers a relevant action when one exists.
|
|
25
|
+
- A user action should show its safe local consequence within 100 ms, then reconcile with authoritative data without flicker. Do not block a click on unrelated data. Preserve the pending action and report a rejection where it can be corrected.
|
|
26
|
+
|
|
27
|
+
## Lists and selection
|
|
28
|
+
|
|
29
|
+
- Use ordinary row selection for browsing. Checkboxes mean multi-selection for a bulk task, not the default way to open an item. Keep selected, focused, disabled, loading, and error cues distinct and accessible without color alone.
|
|
30
|
+
- Put secondary row actions in a meaningful “…” menu and expose the same actions through the row's context menu. Every actionable menu entry has an icon from the application's shared icon set. Double-click opens an editable item; always offer a keyboard and visible edit route too.
|
|
31
|
+
- Reordering uses drag and drop when the order has meaning. Supply an accessible keyboard route and visible position feedback. Do not expose internal database or provider IDs as ordinary row copy.
|
|
32
|
+
- Reuse a semantic component for the same feature in different contexts, with explicit presentation or read-only variants. A list row and a board card should keep the same identity and actions. An enabled control in a demo must work in its shipped parent composition.
|
|
33
|
+
|
|
34
|
+
## Text, state, and continuity
|
|
35
|
+
|
|
36
|
+
- Persist routine edits after a short debounce, and flush on blur, page hide, or an explicit finish. Keep the user's draft visible while saving and keep a scoped recovery copy. Do not add routine Save/Cancel buttons to an editor whose action is simply to persist text. Explicit submit controls are appropriate when creating an object or completing a workflow.
|
|
37
|
+
- Keystrokes update the controlled draft, never a network write on each character. Treat the value at edit start as the merge base so the user's own typing does not become a conflict. Recover the draft after navigation or reload when practical.
|
|
38
|
+
- Unrelated renders must not close a popup, move focus, reset a draft, replace selection, or jump scroll. Application signals own durable and user-visible interaction state; a `wire…` helper owns only the mechanics its API documents. Preserve node identity when meaning has not changed.
|
|
39
|
+
- Scope background synchronization separately from foreground blocking work. Keep the interface usable while data refreshes, and show a clear status only where it changes a decision.
|
|
40
|
+
|
|
41
|
+
## Responsive, platform, and roles
|
|
42
|
+
|
|
43
|
+
- Declare a desktop minimum and a collapse order for each composed screen. Measure the actual content region, not only the viewport. Protect readable text, recognizable icons, and usable targets. Relocate or hide secondary labels before shrinking icons or controls below their usable size.
|
|
44
|
+
- Use one scroll owner per region and check narrow, intermediate, wide, zoomed, keyboard, and reduced-motion states. Avoid clipped menus and dialogs; anchored surfaces retain their trigger relationship and stay inside the viewport.
|
|
45
|
+
- Keep the same mental model across platforms while using native platform language and behavior. Use one icon set through a shared renderer; decorative icons are hidden from assistive technology and icon-only controls have accessible names. Do not use emoji as UI icons.
|
|
46
|
+
- A restricted role sees the same interface with unavailable features explained or disabled according to capability. Do not invent a separate stripped-down product that changes navigation or identity. Important state must be expressed in text or structure, not color alone.
|
|
47
|
+
- Do not round money or other consequential values merely for visual neatness. Label AI-generated content and uncertainty where it matters, with nearby human review, edit, undo, or reject controls.
|
|
48
|
+
|
|
49
|
+
## Review a real composition
|
|
50
|
+
|
|
51
|
+
Exercise every rendered action in the production parent composition and its catalog specimen. Inspect wide and narrow browser renderings and state transitions, including loading, empty, error, open transient surfaces, focus, draft recovery, and delayed data when relevant. Reject clipped or unreachable content, inert enabled controls, lost drafts or focus, unannounced errors, excessive chrome, and a control whose visual treatment misstates its capability. See [accessibility](accessibility.md), [catalog authoring](catalog.md), and [design philosophy](design-philosophy.md).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Testing applications built with Kerf UI
|
|
2
|
+
|
|
3
|
+
Test the application as the user encounters it. A component's catalog example proves its own contract; it does not prove that a feature screen, dialog, or shell wires that component correctly.
|
|
4
|
+
|
|
5
|
+
## Unit tests: state, events, and lifetime
|
|
6
|
+
|
|
7
|
+
Use a DOM test environment such as happy-dom for fast composition tests. Reset global Kerf stores between cases with `clearStoreRegistry()` from `kerfjs/testing`, create a fresh mount root, and call every `mount()`, `delegate()`, and `wire*()` disposer during teardown. Assert that disposal stops subscriptions and listeners; remounting must not double-handle an action.
|
|
8
|
+
|
|
9
|
+
Drive the real control and assert the live state and emitted events. For form controls, read the live `value`, checked state, and focus, not just rendered attributes. Test both directions: a user change updates application state and dependent output; an application state change updates the control and its selected icon, badge, count, or other derived content. Then reset and edit again. For a selection or menu, exercise keyboard and pointer activation and assert which element has focus after dismissal.
|
|
10
|
+
|
|
11
|
+
Test loading, empty, error, and ready separately. A loading collection must not briefly announce an empty result. Assert that an unavailable action remains visible and disabled when that is the intended contract, and that a removed view's wiring can no longer act.
|
|
12
|
+
|
|
13
|
+
See [accessibility contracts](./accessibility.md) for each component's event, focus, and ARIA behavior, and the [composition recipes](./recipes.md) for disposer ownership.
|
|
14
|
+
|
|
15
|
+
## Browser tests: the shipped parent owns the proof
|
|
16
|
+
|
|
17
|
+
Use Playwright against each route or dialog that ships the control. Click and type through the actual parent composition, including its delegation root and wiring calls. Repeat a representative action after a rerender, navigation away and back, and a reset. An isolated demo is useful for component development but does not verify that the application parent installed or disposed its handlers.
|
|
18
|
+
|
|
19
|
+
Use real pointer events for dragging, resizing, and overlay dismissal. Assert meaningful geometry: the fitted panel reaches the declared minimum, drag start and end coordinates differ, a popup is reachable above clipping ancestors, and its hit target receives the click. Exercise keyboard focus and scrolling, especially while overlays open or rows move.
|
|
20
|
+
|
|
21
|
+
Capture and inspect wide, medium, and narrow layouts, then resize across a breakpoint while a view is live. Check title and control fit, clipping, scroll ownership, popup placement, focus visibility, and whether the user's draft survives the transition. Include WebKit for overflow, sticky content, and focus-ring behavior; a Chromium pass alone does not establish those browser-specific results. Check both color schemes where the surface supports them.
|
|
22
|
+
|
|
23
|
+
## What the evaluator proves
|
|
24
|
+
|
|
25
|
+
[`kerf-ui-evaluate`](./ui-evaluator.md) supplies objective browser diagnostics and retained screenshots. Its green exit does **not** judge hierarchy, rhythm, density, aesthetic fit, or the perceived clarity of alignment and scroll ownership. Review those screenshots in the actual application, record the states and viewports inspected, and fix visual defects before treating the work as complete.
|
package/docs/ui-doctor.md
CHANGED
|
@@ -16,9 +16,16 @@ The default terminal output is short and repair-oriented. `--format json` emits
|
|
|
16
16
|
|
|
17
17
|
The catalog stage discovers the package-default application UI profile and workspace/root-to-leaf directory layers. It validates referenced selection/composition catalogs and, when a workspace declares `package.json#kerfComponentCatalog`, invokes the installed `create-kerf-component` catalog checker to validate metadata, source exports, schema conformance, and generated-output drift. This checker reads source text; it does not import application modules.
|
|
18
18
|
|
|
19
|
+
### Project guidance pointer
|
|
20
|
+
|
|
21
|
+
The catalog stage also reports advisory `KUI-D041` when project instructions exist but none points to the installed UI retrieval order. Put a direct pointer to `.claude/skills/kerf-ui/SKILL.md` (or invoke `$kerf-ui`) in project guidance, or link to `node_modules/@kerfjs/ui/llms.txt`. The skill and `llms.txt` give agents the component selection and reference order before they write UI. A generic mention of `@kerfjs/ui` or `kerf-ui-doctor` does not satisfy this check.
|
|
22
|
+
|
|
23
|
+
The scan reads only `AGENTS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md` at the workspace and selected package roots, plus direct Markdown files in each root's `.cursor/rules/` directory. It does not recurse into source, dependency, or generated directories. If no such instruction file exists, or a file is unreadable, oversized, or the rules directory is unusually large, it makes no claim about the project's guidance and emits no warning. This lexical check cannot prove that an agent will follow the pointer; review the instructions themselves when that matters. Like other warnings, it is advisory under the default `--fail-on error` threshold.
|
|
24
|
+
An installed skill by itself does not clear the warning: project entry guidance still needs to direct readers to it.
|
|
25
|
+
|
|
19
26
|
For `--root <workspace> --package <name>`, the analyzer and ESLint stages use that same workspace root to resolve the root profile, nested directory profiles, catalogs, and workspace-relative exception targets. They inspect only the selected package's source files. Keep a workspace profile at the root with `"scope": "workspace"`; a package-local profile under it uses `"scope": "directory"`. An authored doctor config may live in the package and be passed with `--config` relative to the workspace root.
|
|
20
27
|
|
|
21
|
-
TypeScript uses the compiler API with `noEmit`. ESLint loads the installed `eslint-plugin-kerfjs` `recommended-ui` preset (`--eslint strict-ui` opts into advisory rules as errors). This is deliberately an isolated Kerf lint pass rather than the consumer's complete ESLint configuration. For each file, the doctor projects the applicable core ESLint rules and `linterOptions` from the consumer configuration so core-rule suppression directives retain
|
|
28
|
+
TypeScript uses the compiler API with `noEmit`. ESLint loads the installed `eslint-plugin-kerfjs` `recommended-ui` preset (`--eslint strict-ui` opts into advisory rules as errors). This is deliberately an isolated Kerf lint pass rather than the consumer's complete ESLint configuration. For each file, the doctor projects the applicable core ESLint rules, `languageOptions.globals`, and `linterOptions` from the consumer configuration so `no-undef` recognizes declared globals and core-rule suppression directives retain their used/unused semantics. Consumer plugin rules are not executed, and inline directives for plugins such as `@typescript-eslint` therefore do not produce false "rule definition not found" diagnostics; the consumer's normal ESLint command remains authoritative for those rules. Unknown `kerfjs/*` directives still fail the doctor pass. Stable KUI identifiers come from the packaged `application-ui-diagnostic-ids-v1.json` registry; the doctor also reads installed ESLint message metadata for semantic conflict detection instead of duplicating rule definitions. The analyzer calls the public `@kerfjs/ui/analyzer` contract. None of these stages executes generated application code.
|
|
22
29
|
|
|
23
30
|
Composition findings come from the same catalogs. `KUI-L201`–`KUI-L203`
|
|
24
31
|
report a cataloged component under a disallowed parent, a zone child the zone
|
|
@@ -276,6 +283,22 @@ A suppression requires a stable id, one or more exact diagnostic ids, an exact p
|
|
|
276
283
|
|
|
277
284
|
KUI suppression ids are checked against the analyzer, evaluator, doctor, installed ESLint-rule metadata, and diagnostics emitted by available tools. An unknown or stale id is a configuration error rather than a silent no-op. TypeScript `TS####` and namespaced `eslint:*` ids remain valid even when that particular run does not emit them.
|
|
278
285
|
|
|
286
|
+
### Component gaps and exception budgets
|
|
287
|
+
|
|
288
|
+
When a needed appearance or behavior cannot be expressed through a Kerf component's public props, slots, or documented composition, first check the current component reference and selection guide. If the capability is still missing, record a component-gap request upstream with the task, affected component, desired public contract, and a small reproduction. Link that request from the application task. Do not bypass the component with a local CSS selector, private token, raw discouraged element, or a diagnostic suppression. Keep the application task blocked on the upstream capability and ask the maintainer for a decision if timing or design must change. This applies even when a visual request comes directly from a maintainer; the missing package capability remains a separate decision.
|
|
289
|
+
|
|
290
|
+
Projects using Hot Sheet can create the upstream request in the Kerf store, for example:
|
|
291
|
+
|
|
292
|
+
```sh
|
|
293
|
+
hotsheet-cli -C <kerf-store> new --category feature \
|
|
294
|
+
--title 'Expose <capability> on <component>' \
|
|
295
|
+
--details '<use case, current limitation, proposed public contract, reproduction>'
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
When the Kerf capability ships, upgrade in [lockstep](./upgrading.md), remove the local workaround or exception, and close the linked application task against the public API. If a project deliberately chooses a different design, document that project-level convention and give any necessary profile exception an exact target, rationale, owner, and removal condition. An exception documents a reviewed deviation; it does not turn a component gap into a supported API.
|
|
299
|
+
|
|
300
|
+
Keep the doctor at `"failOn": "warning"` for a zero-warning gate. Treat suppressions, profile exceptions, and any accepted warning or review count as a **shrinking budget**: each cleanup should reduce them; an upgrade should never expand them. Review any proposed replacement explicitly, keep it source-located and temporary, and remove stale entries as soon as the public capability or code change makes them unnecessary. If a new finding cannot be repaired within the existing budget, keep the application task blocked for a maintainer decision. A green doctor report with suppressed findings is not a zero-debt report.
|
|
301
|
+
|
|
279
302
|
The content-addressed cache lives at `.kerf-cache/ui-doctor-v1.json`. Its key covers selected source/config/catalog JSON, package manifests, root and package lockfiles, mode, paths, and configuration. Browser results are never cached. Use `--no-cache` when investigating tool installation changes not yet reflected in a lockfile.
|
|
280
303
|
|
|
281
304
|
Reports replace the workspace's absolute path with `<repo-root>` and express in-workspace files as portable relative paths. External paths are reduced to `<external>/<basename>`. URLs are excluded from the cache key. Tool messages and evidence receive the same root redaction before output or caching.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Upgrading Kerf in an application
|
|
2
|
+
|
|
3
|
+
`kerfjs`, `@kerfjs/ui`, `eslint-plugin-kerfjs`, and `create-kerf-component` release in lockstep. Keep all four at **one exact version** in the consuming package (in the dependency section appropriate to each package), commit the lockfile, and assert the four declarations are equal in a small manifest test. Do not let a caret range quietly upgrade one member ahead of the others. Check the installed tree with your package manager after installation as well as the declarations.
|
|
4
|
+
|
|
5
|
+
For example, a Node test in `tests/kerf-versions.test.mjs` can read `package.json`, collect those four names from `dependencies` and `devDependencies`, assert that all four exist, match an exact semver string, and form a set of size one. Put that test in the application's normal check gate.
|
|
6
|
+
|
|
7
|
+
## Upgrade sequence
|
|
8
|
+
|
|
9
|
+
1. Choose a released version and update all four declarations together. Install with the project's package manager and inspect the resulting lockfile and `npm ls kerfjs @kerfjs/ui eslint-plugin-kerfjs create-kerf-component --depth=0` (or its pnpm/Yarn equivalent). Keep the package-version assertion in the regular check gate.
|
|
10
|
+
2. Run `npx kerfjs@<version> setup --ui` as a dry run for the selected application package. Review every proposed change and resolve authored conflicts deliberately. Then apply with `npx kerfjs@<version> setup --ui --write --yes`, retaining any required `--package` and `--resolve` options. The running setup version must match the installed `kerfjs`; a `kerfjs-version` conflict means the versions differ.
|
|
11
|
+
3. Regenerate the consuming application's catalog with `npm run catalog:generate` and check it with `npm run catalog:check`. Review generated changes rather than editing the projection by hand. Run `npm run kerf:check`, the application's own lint, type, unit, and browser suites, and inspect affected screens in both wide and narrow layouts.
|
|
12
|
+
4. Re-read the installed [`ai/skill.md`](../ai/skill.md), [`llms.txt`](../llms.txt), [component selection](./component-selection.md), and the release changelog. Check whether new Kerf primitives replace local code or newly `Discouraged` Web Awesome elements. Remove workarounds, CSS overrides, doctor suppressions, and profile exceptions made obsolete by this version; rerun the gate after each cleanup.
|
|
13
|
+
|
|
14
|
+
For a workspace, run setup and checks against each consuming package, using `--package` where discovery finds more than one candidate. Record any remaining exception with its owner and removal condition.
|
|
@@ -10,12 +10,16 @@ export function isForeignRuleDefinitionDiagnostic(
|
|
|
10
10
|
export interface ConsumerEslintConfigLike {
|
|
11
11
|
rules?: Record<string, unknown>;
|
|
12
12
|
linterOptions?: Record<string, unknown>;
|
|
13
|
+
languageOptions?: Record<string, unknown> & {
|
|
14
|
+
globals?: Record<string, unknown>;
|
|
15
|
+
};
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export interface ProjectedConsumerCoreConfig {
|
|
16
19
|
files: string[];
|
|
17
20
|
rules?: Record<string, unknown>;
|
|
18
21
|
linterOptions?: Record<string, unknown>;
|
|
22
|
+
languageOptions?: { globals: Record<string, unknown> };
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export function projectConsumerCoreConfig(
|
|
@@ -15,10 +15,15 @@ export function projectConsumerCoreConfig(config, file) {
|
|
|
15
15
|
const linterOptions = config?.linterOptions
|
|
16
16
|
? { ...config.linterOptions }
|
|
17
17
|
: undefined;
|
|
18
|
-
|
|
18
|
+
const globals = config?.languageOptions?.globals
|
|
19
|
+
? { ...config.languageOptions.globals }
|
|
20
|
+
: undefined;
|
|
21
|
+
if (Object.keys(rules).length === 0 && !linterOptions && !globals)
|
|
22
|
+
return undefined;
|
|
19
23
|
return {
|
|
20
24
|
files: [file],
|
|
21
25
|
...(Object.keys(rules).length > 0 ? { rules } : {}),
|
|
22
26
|
...(linterOptions ? { linterOptions } : {}),
|
|
27
|
+
...(globals ? { languageOptions: { globals } } : {}),
|
|
23
28
|
};
|
|
24
29
|
}
|
package/doctor/index.mjs
CHANGED
|
@@ -29,6 +29,10 @@ import {
|
|
|
29
29
|
import { evaluateUi, UI_EVALUATION_RULES } from '../evaluator/index.mjs';
|
|
30
30
|
import { checkComponentStyles } from './component-style-checks.mjs';
|
|
31
31
|
import { checkCopyCapitalization } from './copy-capitalization-checks.mjs';
|
|
32
|
+
import {
|
|
33
|
+
checkProjectGuidance,
|
|
34
|
+
collectProjectGuidanceFiles,
|
|
35
|
+
} from './project-guidance-checks.mjs';
|
|
32
36
|
import {
|
|
33
37
|
isForeignRuleDefinitionDiagnostic,
|
|
34
38
|
projectConsumerCoreConfig,
|
|
@@ -68,6 +72,10 @@ export const UI_DOCTOR_RULES = Object.freeze({
|
|
|
68
72
|
severity: 'warning',
|
|
69
73
|
title: 'Visible label is not title-style capitalized',
|
|
70
74
|
},
|
|
75
|
+
'KUI-D041': {
|
|
76
|
+
severity: 'warning',
|
|
77
|
+
title: 'Project guidance omits the UI retrieval order',
|
|
78
|
+
},
|
|
71
79
|
});
|
|
72
80
|
|
|
73
81
|
const sourceExtensions = new Set([
|
|
@@ -497,6 +505,8 @@ async function installedPackageVersion(root, name) {
|
|
|
497
505
|
|
|
498
506
|
async function cacheKey(root, packageRoot, mode, paths, config) {
|
|
499
507
|
const files = await collectInputs(packageRoot);
|
|
508
|
+
const guidance = await collectProjectGuidanceFiles(root, packageRoot);
|
|
509
|
+
files.push(...guidance.files.filter((path) => !files.includes(path)));
|
|
500
510
|
const profileDirectories = [];
|
|
501
511
|
let directory = packageRoot;
|
|
502
512
|
while (directory === root || !relative(root, directory).startsWith('..')) {
|
|
@@ -555,6 +565,7 @@ async function cacheKey(root, packageRoot, mode, paths, config) {
|
|
|
555
565
|
mode,
|
|
556
566
|
paths,
|
|
557
567
|
config,
|
|
568
|
+
guidanceScanComplete: guidance.complete,
|
|
558
569
|
toolVersions,
|
|
559
570
|
}),
|
|
560
571
|
)
|
|
@@ -562,6 +573,7 @@ async function cacheKey(root, packageRoot, mode, paths, config) {
|
|
|
562
573
|
for (const module of [
|
|
563
574
|
'component-style-checks.mjs',
|
|
564
575
|
'copy-capitalization-checks.mjs',
|
|
576
|
+
'project-guidance-checks.mjs',
|
|
565
577
|
])
|
|
566
578
|
hash.update(
|
|
567
579
|
await readFile(resolve(dirname(fileURLToPath(import.meta.url)), module)),
|
|
@@ -1221,6 +1233,7 @@ export async function runUiDoctor({
|
|
|
1221
1233
|
normalizeProfile(item, root),
|
|
1222
1234
|
),
|
|
1223
1235
|
...local.diagnostics,
|
|
1236
|
+
...(await checkProjectGuidance(root, packageRoot)),
|
|
1224
1237
|
],
|
|
1225
1238
|
detail: local.detail,
|
|
1226
1239
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UiDoctorDiagnostic } from './index.mjs';
|
|
2
|
+
|
|
3
|
+
export function collectProjectGuidanceFiles(
|
|
4
|
+
root: string,
|
|
5
|
+
packageRoot?: string,
|
|
6
|
+
): Promise<{ files: string[]; complete: boolean }>;
|
|
7
|
+
|
|
8
|
+
export function checkProjectGuidance(
|
|
9
|
+
root: string,
|
|
10
|
+
packageRoot?: string,
|
|
11
|
+
): Promise<UiDoctorDiagnostic[]>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { lstat, readFile, readdir } from 'node:fs/promises';
|
|
2
|
+
import { relative, resolve } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const DIRECT_FILES = [
|
|
5
|
+
'AGENTS.md',
|
|
6
|
+
'CLAUDE.md',
|
|
7
|
+
'.github/copilot-instructions.md',
|
|
8
|
+
];
|
|
9
|
+
const MAX_RULE_FILES = 64;
|
|
10
|
+
const MAX_FILE_BYTES = 256 * 1024;
|
|
11
|
+
|
|
12
|
+
// Look for a usable retrieval pointer, not a passing mention of the package.
|
|
13
|
+
const UI_GUIDANCE_POINTER =
|
|
14
|
+
/(?:\$kerf-ui\b|(?:node_modules\/)?@kerfjs\/ui\/llms\.txt\b|(?:\.claude|\.agents|\.codex)\/skills\/kerf-ui(?:\/SKILL\.md)?\b)/;
|
|
15
|
+
|
|
16
|
+
async function regularFile(path) {
|
|
17
|
+
try {
|
|
18
|
+
const info = await lstat(path);
|
|
19
|
+
if (info.isSymbolicLink()) throw new Error('Symlinked guidance file');
|
|
20
|
+
return info.isFile() ? info : undefined;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (error.code === 'ENOENT') return undefined;
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Return an incomplete result rather than guess when a scan is unsafe or partial. */
|
|
28
|
+
export async function collectProjectGuidanceFiles(root, packageRoot = root) {
|
|
29
|
+
const directories = [...new Set([root, packageRoot])];
|
|
30
|
+
const files = [];
|
|
31
|
+
try {
|
|
32
|
+
for (const directory of directories) {
|
|
33
|
+
for (const name of DIRECT_FILES) {
|
|
34
|
+
const path = resolve(directory, name);
|
|
35
|
+
const info = await regularFile(path);
|
|
36
|
+
if (info) {
|
|
37
|
+
if (info.size > MAX_FILE_BYTES) return { files: [], complete: false };
|
|
38
|
+
files.push(path);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const rulesDirectory = resolve(directory, '.cursor/rules');
|
|
42
|
+
let rulesInfo;
|
|
43
|
+
try {
|
|
44
|
+
rulesInfo = await lstat(rulesDirectory);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error.code === 'ENOENT') continue;
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
if (!rulesInfo.isDirectory()) return { files: [], complete: false };
|
|
50
|
+
const rules = await readdir(rulesDirectory, { withFileTypes: true });
|
|
51
|
+
if (rules.length > MAX_RULE_FILES) return { files: [], complete: false };
|
|
52
|
+
for (const entry of rules) {
|
|
53
|
+
if (!entry.isFile() || !/\.mdc?$/.test(entry.name)) continue;
|
|
54
|
+
const path = resolve(rulesDirectory, entry.name);
|
|
55
|
+
const info = await regularFile(path);
|
|
56
|
+
if (!info || info.size > MAX_FILE_BYTES)
|
|
57
|
+
return { files: [], complete: false };
|
|
58
|
+
files.push(path);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { files: files.sort(), complete: true };
|
|
62
|
+
} catch {
|
|
63
|
+
return { files: [], complete: false };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function checkProjectGuidance(root, packageRoot = root) {
|
|
68
|
+
const { files, complete } = await collectProjectGuidanceFiles(
|
|
69
|
+
root,
|
|
70
|
+
packageRoot,
|
|
71
|
+
);
|
|
72
|
+
if (!complete || !files.length) return [];
|
|
73
|
+
try {
|
|
74
|
+
for (const path of files)
|
|
75
|
+
if (UI_GUIDANCE_POINTER.test(await readFile(path, 'utf8'))) return [];
|
|
76
|
+
} catch {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
const locations = files.map((path) =>
|
|
80
|
+
relative(root, path).replaceAll('\\', '/'),
|
|
81
|
+
);
|
|
82
|
+
return [
|
|
83
|
+
{
|
|
84
|
+
id: 'KUI-D041',
|
|
85
|
+
severity: 'warning',
|
|
86
|
+
stage: 'catalog',
|
|
87
|
+
message:
|
|
88
|
+
'Project instructions do not point to the installed Kerf UI retrieval order.',
|
|
89
|
+
location: { file: locations[0], line: 1, column: 1 },
|
|
90
|
+
evidence: { instructionFiles: locations },
|
|
91
|
+
action:
|
|
92
|
+
'Point project guidance to `.claude/skills/kerf-ui/SKILL.md` or `node_modules/@kerfjs/ui/llms.txt` before UI work.',
|
|
93
|
+
documentation: '@kerfjs/ui/docs/ui-doctor.md#project-guidance-pointer',
|
|
94
|
+
meaning: 'Project guidance omits the UI retrieval order',
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
}
|
package/llms.txt
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
> state and wires stable `data-action` hooks once. This file orients an LLM to
|
|
6
6
|
> generate correct, good-looking kerf UI — it is not a catalog to browse.
|
|
7
7
|
|
|
8
|
+
Read the [consumer house grammar](./docs/interaction-conventions.md) before
|
|
9
|
+
composing an application screen. It states the default interaction and layout
|
|
10
|
+
decisions; a project records compelling deviations in its own conventions doc.
|
|
11
|
+
|
|
8
12
|
```bash
|
|
9
13
|
npm install kerfjs @kerfjs/ui # kerfjs is a peer; Web Awesome is an optional peer
|
|
10
14
|
```
|
|
@@ -981,6 +985,13 @@ shell, `@kerfjs/ui/collapsible-panel` (`CollapsiblePanel`, `CollapsiblePanelTogg
|
|
|
981
985
|
|
|
982
986
|
- [skill.md](./ai/skill.md): the full rule set + a common-mistakes table (the shipped AI skill).
|
|
983
987
|
- [design-philosophy.md](./docs/design-philosophy.md): why kerf UI is shaped this way — the decision principles behind the rules above.
|
|
988
|
+
- [interaction-conventions.md](./docs/interaction-conventions.md): the consumer house grammar for chrome, actions, lists, input, responsive layout, roles, and review.
|
|
989
|
+
- [testing-applications.md](./docs/testing-applications.md): unit and browser evidence through shipped application parents, lifecycle assertions, and evaluator limits.
|
|
990
|
+
- [upgrading.md](./docs/upgrading.md): the consumer checklist for lockstep package upgrades, setup, catalog regeneration, and cleanup.
|
|
991
|
+
- [ui-doctor.md#component-gaps-and-exception-budgets](./docs/ui-doctor.md#component-gaps-and-exception-budgets): how to raise missing component capabilities and govern doctor exceptions.
|
|
992
|
+
- [forms-and-validation.md](./docs/forms-and-validation.md): field layout, error placement, submission, and draft continuity.
|
|
993
|
+
- [data-tables-and-lists.md](./docs/data-tables-and-lists.md): choose ValueTable, FramedList, SummaryRow, List, a native table, or `bindList`.
|
|
994
|
+
- [dark-mode-checklist.md](./docs/dark-mode-checklist.md): review semantic color, tint, contrast, overlays, and scheme changes on real backdrops.
|
|
984
995
|
- [writing.md](./docs/writing.md): interface copy — the title-style vs. sentence-style capitalization rule per element, from Apple's guidance.
|
|
985
996
|
- [layout.md](./docs/layout.md): the pane/content-item geometry, public roles/tokens, and the spacing scale.
|
|
986
997
|
- [component-contract.md](./docs/component-contract.md): what a component owns vs. what the app owns.
|