@nextop-os/ui-system 0.0.16 → 0.0.17

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/AGENTS.md ADDED
@@ -0,0 +1,84 @@
1
+ # AGENTS.md
2
+
3
+ ## Scope
4
+
5
+ This file applies to `packages/ui/system/*`.
6
+
7
+ `packages/ui/system` is the source package for `@nextop-os/ui-system`, the
8
+ shared Nextop UI component library. It owns shared CSS tokens, theme styles,
9
+ icon exports, presentation primitives, reusable host-agnostic business display
10
+ components, component metadata, storyboard inventory, and the bundled
11
+ `nextop-ui-system` agent skill.
12
+
13
+ Before changing components, icons, metadata, styles, storyboard examples, or
14
+ the bundled skill, read
15
+ [UI_SYSTEM_GUIDELINES.md](/Users/zhengweibin/Desktop/team-shell/nextop/packages/ui/system/UI_SYSTEM_GUIDELINES.md).
16
+
17
+ ## Public API
18
+
19
+ Stable public imports are:
20
+
21
+ - `@nextop-os/ui-system`
22
+ - `@nextop-os/ui-system/components`
23
+ - `@nextop-os/ui-system/metadata`
24
+ - `@nextop-os/ui-system/icons`
25
+ - `@nextop-os/ui-system/styles.css`
26
+ - `@nextop-os/ui-system/utils`
27
+
28
+ Rules:
29
+
30
+ - prefer adding exports to an existing public barrel before introducing a new
31
+ public subpath
32
+ - do not expose `src/*` layout as public API
33
+ - do not encourage per-file deep imports such as
34
+ `@nextop-os/ui-system/components/button`
35
+ - if package exports change intentionally, update both the package exports and
36
+ the UI-boundary check script
37
+
38
+ ## Component Library Rules
39
+
40
+ - keep `base` components low-level, generic, and
41
+ frontend-foundation-focused
42
+ - allow `business` components only when they are reusable business display
43
+ components that remain host-agnostic and side-effect-free
44
+ - business components may expose domain display props such as workspace, file,
45
+ task, agent, status, permission, and callbacks, but must not own daemon,
46
+ Electron, router, store, query, filesystem, persistence, or workflow calls
47
+ - before promoting a business component, scan source usage, build a
48
+ code-evidence state matrix, and generate a temporary preview outside the
49
+ repository for user review
50
+ - business components should compose `base` primitives instead of recreating
51
+ buttons, fields, dialogs, cards, icons, or overlays
52
+ - treat this package as the shared shadcn and Radix host package
53
+ - when a primitive exists in the shadcn registry, acquire it through shadcn CLI
54
+ targeted at this package instead of handwriting the component body
55
+ - keep `components.json` and package aliases usable enough that CLI download
56
+ remains the default path for shared primitives
57
+ - after CLI acquisition, limit edits to narrow package-specific adaptation such
58
+ as icon routing, import aliases, stable exports, and boundary-check fixes
59
+ - keep CSS variables as the source of truth for token values
60
+ - prefer semantic token naming over raw palette leakage in public APIs
61
+ - keep helper exports minimal and tied to primitive support, not general
62
+ convenience reuse
63
+ - build primitives for a calm workbench shell, not for marketing-card theatrics
64
+ - every public component, icon, utility, or style entry must have metadata with
65
+ a stable readable `id` and `layer`
66
+ - use the single `nextop-ui-system` skill for component reuse, extraction,
67
+ base/business classification, metadata, and storyboard work
68
+
69
+ ## Validation
70
+
71
+ - Run `pnpm typecheck`
72
+ - Run `pnpm check:ui-boundaries`
73
+ - If component metadata changed, run `node tools/scripts/check-ui-metadata.mjs`
74
+ - If storyboard inventory changed, run
75
+ `pnpm --filter @nextop-os/ui-storyboard typecheck`
76
+ - If a change affects desktop integration, also run
77
+ `pnpm --filter @nextop-os/desktop build`
78
+
79
+ ## Related Docs
80
+
81
+ - [UI_SYSTEM_GUIDELINES.md](/Users/zhengweibin/Desktop/team-shell/nextop/packages/ui/system/UI_SYSTEM_GUIDELINES.md)
82
+ - [docs/conventions/ui-system.md](/Users/zhengweibin/Desktop/team-shell/nextop/docs/conventions/ui-system.md)
83
+ - [docs/conventions/desktop-visual-language.md](/Users/zhengweibin/Desktop/team-shell/nextop/docs/conventions/desktop-visual-language.md)
84
+ - [docs/conventions/local-git-hooks.md](/Users/zhengweibin/Desktop/team-shell/nextop/docs/conventions/local-git-hooks.md)
package/README.md CHANGED
@@ -42,6 +42,11 @@ source files into `.nextop-ui-system-dev/` and aliases the stable package
42
42
  entrypoints to that cache. When the dev server is unavailable, resolution falls
43
43
  back to the installed package in `node_modules`.
44
44
 
45
+ Temporary agent previews should use this same dev-server path instead of
46
+ hardcoding local checkout paths. Generate the preview outside the repository,
47
+ configure its Vite app with `nextopUISystemDev({ serverUrl })`, and import
48
+ components, icons, styles, and utilities through the stable public entrypoints.
49
+
45
50
  Add the generated cache to the external app's `.gitignore`:
46
51
 
47
52
  ```text
@@ -65,15 +70,18 @@ import { uiSystemMetadata } from "@nextop-os/ui-system/metadata";
65
70
  ```
66
71
 
67
72
  When promoting business UI into this package, use the bundled
68
- `agent/nextop-ui-system/SKILL.md` skill when it is available. The durable rules
73
+ `agent/nextop-ui-system/SKILL.md` skill when it is available. In the source
74
+ checkout, also read `AGENTS.md` and `UI_SYSTEM_GUIDELINES.md`. The durable rules
69
75
  are:
70
76
 
71
77
  1. prefer existing metadata entries before creating a component
72
78
  2. classify the component as `base` or `business`
73
79
  3. keep business components host-agnostic and side-effect-free
74
- 4. compose business components from base primitives
75
- 5. add metadata, stable exports, and storyboard examples for public UI
76
- 6. run metadata and boundary validation before shipping
80
+ 4. before promoting a business component, scan source usage and generate a
81
+ temporary preview outside the repository for user review
82
+ 5. compose business components from base primitives
83
+ 6. add metadata, stable exports, and storyboard examples for public UI
84
+ 7. run metadata and boundary validation before shipping
77
85
 
78
86
  External repositories can install the bundled skill into their local Codex
79
87
  skill directory with one command:
@@ -0,0 +1,148 @@
1
+ # Nextop UI System Guidelines
2
+
3
+ This document is the shared component-library rulebook for
4
+ `@nextop-os/ui-system`. Both `packages/ui/system/AGENTS.md` and the bundled
5
+ `packages/ui/system/agent/nextop-ui-system` skill should point here before
6
+ component extraction, reuse, metadata, or storyboard work.
7
+
8
+ ## Role
9
+
10
+ `@nextop-os/ui-system` owns host-agnostic UI foundations:
11
+
12
+ - CSS tokens and theme styles
13
+ - icon exports
14
+ - shadcn-derived and Radix-backed base primitives
15
+ - reusable business display components
16
+ - component metadata and storyboard inventory
17
+ - small utilities that directly support primitives
18
+
19
+ It does not own business logic, app-specific workflows, daemon or Electron
20
+ calls, routing, persistence, query/cache mutation, filesystem access, global
21
+ store ownership, or workflow orchestration.
22
+
23
+ ## Stable Public Imports
24
+
25
+ Use only these public imports from consumers:
26
+
27
+ - `@nextop-os/ui-system`
28
+ - `@nextop-os/ui-system/components`
29
+ - `@nextop-os/ui-system/metadata`
30
+ - `@nextop-os/ui-system/icons`
31
+ - `@nextop-os/ui-system/styles.css`
32
+ - `@nextop-os/ui-system/utils`
33
+
34
+ Do not import from `@nextop-os/ui-system/src/*` or per-file component paths.
35
+ When a new export is needed, prefer an existing barrel before adding a new
36
+ public subpath. If public exports change, update package exports and the
37
+ UI-boundary check script together.
38
+
39
+ ## Component Layers
40
+
41
+ `base` components are low-level presentation or interaction primitives. Their
42
+ public API should avoid domain nouns and focus on variants, refs, slots,
43
+ children, class names, accessibility, and generic interaction.
44
+
45
+ `business` components are reusable display surfaces for shared business
46
+ concepts. They may expose domain display props such as workspace, file, task,
47
+ agent, run, status, permission, labels, and callbacks. They must stay
48
+ host-agnostic and side-effect-free.
49
+
50
+ Business components should compose `base` primitives instead of recreating
51
+ buttons, fields, dialogs, cards, icons, menus, or overlays.
52
+
53
+ ## Primitive Acquisition
54
+
55
+ Treat this package as the shared shadcn and Radix host package.
56
+
57
+ - When a primitive exists in the shadcn registry, acquire it through shadcn CLI
58
+ targeted at `packages/ui/system`.
59
+ - Keep `components.json` and package aliases usable enough that CLI download
60
+ remains the default path for shared primitives.
61
+ - After CLI acquisition, limit edits to package-specific adaptation such as
62
+ icon routing, import aliases, stable exports, token alignment, metadata, and
63
+ boundary-check fixes.
64
+
65
+ ## Visual And Token Rules
66
+
67
+ - Keep CSS variables as the source of truth for token values.
68
+ - Prefer semantic token names over raw palette leakage in public APIs.
69
+ - Build primitives for a calm workbench shell, not for marketing-card
70
+ theatrics.
71
+ - Reusable packages outside `packages/ui/*` should consume
72
+ `@nextop-os/ui-system` primitives and token-backed Tailwind utilities before
73
+ adding package-local CSS.
74
+ - If repeated package-local CSS needs emerge, move the shared foundation into
75
+ `@nextop-os/ui-system`.
76
+
77
+ ## Metadata And Storyboard
78
+
79
+ Every public UI-system component, icon, utility, or style entry must have
80
+ metadata with:
81
+
82
+ - stable readable `id`
83
+ - `layer` as `base` or `business`
84
+ - `source` under `packages/ui/system/src`
85
+ - stable public `from` entrypoint
86
+
87
+ Keep component ids globally unique and kebab-case. Storyboard inventory should
88
+ stay grouped by `Foundation`, `Base Components`, and `Business Components`.
89
+ Visible component stories should support copying the component id.
90
+
91
+ For business components, add storyboard examples for normal, empty, disabled,
92
+ loading, and error-like states when those states exist in the public contract.
93
+
94
+ ## Promotion Checklist
95
+
96
+ Before promoting local UI into this package, scan the source usage and create a
97
+ preflight state preview:
98
+
99
+ - inspect the source component, call sites, conditional rendering, props, types,
100
+ tests, mocks, and relevant i18n keys
101
+ - build a state matrix from code evidence; for each state, record the state
102
+ name, source file or branch, props or data needed, host-owned behavior, and
103
+ whether it belongs in the shared component contract
104
+ - generate a temporary preview outside the repository, such as under
105
+ `$TMPDIR/nextop-ui-system-preview-<component-id>/`
106
+ - start the UI-system dev server with
107
+ `pnpm --filter @nextop-os/ui-system dev:server`, or verify an existing server
108
+ by probing `/health`
109
+ - configure the temporary Vite preview with
110
+ `nextopUISystemDev({ serverUrl })` from `@nextop-os/ui-system/dev-vite`
111
+ instead of hardcoding checkout paths
112
+ - import UI-system components, icons, styles, and utilities through stable
113
+ public entrypoints; use the local state matrix file or `/components` for
114
+ metadata context
115
+ - render all candidate states in that preview using a draft component or copied
116
+ visual surface
117
+ - start a local preview URL and get user confirmation before writing the
118
+ component into `packages/ui/system`
119
+
120
+ Do not put draft preview files in the Nextop checkout. The temporary preview is
121
+ a visual review gate, not part of the package source.
122
+
123
+ Before promotion, identify:
124
+
125
+ - component `id` and `layer`
126
+ - source usage being replaced
127
+ - intended reuse surfaces
128
+ - public props and callbacks
129
+ - host-owned state and side effects that remain outside the component
130
+ - state matrix summary and temporary preview URL
131
+ - export path, metadata entry, storyboard states, and validation commands
132
+
133
+ Prefer existing metadata entries before creating a component. Replace only the
134
+ visual surface with stable UI-system imports; keep host state, data loading,
135
+ routing, daemon calls, i18n keys, and business transforms in the caller.
136
+
137
+ ## Validation
138
+
139
+ Run the smallest relevant checks and report exact commands and results:
140
+
141
+ ```bash
142
+ node tools/scripts/check-ui-metadata.mjs
143
+ pnpm check:ui-boundaries
144
+ pnpm --filter @nextop-os/ui-storyboard typecheck
145
+ ```
146
+
147
+ If runtime component code changed, also run the relevant package typecheck or
148
+ build for the consumer that was migrated.
@@ -1,21 +1,22 @@
1
1
  ---
2
2
  name: nextop-ui-system
3
- description: Use when working with @nextop-os/ui-system components, replacing local UI with shared components, querying component ids or metadata, promoting business UI into shared base or business components, or maintaining UI-system storyboard inventory.
3
+ description: Use when working with @nextop-os/ui-system components, replacing local UI with shared components, querying component ids or metadata, promoting UI into shared base or business components, or maintaining UI-system storyboard inventory.
4
4
  ---
5
5
 
6
6
  # Nextop UI System
7
7
 
8
- Use this skill as the single entrypoint for `@nextop-os/ui-system` use,
9
- promotion, metadata, and storyboard work.
8
+ Use this skill as the single entrypoint for `@nextop-os/ui-system` component
9
+ reuse, extraction, promotion, metadata, and storyboard work.
10
10
 
11
11
  ## Source Of Truth
12
12
 
13
13
  Read these before editing:
14
14
 
15
15
  1. nearest `AGENTS.md` for the target code
16
- 2. `packages/ui/AGENTS.md`
17
- 3. `docs/conventions/ui-system.md`
18
- 4. component metadata from the first available source:
16
+ 2. `packages/ui/system/AGENTS.md`
17
+ 3. `packages/ui/system/UI_SYSTEM_GUIDELINES.md`
18
+ 4. `docs/conventions/ui-system.md`
19
+ 5. component metadata from the first available source:
19
20
  - `GET http://127.0.0.1:4100/components`
20
21
  - `packages/ui/system/src/metadata/components.json`
21
22
  - `@nextop-os/ui-system/metadata` from the installed package
@@ -33,76 +34,40 @@ Never deep import `@nextop-os/ui-system/src/*` or per-file component paths.
33
34
 
34
35
  ## Route The Task
35
36
 
36
- ### Use Existing Component
37
+ Read only the reference file that matches the task.
37
38
 
38
- Use when replacing local UI or answering what components exist.
39
+ - Using or querying existing components:
40
+ `references/use-existing-component.md`
41
+ - Extracting a low-level base primitive:
42
+ `references/extract-base-component.md`
43
+ - Promoting reusable business UI into a shared component:
44
+ `references/promote-business-component.md`
45
+ - Maintaining ids, metadata, exports, or storyboard inventory:
46
+ `references/maintain-inventory.md`
39
47
 
40
- 1. Check metadata first by `id`, `name`, `export`, `layer`, and `useCases`.
41
- 2. Prefer existing components before creating or extracting new ones.
42
- 3. Read the source and props type for the selected export.
43
- 4. Keep host state, data loading, routing, daemon calls, i18n keys, and business
44
- transforms in the caller.
45
- 5. Replace only the visual surface with stable UI-system imports.
48
+ ## Global Boundaries
46
49
 
47
- ### Extract Base Component
48
-
49
- Use when the target is a low-level visual primitive.
50
-
51
- Proceed only if the public API has no domain noun and props describe
52
- presentation, interaction, accessibility, variants, refs, slots, class names, or
53
- children.
54
-
55
- 1. If the primitive exists in shadcn, acquire it through shadcn CLI targeted at
56
- `packages/ui/system`.
57
- 2. Adapt only package aliases, icons, tokens, exports, and boundary issues.
58
- 3. Add stable exports, metadata with `layer: "base"`, and storyboard coverage.
59
- 4. Replace duplicated local UI with the shared component.
60
-
61
- ### Extract Business Component
62
-
63
- Use when business-side UI should become a reusable display component.
64
-
65
- Proceed only if the component can render from props with no host side effects.
66
- Business components may expose domain display props such as workspace, file,
67
- task, agent, run, status, permission, labels, and callbacks.
68
-
69
- Before editing, state:
70
-
71
- - component `id` and `layer`
72
- - source usage being replaced
73
- - intended reuse surfaces
74
- - public props and callbacks
75
- - host-owned state and side effects that remain outside the component
76
- - export path, metadata entry, storyboard states, and validation commands
77
-
78
- Keep these outside the component:
50
+ Keep these outside `@nextop-os/ui-system` components:
79
51
 
80
52
  - daemon, Electron, filesystem, router, or host adapter calls
81
53
  - data fetching, cache mutation, persistence, polling, and global store
82
54
  ownership
83
- - workflow orchestration such as onboarding, workspace registration, or
84
- navigation
85
-
86
- Implement the business component by composing `base` primitives. Add metadata
87
- with `layer: "business"` and storyboard examples for normal, empty, disabled,
88
- loading, and error-like states when those states exist in the public contract.
89
-
90
- ### Maintain Inventory
55
+ - workflow orchestration such as onboarding, workspace registration, install or
56
+ uninstall flows, confirmation dialogs, queueing, or navigation
57
+ - i18n key lookup and business-specific copy derivation unless supplied by
58
+ props, children, or labels
91
59
 
92
- Use when changing component ids, metadata, exports, or storyboard.
60
+ For any promoted public component, add stable exports, metadata, and storyboard
61
+ coverage that match the chosen reference workflow.
93
62
 
94
- 1. Keep each public entry's `id` stable, readable, globally unique, and
95
- kebab-case.
96
- 2. Keep `layer` as `base` or `business`.
97
- 3. Ensure `source` points under `packages/ui/system/src`.
98
- 4. Ensure `from` is a stable public entrypoint.
99
- 5. Keep storyboard grouped by `Foundation`, `Base Components`, and
100
- `Business Components`; visible component stories should support copying the
101
- component id.
63
+ For business component promotion, the temporary preview must be built from the
64
+ state matrix, proposed props boundary, and candidate source UI. Treat the
65
+ confirmed preview draft as the implementation blueprint for
66
+ `packages/ui/system`, not as a disposable mockup.
102
67
 
103
- ## Validation
68
+ ## Validation Commands
104
69
 
105
- Run the smallest relevant checks, then report exact commands and results:
70
+ Run the smallest relevant checks from the selected reference. Common checks are:
106
71
 
107
72
  ```bash
108
73
  node tools/scripts/check-ui-metadata.mjs
@@ -111,4 +76,4 @@ pnpm --filter @nextop-os/ui-storyboard typecheck
111
76
  ```
112
77
 
113
78
  If runtime component code changed, also run the relevant package typecheck or
114
- build for the consumer that was migrated.
79
+ consumer build.
@@ -0,0 +1,43 @@
1
+ # Extract Base Component
2
+
3
+ Use this reference when the target is a low-level visual primitive.
4
+
5
+ ## Base Criteria
6
+
7
+ Proceed only if the public API has no domain noun and props describe generic UI
8
+ concerns:
9
+
10
+ - presentation and variants
11
+ - interaction and accessibility
12
+ - refs, slots, class names, and children
13
+ - controlled or uncontrolled primitive state
14
+
15
+ If the component represents a workspace, file, task, agent, run, project,
16
+ account, or other business concept, use `promote-business-component.md`
17
+ instead.
18
+
19
+ ## Workflow
20
+
21
+ 1. Check metadata and existing exports first.
22
+ 2. If the primitive exists in the shadcn registry, acquire it through shadcn CLI
23
+ targeted at `packages/ui/system`.
24
+ 3. Adapt only package aliases, icon routing, tokens, stable exports, metadata,
25
+ storyboard examples, and boundary-check issues.
26
+ 4. Keep helper exports minimal and directly tied to primitive support.
27
+ 5. Add metadata with `layer: "base"`.
28
+ 6. Add storyboard coverage for the public states and variants exposed by the
29
+ primitive.
30
+ 7. Replace duplicated local UI only after the shared primitive exists.
31
+
32
+ ## Validation
33
+
34
+ Run the relevant checks:
35
+
36
+ ```bash
37
+ node tools/scripts/check-ui-metadata.mjs
38
+ pnpm check:ui-boundaries
39
+ pnpm --filter @nextop-os/ui-storyboard typecheck
40
+ pnpm --filter @nextop-os/ui-system typecheck
41
+ ```
42
+
43
+ If a consumer was migrated, also run that consumer's typecheck or build.
@@ -0,0 +1,40 @@
1
+ # Maintain Inventory
2
+
3
+ Use this reference when changing component ids, metadata, exports, or storyboard
4
+ inventory without promoting a new component.
5
+
6
+ ## Metadata Rules
7
+
8
+ Every public UI-system entry must have metadata with:
9
+
10
+ - stable readable `id`
11
+ - globally unique kebab-case id
12
+ - `layer` as `base` or `business`
13
+ - `source` under `packages/ui/system/src`
14
+ - stable public `from` entrypoint
15
+
16
+ Do not expose `src/*` layout as public API and do not encourage per-file deep
17
+ imports.
18
+
19
+ ## Storyboard Rules
20
+
21
+ Keep storyboard grouped by:
22
+
23
+ - `Foundation`
24
+ - `Base Components`
25
+ - `Business Components`
26
+
27
+ Visible component stories should support copying the component id.
28
+
29
+ When changing metadata or storyboard inventory, keep ids stable unless the
30
+ rename is intentional and callers or docs are updated together.
31
+
32
+ ## Validation
33
+
34
+ Run the relevant checks:
35
+
36
+ ```bash
37
+ node tools/scripts/check-ui-metadata.mjs
38
+ pnpm check:ui-boundaries
39
+ pnpm --filter @nextop-os/ui-storyboard typecheck
40
+ ```