@vielzeug/codex 26.11.23 → 26.11.25

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 (97) hide show
  1. package/README.md +5 -4
  2. package/data/snapshot.json +1 -0
  3. package/dist/catalog.d.ts +35 -39
  4. package/dist/catalog.js +112 -139
  5. package/dist/catalog.js.map +1 -1
  6. package/dist/cli.js +25 -16
  7. package/dist/cli.js.map +1 -1
  8. package/dist/http.js +1 -1
  9. package/dist/http.js.map +1 -1
  10. package/dist/index.d.ts +5 -7
  11. package/dist/index.js +4 -6
  12. package/dist/index.js.map +1 -1
  13. package/dist/server.d.ts +9 -7
  14. package/dist/server.js +14 -6
  15. package/dist/server.js.map +1 -1
  16. package/dist/snapshot.d.ts +8 -22
  17. package/dist/snapshot.js +41 -176
  18. package/dist/snapshot.js.map +1 -1
  19. package/dist/tools/index.d.ts +1 -1
  20. package/dist/tools/index.js.map +1 -1
  21. package/dist/tools/packages.js +49 -82
  22. package/dist/tools/packages.js.map +1 -1
  23. package/dist/tools/refine.d.ts +1 -2
  24. package/dist/tools/refine.js +90 -82
  25. package/dist/tools/refine.js.map +1 -1
  26. package/dist/tools/schema.d.ts +2 -1
  27. package/dist/tools/schema.js +9 -5
  28. package/dist/tools/schema.js.map +1 -1
  29. package/dist/tools/shared.d.ts +2 -2
  30. package/dist/types.d.ts +77 -64
  31. package/dist/types.js +6 -2
  32. package/dist/types.js.map +1 -1
  33. package/package.json +2 -2
  34. package/skills/vielzeug/SKILL.md +18 -20
  35. package/data/catalog.json +0 -2536
  36. package/data/llms-full.txt +0 -40710
  37. package/data/llms.txt +0 -60
  38. package/data/manifest.json +0 -4
  39. package/data/packages/archive.json +0 -87
  40. package/data/packages/arsenal.json +0 -270
  41. package/data/packages/assay.json +0 -52
  42. package/data/packages/atlas.json +0 -70
  43. package/data/packages/bard.json +0 -38
  44. package/data/packages/beacon.json +0 -51
  45. package/data/packages/clockwork.json +0 -69
  46. package/data/packages/codex.json +0 -37
  47. package/data/packages/coins.json +0 -99
  48. package/data/packages/conduit.json +0 -67
  49. package/data/packages/courier.json +0 -66
  50. package/data/packages/dnd.json +0 -60
  51. package/data/packages/familiar.json +0 -38
  52. package/data/packages/flux.json +0 -97
  53. package/data/packages/focus.json +0 -51
  54. package/data/packages/forge.json +0 -65
  55. package/data/packages/gesture.json +0 -65
  56. package/data/packages/herald.json +0 -80
  57. package/data/packages/illusionist.json +0 -132
  58. package/data/packages/ink.json +0 -32
  59. package/data/packages/keymap.json +0 -55
  60. package/data/packages/ledger.json +0 -60
  61. package/data/packages/lingua.json +0 -68
  62. package/data/packages/mesh.json +0 -52
  63. package/data/packages/necromancer.json +0 -55
  64. package/data/packages/orbit.json +0 -100
  65. package/data/packages/ore.json +0 -78
  66. package/data/packages/palette.json +0 -42
  67. package/data/packages/patchwork.json +0 -55
  68. package/data/packages/postmaster.json +0 -49
  69. package/data/packages/prism.json +0 -99
  70. package/data/packages/pulse.json +0 -71
  71. package/data/packages/refine.json +0 -36
  72. package/data/packages/ripple.json +0 -84
  73. package/data/packages/rune.json +0 -78
  74. package/data/packages/sandbox.json +0 -26
  75. package/data/packages/scout.json +0 -66
  76. package/data/packages/scribe.json +0 -57
  77. package/data/packages/scroll.json +0 -110
  78. package/data/packages/sentinel.json +0 -46
  79. package/data/packages/sigil.json +0 -52
  80. package/data/packages/sourcerer.json +0 -86
  81. package/data/packages/spell.json +0 -126
  82. package/data/packages/stage.json +0 -25
  83. package/data/packages/tabula.json +0 -39
  84. package/data/packages/tandem.json +0 -31
  85. package/data/packages/tavern.json +0 -34
  86. package/data/packages/tempo.json +0 -68
  87. package/data/packages/vault.json +0 -81
  88. package/data/packages/ward.json +0 -77
  89. package/data/packages/wayfinder.json +0 -126
  90. package/data/packages/wire.json +0 -36
  91. package/data/refine.json +0 -17273
  92. package/dist/consumer.d.ts +0 -17
  93. package/dist/consumer.js +0 -114
  94. package/dist/consumer.js.map +0 -1
  95. package/dist/port.d.ts +0 -2
  96. package/dist/port.js +0 -12
  97. package/dist/port.js.map +0 -1
@@ -5,15 +5,6 @@ const tag = {
5
5
  required: ['tagName'],
6
6
  type: 'object',
7
7
  };
8
- const template = {
9
- additionalProperties: false,
10
- properties: {
11
- scenario: { default: '', description: 'Optional scenario label', maxLength: 200, type: 'string' },
12
- tagName: tag.properties.tagName,
13
- },
14
- required: ['tagName'],
15
- type: 'object',
16
- };
17
8
  const tokenFilter = {
18
9
  additionalProperties: false,
19
10
  properties: { filter: { default: '', description: 'Optional token prefix', maxLength: 100, type: 'string' } },
@@ -21,51 +12,96 @@ const tokenFilter = {
21
12
  };
22
13
  const usage = {
23
14
  additionalProperties: false,
24
- properties: {
25
- html: { description: 'Component HTML fragment', maxLength: 5000, minLength: 1, type: 'string' },
26
- tagName: tag.properties.tagName,
27
- },
28
- required: ['html', 'tagName'],
15
+ properties: { html: { description: 'Component HTML fragment', maxLength: 5000, minLength: 1, type: 'string' } },
16
+ required: ['html'],
29
17
  type: 'object',
30
18
  };
31
- function escapeHtml(value) {
32
- return value.replaceAll('&', '&amp;').replaceAll('"', '&quot;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
33
- }
34
- function escapeRegExp(value) {
35
- return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
36
- }
37
- function attribute(attr) {
38
- if (attr.type?.text === 'boolean')
39
- return attr.name;
40
- if (attr.default !== undefined)
41
- return `${attr.name}="${escapeHtml(attr.default)}"`;
42
- return `${attr.name}=""`;
19
+ /** Attributes every element accepts from the platform or ARIA, never flagged as unknown. */
20
+ const SAFE_ATTRIBUTES = new Set([
21
+ 'accesskey',
22
+ 'autocapitalize',
23
+ 'autofocus',
24
+ 'class',
25
+ 'contenteditable',
26
+ 'dir',
27
+ 'draggable',
28
+ 'enterkeyhint',
29
+ 'exportparts',
30
+ 'hidden',
31
+ 'id',
32
+ 'inert',
33
+ 'inputmode',
34
+ 'is',
35
+ 'itemid',
36
+ 'itemprop',
37
+ 'itemref',
38
+ 'itemscope',
39
+ 'itemtype',
40
+ 'lang',
41
+ 'nonce',
42
+ 'part',
43
+ 'popover',
44
+ 'role',
45
+ 'slot',
46
+ 'spellcheck',
47
+ 'style',
48
+ 'tabindex',
49
+ 'title',
50
+ 'translate',
51
+ ]);
52
+ /** Parse the opening tags of `ore-*` custom elements: tag name plus [name, value|null] pairs. */
53
+ function parseOpeningTags(html) {
54
+ const tags = [];
55
+ for (const match of html.matchAll(/<(ore-[\w-]+)((?:"[^"]*"|'[^']*'|[^'">])*)>/gi)) {
56
+ const attributes = [];
57
+ for (const attr of match[2].matchAll(/([\w:@][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s/>]+)))?/g)) {
58
+ attributes.push([attr[1].toLowerCase(), attr[2] ?? attr[3] ?? attr[4] ?? null]);
59
+ }
60
+ tags.push({ attributes, tag: match[1].toLowerCase() });
61
+ }
62
+ return tags;
43
63
  }
44
- function htmlTemplate(component, scenario) {
45
- const name = component.tagName ?? '';
46
- const attributes = (component.attributes ?? []).filter((item) => item.default === undefined).map(attribute);
47
- const slots = (component.slots ?? [])
48
- .filter((slot) => slot.name)
49
- .map((slot) => ` <span slot="${escapeHtml(slot.name)}">${escapeHtml(slot.description ?? slot.name)}</span>`);
50
- const body = slots.length > 0 ? `\n${slots.join('\n')}\n` : '\n Content\n';
51
- const comment = scenario ? `<!-- ${scenario.replaceAll('--', ':')} -->\n` : '';
52
- return `${comment}<${name}${attributes.length ? `\n ${attributes.join('\n ')}` : ''}>${body}</${name}>`;
64
+ /** The literal members of a CEM union type (`'a' | 'b'`), or null when it is not a closed set. */
65
+ function enumValues(type) {
66
+ if (!type)
67
+ return null;
68
+ const literals = [...type.matchAll(/'([^']*)'|"([^"]*)"/g)].map((m) => m[1] ?? m[2]);
69
+ return literals.length > 0 && /^[\s|]*$/.test(type.replaceAll(/'[^']*'|"[^"]*"/g, '')) ? literals : null;
53
70
  }
54
- function usageIssues(component, html) {
55
- const name = component.tagName ?? '';
56
- const opening = new RegExp(`<${escapeRegExp(name)}(?=[\\s/>])((?:"[^"]*"|'[^']*'|[^'">])*)>`, 'i').exec(html);
57
- if (!opening)
58
- return [{ message: `Could not find opening <${name}> tag.`, type: 'error' }];
59
- const known = new Set((component.attributes ?? []).map((attribute) => attribute.name.toLowerCase()));
60
- const safe = new Set(['class', 'id', 'slot', 'style', 'title', 'hidden', 'part']);
71
+ function validateFragment(catalog, html) {
61
72
  const issues = [];
62
- for (const match of opening[1].matchAll(/([\w-]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s/>]+))?/g)) {
63
- const attribute = match[1].toLowerCase();
64
- if (!safe.has(attribute) &&
65
- !attribute.startsWith('aria-') &&
66
- !attribute.startsWith('data-') &&
67
- !known.has(attribute)) {
68
- issues.push({ message: `Unknown attribute "${attribute}" on <${name}>.`, type: 'error' });
73
+ for (const opening of parseOpeningTags(html)) {
74
+ const component = catalog.components.find((item) => item.tag === opening.tag);
75
+ if (!component) {
76
+ issues.push({
77
+ message: `Unknown component <${opening.tag}>. Run refine-list-components for the tag list.`,
78
+ tag: opening.tag,
79
+ type: 'error',
80
+ });
81
+ continue;
82
+ }
83
+ const known = new Map((component.attributes ?? []).map((attr) => [attr.name.toLowerCase(), attr]));
84
+ for (const [name, value] of opening.attributes) {
85
+ if (SAFE_ATTRIBUTES.has(name) || name.startsWith('aria-') || name.startsWith('data-'))
86
+ continue;
87
+ const attr = known.get(name);
88
+ if (!attr) {
89
+ issues.push({ message: `Unknown attribute "${name}" on <${opening.tag}>.`, tag: opening.tag, type: 'error' });
90
+ continue;
91
+ }
92
+ if (value === null || attr.type === undefined)
93
+ continue;
94
+ // Boolean attributes accept presence, an empty value, or the name itself.
95
+ if (/\bboolean\b/i.test(attr.type))
96
+ continue;
97
+ const allowed = enumValues(attr.type);
98
+ // An enum attribute with a CEM default accepts an empty value as "use the default".
99
+ if (allowed && !allowed.includes(value) && !(value === '' && attr.default !== undefined))
100
+ issues.push({
101
+ message: `Value "${value}" is not valid for "${name}" on <${opening.tag}>. Allowed: ${allowed.join(', ')}.`,
102
+ tag: opening.tag,
103
+ type: 'error',
104
+ });
69
105
  }
70
106
  }
71
107
  return issues;
@@ -73,10 +109,7 @@ function usageIssues(component, html) {
73
109
  export const refineTools = [
74
110
  {
75
111
  description: 'List bundled Refine component tags and descriptions.',
76
- execute: (_args, catalog) => catalog
77
- .listComponents()
78
- .filter((component) => component.tagName)
79
- .map((component) => ({ description: component.description ?? '', tagName: component.tagName })),
112
+ execute: (_args, catalog) => catalog.components.map((component) => ({ description: component.summary ?? '', tagName: component.tag })),
80
113
  inputSchema: EMPTY_SCHEMA,
81
114
  name: 'refine-list-components',
82
115
  },
@@ -87,42 +120,17 @@ export const refineTools = [
87
120
  name: 'refine-get-component',
88
121
  },
89
122
  {
90
- description: 'Generate a minimal Refine component HTML template.',
91
- execute: (args, catalog) => {
92
- const input = parseArgs(template, args);
93
- return htmlTemplate(catalog.getComponent(input.tagName), input.scenario);
94
- },
95
- inputSchema: template,
96
- name: 'refine-generate-template',
97
- },
98
- {
99
- description: 'List bundled Refine CSS custom properties.',
123
+ description: 'List Refine theme tokens (custom properties from theme.css) with values and notes.',
100
124
  execute: (args, catalog) => {
101
125
  const filter = parseArgs(tokenFilter, args).filter.toLowerCase();
102
- const tokens = new Map();
103
- for (const component of catalog.listComponents())
104
- for (const property of component.cssProperties ?? []) {
105
- if (property.name &&
106
- !tokens.has(property.name) &&
107
- (!filter || property.name.toLowerCase().startsWith(filter)))
108
- tokens.set(property.name, {
109
- component: component.tagName ?? component.name ?? 'unknown',
110
- ...(property.default !== undefined && { default: property.default }),
111
- ...(property.description && { description: property.description }),
112
- name: property.name,
113
- });
114
- }
115
- return [...tokens.values()].sort((left, right) => left.name.localeCompare(right.name));
126
+ return catalog.tokens.filter((token) => !filter || token.name.toLowerCase().startsWith(filter));
116
127
  },
117
128
  inputSchema: tokenFilter,
118
129
  name: 'refine-get-tokens',
119
130
  },
120
131
  {
121
- description: 'Validate unknown attributes in one Refine component HTML fragment.',
122
- execute: (args, catalog) => {
123
- const input = parseArgs(usage, args);
124
- return usageIssues(catalog.getComponent(input.tagName), input.html);
125
- },
132
+ description: "Validate a Refine HTML fragment: unknown ore-* tags, unknown attributes, and values outside each attribute's allowed set, across every opening tag.",
133
+ execute: (args, catalog) => validateFragment(catalog, parseArgs(usage, args).html),
126
134
  inputSchema: usage,
127
135
  name: 'refine-validate-usage',
128
136
  },
@@ -1 +1 @@
1
- {"version":3,"file":"refine.js","sourceRoot":"","sources":["../../src/tools/refine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAGvE,MAAM,GAAG,GAAG;IACV,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC5G,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,IAAI,EAAE,QAAQ;CACM,CAAC;AACvB,MAAM,QAAQ,GAAG;IACf,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,yBAAyB,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjG,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO;KAChC;IACD,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,IAAI,EAAE,QAAQ;CACM,CAAC;AACvB,MAAM,WAAW,GAAG;IAClB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC7G,IAAI,EAAE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AE,EAAE;YACzB,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAEjE,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAClG,CAAC;QACD,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,mBAAmB;KAC1B;IACD;QACE,WAAW,EACT,qJAAqJ;QACvJ,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;QAClF,WAAW,EAAE,KAAK;QAClB,IAAI,EAAE,uBAAuB;KAC9B;CACF,CAAC"}
@@ -13,7 +13,8 @@ export interface ToolSchema {
13
13
  type: 'object';
14
14
  }
15
15
  export declare const EMPTY_SCHEMA: ToolSchema;
16
- export declare const PACKAGE_SLUG_PROPERTY: ToolProperty;
16
+ /** The one package parameter name used by every tool. */
17
+ export declare const SLUG_PROPERTY: ToolProperty;
17
18
  export type InferArgs<S extends ToolSchema> = {
18
19
  [K in keyof S['properties']]: S['properties'][K] extends {
19
20
  enum: readonly (infer E)[];
@@ -1,6 +1,7 @@
1
1
  import { CatalogError } from '../catalog.js';
2
2
  export const EMPTY_SCHEMA = { additionalProperties: false, properties: {}, type: 'object' };
3
- export const PACKAGE_SLUG_PROPERTY = {
3
+ /** The one package parameter name used by every tool. */
4
+ export const SLUG_PROPERTY = {
4
5
  description: 'Package folder name, e.g. "ripple"',
5
6
  maxLength: 100,
6
7
  minLength: 1,
@@ -15,6 +16,13 @@ export function parseArgs(schema, raw) {
15
16
  for (const [key, property] of Object.entries(schema.properties)) {
16
17
  const required = schema.required?.includes(key) ?? false;
17
18
  const value = raw[key];
19
+ if (typeof value === 'string' &&
20
+ value.trim().length > 0 &&
21
+ property.minLength !== undefined &&
22
+ value.trim().length < property.minLength)
23
+ throw new CatalogError('INVALID_ARG', `${key}: must be at least ${property.minLength} characters.`);
24
+ if (typeof value === 'string' && property.maxLength !== undefined && value.trim().length > property.maxLength)
25
+ throw new CatalogError('INVALID_ARG', `${key}: exceeds ${property.maxLength} character limit. Shorten the value.`);
18
26
  if (value === undefined || value === '') {
19
27
  if (required)
20
28
  throw new CatalogError('INVALID_ARG', `${key}: required non-empty string.`);
@@ -27,10 +35,6 @@ export function parseArgs(schema, raw) {
27
35
  const trimmed = value.trim();
28
36
  if (required && trimmed.length === 0)
29
37
  throw new CatalogError('INVALID_ARG', `${key}: required non-empty string.`);
30
- if (property.minLength !== undefined && trimmed.length < property.minLength)
31
- throw new CatalogError('INVALID_ARG', `${key}: must be at least ${property.minLength} characters.`);
32
- if (property.maxLength !== undefined && trimmed.length > property.maxLength)
33
- throw new CatalogError('INVALID_ARG', `${key}: exceeds ${property.maxLength} character limit. Shorten the value.`);
34
38
  if (property.enum && !property.enum.includes(trimmed))
35
39
  throw new CatalogError('INVALID_ARG', `${key}: must be one of ${property.enum.join(', ')}.`);
36
40
  result[key] = trimmed;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/tools/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAkB7C,MAAM,CAAC,MAAM,YAAY,GAAe,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAExG,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,WAAW,EAAE,oCAAoC;IACjD,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,QAAQ;CACf,CAAC;AAMF,MAAM,UAAU,SAAS,CAAuB,MAAS,EAAE,GAA4B;IAC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,QAAQ;YAAE,MAAM,IAAI,YAAY,CAAC,aAAa,EAAE,GAAG,GAAG,qBAAqB,CAAC,CAAC;QAElG,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAE7B,IAAI,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,YAAY,CAAC,aAAa,EAAE,GAAG,GAAG,8BAA8B,CAAC,CAAC;QAClH,IAAI,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YACnD,MAAM,IAAI,YAAY,CAAC,aAAa,EAAE,GAAG,GAAG,oBAAoB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE/F,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;IACxB,CAAC;IAED,OAAO,MAAsB,CAAC;AAChC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { Catalog } from '../catalog.js';
2
2
  import type { ToolSchema } from './schema.js';
3
- export interface ToolDefinition<CatalogType extends Catalog = Catalog> {
3
+ export interface ToolDefinition {
4
4
  description: string;
5
- execute: (args: Record<string, unknown>, catalog: CatalogType) => unknown;
5
+ execute: (args: Record<string, unknown>, catalog: Catalog) => unknown;
6
6
  inputSchema: ToolSchema;
7
7
  name: string;
8
8
  }
package/dist/types.d.ts CHANGED
@@ -1,55 +1,30 @@
1
- export declare const DOC_PAGES: readonly ["index", "api", "usage", "examples"];
2
- export type DocPage = (typeof DOC_PAGES)[number];
3
- export declare const SNAPSHOT_SCHEMA_VERSION: 2;
4
- export interface CemTypeRef {
5
- readonly text: string;
1
+ /**
2
+ * The snapshot contract shared by the generator (`scripts/`) and the runtime (`src/`).
3
+ * One `data/snapshot.json` carries everything the server serves; metadata the server can
4
+ * derive from content (page lists, example ids, export names) is never stored beside it.
5
+ */
6
+ /** Documentation pages keyed by path relative to `docs/<slug>/` without the `.md` extension (`index`, `migration`, `components/button`). */
7
+ export type PageMap = Readonly<Record<string, string>>;
8
+ /**
9
+ * One heading-delimited section of a docs page. `start`/`end` are offsets into the stored
10
+ * page markdown, computed at generate time against the exact shipped string.
11
+ */
12
+ export interface Section {
13
+ readonly end: number;
14
+ /** Heading text without leading `#`s; the section before the first heading uses the page title. */
15
+ readonly heading: string;
16
+ readonly level: 2 | 3;
17
+ readonly page: string;
18
+ readonly start: number;
6
19
  }
7
- export interface CemAttribute {
8
- readonly default?: string;
9
- readonly description?: string;
10
- readonly fieldName?: string;
11
- readonly name: string;
12
- readonly type?: CemTypeRef;
13
- }
14
- export interface CemCssPart {
15
- readonly description?: string;
16
- readonly name: string;
17
- }
18
- export interface CemCssProperty {
19
- readonly default?: string;
20
- readonly description?: string;
21
- readonly name: string;
22
- }
23
- export interface CemEvent {
24
- readonly description?: string;
25
- readonly name: string;
26
- readonly type?: CemTypeRef;
27
- }
28
- export interface CemMember {
29
- readonly description?: string;
30
- readonly kind?: 'field' | 'method';
31
- readonly name: string;
32
- readonly type?: CemTypeRef;
33
- }
34
- export interface CemSlot {
35
- readonly description?: string;
20
+ /** One public export of a package, resolved through the TypeScript checker at generate time. */
21
+ export interface ExportEntry {
22
+ /** The export's JSDoc summary, when the declaration carries one. */
23
+ readonly doc?: string;
24
+ readonly kind: 'class' | 'const' | 'function' | 'interface' | 'type' | 'variable';
36
25
  readonly name: string;
37
- }
38
- export interface CemDeclaration {
39
- readonly attributes?: readonly CemAttribute[];
40
- readonly cssParts?: readonly CemCssPart[];
41
- readonly cssProperties?: readonly CemCssProperty[];
42
- readonly description?: string;
43
- readonly events?: readonly CemEvent[];
44
- readonly members?: readonly CemMember[];
45
- readonly name?: string;
46
- readonly slots?: readonly CemSlot[];
47
- readonly superclass?: {
48
- readonly name: string;
49
- readonly package?: string;
50
- };
51
- readonly tagName?: string;
52
- readonly [key: string]: unknown;
26
+ /** The declaration text including JSDoc, as written in source. */
27
+ readonly signature: string;
53
28
  }
54
29
  export interface Example {
55
30
  readonly code: string;
@@ -57,30 +32,68 @@ export interface Example {
57
32
  readonly name: string;
58
33
  }
59
34
  export interface PackageMeta {
60
- readonly availableDocPages: readonly DocPage[];
61
35
  readonly category: string;
62
36
  readonly description: string;
63
- readonly exampleIds: readonly string[];
64
- readonly exports: readonly string[];
65
- readonly hasSource: boolean;
66
37
  readonly keywords: readonly string[];
67
38
  readonly name: string;
68
39
  readonly related: readonly string[];
69
40
  readonly slug: string;
70
41
  readonly version: string;
71
42
  }
72
- export interface PackageContent {
73
- readonly apiSource: string | null;
74
- readonly docs: Readonly<Partial<Record<DocPage, string>>>;
43
+ /** Everything one package contributes to the snapshot. */
44
+ export interface PackageEntry {
75
45
  readonly examples: readonly Example[];
76
- readonly typeSignatures: Readonly<Record<string, string>>;
46
+ /** The package's real public exports; this list replaces any hand-curated one. */
47
+ readonly exports: readonly ExportEntry[];
48
+ readonly meta: PackageMeta;
49
+ readonly pages: PageMap;
50
+ readonly sections: readonly Section[];
51
+ /** Page title from each page's frontmatter, keyed like `pages`. */
52
+ readonly titles: Readonly<Record<string, string>>;
77
53
  }
78
- export interface CatalogFile {
79
- readonly packages: readonly PackageMeta[];
80
- readonly version: string;
54
+ export interface RefineAttribute {
55
+ readonly default?: string;
56
+ readonly description?: string;
57
+ readonly name: string;
58
+ /** The CEM type text, e.g. `'primary' | 'ghost'` or `'boolean'`. */
59
+ readonly type?: string;
60
+ }
61
+ export interface RefineComponent {
62
+ readonly attributes?: readonly RefineAttribute[];
63
+ readonly cssParts?: readonly {
64
+ readonly description?: string;
65
+ readonly name: string;
66
+ }[];
67
+ readonly cssProperties?: readonly {
68
+ readonly default?: string;
69
+ readonly description?: string;
70
+ readonly name: string;
71
+ }[];
72
+ /** Docs page carrying this component's examples, e.g. `components/button`. */
73
+ readonly docPage?: string;
74
+ readonly events?: readonly {
75
+ readonly description?: string;
76
+ readonly name: string;
77
+ readonly type?: string;
78
+ }[];
79
+ readonly slots?: readonly {
80
+ readonly description?: string;
81
+ readonly name: string;
82
+ }[];
83
+ readonly summary?: string;
84
+ readonly tag: string;
85
+ }
86
+ /** One theme custom property from `packages/refine/src/styles/theme.css`. */
87
+ export interface ThemeToken {
88
+ readonly comment?: string;
89
+ readonly name: string;
90
+ readonly value: string;
81
91
  }
82
- /** Layout filenames (`catalog.json`, `packages/`, `refine.json`) are code constants; the manifest carries data only. */
83
- export interface SnapshotManifest {
84
- readonly schemaVersion: typeof SNAPSHOT_SCHEMA_VERSION;
92
+ export interface Snapshot {
93
+ /** Element declarations only; non-custom-element CEM declarations are projected out. */
94
+ readonly components: readonly RefineComponent[];
95
+ readonly packages: readonly PackageEntry[];
96
+ readonly tokens: readonly ThemeToken[];
97
+ /** The codex package version this snapshot was generated from. */
85
98
  readonly version: string;
86
99
  }
package/dist/types.js CHANGED
@@ -1,3 +1,7 @@
1
- export const DOC_PAGES = ['index', 'api', 'usage', 'examples'];
2
- export const SNAPSHOT_SCHEMA_VERSION = 2;
1
+ /**
2
+ * The snapshot contract shared by the generator (`scripts/`) and the runtime (`src/`).
3
+ * One `data/snapshot.json` carries everything the server serves; metadata the server can
4
+ * derive from content (page lists, example ids, export names) is never stored beside it.
5
+ */
6
+ export {};
3
7
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAGxE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAU,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vielzeug/codex",
3
- "version": "26.11.23",
3
+ "version": "26.11.25",
4
4
  "description": "MCP server exposing all Vielzeug docs to AI clients",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^26.6.6",
55
- "@vielzeug/refine": "26.11.23",
55
+ "@vielzeug/refine": "26.11.25",
56
56
  "typescript": "^6.0.3",
57
57
  "vitest": "^5.1.0"
58
58
  }
@@ -9,7 +9,7 @@ Vielzeug is a monorepo of independently published TypeScript packages. "Zero dep
9
9
 
10
10
  ## Detect
11
11
 
12
- 1. If codex's MCP server is connected, call `check-install` once per project: it compares every declared `@vielzeug/*` dependency with the snapshot. Offline, read `package.json` (`dependencies`, `devDependencies`, `peerDependencies`) and list every `@vielzeug/*` entry, resolving each installed version from `node_modules/@vielzeug/<pkg>/package.json` when present, otherwise from the package-manager lockfile.
12
+ 1. Read `package.json` (`dependencies`, `devDependencies`, `peerDependencies`) and list every `@vielzeug/*` entry, resolving each installed version from `node_modules/@vielzeug/<pkg>/package.json` when present, otherwise from the package-manager lockfile. When codex's MCP server is connected, its server instructions report the snapshot version its answers describe: compare it with the installed versions before recommending APIs, and treat the installed package as authoritative when they differ.
13
13
  2. Note whether `@vielzeug/refine` is installed. If it is, the **Refine** and **Theme** sections below are mandatory for any UI work.
14
14
  3. Read the project's own agent contract (`AGENTS.md`, `.github/copilot-instructions.md`) first: project rules win over this skill. Also load the nearest subtree `AGENTS.md` before editing inside it (index at the end of root `AGENTS.md`).
15
15
 
@@ -17,27 +17,25 @@ Vielzeug is a monorepo of independently published TypeScript packages. "Zero dep
17
17
 
18
18
  Never guess exports, attributes, events, slots, or token names. Look them up:
19
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` (`slug`, `symbol`) | the declaration file named by the installed manifest's matching export |
25
- | Bundled source of one package (only on a `check-install` `match`) | `get-source` (`packageSlug`) | the installed package's declaration files; checkout `packages/<pkg>/src/` when the repository is checked out |
26
- | Runnable example | `list-examples`, `get-example` | package README; `docs/<pkg>/examples/` when the Vielzeug repository is checked out |
27
- | Which Refine components exist? | `refine-list-components` (tags + descriptions) | `rg '"tagName"' node_modules/@vielzeug/refine/dist/custom-elements.json` |
28
- | Attributes, properties, events, slots, CSS parts of `ore-*` | `refine-get-component` | extract the matching `tagName` declaration from the manifest with a JSON parser |
29
- | Component CSS custom properties | `refine-get-tokens` (pass a prefix) | extract the component's `cssProperties` from the manifest |
30
- | Global design tokens | targeted search in installed theme CSS | `node_modules/@vielzeug/refine/dist/styles/theme.css` or checkout `packages/refine/src/styles/theme.css` |
31
- | Are component attribute names recognized? | `refine-validate-usage` | compare against the manifest |
32
- | Blank component scaffold | `refine-generate-template` | N/A |
20
+ | Question | MCP tool (`@vielzeug/codex`) | Offline fallback |
21
+ | ----------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
22
+ | Which package solves X? | `search`, `list-packages` | the package list below |
23
+ | How do I use package X? | `get-docs` (`slug`, `page`, optional `section`) | `node_modules/@vielzeug/<pkg>/README.md` |
24
+ | Exact signature of an export | `get-type-signature` (`slug`, `symbol`) | the declaration file named by the installed manifest's matching export |
25
+ | Runnable example | `get-package` (example ids), `get-example` | package README; `docs/<pkg>/examples/` when the Vielzeug repository is checked out |
26
+ | Which Refine components exist? | `refine-list-components` (tags + summaries) | `rg '"tagName"' node_modules/@vielzeug/refine/dist/custom-elements.json` |
27
+ | Attributes, properties, events, slots, CSS parts of `ore-*` | `refine-get-component` | extract the matching `tagName` declaration from the manifest with a JSON parser |
28
+ | Component CSS custom properties | `refine-get-tokens` (pass a prefix) | extract the component's `cssProperties` from the manifest |
29
+ | Global design tokens | `refine-get-tokens`, or targeted search in installed theme CSS | `node_modules/@vielzeug/refine/dist/styles/theme.css` or checkout `packages/refine/src/styles/theme.css` |
30
+ | Are component tags, attributes, and values valid? | `refine-validate-usage` | compare against the manifest |
33
31
 
34
- Look each thing up once, from the smallest source that answers it: reuse a lookup already in this task while its version and relevant inputs remain unchanged; read one component with `refine-get-component` instead of listing the whole catalog; pass the narrowest known prefix (prefer an exact token name when known) to `refine-get-tokens`; fetch the one `get-docs` page that answers the question, not `index` + `usage` + `api` + `examples`. Verified installed declarations or checkout source are sufficient evidence without an additional docs fetch. Offline, use targeted searches to locate source or CSS; extract a component declaration from the JSON manifest with a structured parser rather than dumping the manifest.
32
+ Look each thing up once, from the smallest source that answers it: reuse a lookup already in this task while its version and relevant inputs remain unchanged; read one component with `refine-get-component` instead of listing the whole catalog; pass the narrowest known prefix (prefer an exact token name when known) to `refine-get-tokens`; fetch the one `get-docs` page (or single `section` of it) that answers the question. Verified installed declarations or checkout source are sufficient evidence without an additional docs fetch. Offline, use targeted searches to locate source or CSS; extract a component declaration from the JSON manifest with a structured parser rather than dumping the manifest.
35
33
 
36
- `refine-get-tokens` reads CEM component CSS properties, not the complete global theme. For global tokens such as `--size-*`, search the relevant prefix or exact name in theme CSS; an empty MCP result does not prove a global token is unavailable. `tokens.css` only imports the underlying stylesheets.
34
+ `refine-get-tokens` reads the theme custom properties from `theme.css`. For an exact token name, pass it as `filter`; an empty result means the token does not exist in the theme.
37
35
 
38
- Codex serves a versioned snapshot, which may not match the versions installed in the project or include the newest packages. Call codex's `check-install` once per project to compare the snapshot against every `@vielzeug/*` dependency the project declares; it reports `match`, `drift`, `linked`, `not-in-snapshot`, or `unresolved`. Use snapshot docs, signatures, and `get-source` only for a `match`. Otherwise, treat the installed package's declarations, docs, and runtime as authoritative; do not use newer snapshot APIs unless the dependency is deliberately updated. Treat the generated package list as a discovery aid, not proof that no other package exists.
36
+ Codex serves a versioned snapshot, which may not match the versions installed in the project. The server instructions carry the snapshot version: compare it with the installed `@vielzeug/*` versions. When they differ, treat the installed package's declarations, docs, and runtime as authoritative; do not use newer snapshot APIs unless the dependency is deliberately updated. Treat the generated package list as a discovery aid, not proof that no other package exists.
39
37
 
40
- `get-docs` reaches only the four standard pages (`index`, `api`, `usage`, `examples`). A package's extra guides (Refine's `frameworks`, `theming`, `accessibility`, per-component references) are not in that set: read them from `https://vielzeug.dev/<pkg>/<page>` or from the checkout's `docs/<pkg>/`, not from `get-docs`.
38
+ `get-docs` serves every bundled docs page by path (`index`, `api`, `usage`, and extras such as Refine's `frameworks`, `theming`, `accessibility`, and `components/<name>`); `get-package` lists a package's pages. Offline, read the same pages from `https://vielzeug.dev/<pkg>/<page>` or the checkout's `docs/<pkg>/`.
41
39
 
42
40
  If MCP is unavailable, use the offline fallback first. Check installed packages and the lockfile when the generated package list has no match. If the needed information is still unavailable and MCP setup would help, ask before running `npx -y @vielzeug/codex` or changing MCP configuration; setup details are in `node_modules/@vielzeug/codex/mcp-setup.json`.
43
41
 
@@ -131,9 +129,9 @@ Refine is the UI layer. Build interfaces from `ore-*` elements before anything e
131
129
 
132
130
  5. **Follow the element contract**: attributes for primitives, JavaScript properties for objects/arrays/callbacks, named slots for composition. Read event payloads from the documented `event.detail` or element state as appropriate; do not assume every event uses `event.target`. Icon-only controls need an accessible label.
133
131
 
134
- 6. **Type the tags** once in a type entry point: `import type {} from '@vielzeug/refine/frameworks/elements'` (or `/react`, `/vue`). For new or changed framework wiring (React 18/19, Vue, Svelte, Angular, SSR guards), read the relevant section of the Refine `frameworks` guide from the checkout or `https://vielzeug.dev/refine/frameworks` (`get-docs` does not serve it). Reuse verified existing wiring for ordinary component edits.
132
+ 6. **Type the tags** once in a type entry point: `import type {} from '@vielzeug/refine/frameworks/elements'` (or `/react`, `/vue`). For new or changed framework wiring (React 18/19, Vue, Svelte, Angular, SSR guards), read the `frameworks` guide (`get-docs` with `slug: "refine"`, `page: "frameworks"`, or `https://vielzeug.dev/refine/frameworks`). Reuse verified existing wiring for ordinary component edits.
135
133
 
136
- 7. **Check attribute names** with `refine-validate-usage` when available. It only checks for unknown attributes on the specified component's opening tag; it does not validate HTML generally, attribute values, JavaScript properties, events, slots, accessibility, or runtime behavior. Check those against the component docs and relevant tests instead.
134
+ 7. **Check generated markup** with `refine-validate-usage` when available. It checks every `ore-*` opening tag in the fragment for unknown tags, unknown attributes, and values outside an attribute's documented set; it does not validate children, slot content, JavaScript properties, events, accessibility, or runtime behavior. Check those against the component docs and relevant tests instead.
137
135
 
138
136
  8. **Missing capability?** Compose existing `ore-*` elements when they fit. If none meets the documented feature and project requirements, use the simplest appropriate native element or other package and report the gap.
139
137