@nextop-os/ui-system 0.0.15 → 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.
Files changed (35) hide show
  1. package/AGENTS.md +84 -0
  2. package/README.md +86 -0
  3. package/UI_SYSTEM_GUIDELINES.md +148 -0
  4. package/agent/install-skill.mjs +181 -0
  5. package/agent/nextop-ui-system/SKILL.md +79 -0
  6. package/agent/nextop-ui-system/references/extract-base-component.md +43 -0
  7. package/agent/nextop-ui-system/references/maintain-inventory.md +40 -0
  8. package/agent/nextop-ui-system/references/promote-business-component.md +352 -0
  9. package/agent/nextop-ui-system/references/use-existing-component.md +37 -0
  10. package/agent/nextop-ui-system/scripts/create-business-preview.mjs +658 -0
  11. package/dist/{chunk-G6KJIFD2.js → chunk-FT633NLJ.js} +2 -2
  12. package/dist/{chunk-OBW6ALOJ.js → chunk-NFSMZKML.js} +78 -3
  13. package/dist/chunk-NFSMZKML.js.map +1 -0
  14. package/dist/chunk-XHA7R2WC.js +292 -0
  15. package/dist/chunk-XHA7R2WC.js.map +1 -0
  16. package/dist/components/index.js +2 -2
  17. package/dist/dev-vite.d.ts +9 -0
  18. package/dist/dev-vite.js +578 -0
  19. package/dist/dev-vite.js.map +1 -0
  20. package/dist/icons/index.d.ts +14 -1
  21. package/dist/icons/index.js +16 -2
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +17 -3
  24. package/dist/metadata/components.json +1464 -0
  25. package/dist/metadata/components.schema.json +106 -0
  26. package/dist/metadata/index.d.ts +25 -0
  27. package/dist/metadata/index.js +1472 -0
  28. package/dist/metadata/index.js.map +1 -0
  29. package/dist/styles/semantic.css +1 -0
  30. package/dist/styles/theme.css +12 -0
  31. package/package.json +25 -3
  32. package/dist/chunk-IK2XRJQG.js +0 -56
  33. package/dist/chunk-IK2XRJQG.js.map +0 -1
  34. package/dist/chunk-OBW6ALOJ.js.map +0 -1
  35. /package/dist/{chunk-G6KJIFD2.js.map → chunk-FT633NLJ.js.map} +0 -0
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
@@ -12,3 +12,89 @@ import "@nextop-os/ui-system/styles.css";
12
12
 
13
13
  Application code should prefer the root package export and the documented stable
14
14
  subpaths over deep imports from internal files.
15
+
16
+ ## External Development
17
+
18
+ External consumers should install the package normally:
19
+
20
+ ```bash
21
+ pnpm add @nextop-os/ui-system
22
+ ```
23
+
24
+ For local source sync from a Nextop checkout, start the UI system dev server:
25
+
26
+ ```bash
27
+ pnpm --filter @nextop-os/ui-system dev:server
28
+ ```
29
+
30
+ Then add the Vite plugin in the external app:
31
+
32
+ ```ts
33
+ import { nextopUISystemDev } from "@nextop-os/ui-system/dev-vite";
34
+
35
+ export default defineConfig({
36
+ plugins: [nextopUISystemDev()]
37
+ });
38
+ ```
39
+
40
+ When the dev server is reachable, the plugin mirrors the allowed UI-system
41
+ source files into `.nextop-ui-system-dev/` and aliases the stable package
42
+ entrypoints to that cache. When the dev server is unavailable, resolution falls
43
+ back to the installed package in `node_modules`.
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
+
50
+ Add the generated cache to the external app's `.gitignore`:
51
+
52
+ ```text
53
+ .nextop-ui-system-dev/
54
+ ```
55
+
56
+ If the external app uses Tailwind CSS, include both the installed package output
57
+ and the generated dev cache in the app's Tailwind source scan:
58
+
59
+ ```css
60
+ @source "../node_modules/@nextop-os/ui-system/dist";
61
+ @source "../.nextop-ui-system-dev";
62
+ ```
63
+
64
+ ## Agent Usage
65
+
66
+ Coding agents should read component metadata before creating or promoting UI:
67
+
68
+ ```ts
69
+ import { uiSystemMetadata } from "@nextop-os/ui-system/metadata";
70
+ ```
71
+
72
+ When promoting business UI into this package, use the bundled
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
75
+ are:
76
+
77
+ 1. prefer existing metadata entries before creating a component
78
+ 2. classify the component as `base` or `business`
79
+ 3. keep business components host-agnostic and side-effect-free
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
85
+
86
+ External repositories can install the bundled skill into their local Codex
87
+ skill directory with one command:
88
+
89
+ ```bash
90
+ pnpm exec nextop-ui-system-install-skill
91
+ ```
92
+
93
+ This copies the package skill into:
94
+
95
+ ```text
96
+ .codex/skills/nextop-ui-system/SKILL.md
97
+ ```
98
+
99
+ The installer does not overwrite a locally modified skill unless `--force` is
100
+ provided.
@@ -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.
@@ -0,0 +1,181 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { constants } from "node:fs";
4
+ import {
5
+ access,
6
+ cp,
7
+ mkdir,
8
+ readdir,
9
+ readFile,
10
+ rm,
11
+ stat
12
+ } from "node:fs/promises";
13
+ import { dirname, join, relative, resolve } from "node:path";
14
+ import { fileURLToPath } from "node:url";
15
+
16
+ const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
17
+ const sourceDirectory = join(packageRoot, "agent", "nextop-ui-system");
18
+ const skillName = "nextop-ui-system";
19
+
20
+ const options = parseArgs(process.argv.slice(2));
21
+
22
+ if (options.help) {
23
+ printHelp();
24
+ process.exit(0);
25
+ }
26
+
27
+ const targetRoot = resolve(options.cwd, ".codex", "skills");
28
+ const targetDirectory = join(targetRoot, skillName);
29
+
30
+ await assertReadableDirectory(sourceDirectory);
31
+ await mkdir(targetRoot, { recursive: true });
32
+
33
+ if (await pathExists(targetDirectory)) {
34
+ const targetStats = await stat(targetDirectory);
35
+
36
+ if (!targetStats.isDirectory()) {
37
+ throw new Error(`Target exists and is not a directory: ${targetDirectory}`);
38
+ }
39
+
40
+ if (!options.force) {
41
+ if (await directoriesMatch(sourceDirectory, targetDirectory)) {
42
+ console.log(
43
+ `nextop-ui-system skill already configured at ${targetDirectory}`
44
+ );
45
+ process.exit(0);
46
+ }
47
+
48
+ throw new Error(
49
+ `Target skill already exists with local changes: ${targetDirectory}\n` +
50
+ "Run with --force to replace it."
51
+ );
52
+ }
53
+
54
+ await rm(targetDirectory, { recursive: true, force: true });
55
+ }
56
+
57
+ await cp(sourceDirectory, targetDirectory, {
58
+ errorOnExist: false,
59
+ force: true,
60
+ recursive: true
61
+ });
62
+
63
+ console.log(`Installed nextop-ui-system skill to ${targetDirectory}`);
64
+ console.log(
65
+ "Agents can now load it from .codex/skills/nextop-ui-system/SKILL.md"
66
+ );
67
+
68
+ function parseArgs(args) {
69
+ const parsed = {
70
+ cwd: process.cwd(),
71
+ force: false,
72
+ help: false
73
+ };
74
+
75
+ for (let index = 0; index < args.length; index += 1) {
76
+ const arg = args[index];
77
+
78
+ if (arg === "--force") {
79
+ parsed.force = true;
80
+ continue;
81
+ }
82
+
83
+ if (arg === "--help" || arg === "-h") {
84
+ parsed.help = true;
85
+ continue;
86
+ }
87
+
88
+ if (arg === "--cwd") {
89
+ const cwd = args[index + 1];
90
+ if (!cwd) {
91
+ throw new Error("--cwd requires a directory path");
92
+ }
93
+ parsed.cwd = resolve(cwd);
94
+ index += 1;
95
+ continue;
96
+ }
97
+
98
+ throw new Error(`Unknown option: ${arg}`);
99
+ }
100
+
101
+ return parsed;
102
+ }
103
+
104
+ function printHelp() {
105
+ console.log(`Usage: nextop-ui-system-install-skill [options]
106
+
107
+ Copies the bundled Nextop UI System skill into the current repository.
108
+
109
+ Options:
110
+ --cwd <path> Repository root to configure. Defaults to the current directory.
111
+ --force Replace an existing .codex/skills/nextop-ui-system directory.
112
+ -h, --help Show this help message.`);
113
+ }
114
+
115
+ async function assertReadableDirectory(path) {
116
+ await access(path, constants.R_OK);
117
+ const pathStats = await stat(path);
118
+
119
+ if (!pathStats.isDirectory()) {
120
+ throw new Error(`Expected directory: ${path}`);
121
+ }
122
+ }
123
+
124
+ async function pathExists(path) {
125
+ try {
126
+ await access(path, constants.F_OK);
127
+ return true;
128
+ } catch {
129
+ return false;
130
+ }
131
+ }
132
+
133
+ async function directoriesMatch(leftDirectory, rightDirectory) {
134
+ const leftEntries = await listFiles(leftDirectory, leftDirectory);
135
+ const rightEntries = await listFiles(rightDirectory, rightDirectory);
136
+
137
+ if (leftEntries.length !== rightEntries.length) {
138
+ return false;
139
+ }
140
+
141
+ for (let index = 0; index < leftEntries.length; index += 1) {
142
+ if (leftEntries[index] !== rightEntries[index]) {
143
+ return false;
144
+ }
145
+
146
+ const leftFile = join(leftDirectory, leftEntries[index]);
147
+ const rightFile = join(rightDirectory, rightEntries[index]);
148
+
149
+ const [leftContent, rightContent] = await Promise.all([
150
+ readFile(leftFile),
151
+ readFile(rightFile)
152
+ ]);
153
+
154
+ if (!leftContent.equals(rightContent)) {
155
+ return false;
156
+ }
157
+ }
158
+
159
+ return true;
160
+ }
161
+
162
+ async function listFiles(rootDirectory, directory) {
163
+ const entries = await readdir(directory, { withFileTypes: true });
164
+ const files = await Promise.all(
165
+ entries.map(async (entry) => {
166
+ const absolutePath = join(directory, entry.name);
167
+
168
+ if (entry.isDirectory()) {
169
+ return listFiles(rootDirectory, absolutePath);
170
+ }
171
+
172
+ if (!entry.isFile()) {
173
+ return [];
174
+ }
175
+
176
+ return relative(rootDirectory, absolutePath);
177
+ })
178
+ );
179
+
180
+ return files.flat().sort((left, right) => left.localeCompare(right));
181
+ }
@@ -0,0 +1,79 @@
1
+ ---
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 UI into shared base or business components, or maintaining UI-system storyboard inventory.
4
+ ---
5
+
6
+ # Nextop UI System
7
+
8
+ Use this skill as the single entrypoint for `@nextop-os/ui-system` component
9
+ reuse, extraction, promotion, metadata, and storyboard work.
10
+
11
+ ## Source Of Truth
12
+
13
+ Read these before editing:
14
+
15
+ 1. nearest `AGENTS.md` for the target code
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:
20
+ - `GET http://127.0.0.1:4100/components`
21
+ - `packages/ui/system/src/metadata/components.json`
22
+ - `@nextop-os/ui-system/metadata` from the installed package
23
+
24
+ Use stable public imports only:
25
+
26
+ - `@nextop-os/ui-system`
27
+ - `@nextop-os/ui-system/components`
28
+ - `@nextop-os/ui-system/icons`
29
+ - `@nextop-os/ui-system/metadata`
30
+ - `@nextop-os/ui-system/styles.css`
31
+ - `@nextop-os/ui-system/utils`
32
+
33
+ Never deep import `@nextop-os/ui-system/src/*` or per-file component paths.
34
+
35
+ ## Route The Task
36
+
37
+ Read only the reference file that matches the task.
38
+
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`
47
+
48
+ ## Global Boundaries
49
+
50
+ Keep these outside `@nextop-os/ui-system` components:
51
+
52
+ - daemon, Electron, filesystem, router, or host adapter calls
53
+ - data fetching, cache mutation, persistence, polling, and global store
54
+ ownership
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
59
+
60
+ For any promoted public component, add stable exports, metadata, and storyboard
61
+ coverage that match the chosen reference workflow.
62
+
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.
67
+
68
+ ## Validation Commands
69
+
70
+ Run the smallest relevant checks from the selected reference. Common checks are:
71
+
72
+ ```bash
73
+ node tools/scripts/check-ui-metadata.mjs
74
+ pnpm check:ui-boundaries
75
+ pnpm --filter @nextop-os/ui-storyboard typecheck
76
+ ```
77
+
78
+ If runtime component code changed, also run the relevant package typecheck or
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
+ ```