Skip to content

Commit e404a02

Browse files
committed
feat(Root)!: critical arch changes
- packages/ui renamed to packages/gui - new package stylish to create the design system behind the ui library (@snapverse/gui) - AI assistant context files created from .rules file - brief template of github issues, PRs, and workflows
1 parent 94e5e52 commit e404a02

30 files changed

Lines changed: 270 additions & 3 deletions

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
insert_final_newline = true
9+
10+
[*.{js,ts,jsx,tsx}]
11+
charset = utf-8
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.md]
16+
indent_style = space
17+
indent_size = 4
18+
19+
[*.{yaml,yml}]
20+
indent_style = space
21+
indent_size = 2
22+
23+
[package.json]
24+
indent_style = space
25+
indent_size = 2
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug to help us improve
4+
title: "[BUG] "
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of the bug.
12+
13+
## Steps to Reproduce
14+
15+
1. Go to '...'
16+
2. Click on '...'
17+
3. See error
18+
19+
## Expected Behavior
20+
21+
A clear description of what you expected to happen.
22+
23+
## Actual Behavior
24+
25+
A clear description of what actually happened.
26+
27+
## Screenshots
28+
29+
If applicable, add screenshots to help explain the problem.
30+
31+
## Environment
32+
33+
- OS: [e.g. Windows, macOS, Linux]
34+
- Version: [e.g. 1.0.0]
35+
- Browser (if applicable): [e.g. Chrome, Firefox]
36+
37+
## Additional Context
38+
39+
Add any other context about the problem here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Pull Request
2+
3+
## Description
4+
5+
Brief description of the changes introduced by this PR.
6+
7+
## Type of Change
8+
9+
- [ ] Bug fix
10+
- [ ] New feature
11+
- [ ] Breaking change
12+
- [ ] Documentation update
13+
14+
## Related Issues
15+
16+
Closes #(issue number)
17+
18+
## Changes Made
19+
20+
-
21+
-
22+
-
23+
24+
## Testing
25+
26+
Describe the tests you ran and how to reproduce them.
27+
28+
- [ ] Unit tests pass
29+
- [ ] Integration tests pass
30+
- [ ] Manually tested
31+
32+
## Checklist
33+
34+
- [ ] My code follows the project style guidelines
35+
- [ ] I have performed a self-review of my code
36+
- [ ] I have commented my code where necessary
37+
- [ ] I have updated the documentation accordingly
38+
- [ ] My changes generate no new warnings
39+
40+
## Screenshots (if applicable)
41+
42+
Add screenshots to help explain your changes.
43+
44+
## Additional Notes
45+
46+
Any additional information reviewers should know.

.github/workflows/test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Test CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-slim
12+
steps:
13+
- name: Run tests
14+
run: echo "Tests passed ✅"

.rules

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# SNAP-UI Project Architecture
2+
3+
## Core Architecture
4+
5+
**Monorepo Structure**: Turborepo with pnpm workspaces
6+
- `packages/ui` (@snap-ui): Component library (React 19, TypeScript)
7+
- `packages/stylish` (@snapverse/stylish): Styling system (empty/WIP)
8+
- `apps/docs`: Next.js 15 demo app (port 3001)
9+
- `apps/web`: Next.js 15 app (port 3000)
10+
11+
## Critical Patterns
12+
13+
### Component Architecture
14+
- **Namespace Pattern**: Components use compound pattern (e.g., `Accordion.Root`, `Accordion.Item`)
15+
- **Export Structure**: `src/{component}/index.ts` → `namespace.ts` → `{component}.tsx`
16+
- Each component folder exports via namespace pattern for cleaner API
17+
18+
### Type System
19+
- Global types in `packages/ui/types/index.d.ts` under `SnapUI` namespace
20+
- Import types via path alias: `import SnapUI from "#types"`
21+
- `ComponentProps` extends HTMLDivElement attributes + React.ReactNode
22+
- `Merge<Left, Right>` utility type prioritizes right side over left
23+
24+
### Component Pattern Example
25+
```tsx
26+
// {component}.tsx
27+
export const ComponentRoot = forwardRef<HTMLDivElement, Props>(...)
28+
export const ComponentItem = forwardRef<HTMLDivElement, Props>(...)
29+
30+
// namespace.ts
31+
import { ComponentRoot as Root, ComponentItem as Item } from "./{component}"
32+
const Component = { Root, Item }
33+
export default Component
34+
```
35+
36+
### Package Exports
37+
UI package uses wildcard exports: `./*` maps to `./src/*/index.ts`
38+
- Consumers import: `import Accordion from "@snap-ui/accordion"`
39+
40+
### Code Generation
41+
Turbo generator at `packages/ui/turbo/generators/config.ts`:
42+
- Run: `pnpm --filter @snap-ui generate:component`
43+
- Uses Handlebars template with kebabCase/pascalCase helpers
44+
- Auto-appends export to package.json
45+
46+
### Build System
47+
- Turbo tasks: build depends on `^build` (topological)
48+
- UI package compiles TS → `dist/` (no bundler, just tsc)
49+
- Next.js apps use Turbopack in dev mode
50+
- `dev` task is persistent, non-cacheable
51+
52+
### TypeScript Config
53+
- Base: NodeNext modules, strict mode, ES2022
54+
- React libs extend base + add `jsx: "react-jsx"`
55+
- Path alias `#types` → `./types/index.d.ts`
56+
57+
### Display Names
58+
All components use `@snapverse/{ComponentName}` for React DevTools
59+
60+
## Key Constraints
61+
- Node.js >=22 required
62+
- React 19.1.0 (latest)
63+
- pnpm@9.0.0 package manager
64+
- All workspace packages use `workspace:*` protocol
65+
- ESLint max warnings = 0 (strict)
66+
- Components are forwardRef wrappers using createElement (not JSX)
67+
68+
## Development Preferences
69+
70+
**CRITICAL**:
71+
- **Native-first**: Prefer vanilla JS/TS, native Web APIs, and built-in React features over external libraries
72+
- Only add dependencies when absolutely necessary or explicitly requested
73+
- **Never run builds**: Only modify code when requested. Building is the user's responsibility
74+
- Don't suggest `pnpm build` or `npm build` unless explicitly asked
75+
76+
## Development Flow
77+
1. Generate component: `pnpm --filter @snap-ui generate:component`
78+
2. Edit in `packages/ui/src/{component}/`
79+
3. Export via namespace pattern in `namespace.ts`
80+
4. Apps auto-reload via turborepo watch mode
81+
5. Type checking: `pnpm check-types`
82+
83+
## Empty/Placeholder Packages
84+
- `packages/stylish`: Has structure but empty implementation files
85+
- `packages/ui/src/box`: Empty index.ts

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.rules

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.rules

GEMINI.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.rules

LLM.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.rules

SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.rules

0 commit comments

Comments
 (0)