Skip to content

Commit b9a3e57

Browse files
committed
Update copilot-instructions.md
1 parent cab21cc commit b9a3e57

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

.github/copilot-instructions.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ You manage a strict PNPM Workspace.
2626
| @object-ui/core | The Engine | Schema Registry, Validation, Expression Evaluation (visible: "${data.age > 18}"). | No UI library dependencies. Logic Only. |
2727
| @object-ui/components | The UI Kit | Shadcn implementation of the Schema. | Stateless. Controlled by props only. |
2828
| @object-ui/react | The Runtime | <SchemaRenderer>, useRenderer, useDataScope. | Bridges Core and Components. |
29+
| @object-ui/fields | The Registry | Standard Field Renderers & Registry. | Centralizes all field logic. |
2930
| @object-ui/layout | The Structure | Grid, Stack, Card, Dialog containers. | Handles responsiveness. |
3031
| @object-ui/data-* | The Adapters | Connectors for REST, ObjectQL, GraphQL. | Isolate ALL fetch logic. |
3132
4. The JSON Protocol Specification (The "DNA")
@@ -58,16 +59,31 @@ interface UIComponent {
5859
children?: UIComponent[];
5960
}
6061

61-
5. Coding Standards (The 5 Commandments)
62+
5. Coding Standards (The 7 Commandments)
63+
📜 Rule #0: Strict Adherence to @objectstack/spec
64+
* Context: We are the implementation of a standard protocol.
65+
* Instruction: All component schemas, JSON structures, and data types MUST strictly follow definitions in `@objectstack/spec`.
66+
* Constraint: Do not invent new schema properties. If the spec says `columns`, do not use `fields`.
67+
* Validation: Check `@objectstack/spec` definitions before writing any `interface` or `type`.
68+
6269
🌍 Rule #1: Protocol Agnostic (The Universal Adapter)
6370
* Context: The user might fetch data from a legacy SOAP API or a local JSON file.
6471
* Instruction: Never hardcode objectql.find(). Use the DataSource Interface.
6572
* Pattern: Inject dataSource via the root <SchemaRendererProvider dataSource={...} />.
66-
🎨 Rule #2: "Shadcn Native" Aesthetics
73+
74+
📚 Rule #2: Documentation Driven Development
75+
* Context: Code without docs is dead code.
76+
* Instruction: For EVERY feature implemented or refactored, you MUST update the corresponding documentation:
77+
1. Package `README.md`
78+
2. `content/docs/guide/*.md`
79+
* Definition of Done: The task is not complete until the documentation reflects the new code/architecture.
80+
81+
🎨 Rule #3: "Shadcn Native" Aesthetics
6782
* Identity: We are essentially "Serializable Shadcn".
6883
* Instruction: When implementing a component (e.g., Card), strictly follow Shadcn's DOM structure (CardHeader, CardTitle, CardContent).
6984
* Constraint: ALWAYS expose className in the schema props. Allow users to inject bg-red-500 via JSON to override default styles.
70-
⚡ Rule #3: The Action System (Interactivity)
85+
86+
⚡ Rule #4: The Action System (Interactivity)
7187
* Concept: A static UI is useless. The JSON must define behavior.
7288
* Pattern: Actions are defined as data, not functions.
7389
* Example JSON:
@@ -80,13 +96,16 @@ interface UIComponent {
8096
}
8197

8298
* Implementation: The @object-ui/core package acts as an Event Bus to dispatch these actions.
83-
🧩 Rule #4: Layout as Components
99+
100+
🧩 Rule #5: Layout as Components
84101
* Concept: Layouts are just components that render children.
85102
* Instruction: Treat Grid, Stack, Container as first-class citizens.
86103
* Responsiveness: Layout schemas must support responsive props (e.g., cols: { sm: 1, md: 2, lg: 4 }).
87-
🔒 Rule #5: Type Safety over Magic
104+
105+
🔒 Rule #6: Type Safety over Magic
88106
* No any: Use strict Generics.
89107
* Registry: Use a central ComponentRegistry to map strings ("type": "button") to React components. Do not use eval() or dynamic imports to load components at runtime for security.
108+
90109
6. Implementation Patterns
91110
Pattern A: The Component Registry (Extensibility)
92111
How do we let users add their own "Map" component?

0 commit comments

Comments
 (0)