diff --git a/.cursor/rules/commit-messages.mdc b/.cursor/rules/commit-messages.mdc new file mode 100644 index 0000000..697d51b --- /dev/null +++ b/.cursor/rules/commit-messages.mdc @@ -0,0 +1,17 @@ +--- +description: Commit message format for web-editor +alwaysApply: true +--- + +When generating a commit, the format should be: + +``` +CHANGE TYPE: SHORT TITLE + +DESCRIPTION OF EXPECTED IMPACT FOR END USER. DESCRIPTION OF THE CHANGES MADE. + +[TICKET NUMBER] +``` + +- `CHANGE TYPE` is one of `feat`, `chore`, or `fix` +- `TICKET NUMBER` is in the format `AP-XXXX` — usually found in the branch name diff --git a/.cursor/rules/components.mdc b/.cursor/rules/components.mdc new file mode 100644 index 0000000..3a0f521 --- /dev/null +++ b/.cursor/rules/components.mdc @@ -0,0 +1,28 @@ +--- +description: React component patterns for web-editor +globs: **/*.tsx +alwaysApply: false +--- + +# Components + +- Use function components with hooks instead of class components. +- Use the `FC` type rather than `FunctionComponent`. +- Wrap all components with `observer()` from `mobx-react`. +- Use named exports for components, not default exports. +- Use a named function for the component; the function name should match the component name: + ```tsx + const Cmpt: FC = observer(function Cmpt(props: Props) { + return
; + }); + ``` +- Never use barrel files (`index.ts` re-exports). Always use direct imports to the specific file. + +## Base Practices +- For components exceeding 150 lines, extract sub-components into separate files. +- Remove props that can be derived from other props. + +## Styling +- Prefer `makeStyles()` over inline styles or `sx` props. +- Always include a `name` option in `makeStyles` matching the component name. +- Keep styles in the same file as the component. diff --git a/.cursor/rules/general.mdc b/.cursor/rules/general.mdc new file mode 100644 index 0000000..54d4446 --- /dev/null +++ b/.cursor/rules/general.mdc @@ -0,0 +1,27 @@ +--- +description: TypeScript/Node.js coding standards for web-editor +alwaysApply: true +--- + +# Web Editor — General Standards + +## Language & Style +- Use **TypeScript** throughout. No plain `.js` files in source. +- Follow **AirBnB ESLint** rules for all TypeScript and JavaScript. +- Always remove unused imports. +- Be as focused and concise as possible — check existing files before creating new ones. + +## Project Context +- This is the Evolv visual editor, hosted inside the Aetherial Docker desktop environment. +- It communicates with Aetherial via **AWS SQS** — the command queue receives actions (e.g. `create_metamodel`) and the response queue returns results. +- SQS message schema changes must be coordinated with the `aetherial` repo. + +## Build & Dev +- Package manager: **npm** (npm workspaces). +- Build workspace dependencies before starting: `npm run build:deps` +- Start the dev server: `npm start` +- Always run `npm run type-check` and `npm run lint` before committing. + +## Error Handling +- Never fail silently. Missing required env vars or config must throw at startup. +- Log errors with sufficient structured context to debug issues without a debugger. diff --git a/.cursor/rules/git-linear-workflow.mdc b/.cursor/rules/git-linear-workflow.mdc new file mode 100644 index 0000000..0dcdaa8 --- /dev/null +++ b/.cursor/rules/git-linear-workflow.mdc @@ -0,0 +1,27 @@ +--- +description: Git hygiene and Linear workflow standards for web-editor +alwaysApply: true +--- + +# Git Hygiene + +## Branch Naming +- Prefer `feature/AP-123-short-slug`, `fix/AP-123-short-slug`, or `chore/AP-123-short-slug` when working from a Linear ticket. +- Always include the Linear issue key in the branch name when one exists. + +## Pull Requests +- Include the Linear issue key in the PR title. +- Link the issue in the PR description. +- Keep PRs focused to one concern. +- Ensure `npm run type-check` and `npm run lint` pass before requesting review. +- Always use `GH_PAGER=cat` for `gh` commands. + +# Linear Workflow + +## Before Starting Work +1. Search for an existing Linear issue first. +2. Assign to yourself and move to `In Progress` before writing code. +3. Ensure acceptance criteria are explicit checklist items. + +# Linear Access +- Use the `linear` CLI for Linear operations instead of Linear MCP tools. diff --git a/.cursor/rules/state-management.mdc b/.cursor/rules/state-management.mdc new file mode 100644 index 0000000..8f1dfd8 --- /dev/null +++ b/.cursor/rules/state-management.mdc @@ -0,0 +1,12 @@ +--- +description: State management patterns for web-editor +globs: **/*.ts,**/*.tsx +alwaysApply: false +--- + +# State Management + +- Use **MobX** for app-wide state management. +- Prefer method syntax over arrow functions in classes where binding isn't required. +- Prefer `useStaticValue` over `useState` for stores and values that never change after the initial render. +- Use `useDisposable()` rather than `useState()` for objects that implement `Disposable`.