@cere/cere-design-system 0.0.11 → 0.0.15
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/.specify/memory/agent-factory.md +44 -0
- package/{.agent/rules/AGENTS.md → .specify/memory/architecture.md} +1 -3
- package/.specify/memory/component-architecture.md +73 -0
- package/{.agent/rules/COMPONENTS.md → .specify/memory/components-reference.md} +3 -1
- package/.specify/memory/constitution.md +295 -0
- package/.specify/memory/design-tokens.md +139 -0
- package/.specify/memory/package-usage-guide.md +99 -0
- package/.specify/memory/toolkits.md +57 -0
- package/.specify/memory/workflow.md +87 -0
- package/README.md +149 -4
- package/dist/index.d.mts +442 -1
- package/dist/index.d.ts +442 -1
- package/dist/index.js +1325 -497
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1261 -433
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/.agent/README.md +0 -154
- package/.agent/rules/guidelines.md +0 -111
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cere/cere-design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Cere Network Design System - UI component library built with Material UI and React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
".
|
|
17
|
+
".specify/memory"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsup",
|
package/.agent/README.md
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# Cere Design System - AI Agent Context
|
|
2
|
-
|
|
3
|
-
This folder contains documentation and context optimized for AI agents to effectively work with the Cere Design System.
|
|
4
|
-
|
|
5
|
-
## Files
|
|
6
|
-
|
|
7
|
-
### `rules/COMPONENTS.md`
|
|
8
|
-
**Comprehensive component reference** for AI agents building applications with the Cere Design System.
|
|
9
|
-
|
|
10
|
-
This file provides:
|
|
11
|
-
- Complete listing of all 70+ available components
|
|
12
|
-
- Detailed props and usage examples for each component
|
|
13
|
-
- TypeScript type information
|
|
14
|
-
- Theme and styling guidelines
|
|
15
|
-
- Best practices and common patterns
|
|
16
|
-
- Installation and setup instructions
|
|
17
|
-
|
|
18
|
-
**Use Case:** Feed this document to AI agents (like Claude, GPT-4, etc.) as context when building React applications. The agent will have immediate access to all component APIs, props, and usage patterns without needing to search documentation or source code.
|
|
19
|
-
|
|
20
|
-
### `rules/AGENTS.md`
|
|
21
|
-
Development guidelines and architecture documentation for AI agents working on the design system codebase itself.
|
|
22
|
-
|
|
23
|
-
### `rules/guidelines.md`
|
|
24
|
-
General coding guidelines and conventions.
|
|
25
|
-
|
|
26
|
-
## Usage Examples
|
|
27
|
-
|
|
28
|
-
### For Building Applications
|
|
29
|
-
|
|
30
|
-
When using an AI agent to build a React application with the Cere Design System:
|
|
31
|
-
|
|
32
|
-
1. **Include the context**: Upload or paste `rules/COMPONENTS.md` into your AI conversation
|
|
33
|
-
2. **Reference components**: Ask the agent to build UI using specific components from the design system
|
|
34
|
-
3. **Get accurate code**: The agent will generate TypeScript/React code with correct imports, props, and patterns
|
|
35
|
-
|
|
36
|
-
Example prompts:
|
|
37
|
-
```
|
|
38
|
-
"Build a login form using TextField, LoadingButton, and Alert components"
|
|
39
|
-
"Create a dashboard with Grid, Card, ChartWidget, and MetricsChart"
|
|
40
|
-
"Implement a data table with pagination using Table and Pagination components"
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
#### Injecting Context into Project Prompts
|
|
44
|
-
|
|
45
|
-
You can provide the component reference to AI agents in several ways:
|
|
46
|
-
|
|
47
|
-
**Method 1: Direct File Reference (Recommended)**
|
|
48
|
-
```bash
|
|
49
|
-
# After installing the package, reference the file directly
|
|
50
|
-
cat node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Then paste the output into your AI conversation or include it in your project's AI configuration.
|
|
54
|
-
|
|
55
|
-
**Method 2: Project .cursorrules or .agent Files**
|
|
56
|
-
|
|
57
|
-
Create a rule file in your project root that references the design system components:
|
|
58
|
-
|
|
59
|
-
`.cursorrules` or `.agent/rules/design-system.md`:
|
|
60
|
-
```markdown
|
|
61
|
-
# Design System Components
|
|
62
|
-
|
|
63
|
-
When building UI components, use the Cere Design System.
|
|
64
|
-
|
|
65
|
-
Available components reference:
|
|
66
|
-
|
|
67
|
-
{PASTE CONTENTS OF node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md HERE}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Method 3: Dynamic Import Script**
|
|
71
|
-
|
|
72
|
-
Create a script to automatically inject the context:
|
|
73
|
-
|
|
74
|
-
`scripts/inject-design-system-context.sh`:
|
|
75
|
-
```bash
|
|
76
|
-
#!/bin/bash
|
|
77
|
-
# Inject Cere Design System component reference into project AI context
|
|
78
|
-
|
|
79
|
-
COMPONENTS_FILE="node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md"
|
|
80
|
-
OUTPUT_FILE=".agent/rules/cere-components.md"
|
|
81
|
-
|
|
82
|
-
if [ -f "$COMPONENTS_FILE" ]; then
|
|
83
|
-
echo "Copying Cere Design System component reference..."
|
|
84
|
-
mkdir -p .agent/rules
|
|
85
|
-
cp "$COMPONENTS_FILE" "$OUTPUT_FILE"
|
|
86
|
-
echo "✓ Component reference available at $OUTPUT_FILE"
|
|
87
|
-
else
|
|
88
|
-
echo "Error: Design system not found. Run 'npm install' first."
|
|
89
|
-
exit 1
|
|
90
|
-
fi
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Make it executable and run after installation:
|
|
94
|
-
```bash
|
|
95
|
-
chmod +x scripts/inject-design-system-context.sh
|
|
96
|
-
npm install && ./scripts/inject-design-system-context.sh
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Method 4: Package.json Postinstall Hook**
|
|
100
|
-
|
|
101
|
-
Automatically copy the component reference after package installation:
|
|
102
|
-
|
|
103
|
-
`package.json`:
|
|
104
|
-
```json
|
|
105
|
-
{
|
|
106
|
-
"scripts": {
|
|
107
|
-
"postinstall": "mkdir -p .agent/rules && cp node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md .agent/rules/cere-components.md || true"
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**Method 5: AI Tool Configuration**
|
|
113
|
-
|
|
114
|
-
For tools like Cursor, Cline, or Windsurf, add to your configuration:
|
|
115
|
-
|
|
116
|
-
`.cursor/rules` or `.windsurfrules`:
|
|
117
|
-
```
|
|
118
|
-
When building React components, always use components from @cere/cere-design-system.
|
|
119
|
-
Refer to the complete component API documentation at:
|
|
120
|
-
node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### For Package Installation
|
|
124
|
-
|
|
125
|
-
After installing the package:
|
|
126
|
-
```bash
|
|
127
|
-
npm install @cere/cere-design-system
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
The `.agent` folder will be available at:
|
|
131
|
-
```
|
|
132
|
-
node_modules/@cere/cere-design-system/.agent/
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
You can reference it in AI agent contexts or documentation tools.
|
|
136
|
-
|
|
137
|
-
## Benefits
|
|
138
|
-
|
|
139
|
-
- **Faster Development**: AI agents have immediate access to all component APIs
|
|
140
|
-
- **Consistency**: Ensures AI-generated code follows design system patterns
|
|
141
|
-
- **Type Safety**: All TypeScript types and interfaces are documented
|
|
142
|
-
- **Best Practices**: Common patterns and usage guidelines included
|
|
143
|
-
- **Complete Reference**: No need to browse Storybook or source code during AI-assisted development
|
|
144
|
-
|
|
145
|
-
## Updating
|
|
146
|
-
|
|
147
|
-
This documentation is maintained alongside the component source code. When components are added or updated, the `COMPONENTS.md` file should be updated to reflect the changes.
|
|
148
|
-
|
|
149
|
-
## Package Information
|
|
150
|
-
|
|
151
|
-
- **Package**: `@cere/cere-design-system`
|
|
152
|
-
- **Version**: 0.0.10
|
|
153
|
-
- **Repository**: https://github.com/cere-io/cere-design-system
|
|
154
|
-
- **License**: MIT
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
### Cere Design System — Development Guidelines (Material UI, Vite, Storybook, Jest)
|
|
2
|
-
|
|
3
|
-
These notes capture project-specific details for developing this Material UI–based design system. Components should be implemented first, then covered with comprehensive tests. They complement README/TESTING docs with nuances from this repo's configuration.
|
|
4
|
-
|
|
5
|
-
#### Build and Configuration
|
|
6
|
-
- Build tool: `tsup`
|
|
7
|
-
- Entry: `src/index.ts`
|
|
8
|
-
- Formats: CJS + ESM, with type declarations (`dts: true`)
|
|
9
|
-
- Externalized peer deps to keep bundle lean: `react`, `react-dom`, `@mui/*`, `@emotion/*`, `reactflow`, `@monaco-editor/react`
|
|
10
|
-
- Command: `npm run build`
|
|
11
|
-
- Type checking: `npm run type-check` (and `npm run check-types:ci` in CI)
|
|
12
|
-
- Linting: `npm run lint` or `npm run lint:fix`
|
|
13
|
-
- Vite (for Storybook and local tooling): minimal plugin setup in `vite.config.ts`
|
|
14
|
-
- Package entrypoints are defined in `package.json` `exports`, with `main/module/types` pointing to `dist/*`
|
|
15
|
-
- Peer dependencies (must be present in consumer app and in local dev):
|
|
16
|
-
- `@emotion/react`, `@emotion/styled`, `@mui/material`, `@mui/icons-material`, `@mui/lab`, `react`, `react-dom`, plus `reactflow`, `@monaco-editor/react` for third-party components
|
|
17
|
-
|
|
18
|
-
#### Storybook Setup (Vite)
|
|
19
|
-
- Start: `npm run storybook`
|
|
20
|
-
- Build: `npm run build-storybook`
|
|
21
|
-
- Customizations in `.storybook/main.ts`:
|
|
22
|
-
- CSS modules `localsConvention: 'camelCase'` to align class name access patterns
|
|
23
|
-
- `optimizeDeps.include` for `@monaco-editor/react`, `reactflow`, `monaco-editor`
|
|
24
|
-
- `define: { 'process.env': {} }` to satisfy Monaco in Vite/Storybook
|
|
25
|
-
- Accessibility: `.storybook/test-runner.ts` integrates `@axe-core/playwright` checks for every story root (`#storybook-root`). Run with `npm run test:storybook`.
|
|
26
|
-
|
|
27
|
-
#### Jest and RTL Configuration
|
|
28
|
-
- Jest setup in `jest.config.js`:
|
|
29
|
-
- Preset: `ts-jest`
|
|
30
|
-
- Environment: `jsdom`
|
|
31
|
-
- Roots: `<rootDir>/src`
|
|
32
|
-
- Test discovery: `**/__tests__/**/*.test.{ts,tsx}` and `**/*.test.{ts,tsx}` under `src/`
|
|
33
|
-
- Path alias: `^@/(.*)$ -> <rootDir>/src/$1`
|
|
34
|
-
- CSS modules auto-mocked via `identity-obj-proxy`
|
|
35
|
-
- Coverage excludes stories, test files, `src/index.ts`, and type decls
|
|
36
|
-
- Transform configured to ensure `jsx: 'react-jsx'`
|
|
37
|
-
- Test setup file: `src/setupTests.ts`
|
|
38
|
-
- Imports `@testing-library/jest-dom`
|
|
39
|
-
- Mocks `window.matchMedia` (important for MUI internals and components using media queries)
|
|
40
|
-
- Commands:
|
|
41
|
-
- All tests: `npm test`
|
|
42
|
-
- Watch: `npm run test:watch`
|
|
43
|
-
- Coverage: `npm run test:coverage`
|
|
44
|
-
- CI mode: `npm run test:ci`
|
|
45
|
-
|
|
46
|
-
#### Verified test run (local sanity)
|
|
47
|
-
A minimal Jest test was added temporarily at `src/__tests__/sanity.test.ts` and executed with:
|
|
48
|
-
```
|
|
49
|
-
npm test -- src/__tests__/sanity.test.ts
|
|
50
|
-
```
|
|
51
|
-
It passed (`1 passed`). The file was removed after verification to keep the repo clean. Use this pattern to quickly validate the test harness when needed.
|
|
52
|
-
|
|
53
|
-
#### Writing Tests (Pragmatic Workflow)
|
|
54
|
-
- Principle: Implement components first, then write comprehensive tests to ensure quality and prevent regressions.
|
|
55
|
-
- Where to put tests:
|
|
56
|
-
- Preferred: colocate under the component area using `__tests__` with `*.test.tsx` naming. Example: `src/components/layout/__tests__/Avatar.test.tsx`
|
|
57
|
-
- Alternatively: place a direct `*.test.tsx` beside the component; Jest will still pick it up.
|
|
58
|
-
- Wrap components with theme in tests:
|
|
59
|
-
```
|
|
60
|
-
import { ThemeProvider } from '@mui/material';
|
|
61
|
-
import { theme } from '@/theme';
|
|
62
|
-
import { render } from '@testing-library/react';
|
|
63
|
-
|
|
64
|
-
const renderWithTheme = (ui: React.ReactElement) =>
|
|
65
|
-
render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>);
|
|
66
|
-
```
|
|
67
|
-
- Use React Testing Library idioms:
|
|
68
|
-
- Prefer `getByRole`, `getByText`, `getByLabelText` and user-level interactions via `@testing-library/user-event`
|
|
69
|
-
- Use `@testing-library/jest-dom` matchers (already configured)
|
|
70
|
-
- Snapshot testing: Avoid broad snapshots for MUI; assert semantics and key props/attributes instead
|
|
71
|
-
- Accessibility: Validate roles, names, disabled state, focus management
|
|
72
|
-
- Example patterns already in repo: see `src/components/**/__tests__/*.test.tsx` (e.g., `Avatar.test.tsx`)
|
|
73
|
-
|
|
74
|
-
#### Adding Storybook Interaction Tests
|
|
75
|
-
- Add `play` functions to stories using `@storybook/test` utilities (e.g., `within`, `userEvent`)
|
|
76
|
-
- Run with: `npm run test:storybook`
|
|
77
|
-
- These tests also run automatic axe accessibility checks via the configured test runner
|
|
78
|
-
|
|
79
|
-
#### Component Authoring Conventions
|
|
80
|
-
- Material UI theming
|
|
81
|
-
- Use the shared `theme` from `src/theme` and expose component tokens via theme when practical
|
|
82
|
-
- Respect MUI variants/sizes; provide sensible defaults and typed props
|
|
83
|
-
- Public exports
|
|
84
|
-
- Ensure all new components are exported from `src/index.ts` and surfaced in the package
|
|
85
|
-
- CSS and classNames
|
|
86
|
-
- MUI’s `sx` and `styled` utilities are preferred; if class-based styling is necessary, remember Storybook’s CSS module config uses camelCase
|
|
87
|
-
- Third-party components
|
|
88
|
-
- If components integrate `reactflow` or `@monaco-editor/react`, keep their imports dynamic-friendly and avoid relying on Node globals; Storybook’s `process.env` shim is in place
|
|
89
|
-
|
|
90
|
-
#### Common Pitfalls and Fixes
|
|
91
|
-
- matchMedia not defined in JSDOM
|
|
92
|
-
- Already handled in `src/setupTests.ts`. If adding features that rely on different media APIs, extend this mock
|
|
93
|
-
- Failing to wrap with ThemeProvider in tests
|
|
94
|
-
- Most MUI components require theme context; tests should wrap components with `ThemeProvider`
|
|
95
|
-
- Missing peer dependencies in consumer app or local dev
|
|
96
|
-
- Install all listed peer deps to avoid runtime errors
|
|
97
|
-
- Class name expectations
|
|
98
|
-
- RTL queries should target roles and text over MUI-generated class names; class selectors may be brittle across MUI versions
|
|
99
|
-
|
|
100
|
-
#### Release Hygiene
|
|
101
|
-
- Run `npm run type-check && npm run lint && npm test && npm run build` before publishing
|
|
102
|
-
- Storybook should render locally (`npm run storybook`) for visual checks; optionally run `npm run test:storybook` for a11y/interaction coverage
|
|
103
|
-
|
|
104
|
-
#### Quick Development Loop
|
|
105
|
-
1) Implement component following existing patterns and conventions
|
|
106
|
-
2) Create Storybook story with all variants and states
|
|
107
|
-
3) Write comprehensive tests under the component's `__tests__` folder
|
|
108
|
-
4) Run `npm test -- componentPathOrPattern` to verify coverage
|
|
109
|
-
5) Add `play` interaction tests to Storybook stories if relevant
|
|
110
|
-
6) Verify accessibility with `npm run test:storybook`
|
|
111
|
-
|