{"owner":"Kong","repo":"insomnia","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md"],"files":{"AGENTS.md":"# AGENTS.md\n\n## Tech Stack\n\n- **UI:** React with React Router (loaders/actions pattern)\n- **Components:** React Aria Components\n- **Desktop Shell:** Electron (main + renderer processes)\n- **Styling:** TailwindCSS\n- **Language:** TypeScript\n- **Database:** NeDB (`@seald-io/nedb`) — embedded NoSQL\n- **Build/Dev:** Vite, npm workspaces monorepo\n\n_See `package.json` for current versions and `.nvmrc` for the Node version._\n\n## Strict Rules\n\n- **No unsolicited formatting.** Rely on ESLint/Prettier. Do not reformat existing code.\n- **Strict scoping.** Only modify code directly related to the prompt. Do not refactor adjacent code unless asked.\n\n## Command Output\n\nPrefer quiet command variants to minimise output volume:\n\n- `git log --oneline -20` not `git log`\n- `git diff --stat` not `git diff`\n- `npm test --silent` not `npm test`\n- `tsc --noEmit 2>&1 | head -50` for type-check failures\n- Use the `Read` tool with `limit` rather than `cat` on large files\n- Use `Grep` with `head_limit` rather than unrestricted searches\n\n## Validation Commands\n\nRun from repo root before considering work complete:\n\n```bash\nnpm run lint          # ESLint all workspaces\nnpm run type-check    # TypeScript check all workspaces\nnpm test              # Tests all workspaces (or: npm test -w packages/insomnia)\n```\n\n## Worktree Setup\n\n- New git worktrees may not have `node_modules` yet. Before installing or validating, switch to the repo's required runtime from the worktree root:\n\n```bash\nfnm use \"$(cat .nvmrc)\"\nnode -v\nnpm -v\n```\n\n- This repo expects the `.nvmrc` Node version and npm 11+. If `fnm` is unavailable, manually use an equivalent Node/npm version before running any `npm` commands.\n- After switching versions in a fresh worktree, install dependencies from repo root with `npm ci`.\n- Do **not** use `npm ci --ignore-scripts` for normal worktree setup. It leaves Electron partially installed, which later breaks builds, renderer import checks, and other validation commands.\n\n## Repository Structure\n\n`packages/`\n  `insomnia/`                ← Main Electron app\n    `src/`\n      `common/`              ← Shared utils, settings types\n      `routes/`              ← React Router files (clientLoader/clientAction)\n      `ui/`                  ← React components, hooks, `insomnia-fetch.ts`\n      `main/`                ← Electron IPC handlers, `preload.ts`\n      `account/`             ← Auth, session, encryption\n      `sync/`                ← Git/VCS sync\n      `network/`             ← Request execution engine\n      `templating/`          ← Nunjucks rendering (Web Worker)\n  `insomnia-data/`           ← Data models, services, NeDB implementation, shared data utilities\n  `insomnia-api/`            ← Cloud API client\n  `insomnia-inso/`           ← CLI tool\n  `insomnia-testing/`        ← Test framework\n\n## Data Model Hierarchy\n\nOrganization\n  → Project (local | remote/cloud | git-backed)\n    → Workspace (scope: 'collection' | 'design')\n      → Base Environment (auto-created: use `models.environment.getOrCreateForParentId(workspaceId)`)\n        → Sub-Environments\n      → Cookie Jar (auto-created)\n      → Request Group (folders)\n        → Request (HTTP, GraphQL, gRPC, WebSocket, Socket.IO)\n      → Request (can be direct child of workspace)\n**Note:** A Workspace with `scope: 'collection'` IS the collection.\n\n## Key Patterns\n\n- **Route-Based Actions:** Mutations use React Router's `clientAction` (`src/routes/`).\n  - **CRITICAL:** `clientAction` blocks navigation. For long-running UI operations, use plain async functions instead.\n- **Database Buffering:** Always buffer bulk writes (`database.bufferChangesIndefinitely()`, then `flushChanges()`). Unbuffered writes fire UI revalidation per operation, causing severe lag.\n- **State Management:** Use Router loaders/actions and NeDB for persistent state. Use React `useState`/context for ephemeral UI state (No Redux/Zustand).\n- **Electron IPC:** For main↔renderer communication, define handlers in `src/main/ipc/`, expose in `src/main/preload.ts`, and update `window.main` in `src/global.d.ts`.\n- **Templates:** Nunjucks runs in a Web Worker (`src/templating/`). Use `{{ _.variable_name }}`.\n- **Models:** Follow CRUD via `models.<type>` (e.g., `create()`, `update()`).\n- **HTTP Calls:** Use `insomniaFetch()` for Insomnia backend APIs. Use plain `fetch()` for external/third-party APIs.\n- **Styling:** Tailwind utility classes only. Use `clsx`/`tailwind-merge` for conditionals. Use React Aria for interactive HTML elements.\n- **Testing:** Use **Vitest** (unit) and **Playwright** (E2E). Co-locate unit tests as `filename.test.ts`. Use `vi.mock()`. Prefer testing logic via loaders over mounting components.\n- **E2E tests** live in `packages/insomnia-smoke-test/`. Full docs: [`packages/insomnia-smoke-test/README.md`](packages/insomnia-smoke-test/README.md).\n- Run E2E from repo root: `npm run test:smoke:dev` (filter: `npm run test:smoke:dev -- <title-substring>`).\n- New test imports: `import { test } from '../../playwright/test'` and `import { expect } from '@playwright/test'`.\n\n## Sensitive Data\n\n- **Vault system (AES-GCM):** For environment secrets (`EnvironmentKvPairDataType.SECRET`).\n- **Electron safeStorage:** Platform-native encryption (`window.main.secretStorage`).\n"}}