create-modoock-app 1.0.0 → 2.0.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/README.md +68 -0
- package/dist/cli.js +112 -43
- package/package.json +22 -21
- package/template/.cursor/hooks/gate-ui-pack.mjs +108 -0
- package/template/.cursor/hooks.json +18 -0
- package/template/.cursor/rules/honey.mdc +11 -3
- package/template/AGENTS.md +13 -12
- package/template/README.md +225 -175
- package/template/app/(local)/components/page.tsx +3 -3
- package/template/app/(local)/design-system/page.tsx +2 -2
- package/template/components/layout/app-layout.tsx +16 -5
- package/template/components/layout/header.tsx +19 -1
- package/template/components/layout/side-nav.tsx +103 -30
- package/template/postcss.config.mjs +7 -7
- package/template/public/identity/full_logo_black.svg +26 -26
- package/template/public/identity/full_logo_color.svg +37 -37
- package/template/public/identity/full_logo_white.svg +33 -33
- package/template/public/identity/logo_icon_black.svg +5 -5
- package/template/public/identity/logo_icon_color.svg +12 -12
- package/template/public/identity/logo_icon_white.svg +12 -12
- package/template/components/ui/action-stack.tsx +0 -42
- package/template/components/ui/badge.tsx +0 -43
- package/template/components/ui/button.tsx +0 -104
- package/template/components/ui/icon.tsx +0 -78
- package/template/components/ui/index.ts +0 -28
- package/template/components/ui/input.tsx +0 -376
- package/template/components/ui/loader.tsx +0 -78
- package/template/components/ui/metric-bar.tsx +0 -49
- package/template/components/ui/modal.tsx +0 -177
- package/template/components/ui/select.tsx +0 -458
- package/template/components/ui/stepper.tsx +0 -96
- package/template/components/ui/tab.tsx +0 -85
- package/template/components/ui/user-table.tsx +0 -806
- package/template/knowledge-base/design-system/components/action-stack.mdc +0 -17
- package/template/knowledge-base/design-system/components/badges.mdc +0 -16
- package/template/knowledge-base/design-system/components/buttons.mdc +0 -21
- package/template/knowledge-base/design-system/components/detail-header.mdc +0 -17
- package/template/knowledge-base/design-system/components/dropdowns.mdc +0 -12
- package/template/knowledge-base/design-system/components/info-list.mdc +0 -17
- package/template/knowledge-base/design-system/components/inputs.mdc +0 -23
- package/template/knowledge-base/design-system/components/menu.mdc +0 -20
- package/template/knowledge-base/design-system/components/modals.mdc +0 -24
- package/template/knowledge-base/design-system/components/selects.mdc +0 -39
- package/template/knowledge-base/design-system/components/stepper.mdc +0 -18
- package/template/knowledge-base/design-system/components/tables.mdc +0 -59
- package/template/knowledge-base/design-system/components/tabs.mdc +0 -17
- package/template/knowledge-base/design-system/components.mdc +0 -91
- package/template/knowledge-base/design-system/tokens.mdc +0 -24
- package/template/knowledge-base/examples/bad/README.md +0 -8
- package/template/knowledge-base/examples/good/README.md +0 -13
- package/template/knowledge-base/metadata/catalog.yaml +0 -245
- package/template/knowledge-base/patterns/components/reuse-existing.mdc +0 -26
- package/template/knowledge-base/patterns/data-fetching/local-data.mdc +0 -20
- package/template/knowledge-base/patterns/layouts/app-shell.mdc +0 -20
- package/template/knowledge-base/patterns/pages/data-table-page.mdc +0 -31
- package/template/knowledge-base/patterns/pages/workflow-page.mdc +0 -27
- package/template/knowledge-base/rules/accessibility/responsive.mdc +0 -31
- package/template/knowledge-base/rules/architecture/layout.mdc +0 -52
- package/template/knowledge-base/rules/architecture/single-screen.mdc +0 -62
- package/template/knowledge-base/rules/code-quality/jsx.mdc +0 -19
- package/template/knowledge-base/rules/global/naming.mdc +0 -12
- package/template/knowledge-base/rules/global/technology.mdc +0 -19
- package/template/knowledge-base/rules/global/ui-copy.mdc +0 -20
- package/template/knowledge-base/rules/performance/client.mdc +0 -20
- package/template/knowledge-base/rules/ui/information-density.mdc +0 -36
- package/template/knowledge-base/rules/ui/interaction.mdc +0 -47
- package/template/knowledge-base/rules/ui/simple-ui.mdc +0 -58
- package/template/knowledge-base/validation/accessibility.mdc +0 -13
- package/template/knowledge-base/validation/architecture.mdc +0 -10
- package/template/knowledge-base/validation/ast-grep/do-what-brooooooklyn-said.yml +0 -15
- package/template/knowledge-base/validation/ast-grep/no-nested-links.yml +0 -12
- package/template/knowledge-base/validation/ast-grep/rewrite-svg-attribute.yml +0 -19
- package/template/knowledge-base/validation/code-quality.mdc +0 -18
- package/template/knowledge-base/validation/performance.mdc +0 -11
- package/template/knowledge-base/validation/ui.mdc +0 -26
package/template/README.md
CHANGED
|
@@ -1,213 +1,225 @@
|
|
|
1
1
|
# Modoock Projects Boilerplate
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Modoock web-app boilerplate: an enterprise UI for people who are not used to information systems. The repo is both a **development base** (design system, reusable components, rules) and a **demo** of several business modules, with local fake data.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The UI is in French. Each business page aims at immediate reading: one screen, one goal, one main table, secondary details in a record or a tab.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Goal
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Provide a consistent starting point for Modoock apps:
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
11
|
+
- a single visual identity (tokens, type, color);
|
|
12
|
+
- reusable UI components, no raw HTML when a component already exists;
|
|
13
|
+
- dashboard pages with no page-level scroll on large screens;
|
|
14
|
+
- development rules centralized in `knowledge-base/`;
|
|
15
|
+
- sample modules (projects, equipment, infrastructure, research) to illustrate the patterns.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
There is no backend: lists and records use deterministic data files under `app/`.
|
|
18
18
|
|
|
19
19
|
## Stack
|
|
20
20
|
|
|
21
|
-
|
|
|
21
|
+
| Piece | Choice |
|
|
22
22
|
| --- | --- |
|
|
23
23
|
| Framework | Next.js 16 (App Router) |
|
|
24
24
|
| UI | React 19, TypeScript 5 |
|
|
25
|
-
| Styles | Tailwind CSS 4, tokens
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
25
|
+
| Styles | Tailwind CSS 4, tokens in `app/globals.css` |
|
|
26
|
+
| Icons | `lucide-react`, only through the `Icon` component |
|
|
27
|
+
| Font | Montserrat (`next/font`) |
|
|
28
|
+
| Quality | ESLint (`eslint-config-next`), TypeScript, ast-grep (`npm run sg:scan`) |
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Exact versions live in `package.json`. No extra icon or animation library is planned.
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Getting started
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
npm install
|
|
36
36
|
npm run dev
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Open [http://localhost:3000](http://localhost:3000).
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Other commands:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
44
|
npm run lint # ESLint
|
|
45
|
-
npm run typecheck # TypeScript,
|
|
46
|
-
npm run sg:scan #
|
|
47
|
-
npm run build # build
|
|
48
|
-
npm run start #
|
|
45
|
+
npm run typecheck # TypeScript, including JSX props
|
|
46
|
+
npm run sg:scan # ast-grep (structural facts, lot A)
|
|
47
|
+
npm run build # production build
|
|
48
|
+
npm run start # production server
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## Architecture
|
|
52
52
|
|
|
53
53
|
```
|
|
54
|
-
app/ Pages (App Router)
|
|
54
|
+
app/ Pages (App Router) and demo data
|
|
55
55
|
components/
|
|
56
|
-
ui/
|
|
57
|
-
layout/
|
|
58
|
-
shared/
|
|
56
|
+
ui/ Generic Design System components
|
|
57
|
+
layout/ App chrome (header, menu, layout)
|
|
58
|
+
shared/ Cross-page business blocks
|
|
59
59
|
knowledge-base/
|
|
60
|
-
rules/
|
|
61
|
-
patterns/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
metadata/ catalog.yaml — index
|
|
66
|
-
.cursor/
|
|
60
|
+
rules/ Constraints (global, architecture, ui, accessibility)
|
|
61
|
+
patterns/ How this repo solves a class of problem
|
|
62
|
+
design-system/ Tokens and component constraints
|
|
63
|
+
validation/ How to detect a violation (human)
|
|
64
|
+
ast-grep/ Mechanical proofs (`sg:scan`)
|
|
65
|
+
metadata/ catalog.yaml — load index (load, open, description)
|
|
66
|
+
.cursor/
|
|
67
|
+
rules/ agents.mdc (pointer), honey.mdc, ui.mdc (glob reminder)
|
|
68
|
+
hooks.json Cursor bind (deny UI writes until the pack is read)
|
|
69
|
+
hooks/ gate-ui-pack.mjs
|
|
70
|
+
AGENTS.md Canonical router (every agent)
|
|
67
71
|
```
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
Each component folder exposes its public API in an `index.ts`. Pages import from those indexes, not from internal files.
|
|
70
74
|
|
|
71
75
|
### Layout
|
|
72
76
|
|
|
73
|
-
`AppLayout`
|
|
77
|
+
`AppLayout` wraps the whole app:
|
|
74
78
|
|
|
75
|
-
- **SideNav
|
|
76
|
-
- **Header
|
|
79
|
+
- **SideNav**: blue (primary) side menu, collapsible (icons only / icons + labels).
|
|
80
|
+
- **Header**: page title, optional description, back and refresh.
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
On `md+`, dashboard and compact-detail pages stay within the viewport: the table or cards scroll inside. Below `md`, page scroll is allowed and tables become stacked cards.
|
|
79
83
|
|
|
80
84
|
## Modules
|
|
81
85
|
|
|
82
|
-
| Route | Module |
|
|
86
|
+
| Route | Module | Role |
|
|
83
87
|
| --- | --- | --- |
|
|
84
|
-
| `/` | Dashboard |
|
|
85
|
-
| `/projects` |
|
|
86
|
-
| `/equipment` |
|
|
87
|
-
| `/infrastructure` | Infrastructure |
|
|
88
|
-
| `/infrastructure/incidents` | Incidents | Incidents
|
|
89
|
-
| `/research` |
|
|
90
|
-
| `/tables` | Tables |
|
|
91
|
-
| `/design-system` | Design System |
|
|
88
|
+
| `/` | Dashboard | Showcase of fields, buttons, icons, loaders, and a sample table |
|
|
89
|
+
| `/projects` | Projects | Portfolio: search, filters, summary, table, record `/projects/[id]` |
|
|
90
|
+
| `/equipment` | Equipment | Fleet (e.g. medical): statuses, maintenance, tabbed record |
|
|
91
|
+
| `/infrastructure` | Infrastructure | Service catalog: metrics, filters, bulk actions, service record |
|
|
92
|
+
| `/infrastructure/incidents` | Incidents | Incidents tied to services, record with timeline |
|
|
93
|
+
| `/research` | Research | Experiments, datasets, runs, events, metric comparison |
|
|
94
|
+
| `/tables` | Tables | Four table attitudes (Sprinter, Analyste, Focus, À la une) |
|
|
95
|
+
| `/design-system` | Design System | Visual documentation of tokens and components |
|
|
92
96
|
|
|
93
|
-
###
|
|
97
|
+
### Projects
|
|
94
98
|
|
|
95
|
-
|
|
99
|
+
Portfolio overview (about 300 projects, generated deterministically). Status, priority, team, project lead, progress, due date, budget, tasks, and recent activity. The record details team, dates, progress and budget, plus activity history.
|
|
96
100
|
|
|
97
|
-
###
|
|
101
|
+
### Equipment
|
|
98
102
|
|
|
99
|
-
|
|
103
|
+
Fleet tracking: operational, maintenance, urgent intervention, out of service. The record groups information, incidents, interventions, and maintenance history.
|
|
100
104
|
|
|
101
|
-
### Infrastructure
|
|
105
|
+
### Infrastructure and incidents
|
|
102
106
|
|
|
103
|
-
Services (
|
|
107
|
+
Services (environment, region, type, team, CPU, memory, latency, errors, deployments). Multi-select, CSV export, and simulated actions (restart, monitoring off). Incidents have severity, status, impact, and history.
|
|
104
108
|
|
|
105
|
-
###
|
|
109
|
+
### Research
|
|
106
110
|
|
|
107
|
-
|
|
111
|
+
Experiments by domain (vision, NLP, robotics, generative AI, bioinformatics, climate), with datasets, runs, and events. A tab compares metrics across experiments.
|
|
108
112
|
|
|
109
|
-
##
|
|
113
|
+
## Context flow (rules, components, code)
|
|
110
114
|
|
|
111
|
-
|
|
115
|
+
The project is not driven from `app/`. Work happens in a **context**: a request, rules, a component catalog, tokens. `app/` is only the test bench for that chain.
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
Rules stay in `knowledge-base/`. They are **not** moved into `.cursor/rules/`: Cursor, Claude, Codex, and Copilot follow the **same** index (`catalog.yaml`) and the **same** router.
|
|
114
118
|
|
|
115
|
-
###
|
|
119
|
+
### Who does what
|
|
116
120
|
|
|
117
|
-
|
|
|
121
|
+
| Piece | Role | Go there to… |
|
|
118
122
|
| --- | --- | --- |
|
|
119
|
-
|
|
|
120
|
-
| `knowledge-base/` |
|
|
121
|
-
| `knowledge-base/metadata/catalog.yaml` |
|
|
122
|
-
| `AGENTS.md` |
|
|
123
|
-
| `CLAUDE.md` |
|
|
124
|
-
| `.cursor/rules/agents.mdc` |
|
|
125
|
-
| `.cursor/rules/
|
|
126
|
-
| `.cursor/rules/
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `knowledge-base/
|
|
130
|
-
| `
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
| Request (prompt) | Scope | **What** to do, nothing more |
|
|
124
|
+
| `knowledge-base/` | Rule text | **How** to do it |
|
|
125
|
+
| `knowledge-base/metadata/catalog.yaml` | Load index | **Which file** to open, and with what |
|
|
126
|
+
| `AGENTS.md` | Canonical router | Load procedure, not the rules |
|
|
127
|
+
| `CLAUDE.md` | Claude Code import | `@AGENTS.md` and `@.cursor/rules/honey.mdc` — do not copy the text there |
|
|
128
|
+
| `.cursor/rules/agents.mdc` | Cursor pointer | Follow `AGENTS.md` — do not copy the router there |
|
|
129
|
+
| `.cursor/rules/honey.mdc` | Writing style (every agent, one file) | Less code, less prose — do not copy or split |
|
|
130
|
+
| `.cursor/rules/ui.mdc` | Cursor reminder (UI glob) | Same procedure as the router — not a second rulebook |
|
|
131
|
+
| `.cursor/hooks.json` + `hooks/gate-ui-pack.mjs` | Cursor bind | Deny `Write` / `StrReplace` / `Delete` under `app/` and `components/` until the UI pack has been `Read` this conversation. jsonl log of `Read`s (temp). Shell and Tab are not gated |
|
|
132
|
+
| `components/*/index.ts` | What exists | Reuse the export; no `.mdc` required |
|
|
133
|
+
| `knowledge-base/design-system/components/*.mdc` | Extra rules | Only if the catalog lists them |
|
|
134
|
+
| `knowledge-base/validation/` | Fails (human + pointers) | How to fail; what the scanner cannot prove |
|
|
135
|
+
| `knowledge-base/validation/ast-grep/` | Proofs | `npm run sg:scan` — dumb YAML, one rule = one fail |
|
|
136
|
+
| `app/globals.css` | Tokens | No hard-coded visual values |
|
|
137
|
+
|
|
138
|
+
Codex / Copilot / Cursor read `AGENTS.md` (Always = open `honey.mdc` if it is not already in context). Claude Code reads `CLAUDE.md`, which imports `@AGENTS.md` and `@.cursor/rules/honey.mdc`. Cursor injects `honey.mdc` (always-on) and `agents.mdc` (pointer); `ui.mdc` if an `app/` or `components/` `.tsx` is open. Cursor then **denies** writes under `app/` and `components/` until the `load: ui` pack has been `Read` (hook). Do not copy the router or Honey.
|
|
139
|
+
|
|
140
|
+
### Global diagram
|
|
135
141
|
|
|
136
142
|
```
|
|
137
143
|
USER TASK
|
|
138
144
|
│
|
|
139
145
|
▼
|
|
140
|
-
AGENTS.md ←
|
|
146
|
+
AGENTS.md ← canonical router
|
|
141
147
|
▲
|
|
142
148
|
├── CLAUDE.md (@AGENTS.md) ← Claude Code
|
|
143
|
-
└── .cursor/rules/agents.mdc ←
|
|
149
|
+
└── .cursor/rules/agents.mdc ← Cursor pointer
|
|
144
150
|
│
|
|
145
151
|
▼
|
|
146
|
-
catalog.yaml ← index
|
|
152
|
+
catalog.yaml ← single index
|
|
147
153
|
│
|
|
148
|
-
├── load: ui ──► path (
|
|
149
|
-
├── description match ──► path (
|
|
150
|
-
└── open: ──► paths
|
|
154
|
+
├── load: ui ──► path (pack on every UI edit)
|
|
155
|
+
├── description match ──► path (on demand)
|
|
156
|
+
└── open: ──► related paths (pattern / rule graph)
|
|
151
157
|
│
|
|
152
158
|
▼
|
|
153
|
-
knowledge-base/**/*.mdc + components/*/index.ts ←
|
|
159
|
+
knowledge-base/**/*.mdc + components/*/index.ts ← constraints + real API
|
|
160
|
+
│
|
|
161
|
+
│ Cursor only: hook deny Write app/ + components/
|
|
162
|
+
│ until catalog.yaml + load: ui + components/*/index.ts are Read
|
|
154
163
|
│
|
|
155
164
|
▼
|
|
156
165
|
CODE
|
|
157
166
|
│
|
|
158
167
|
├── npm run lint → ESLint
|
|
159
|
-
├── npm run typecheck → TypeScript (props
|
|
160
|
-
├── npm run sg:scan →
|
|
161
|
-
├── validation/*.mdc →
|
|
162
|
-
└── agent →
|
|
168
|
+
├── npm run typecheck → TypeScript (JSX props = public type)
|
|
169
|
+
├── npm run sg:scan → structural facts (TSX catalog + lot A)
|
|
170
|
+
├── validation/*.mdc → still-human fails (copy, scroll, UX…)
|
|
171
|
+
└── agent → context and judgment
|
|
163
172
|
```
|
|
164
173
|
|
|
165
|
-
### 1.
|
|
174
|
+
### 1. Multi-agent router
|
|
166
175
|
|
|
167
|
-
`AGENTS.md`
|
|
176
|
+
`AGENTS.md` is the only copy of the procedure. `CLAUDE.md` imports it (`@AGENTS.md`) and imports Honey. `agents.mdc` points at `AGENTS.md` (do not copy the Next.js footer that `next dev` may append to `AGENTS.md`).
|
|
168
177
|
|
|
169
178
|
```
|
|
170
179
|
Codex / Copilot Claude Cursor
|
|
171
180
|
│ │ │
|
|
172
181
|
▼ ▼ ▼
|
|
173
182
|
AGENTS.md CLAUDE.md AGENTS.md
|
|
174
|
-
+ open honey.mdc @AGENTS.md + honey.mdc (
|
|
175
|
-
@honey.mdc + agents.mdc (
|
|
183
|
+
+ open honey.mdc @AGENTS.md + honey.mdc (injected)
|
|
184
|
+
@honey.mdc + agents.mdc (pointer)
|
|
176
185
|
│ │ │
|
|
177
186
|
└────────────┬───────┴──────────────────────┘
|
|
178
187
|
▼
|
|
179
188
|
catalog.yaml
|
|
180
189
|
```
|
|
181
190
|
|
|
182
|
-
Honey
|
|
191
|
+
Honey: one file, every agent, no copy, no split. Cursor injects it; Codex / Copilot open it (Always); Claude Code imports it. Cursor only: `ui.mdc` (UI glob) is a reminder; the **bind** is the hook (not a second rulebook).
|
|
183
192
|
|
|
184
|
-
Honey
|
|
193
|
+
Honey is **not** generated (`skills/honey/SKILL.md` / `scripts/build-rules.js` do not exist). Edit it in `.cursor/rules/honey.mdc`.
|
|
185
194
|
|
|
186
|
-
### 2. Catalog —
|
|
195
|
+
### 2. Catalog — entry schema
|
|
187
196
|
|
|
188
|
-
`knowledge-base/metadata/catalog.yaml
|
|
197
|
+
`knowledge-base/metadata/catalog.yaml`: sections `files`, `patterns`, `validation`.
|
|
189
198
|
|
|
190
199
|
```yaml
|
|
191
200
|
# files: / patterns:
|
|
192
|
-
- path: knowledge-base/…/
|
|
193
|
-
description: … # match
|
|
194
|
-
load: ui #
|
|
195
|
-
open: #
|
|
196
|
-
- knowledge-base/…/
|
|
201
|
+
- path: knowledge-base/…/example.mdc # required — exact path
|
|
202
|
+
description: … # on-demand match
|
|
203
|
+
load: ui # optional — UI pack
|
|
204
|
+
open: # optional — load graph
|
|
205
|
+
- knowledge-base/…/other.mdc
|
|
206
|
+
# patterns only:
|
|
207
|
+
# id: data-table-page # alias (ui.mdc)
|
|
197
208
|
```
|
|
198
209
|
|
|
199
|
-
|
|
|
210
|
+
| Field | Effect |
|
|
200
211
|
| --- | --- |
|
|
201
|
-
| `path` |
|
|
202
|
-
| `description` |
|
|
203
|
-
| `load: ui` |
|
|
204
|
-
| `open:` |
|
|
212
|
+
| `path` | File to open (exact name: `tabs.mdc`, not `tab.mdc`) |
|
|
213
|
+
| `description` | If it matches the need → open `path` |
|
|
214
|
+
| `load: ui` | UI pack. Cursor: the hook **requires** a `Read` of these `path`s (plus `catalog.yaml` and `components/*/index.ts`) before any write under `app/` or `components/`. Other agents follow `AGENTS.md` (hint) |
|
|
215
|
+
| `open:` | After `path`, also open these files (do not copy the rules into them) |
|
|
216
|
+
| `id` | Patterns only — alias (`data-table-page`, `workflow-page`) |
|
|
205
217
|
|
|
206
|
-
|
|
218
|
+
With no `load`: on demand only. `catalog.yaml` injects nothing. Cursor injects via `.cursor/rules/` (hints) and **gates** via `.cursor/hooks` (UI writes).
|
|
207
219
|
|
|
208
|
-
**
|
|
220
|
+
**Current pack** (`load: ui`): `components.mdc`, `tokens.mdc`, `simple-ui.mdc`, `layout.mdc`, `ui-copy.mdc`.
|
|
209
221
|
|
|
210
|
-
**
|
|
222
|
+
**Current graph** (`open:`):
|
|
211
223
|
|
|
212
224
|
```
|
|
213
225
|
data-table-page.mdc ──open──► tables.mdc
|
|
@@ -216,124 +228,162 @@ workflow-page.mdc ──open──► stepper.mdc
|
|
|
216
228
|
detail-header.mdc
|
|
217
229
|
```
|
|
218
230
|
|
|
219
|
-
(`layout.mdc`
|
|
231
|
+
(`layout.mdc` and `components.mdc` are already `load: ui`, no need to list them again.)
|
|
232
|
+
|
|
233
|
+
### Cursor bind (hook)
|
|
234
|
+
|
|
235
|
+
Files: `.cursor/hooks.json`, `.cursor/hooks/gate-ui-pack.mjs`.
|
|
236
|
+
|
|
237
|
+
Cursor rules stay hints. The hook is the bind:
|
|
238
|
+
|
|
239
|
+
1. Parse `catalog.yaml` → every `load: ui` + `components/*/index.ts` + the catalog.
|
|
240
|
+
2. `preToolUse` (`Write` / `StrReplace` / `Delete` / `Edit`) under `app/` or `components/` → **deny** until those files have been `Read` **without** `offset` / `limit` this conversation.
|
|
241
|
+
3. `postToolUse` (`Read`) → stamp + one jsonl line (`t`, `cid`, `path`) in the OS temp dir: `modoock-ui-pack/{conversation_id}.jsonl`.
|
|
242
|
+
4. `preCompact` → stamp cleared (the pack left context). The jsonl stays.
|
|
243
|
+
|
|
244
|
+
Out of scope (on purpose): `AGENTS.md`, `knowledge-base/`, Shell, Tab, `description` / `open:` matching (still a hint). Hook crash → allow (the rest of the repo is not bricked).
|
|
245
|
+
|
|
246
|
+
Codex / Claude Code do not run this hook: they follow `AGENTS.md` only.
|
|
247
|
+
|
|
248
|
+
### ast-grep (lot A)
|
|
249
|
+
|
|
250
|
+
`sgconfig.yml` → `knowledge-base/validation/ast-grep/`. One YAML rule = one fail already listed in `validation/*.mdc`. The scanner does not copy constraint text.
|
|
251
|
+
|
|
252
|
+
Already there (official TSX catalog): `no-nested-links`, `rewrite-svg-attribute`, `do-what-brooooooklyn-said` (`&&` in JSX, **warning**).
|
|
253
|
+
|
|
254
|
+
Lot A (**error**, except layout chrome as warning):
|
|
255
|
+
|
|
256
|
+
| id | Fail |
|
|
257
|
+
| --- | --- |
|
|
258
|
+
| `no-raw-native` | `<button>` / `<input>` / `<select>` / `<table>` in `app/` (`/design-system` gallery ignored; `components/ui` = primitives) |
|
|
259
|
+
| `no-raw-native-chrome` | Same as warning on `components/layout` and `components/shared` |
|
|
260
|
+
| `no-div-as-control` | `<div>` with a control `role` (`button`, `link`, …) |
|
|
261
|
+
| `no-transition-all` | `transition-all` / `transition: all` |
|
|
262
|
+
| `no-disable-zoom` | `maximumScale: 1` / `userScalable: false` / equivalent meta |
|
|
263
|
+
| `no-memo-without-deps` | `useMemo` / `useCallback` with no deps array |
|
|
264
|
+
| `no-js-layout-size` | `offsetHeight` / `clientHeight` / `ResizeObserver` |
|
|
265
|
+
| `no-password-field-outside-auth` | password `name` / `autoComplete` outside `app/auth` |
|
|
266
|
+
| `no-block-typing` | inline `preventDefault` on `onPaste` / `onKeyDown` |
|
|
267
|
+
| `no-two-tables` | two `UserTable` or `<table>` on one page |
|
|
268
|
+
|
|
269
|
+
Copy, scroll, information density, destructive confirmation, “ask don’t invent”: still `validation/*.mdc` + the agent. Do not run `ast-grep scan -U` on existing app JSX to silence a warning.
|
|
220
270
|
|
|
221
|
-
### 3.
|
|
271
|
+
### 3. Component discovery
|
|
222
272
|
|
|
223
273
|
```
|
|
224
274
|
CODE KNOWLEDGE BASE
|
|
225
275
|
components/*/index.ts design-system/components/*.mdc
|
|
226
276
|
│ │
|
|
227
277
|
▼ ▼
|
|
228
|
-
|
|
229
|
-
Icon, Loader, TimelineList…
|
|
230
|
-
|
|
278
|
+
“what exists?” “any extra rules?”
|
|
279
|
+
Icon, Loader, TimelineList… only if catalog.yaml lists the file
|
|
280
|
+
no .mdc required
|
|
231
281
|
```
|
|
232
282
|
|
|
233
|
-
|
|
283
|
+
Written once: `knowledge-base/design-system/components.mdc` (`## Discovery`). No `.mdc` = use the export, do not invent a wrapper.
|
|
234
284
|
|
|
235
|
-
### 4.
|
|
285
|
+
### 4. Load layers (every agent)
|
|
236
286
|
|
|
237
287
|
```
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
288
|
+
Always → router + honey.mdc
|
|
289
|
+
UI edit → catalog load: ui + index.ts; Cursor: hook deny until the pack is Read
|
|
290
|
+
On demand → catalog description → path → open: (hint)
|
|
291
|
+
After code → lint / typecheck / sg:scan; validation/*.mdc for the theme (still human); code-reviewer on the diff
|
|
242
292
|
```
|
|
243
293
|
|
|
244
|
-
### 5.
|
|
294
|
+
### 5. Splitting a module (list page)
|
|
245
295
|
|
|
246
|
-
Pattern `knowledge-base/patterns/pages/data-table-page.mdc
|
|
296
|
+
Pattern `knowledge-base/patterns/pages/data-table-page.mdc`:
|
|
247
297
|
|
|
248
298
|
```
|
|
249
|
-
/
|
|
250
|
-
/
|
|
299
|
+
/entity → one list, one entity
|
|
300
|
+
/entity/[id] → related records (incidents, runs, events…)
|
|
251
301
|
```
|
|
252
302
|
|
|
253
|
-
|
|
303
|
+
Forbidden: more than one entity list on the list page (tabs or not). Good: `/projects` + `/projects/[id]`. Fail: `knowledge-base/validation/ui.mdc`.
|
|
254
304
|
|
|
255
|
-
### 6.
|
|
305
|
+
### 6. Adding a rule later
|
|
256
306
|
|
|
257
|
-
|
|
307
|
+
The text goes in a `.mdc` under `knowledge-base/`. **Propose first** (New rules), wait for yes.
|
|
258
308
|
|
|
259
|
-
|
|
|
309
|
+
| Case | Files to touch |
|
|
260
310
|
| --- | --- |
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
|
|
|
265
|
-
|
|
|
266
|
-
|
|
|
267
|
-
|
|
|
268
|
-
|
|
|
269
|
-
|
|
|
311
|
+
| Sentence in a rule already listed | That `.mdc` only |
|
|
312
|
+
| New rule file | `.mdc` + `catalog.yaml` entry (`path` + `description`) |
|
|
313
|
+
| Pack on every UI edit | + `load: ui` on that entry |
|
|
314
|
+
| Load with a pattern | + `open:` on the pattern entry |
|
|
315
|
+
| Component, API is enough | `index.ts` export only |
|
|
316
|
+
| Component + extra rules | `.mdc` + catalog entry (no `load: ui`) |
|
|
317
|
+
| Provable structural fail | YAML in `validation/ast-grep/` (`sg:scan` stays dumb). Lot A is already there |
|
|
318
|
+
| DS / UX / architecture fail | + line in `validation/*.mdc` |
|
|
319
|
+
| Cursor bind (UI pack, jsonl) | `.cursor/hooks.json` / `hooks/gate-ui-pack.mjs` — not a `.mdc` |
|
|
320
|
+
| Change the load **procedure** | `AGENTS.md` only (`ui.mdc` if it repeats). Do not copy into `CLAUDE.md` / `agents.mdc` |
|
|
270
321
|
|
|
271
|
-
|
|
322
|
+
Do not copy the need → file table into the README or the router.
|
|
272
323
|
|
|
273
|
-
###
|
|
324
|
+
### How to work in this context
|
|
274
325
|
|
|
275
|
-
**
|
|
326
|
+
**Before writing:**
|
|
276
327
|
|
|
277
|
-
1.
|
|
278
|
-
2.
|
|
279
|
-
3.
|
|
280
|
-
4.
|
|
281
|
-
5.
|
|
328
|
+
1. Read the request as-is — do not expand it.
|
|
329
|
+
2. Inspect the code already there (components and usages).
|
|
330
|
+
3. Open `catalog.yaml`: every `load: ui` on a UI edit; then matching `description`s; then each `open:`. Cursor will block the UI write until the pack is read.
|
|
331
|
+
4. Read `components/*/index.ts` — that is the real catalog.
|
|
332
|
+
5. Reuse: existing export → pattern → composition. Anything the request did not decide (missing part, unclear idea, choice, preference) → question, wait. Do not generate the gap. Do not hide a Design System primitive in the page.
|
|
282
333
|
|
|
283
|
-
**
|
|
334
|
+
**During:**
|
|
284
335
|
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
-
|
|
288
|
-
- Cas récurrent non couvert → proposer une règle et son `path` catalog, attendre.
|
|
336
|
+
- Every decision comes from the request or an existing rule — otherwise question, that part pauses.
|
|
337
|
+
- Do not invent a rule, do not change `knowledge-base/` without agreement.
|
|
338
|
+
- Recurring uncovered case → propose a rule and its catalog `path`, wait.
|
|
289
339
|
|
|
290
|
-
**
|
|
340
|
+
**After:**
|
|
291
341
|
|
|
292
|
-
-
|
|
293
|
-
-
|
|
294
|
-
- `npm run lint`, `npm run typecheck`
|
|
295
|
-
-
|
|
342
|
+
- Check `knowledge-base/validation/` for the theme.
|
|
343
|
+
- New export → that folder’s `index.ts`.
|
|
344
|
+
- `npm run lint`, `npm run typecheck` and `npm run sg:scan` (fix **errors**). Typecheck proves JSX props exist on the component type.
|
|
345
|
+
- Report hypotheses and still-open choices.
|
|
296
346
|
|
|
297
|
-
##
|
|
347
|
+
## Components
|
|
298
348
|
|
|
299
349
|
### UI (`components/ui/`)
|
|
300
350
|
|
|
301
|
-
`ClickableButton`, `Input`, `Textarea`, `Badge`, `UserTable`, `Select` / `MultiSelect` / `SelectFilter`, `Modal`, `Tabs`, `Icon`, `Loader`, `MetricBar`.
|
|
351
|
+
`ClickableButton`, `Input`, `Textarea`, `Badge`, `UserTable`, `Select` / `MultiSelect` / `SelectFilter`, `Modal`, `Tabs`, `Icon`, `Loader`, `MetricBar`, `Stepper`, `ActionStack`.
|
|
302
352
|
|
|
303
|
-
`UserTable`
|
|
353
|
+
`UserTable` handles sort, pagination, empty message, transpose, and below `md` table → cards (every column stays reachable).
|
|
304
354
|
|
|
305
355
|
### Shared (`components/shared/`)
|
|
306
356
|
|
|
307
|
-
`SummaryCard` (
|
|
357
|
+
`SummaryCard` (key figure), `InfoCard` / `InfoList` (detail records), `DetailHeader`, `TableSection`, `TimelineList`.
|
|
308
358
|
|
|
309
359
|
### Layout (`components/layout/`)
|
|
310
360
|
|
|
311
361
|
`AppLayout`, `Header`, `SideNav`.
|
|
312
362
|
|
|
313
|
-
|
|
363
|
+
Before adding a component, read these `index.ts` files. A new Design System component needs validation. An existing pattern does not authorize inventing the rest.
|
|
314
364
|
|
|
315
365
|
## Design System
|
|
316
366
|
|
|
317
|
-
|
|
367
|
+
Tokens live in `app/globals.css`: colors (primary blue, success, warning, danger, info, accent), type, spacing, radii.
|
|
318
368
|
|
|
319
|
-
-
|
|
320
|
-
-
|
|
321
|
-
-
|
|
369
|
+
- Orange / yellow is reserved for critical alerts, never as decoration.
|
|
370
|
+
- Pages do not redefine colors, sizes, or spacing that already exist as tokens.
|
|
371
|
+
- The `/design-system` page documents the visual language.
|
|
322
372
|
|
|
323
|
-
##
|
|
373
|
+
## Data
|
|
324
374
|
|
|
325
|
-
|
|
375
|
+
Each business module has a `*-data.ts` file next to its pages. Large sets (projects, infrastructure, incidents) are generated with a **fixed seed** so server and client stay identical.
|
|
326
376
|
|
|
327
|
-
|
|
377
|
+
There is no API, authentication, or persistence: actions (export, restart, etc.) are simulated in the browser.
|
|
328
378
|
|
|
329
|
-
##
|
|
379
|
+
## Development conventions
|
|
330
380
|
|
|
331
|
-
`knowledge-base/`
|
|
381
|
+
`knowledge-base/` is the source of truth. Load and index: **Context flow** above (`catalog.yaml`: `load`, `description`, `open:`).
|
|
332
382
|
|
|
333
|
-
|
|
383
|
+
Day-to-day principles:
|
|
334
384
|
|
|
335
|
-
-
|
|
336
|
-
-
|
|
337
|
-
-
|
|
338
|
-
-
|
|
339
|
-
-
|
|
385
|
+
- UI copy in French, direct wording;
|
|
386
|
+
- one list page = one entity; related records go to `/[id]`;
|
|
387
|
+
- one table visible at a time;
|
|
388
|
+
- do not invent what the request did not decide (missing part, choice, preference) — ask, then implement;
|
|
389
|
+
- minimal code: nothing “just in case”.
|