Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9d09568
updated plan
jackkav May 21, 2026
b05b06a
feat: lift network.ts fs/path use behind window.main.timeline IPC bridge
jackkav May 21, 2026
272de90
fix: address Aikido path-traversal feedback and mock window.main in n…
jackkav May 21, 2026
c749714
chore: suppress echoServer stdout in playwright config
jackkav May 26, 2026
3e8d51d
fix: update insomnia-inso logger for consola v3 compatibility
jackkav May 26, 2026
7c8b2a2
refactor: address timeline IPC review concerns
jackkav May 26, 2026
efc2938
fix: upgrade consola to v3 and fix type/import issues in insomnia-inso
jackkav May 26, 2026
8e394ee
fix: restore Node.js-safe fallbacks in network.ts for inso CLI
jackkav May 26, 2026
9cac959
fix: sort node: imports before third-party and replace if/else with t…
jackkav May 26, 2026
7b07a71
fix: replace static fs/path imports with inline require() to pass ren…
jackkav May 26, 2026
bea2628
refactor: replace process.type branching in network.ts with build-tim…
jackkav May 26, 2026
a3746cf
fix: restore object alias format in vite.config.ts to fix rollup build
jackkav May 27, 2026
47fa7ae
fix: resolve merge conflicts in logger.ts and cli.ts, restore AGENTS.…
jackkav May 27, 2026
4a7b823
remove cx
jackkav May 27, 2026
94dce09
fix: add path traversal guard to getTimelinePath in node adapter
jackkav May 27, 2026
25c1741
fix tests which use network from main
jackkav May 27, 2026
ca0cd3b
flake
jackkav May 27, 2026
b6d6ea6
refactor: replace bundler aliases with process.type runtime detection…
jackkav May 27, 2026
af8b11b
fix: restore vite alias for network-adapter to fix server bundle build
jackkav May 27, 2026
fa1a270
feedback
jackkav May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 24 additions & 45 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# AGENTS.md

## Tech Stack

- **UI:** React with React Router (loaders/actions pattern)
- **Components:** React Aria Components
- **Desktop Shell:** Electron (main + renderer processes)
Expand All @@ -9,14 +10,17 @@
- **Database:** NeDB (`@seald-io/nedb`) — embedded NoSQL
- **Build/Dev:** Vite, npm workspaces monorepo

*See `package.json` for current versions and `.nvmrc` for the Node version.*
_See `package.json` for current versions and `.nvmrc` for the Node version._

## Strict Rules

- **No unsolicited formatting.** Rely on ESLint/Prettier. Do not reformat existing code.
- **Strict scoping.** Only modify code directly related to the prompt. Do not refactor adjacent code unless asked.

## Command Output

Prefer quiet command variants to minimise output volume:

- `git log --oneline -20` not `git log`
- `git diff --stat` not `git diff`
- `npm test --silent` not `npm test`
Expand All @@ -25,6 +29,7 @@ Prefer quiet command variants to minimise output volume:
- Use `Grep` with `head_limit` rather than unrestricted searches

## Validation Commands

Run from repo root before considering work complete:

```bash
Expand All @@ -33,7 +38,22 @@ npm run type-check # TypeScript check all workspaces
npm test # Tests all workspaces (or: npm test -w packages/insomnia)
```

## Worktree Setup

- New git worktrees may not have `node_modules` yet. Before installing or validating, switch to the repo's required runtime from the worktree root:

```bash
fnm use "$(cat .nvmrc)"
node -v
npm -v
```

- 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.
- After switching versions in a fresh worktree, install dependencies from repo root with `npm ci`.
- 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.

## Repository Structure

`packages/`
`insomnia/` ← Main Electron app
`src/`
Expand All @@ -52,6 +72,7 @@ npm test # Tests all workspaces (or: npm test -w packages/insomnia)
`insomnia-testing/` ← Test framework

## Data Model Hierarchy

Organization
→ Project (local | remote/cloud | git-backed)
→ Workspace (scope: 'collection' | 'design')
Expand All @@ -64,6 +85,7 @@ Organization
**Note:** A Workspace with `scope: 'collection'` IS the collection.

## Key Patterns

- **Route-Based Actions:** Mutations use React Router's `clientAction` (`src/routes/`).
- **CRITICAL:** `clientAction` blocks navigation. For long-running UI operations, use plain async functions instead.
- **Database Buffering:** Always buffer bulk writes (`database.bufferChangesIndefinitely()`, then `flushChanges()`). Unbuffered writes fire UI revalidation per operation, causing severe lag.
Expand All @@ -79,49 +101,6 @@ Organization
- New test imports: `import { test } from '../../playwright/test'` and `import { expect } from '@playwright/test'`.

## Sensitive Data

- **Vault system (AES-GCM):** For environment secrets (`EnvironmentKvPairDataType.SECRET`).
- **Electron safeStorage:** Platform-native encryption (`window.main.secretStorage`).
## cx — Semantic Code Navigation

Prefer cx over reading files. Escalate: overview → symbols → definition/references → Read tool.

### Quick reference

```
cx overview PATH file or directory table of contents
cx overview DIR --full directory overview with signatures
cx symbols [--kind K] [--name GLOB] [--file PATH] search symbols project-wide
cx symbols --kinds [--file PATH] list distinct kinds with counts
cx definition --name NAME [--from PATH] [--kind K] get a function/type body
cx references --name NAME [--file PATH] [--unique] find all usages (--unique: one per caller)
cx lang list show supported languages
cx lang add LANG [LANG...] install language grammars
```

Aliases: `cx o`, `cx s`, `cx d`, `cx r`

Kinds: fn, struct, enum, trait, type, const, class, interface, module, event

### Key patterns

- Start with `cx overview .`, drill into subdirectories — cheaper than ls + reading files
- `cx definition --name X` gives exact text for Edit tool's `old_string` without reading the whole file
- `cx references --name X --unique` shows one row per caller — use before refactoring to check blast radius
- After context compression, use `cx overview` / `cx definition` to re-orient — don't re-read full files
- Check signatures for `pub`/`export` to identify public API without reading the file

### Pagination

Default limits: definition 3, symbols 100, references 50. When truncated, stderr shows:

```
cx: 3/32 definitions for "X" | --from PATH to narrow | --offset 3 for more | --all
```

`--offset N` pages forward, `--all` bypasses, `--limit N` overrides. Narrowing with `--from`/`--file`/`--kind` is usually better than paging.

JSON: paginated → `{total, offset, limit, results: [...]}`, non-paginated → bare array.

### Missing grammars

If cx reports a missing grammar, install with `cx lang add <lang>`. Run `cx lang list` to see what's installed.
6 changes: 1 addition & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/insomnia-inso/esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const config: BuildOptions = {
'process.env.DEFAULT_APP_NAME': JSON.stringify(isProd ? 'Insomnia' : 'insomnia-app'),
'process.env.VERSION': JSON.stringify(isProd ? version : 'dev'),
'__DEV__': JSON.stringify(!isProd),
'process.type': 'undefined',
},
// node-llama-cpp is not included here because inso does not need it
external: ['@getinsomnia/node-libcurl', 'fsevents', 'mocha'],
Expand Down
2 changes: 1 addition & 1 deletion packages/insomnia-inso/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@stoplight/spectral-rulesets": "^1.22.1",
"@stoplight/types": "^14.1.1",
"commander": "^12.1.0",
"consola": "^2.15.3",
"consola": "^3.4.2",
"cosmiconfig": "^9.0.0",
"enquirer": "^2.4.1",
"picocolors": "^1.1.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/insomnia-inso/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { readFile } from 'node:fs/promises';
import nodePath from 'node:path';

import * as commander from 'commander';
import { LogLevels } from 'consola';
import { cosmiconfig } from 'cosmiconfig';
// @ts-expect-error the enquirer types are incomplete https://github.com/enquirer/enquirer/pull/307
import { Confirm } from 'enquirer';
Expand Down Expand Up @@ -37,7 +38,7 @@ import { matchIdIsh } from './db/models/util';
import { loadWorkspace, promptWorkspace } from './db/models/workspace';
import type { Database } from './db/types';
import { InsoError } from './errors';
import { BasicReporter, logger, LogLevel } from './logger';
import { BasicReporter, logger } from './logger';
import { logTestResult, logTestResultSummary, reporterTypes, type TestReporter } from './reporter';
import { generateDocumentation } from './scripts/docs';
import { getAppDataDir, getDefaultProductName } from './util';
Expand Down Expand Up @@ -296,7 +297,7 @@ export const go = (args?: string[]) => {
...commandOptions,
configFileContent: __configFile,
};
logger.level = options.verbose ? LogLevel.Verbose : LogLevel.Info;
logger.level = options.verbose ? LogLevels.verbose : LogLevels.info;
options.ci && logger.setReporters([new BasicReporter()]);
options.printOptions && logger.log('Loaded options', options, '\n');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import nodePath from 'node:path';

import type { Consola } from 'consola';
import type { ConsolaInstance } from 'consola';
import { pick } from 'es-toolkit';

import type {
Expand Down Expand Up @@ -65,7 +65,7 @@ export class RunCollectionResultReport {
outputFilePath: string;
includeFullData?: 'redact' | 'plaintext';
},
private logger: Consola,
private logger: ConsolaInstance,
init?: Partial<ReportData>,
) {
Object.assign(this, init);
Expand Down
28 changes: 14 additions & 14 deletions packages/insomnia-inso/src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import type { logType } from 'consola';
import consola, { BasicReporter, FancyReporter, LogLevel } from 'consola';
import type { ConsolaOptions, LogObject, LogType } from 'consola';
import { createConsola } from 'consola';

type LogsByType = Partial<Record<logType, string[]>>;
type LogsByType = Partial<Record<LogType, string[]>>;

type ModifiedConsola = ReturnType<typeof consola.create> & { __getLogs: () => LogsByType };
type ModifiedConsola = ReturnType<typeof createConsola> & { __getLogs: () => LogsByType };

const consolaLogger = consola.create({
reporters: [
new FancyReporter({
formatOptions: {
// @ts-expect-error something is wrong here, ultimately these types come from https://nodejs.org/api/util.html#util_util_inspect_object_options and `date` doesn't appear to be one of the options.
date: false,
},
}),
],
const consolaLogger = createConsola({
formatOptions: {
date: false,
},
});

(consolaLogger as ModifiedConsola).__getLogs = () => ({});

export const logger = consolaLogger as ModifiedConsola;
export { LogLevel, BasicReporter };

export class BasicReporter {
log(logObj: LogObject, _ctx: { options: ConsolaOptions }) {
process.stdout.write(logObj.args.join(' ') + '\n');
}
}
1 change: 1 addition & 0 deletions packages/insomnia-inso/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default defineConfig({
test: {
hideSkippedTests: true,
alias: {
'~/network/network-adapter': new URL('../insomnia/src/network/network-adapter.node.ts', import.meta.url).pathname,
'~/': new URL('../insomnia/src/', import.meta.url).pathname,
},
env: {
Expand Down
2 changes: 1 addition & 1 deletion packages/insomnia-smoke-test/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const echoServer: PlaywrightTestConfig['webServer'] = {
url: 'http://localhost:4010',
timeout: 20 * 1000,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
stdout: 'ignore',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we ignore the stdout here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because I only enabled it recently, and it was cluttering the smoke test output

stderr: 'pipe',
wait: {
stdout: /Listening at http/,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ test.describe('Environment Editor', () => {
const bodyEditor = page.getByRole('dialog').getByTestId('CodeEditor').getByRole('textbox');
// move cursor right and input json string
await bodyEditor.focus();
await bodyEditor.press('ArrowRight');
await bodyEditor.fill('"anotherString":"kvAnotherStr","anotherNumber": 12345');
await page.keyboard.press('ControlOrMeta+a');
await page.keyboard.type('{"anotherString":"kvAnotherStr","anotherNumber": 12345}');
// Submit and wait for the JSON modal to close before proceeding
await page.getByRole('button', { name: 'Modal Submit' }).click();
await expect.soft(page.getByRole('dialog', { name: 'Modal' })).toBeHidden();
Expand Down
Loading
Loading