|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +Guidance for AI agents and contributors working on `@elek-io/client`. |
| 4 | + |
| 5 | +`@elek-io/core` handles file IO and git version control for elek.io Projects, a headless, git-backed CMS. It is published as a TypeScript library with Node, Browser, Astro and CLI entry points. |
| 6 | + |
| 7 | +`@elek-io/client` uses `@elek-io/core` and provides a UI on top of that business logic, packaged with Electron as a cross-platform desktop application. |
| 8 | + |
| 9 | +## Documentation |
| 10 | + |
| 11 | +Documentation is split by what you are working on: |
| 12 | + |
| 13 | +- [`contributing/`](./contributing/) - contributor and design docs for the client: the Electron process architecture, the IPC security model, TanStack Query data loading, and the dynamic form system. Start at [`contributing/README.md`](./contributing/README.md). The client ships as a packaged desktop app, not an npm package, so these docs are never shipped and may link anywhere. |
| 14 | +- **Core's behavior** is documented inside the `@elek-io/core` package itself. After `pnpm install`, read it under [`node_modules/@elek-io/core/docs/`](./node_modules/@elek-io/core/docs/index.md) (content export, the local API, API client generation, fields, storage layout, and more). This is the reference for anything the client delegates to Core. |
| 15 | +- To **contribute to Core** itself, use the [`@elek-io/core` repository](https://github.com/elek-io/core). Core's own contributor docs are not part of its published package, so they live only there. |
| 16 | + |
| 17 | +Two rules follow: |
| 18 | + |
| 19 | +- **Read before you change.** Before working on an area, read its doc first so you change behavior on purpose, not by guesswork. For client behavior that is the matching doc in `contributing/`; for behavior that comes from Core, read Core's docs in the package. |
| 20 | +- **Write after you change.** When you change client behavior a user or contributor should know about, update the matching doc in `contributing/` in the same change. Changes to Core itself do not belong in this repo - make them in the separate [`@elek-io/core`](https://github.com/elek-io/core) repository and document them there. |
| 21 | + |
| 22 | +## Commands |
| 23 | + |
| 24 | +- `pnpm install` - install dependencies (use pnpm, not npm) |
| 25 | +- `pnpm dev` - start the app in development with HMR (electron-vite) |
| 26 | +- `pnpm start` - preview the built app (electron-vite preview) |
| 27 | +- `pnpm build` - clean, build and package for the current platform (electron-vite then electron-builder) |
| 28 | +- `pnpm build:unpack` - build without packaging, faster for local testing |
| 29 | +- `pnpm build:win` / `pnpm build:mac` / `pnpm build:linux` - package for a specific platform |
| 30 | +- `pnpm check-types` - type-check both processes with tsc, no emit (`check-types:node` and `check-types:web` cover one process each) |
| 31 | +- `pnpm lint` - run eslint |
| 32 | +- `pnpm format` - format with prettier |
| 33 | + |
| 34 | +## Conventions |
| 35 | + |
| 36 | +- Prefer a library's built-in feature over hand-rolled code. |
| 37 | +- Avoid type casts. Shape the types so a cast is not needed. |
| 38 | +- Keep comments short and put deeper detail in the docs. Avoid em-dashes and semicolons, use simple sentences for readability. |
| 39 | + |
| 40 | +## Testing notes |
| 41 | + |
| 42 | +- The client has no automated test runner configured yet, so there are no existing tests to follow. Until one is set up, verify a change by running the app with `pnpm dev` telling the user to exercise the affected flows, and make sure `pnpm check-types` and `pnpm lint` pass before considering it done. |
| 43 | +- All Core file and git operations run in the main process and are reached from the renderer only through `window.ipc`. Exercise them through the running app, not in isolation. |
0 commit comments