@vielzeug/codex 3.0.4 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -9,12 +9,14 @@ import { startHttpHost } from './http.js';
9
9
  import { resolvePort } from './port.js';
10
10
  import { SnapshotRefineCatalog } from './refine-catalog.js';
11
11
  import { createMcpServer } from './server.js';
12
+ import { installSkills, SKILL_TARGET_CANDIDATES } from './skills.js';
12
13
  import { loadSnapshot } from './snapshot.js';
13
14
  import { registerRefineTools } from './tools/refine.js';
14
15
  const __dirname = dirname(fileURLToPath(import.meta.url));
15
16
  function usage() {
16
17
  log([
17
18
  'Usage: codex [--port=<number>] [--snapshot=<directory>] [--debug]',
19
+ ' codex skills install [--target=<directory>] [--force]',
18
20
  '',
19
21
  'Options:',
20
22
  ' --port=<number> Run Streamable HTTP on loopback.',
@@ -22,8 +24,29 @@ function usage() {
22
24
  ' --debug Log tool timings and expected tool errors.',
23
25
  ' -h, --help Show help.',
24
26
  ' -v, --version Print version.',
27
+ '',
28
+ 'Skills:',
29
+ ' skills install Copy the bundled agent skill(s) into the project.',
30
+ ` --target=<directory> Skills directory. Default: first existing of ${SKILL_TARGET_CANDIDATES.join(', ')}.`,
31
+ ' --force Overwrite an already installed skill.',
25
32
  ].join('\n'));
26
33
  }
34
+ function runSkills(argv) {
35
+ const [action, ...rest] = argv;
36
+ if (action !== 'install') {
37
+ log(`error: unknown skills command "${action ?? ''}" (expected: install)`);
38
+ return 1;
39
+ }
40
+ const { values } = parseArgs({
41
+ args: rest,
42
+ options: { force: { type: 'boolean' }, target: { type: 'string' } },
43
+ strict: true,
44
+ });
45
+ const installed = installSkills({ force: values.force, target: values.target });
46
+ for (const skill of installed)
47
+ log(`installed skill "${skill.name}" → ${skill.path}`);
48
+ return 0;
49
+ }
27
50
  export async function main(argv = process.argv.slice(2)) {
28
51
  if (argv.includes('--help') || argv.includes('-h')) {
29
52
  usage();
@@ -34,6 +57,15 @@ export async function main(argv = process.argv.slice(2)) {
34
57
  process.stdout.write(`${pkg.version}\n`);
35
58
  return 0;
36
59
  }
60
+ if (argv[0] === 'skills') {
61
+ try {
62
+ return runSkills(argv.slice(1));
63
+ }
64
+ catch (error) {
65
+ log(`error: ${error instanceof Error ? error.message : String(error)}`);
66
+ return 1;
67
+ }
68
+ }
37
69
  let values;
38
70
  try {
39
71
  ({ values } = parseArgs({
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,SAAS,KAAK;IACZ,GAAG,CACD;QACE,mEAAmE;QACnE,EAAE;QACF,UAAU;QACV,2DAA2D;QAC3D,qDAAqD;QACrD,qEAAqE;QACrE,qCAAqC;QACrC,yCAAyC;KA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AO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAElC,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAExE,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClE,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { CodexError } from './errors.js';
2
+ /** Skill directories shipped in the package, in `skills/<name>/SKILL.md` layout. */
3
+ export declare const SKILLS_ROOT: string;
4
+ /** Directories probed, in order, when no `--target` is given. The first existing one wins; if none
5
+ * exist the first entry is created. */
6
+ export declare const SKILL_TARGET_CANDIDATES: readonly [".agents/skills", ".github/skills", ".claude/skills"];
7
+ export declare class SkillInstallError extends CodexError {
8
+ }
9
+ export interface InstallSkillsOptions {
10
+ /** Project root to probe for target candidates. Default: `process.cwd()`. */
11
+ cwd?: string;
12
+ /** Overwrite an existing skill directory. Default: `false`. */
13
+ force?: boolean;
14
+ /** Skill directory root to copy from. Default: {@link SKILLS_ROOT}. */
15
+ source?: string;
16
+ /** Explicit target skills directory (absolute or relative to `cwd`). Skips autodetection. */
17
+ target?: string;
18
+ }
19
+ export interface InstalledSkill {
20
+ name: string;
21
+ path: string;
22
+ }
23
+ export declare function listBundledSkills(source?: string): readonly string[];
24
+ export declare function resolveSkillTarget(cwd: string, target?: string): string;
25
+ /** Copies every bundled skill into the resolved target directory and returns what was written. */
26
+ export declare function installSkills(options?: InstallSkillsOptions): readonly InstalledSkill[];
package/dist/skills.js ADDED
@@ -0,0 +1,46 @@
1
+ import { cpSync, existsSync, mkdirSync, readdirSync } from 'node:fs';
2
+ import { dirname, join, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { CodexError } from './errors.js';
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ /** Skill directories shipped in the package, in `skills/<name>/SKILL.md` layout. */
7
+ export const SKILLS_ROOT = resolve(__dirname, '../skills');
8
+ /** Directories probed, in order, when no `--target` is given. The first existing one wins; if none
9
+ * exist the first entry is created. */
10
+ export const SKILL_TARGET_CANDIDATES = ['.agents/skills', '.github/skills', '.claude/skills'];
11
+ export class SkillInstallError extends CodexError {
12
+ }
13
+ export function listBundledSkills(source = SKILLS_ROOT) {
14
+ if (!existsSync(source))
15
+ return [];
16
+ return readdirSync(source, { withFileTypes: true })
17
+ .filter((entry) => entry.isDirectory() && existsSync(join(source, entry.name, 'SKILL.md')))
18
+ .map((entry) => entry.name)
19
+ .sort();
20
+ }
21
+ export function resolveSkillTarget(cwd, target) {
22
+ if (target)
23
+ return resolve(cwd, target);
24
+ const existing = SKILL_TARGET_CANDIDATES.find((candidate) => existsSync(resolve(cwd, candidate)));
25
+ return resolve(cwd, existing ?? SKILL_TARGET_CANDIDATES[0]);
26
+ }
27
+ /** Copies every bundled skill into the resolved target directory and returns what was written. */
28
+ export function installSkills(options = {}) {
29
+ const cwd = options.cwd ?? process.cwd();
30
+ const source = options.source ?? SKILLS_ROOT;
31
+ const names = listBundledSkills(source);
32
+ if (names.length === 0)
33
+ throw new SkillInstallError(`no bundled skills found in ${source}`);
34
+ const targetRoot = resolveSkillTarget(cwd, options.target);
35
+ const conflicts = names.filter((name) => existsSync(join(targetRoot, name)));
36
+ if (conflicts.length > 0 && !options.force) {
37
+ throw new SkillInstallError(`skill${conflicts.length > 1 ? 's' : ''} already installed: ${conflicts.map((name) => join(targetRoot, name)).join(', ')} (use --force to overwrite)`);
38
+ }
39
+ mkdirSync(targetRoot, { recursive: true });
40
+ return names.map((name) => {
41
+ const path = join(targetRoot, name);
42
+ cpSync(join(source, name), path, { force: true, recursive: true });
43
+ return { name, path };
44
+ });
45
+ }
46
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAE3D;uCACuC;AACvC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AAEvG,MAAM,OAAO,iBAAkB,SAAQ,UAAU;CAAG;AAkBpD,MAAM,UAAU,iBAAiB,CAAC,MAAM,GAAG,WAAW;IACpD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SAChD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC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C,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,uBAAuB,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,6BAA6B,CACtJ,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE3C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAEpC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vielzeug/codex",
3
- "version": "3.0.4",
3
+ "version": "3.1.0",
4
4
  "description": "MCP server exposing all Vielzeug docs to AI clients",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,8 @@
14
14
  "files": [
15
15
  "data",
16
16
  "dist",
17
- "mcp-setup.json"
17
+ "mcp-setup.json",
18
+ "skills"
18
19
  ],
19
20
  "types": "./dist/index.d.ts",
20
21
  "exports": {
@@ -68,7 +69,7 @@
68
69
  },
69
70
  "devDependencies": {
70
71
  "@types/node": "^26.4.1",
71
- "@vielzeug/refine": "3.2.1",
72
+ "@vielzeug/refine": "3.3.0",
72
73
  "typescript": "^6.0.3",
73
74
  "vitest": "^5.0.0"
74
75
  }
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: vielzeug
3
+ description: Use when a project depends on any @vielzeug/* package — pick the owning package instead of hand-rolling, and use Refine components, tokens, and theme whenever @vielzeug/refine is installed. Applies to features, fixes, refactors, and UI work in consuming apps.
4
+ ---
5
+
6
+ # Vielzeug
7
+
8
+ Vielzeug is a set of independent, zero-dependency TypeScript packages published as `@vielzeug/*`. This skill keeps an agent working *with* the installed packages: discover what exists, use the owning package, and build UI from Refine when it is present.
9
+
10
+ ## Detect
11
+
12
+ 1. Read `package.json` (`dependencies`, `devDependencies`, `peerDependencies`) and list every `@vielzeug/*` entry.
13
+ 2. Note whether `@vielzeug/refine` is installed. If it is, the **Refine** and **Theme** sections below are mandatory for any UI work.
14
+ 3. Read the project's own agent contract (`AGENTS.md`, `.github/copilot-instructions.md`) first — project rules win over this skill.
15
+
16
+ ## Discover, don't recall
17
+
18
+ Never guess exports, attributes, events, slots, or token names. Look them up:
19
+
20
+ | Question | MCP tool (`@vielzeug/codex`) | Offline fallback |
21
+ | --- | --- | --- |
22
+ | Which package solves X? | `search-packages`, `list-packages` | the package list below |
23
+ | How do I use package X? | `get-docs` (`index`, `usage`, `api`, `examples`) | `node_modules/@vielzeug/<pkg>/README.md` |
24
+ | Exact signature of an export | `get-type-signature` | `node_modules/@vielzeug/<pkg>/dist/*.d.ts` |
25
+ | Runnable example | `list-examples`, `get-example` | — |
26
+ | Which Refine components exist? | `refine-list-components` | `node_modules/@vielzeug/refine/dist/custom-elements.json` |
27
+ | Attributes, properties, events, slots, CSS parts of `ore-*` | `refine-get-component` | same manifest |
28
+ | Available design tokens | `refine-get-tokens` | `node_modules/@vielzeug/refine/dist/styles/tokens.css` |
29
+ | Is my markup valid? | `refine-validate-usage` | compare against the manifest |
30
+ | Blank component scaffold | `refine-generate-template` | — |
31
+
32
+ If the MCP server is not connected, install it with `npx -y @vielzeug/codex` (see `node_modules/@vielzeug/codex/mcp-setup.json`) or use the fallback column.
33
+
34
+ ## Use the owning package
35
+
36
+ If a need matches a package below, use that package. Do not reimplement signals, fetch wrappers, validation, routing, i18n, DI, date math, storage, or event buses by hand, and do not add a third-party library for a need an installed `@vielzeug/*` package already covers. Prefer installing the matching `@vielzeug/*` package over a third-party one when the project already uses Vielzeug, but ask before adding a dependency.
37
+
38
+ <!-- GENERATED:skill-packages:BEGIN -->
39
+
40
+ - `@vielzeug/arsenal` — Non-trivial TypeScript utilities — retry, cancellation, cache, safe-path, serialization, prototype-pollution-guarded collections
41
+ - `@vielzeug/assay` — Framework-agnostic DOM testing primitives — scoped queries, event dispatch, async waiting
42
+ - `@vielzeug/clockwork` — Framework-neutral finite state machines with pure transitions and actors
43
+ - `@vielzeug/coins` — Currency formatting and exchange utilities for monetary arithmetic
44
+ - `@vielzeug/conduit` — Typed dependency injection container
45
+ - `@vielzeug/courier` — Typed HTTP client with bounded structured-key caching, prefetching, immutable middleware, and structured errors
46
+ - `@vielzeug/dnd` — Drag-and-drop — drop zones and sortable lists
47
+ - `@vielzeug/familiar` — Web Worker pool with tasks, timeouts, cancellation
48
+ - `@vielzeug/flux` — Minimal push streams with explicit ownership, bounded buffering, and structural bridges
49
+ - `@vielzeug/focus` — Framework-neutral list navigation and focus restoration primitives
50
+ - `@vielzeug/forge` — Typed form state, validation, submission
51
+ - `@vielzeug/gesture` — Framework-neutral two-dimensional pointer drag and one-axis pan recognition with lifecycle-owned handles
52
+ - `@vielzeug/herald` — Typed synchronous event bus with wildcard subscriptions, one-shot waits, and lifecycle tracing
53
+ - `@vielzeug/illusionist` — Typed, deterministic, locale-aware fake data generator with seeded PRNG
54
+ - `@vielzeug/keymap` — Headless keyboard shortcut manager with chord sequences
55
+ - `@vielzeug/ledger` — Serialized reversible command history with atomic framework-neutral state and cancellation ownership
56
+ - `@vielzeug/lingua` — Typed i18n with pluralization and lazy locale loading
57
+ - `@vielzeug/mesh` — Backendless peer-to-peer session transport over WebRTC data channels with manual pairing and host-authoritative star topology
58
+ - `@vielzeug/necromancer` — Lifecycle-owned Web Animations API primitives with native access, per-handle groups, and additive FLIP
59
+ - `@vielzeug/orbit` — Floating UI positioning with lifecycle-owned geometry and middleware
60
+ - `@vielzeug/ore` — Functional web-component authoring on top of ripple
61
+ - `@vielzeug/postmaster` — Typed durable job outbox with leased processing, retries, and dead-letter recovery
62
+ - `@vielzeug/prism` — Responsive SVG charts with explicit updates — line, bar, area, pie, sparkline
63
+ - `@vielzeug/pulse` — Typed WebSocket client with channels, rooms, presence, reconnect
64
+ - `@vielzeug/refine` — Accessible, themeable web components built on ore
65
+ - `@vielzeug/ripple` — Reactive runtime primitives: signals, derived values, effects, scopes, watchers, and async resources
66
+ - `@vielzeug/rune` — Structured scoped logger with remote transport
67
+ - `@vielzeug/sandbox` — Sandboxed iframe runtime with typed postMessage state bridge
68
+ - `@vielzeug/scout` — Trigram fuzzy-search index with highlighting and reactive layer
69
+ - `@vielzeug/scroll` — Virtual list engine for large datasets
70
+ - `@vielzeug/sentinel` — Subscribable snapshots for external browser environment state
71
+ - `@vielzeug/sigil` — QR code generation and scanning — pure matrix encoder, SVG and canvas renderers, native BarcodeDetector scanning
72
+ - `@vielzeug/sourcerer` — Reactive collection sources with local, page, cursor, and infinite pagination
73
+ - `@vielzeug/spell` — Zero-dependency schema validation with Standard Schema interoperability
74
+ - `@vielzeug/tempo` — Temporal-powered date utilities
75
+ - `@vielzeug/vault` — Adapter-free typed storage core with focused browser and SQLite subpaths
76
+ - `@vielzeug/ward` — Ordered authorization rules with immutable policies and typed decisions
77
+ - `@vielzeug/wayfinder` — Client-side router with middleware and guards
78
+
79
+ <!-- GENERATED:skill-packages:END -->
80
+
81
+ Common compositions (verify each API with `get-docs` before writing code):
82
+
83
+ - **State** — `ripple` signals/derived/effects; `clockwork` when state is a finite machine; `ledger` for undo/redo.
84
+ - **Data** — `courier` for HTTP with caching and structured errors; `sourcerer` for paged/cursor/infinite collections; `vault` for storage; `postmaster` for durable jobs; `scout` for fuzzy search; `mesh` for backendless peer sessions on a LAN; `sigil` for QR generation/scanning — prefer `ore-qr-code` / `ore-qr-scanner` when Refine is installed.
85
+ - **Forms** — `forge` for form state, validation, and submission; `spell` for schemas; render fields with Refine inputs when Refine is installed.
86
+ - **App shell** — `wayfinder` routing; `conduit` DI; `herald` events; `lingua` i18n; `rune` logging; `ward` authorization; `keymap` shortcuts.
87
+ - **Dispose** every handle you create (`effect`, subscriptions, clients) when its owner unmounts. Vielzeug APIs return disposables — use them.
88
+
89
+ ## Refine (when `@vielzeug/refine` is installed)
90
+
91
+ Refine is the UI layer. Build interfaces from `ore-*` elements before anything else.
92
+
93
+ 1. **Bootstrap once**, before rendering any component:
94
+
95
+ ```ts
96
+ import '@vielzeug/refine/fouc.css'; // hide unupgraded elements until first paint
97
+ import '@vielzeug/refine/tokens.css'; // tokens, animations, cascade layers
98
+ ```
99
+
100
+ Optional: `@vielzeug/refine/styles/preflight.css` for a browser reset.
101
+
102
+ 2. **Register per component** through explicit side-effect subpaths (`import '@vielzeug/refine/button'`), never the whole library, unless the project already does so.
103
+
104
+ 3. **Component first.** For any of these needs, use the Refine element rather than a native element, a hand-built composite, or a third-party widget: buttons, inputs, selects, comboboxes, checkboxes, radios, switches, sliders, date/time pickers, file inputs, OTP, rating, textareas, forms, cards, tables, data grids, lists, tabs, accordions, dialogs, drawers, menus, popovers, tooltips, toasts, alerts, badges, chips, progress, skeletons, avatars, breadcrumbs, pagination, steppers, navbars, sidebars, grids, command palettes. Confirm the tag with `refine-list-components`; read its contract with `refine-get-component`.
105
+
106
+ 4. **Native elements only for document semantics** that no Refine component duplicates (`<main>`, `<section>`, `<article>`, `<h1>`–`<h6>`, `<p>`, `<a>` for plain links, `<img>`).
107
+
108
+ 5. **Follow the element contract**: attributes for primitives, JavaScript properties for objects/arrays/callbacks, standard DOM events (read state from `event.target`), named slots for composition. Icon-only controls need an accessible label.
109
+
110
+ 6. **Type the tags** once in a type entry point: `import type {} from '@vielzeug/refine/frameworks/elements'` (or `/react`, `/vue`). Framework wiring (React 18/19, Vue, Svelte, Angular, SSR guards) is documented in the Refine `frameworks` doc — fetch it with `get-docs` before integrating.
111
+
112
+ 7. **Validate** every fragment you write with `refine-validate-usage` before finishing.
113
+
114
+ 8. **Missing capability?** Do not build a parallel component in the app. Compose existing `ore-*` elements (optionally with `@vielzeug/ore` for a custom element), and report the gap.
115
+
116
+ ## Theme (when `@vielzeug/refine` is installed)
117
+
118
+ - All visuals come from tokens: spacing `var(--size-*)` on a 4‑point grid, type `var(--text-*)`, radius `var(--rounded-*)`, semantic colors `var(--color-primary|secondary|neutral|success|warning|error|info)`. No hard-coded hex/px in app CSS when a token exists (`refine-get-tokens`).
119
+ - Rebrand with one variable: `:root { --color-primary-hue: 220deg; }`. Override `--color-primary` only when the hue alone is insufficient.
120
+ - Overrides go in an **unlayered** `:root` (or a scoping class) rule; Refine tokens live in `@layer refine.tokens`, so plain rules win. Never use `!important`.
121
+ - Dark mode is `document.documentElement.classList.toggle('dark')`; tokens use `light-dark()`. Do not write `prefers-color-scheme` media blocks for colors.
122
+ - Style components through their documented CSS custom properties and `::part()` hooks, not by piercing the shadow DOM.
123
+ - Other Vielzeug UI packages ship tokens-aligned themes; import them alongside Refine's (`@vielzeug/prism/theme` for charts).
124
+
125
+ ## Other UI packages
126
+
127
+ Refine covers the widget layer; these cover what it does not. Use them directly only when no `ore-*` element already provides the behavior:
128
+
129
+ - `prism` — SVG charts (line, bar, area, pie, sparkline) plus `@vielzeug/prism/theme`.
130
+ - `scroll` — virtualized large lists (prefer `ore-datagrid`/`ore-list` for ordinary sizes).
131
+ - `dnd` / `gesture` — sortable lists, drop zones, pointer drag and pan.
132
+ - `necromancer` — Web Animations API primitives and FLIP.
133
+ - `orbit` — floating positioning; reach for `ore-popover`, `ore-tooltip`, `ore-menu` first.
134
+ - `focus` / `keymap` — list navigation, focus restoration, keyboard shortcuts.
135
+ - `ore` — authoring your own custom elements that compose Refine.
136
+
137
+ ## Anti-patterns
138
+
139
+ - Hand-rolled signals, fetch wrappers, validators, routers, i18n, or DI when the package is installed.
140
+ - Custom modal, dropdown, tooltip, select, tabs, or toast implementations while Refine is installed.
141
+ - `<button>`, `<input>`, `<select>`, `<table>` for interactive UI while Refine is installed.
142
+ - Inline colors, magic pixel values, `!important`, or `@media (prefers-color-scheme)` color rules.
143
+ - Inventing an attribute, event, or slot that `refine-get-component` does not list.
144
+ - Forgetting `tokens.css`/`fouc.css`, or importing the whole library when subpaths suffice.
145
+ - Leaking effects, subscriptions, or clients past their owner's lifetime.
146
+
147
+ ## Done when
148
+
149
+ - Every new capability maps to an installed `@vielzeug/*` package or is justified as out of scope.
150
+ - No parallel implementation of something an installed package provides.
151
+ - With Refine installed: all interactive UI is `ore-*`, `tokens.css` + `fouc.css` are loaded once, every fragment passed `refine-validate-usage`, and app CSS uses tokens only.
152
+ - Every disposable is disposed by its owner.
153
+ - Claims about package APIs were verified with `get-docs` / `get-type-signature`, not recalled.