agentleFS
mainsdotdevmainsdotdev/mains/.github/copilot-instructions.md

mains

Copilot instructions8 starsChanged 6 months agoMITView on GitHub

Mains is an Electron 41 desktop app (React 19 renderer, SQLite + Drizzle ORM). CommonJS package with ESM Vite configs (.mjs). macOS only (Apple Silicon and Intel). Three Electron processes with strict boundaries: Every backend domain uses this exact structure (see packages/backend/src/modules/account/ as reference): Critical: All layers are plain object literals, never classes. No DI — repos call getDb() inline. All modules: account, appSettings, automations, browser, connections, entities, fileExplorer, git, guards, imageProxy, projects, providers, pulse, runs, skillsMarketplace, space, stats, sync,…

The file

We split this copilot-instructions.md into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every backend domain uses this exact structure (see packages/backend/src/modules/account/ as reference):

    line 32
  2. Very specific:

    Critical: All layers are plain object literals, never classes.

    line 43
  3. Very specific:

    All modules: account, appSettings, automations, browser, connections, entities, fileExplorer, git, guards, imageProxy, projects, providers, …

    line 45
  4. Very specific:

    All IPC responses use the ServiceResponse<T> envelope, constructed via ok(data) → { success: true, data } or fail(msg) → { success: false, …

    line 55
  5. Distinctive:

    No Prettier — formatting via editor settings + ESLint

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions — Mains

Mains is an Electron 41 desktop app (React 19 renderer, SQLite + Drizzle ORM). CommonJS package with ESM Vite configs (.mjs). macOS only (Apple Silicon and Intel).

Build & Test

npm start              # Dev server (full restart needed for preload changes)
npm run lint           # ESLint on src/
npm run lint:fix       # Auto-fix
npm run db:generate    # Generate Drizzle migrations from schema changes
npm run db:push        # Push schema to dev DB (.data/mains.db)
npm run db:studio      # Open Drizzle Studio (dev database)
npm run db:studio:runtime  # Open Drizzle Studio (runtime database)
npm run db:clean:dev   # Reset dev database
npm run db:clean:runtime   # Reset runtime database
npm run db:clean:all   # Reset both databases
npm run package        # Package for current platform
npm run make           # Create distributable

Architecture

Three Electron processes with strict boundaries:

  • Main (src/main/) — DB, IPC handlers, business logic in domain modules
  • Preload (src/preload/index.ts) — typed window.api bridge, namespace-per-domain
  • Renderer (src/renderer/) — React + Redux Toolkit + HashRouter, @/ alias → src/renderer/

Module Pattern (packages/backend/src/modules/{name}/)

Every backend domain uses this exact structure (see packages/backend/src/modules/account/ as reference):

FileRole
{name}.ipc.tsregisterXxxIpc() / unregisterXxxIpc() using ipcMain.handle — calls the service directly (no controller layer)
{name}.service.tsObject literal with business logic, uses this for sibling calls; returns Promise<ServiceResponse<T>>
{name}.repo.tsObject literal, calls getDb() per method, Drizzle queries
{name}.dto.tsTypes via typeof table.$inferSelect, formatter functions
{name}.validation.tsHand-rolled allowlist validation (no zod/yup)
index.tsBarrel exports

Critical: All layers are plain object literals, never classes. No DI — repos call getDb() inline.

All modules: account, appSettings, automations, browser, connections, entities, fileExplorer, git, guards, imageProxy, projects, providers, pulse, runs, skillsMarketplace, space, stats, sync, terminal, tools, updates, workspace

IPC Convention

Channel format: "domain:action" (e.g. "runs:start", "entities:getAll"). All channels are defined once in src/shared/ipc-kit/channels.ts as a typed map (CHANNELS.entities.getAll) — never type the channel string literally. Referenced from three sites:

  1. src/preload/index.ts — ipcRenderer.invoke(CHANNELS.entities.getAll, ...)
  2. packages/backend/src/modules/{name}/{name}.ipc.ts — ipcMain.handle(CHANNELS.entities.getAll, ...)
  3. src/renderer/lib/redux/api/{name}Api.ts — { handler: CHANNELS.entities.getAll }

All IPC responses use the ServiceResponse<T> envelope, constructed via ok(data) → { success: true, data } or fail(msg) → { success: false, error } (from src/shared/ipc-kit/service-response).

Database (packages/backend/src/db/schema.ts)

  • Text primary keys (UUIDs or string literals), timestamps as integer("col", { mode: "timestamp" }) with default(sql\(unixepoch())`)`
  • Snake_case SQL columns, camelCase TypeScript — Drizzle handles mapping
  • Booleans: integer("col", { mode: "boolean" }), enums: text("col", { enum: [...] })
  • Updates must manually set updatedAt: sql\(unixepoch())``
  • Index naming: idx_{table}_{col}, unique: uniq_{table}_{desc}

Frontend Conventions

  • Redux: RTK Query with custom ipcBaseQuery (no HTTP), baseApi.injectEndpoints() per domain
  • Hooks: use-kebab-case.ts filenames, useCamelCase export names
  • Components: kebab-case.tsx filenames in feature dirs under src/renderer/features/{name}/components/
  • Routing: HashRouter — routes at /, /settings, /copilot[/:workspaceId], /claude[/:workspaceId], /codex[/:workspaceId], /cursor[/:workspaceId], /plugins, /pulse, /relay
  • Styling: Tailwind CSS v4 (PostCSS-based)

Code Style

  • Strict TypeScript, but any is allowed (no-explicit-any: off)
  • Unused vars prefixed with _ (warn, not error)
  • No Prettier — formatting via editor settings + ESLint
  • No import React needed (react-jsx transform)

Gotchas

  • Preload changes require full dev server restart
  • Dual DB paths: .data/mains.db (dev) vs ~/Library/Application Support/mains/mains.db (packaged)
  • Migration .sql files are copied into the build via Vite plugin and bundled as extraResource

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.