Skip to content

Commit c36d09a

Browse files
committed
fix: agents.md.
1 parent 76810cd commit c36d09a

1 file changed

Lines changed: 52 additions & 37 deletions

File tree

AGENTS.md

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,39 @@
22

33
## Repository Overview
44

5-
Appwrite Console is the web-based GUI for the Appwrite backend-as-a-service platform. Single-page application built with **Svelte 5 + SvelteKit 2**, **TypeScript** (not strict mode), **Vite 7**, tested with **Vitest + Playwright**. Package manager: **pnpm 10.15.1**, Node 20+. ~1500 files with extensive component-based architecture.
5+
Appwrite Console is the web-based GUI for the Appwrite backend-as-a-service platform. Single-page application built with
6+
**Svelte 5 + SvelteKit 2**, **TypeScript** (not strict mode), **Vite 7**, tested with **Vitest + Playwright**. Package
7+
manager/runtime: **Bun** (Node 20+ optional for tooling). ~1500 files with extensive component-based architecture.
68

79
## Critical Build & Test Commands
810

911
### Setup (REQUIRED before any commands)
1012

11-
1. **Install pnpm**: `npm install -g corepack && corepack enable && corepack prepare pnpm@10.15.1 --activate`
13+
1. **Install Bun**:
14+
- Linux & macOS: `curl -fsSL https://bun.sh/install | bash`
15+
- Windows: `powershell -c "irm bun.sh/install.ps1 | iex"`
1216
2. **Create .env**: `cp .env.example .env` (configure `PUBLIC_APPWRITE_ENDPOINT` and `PUBLIC_CONSOLE_MODE`)
1317
3. **Configure network access** (if using GitHub Actions or restricted environments):
1418
- Ensure firewall/proxy allows access to: `pkg.pr.new`, `pkg.vc`, `registry.npmjs.org`
15-
- These domains are required for dependencies: `@appwrite.io/console`, `@appwrite.io/pink-icons-svelte`, `@appwrite.io/pink-svelte`
16-
- In GitHub Actions: Use `pnpm/action-setup@v4` which handles registry configuration
19+
- These domains are required for dependencies: `@appwrite.io/console`, `@appwrite.io/pink-icons-svelte`,
20+
`@appwrite.io/pink-svelte`
21+
- In GitHub Actions: Ensure Bun is installed and registry access is configured
1722
- If network errors persist, check proxy settings: `npm config get proxy` and `npm config get https-proxy`
18-
4. **Install dependencies**: `pnpm install --frozen-lockfile` (if pkg.pr.new/pkg.vc fail due to network restrictions, installation may still succeed with cached versions)
23+
4. **Install dependencies**: `bun install --frozen-lockfile` (if pkg.pr.new/pkg.vc fail due to network restrictions,
24+
installation may still succeed with cached versions)
1925

2026
### Development Commands
2127

2228
**Standard workflow**: `check``lint``test``build` (before committing)
2329

24-
- `pnpm run check` - TypeScript/Svelte validation (~30-60s)
25-
- `pnpm run lint` - ESLint check (~10-20s)
26-
- `pnpm run format` - Auto-fix Prettier formatting
27-
- `pnpm run test` - Vitest unit tests with TZ=EST (~10-30s)
28-
- `pnpm run build` - Production build via build.js (~60-120s)
29-
- `pnpm dev` - Dev server on port 3000
30-
- `pnpm run preview` - Preview build on port 4173
31-
- `pnpm run e2e` - Playwright tests (needs `pnpm exec playwright install --with-deps chromium` first, ~120s+)
30+
- `bun run check` - TypeScript/Svelte validation (~30-60s)
31+
- `bun run lint` - ESLint check (~10-20s)
32+
- `bun run format` - Auto-fix Prettier formatting
33+
- `bun run test` - Bun unit tests with TZ=EST (~10-30s)
34+
- `bun run build` - Production build via build.js (~60-120s)
35+
- `bun run dev` - Dev server on port 3000
36+
- `bun run preview` - Preview build on port 4173
37+
- `bun run e2e` - Playwright tests (needs `bunx playwright install --with-deps chromium` first, ~120s+)
3238

3339
**CI Pipeline** (`.github/workflows/tests.yml`): audit → install → check → lint → test → build
3440

@@ -52,36 +58,42 @@ src/
5258
└── app.html, hooks.{client,server}.ts, service-worker.ts
5359
```
5460

55-
**SvelteKit conventions**: `+page.svelte` (component), `+page.ts` (data loader), `+layout.svelte` (wrapper), `+error.svelte` (errors). Groups like `(console)` organize routes without affecting URLs. Dynamic params: `[param]`.
61+
**SvelteKit conventions**: `+page.svelte` (component), `+page.ts` (data loader), `+layout.svelte` (wrapper),
62+
`+error.svelte` (errors). Groups like `(console)` organize routes without affecting URLs. Dynamic params: `[param]`.
5663

5764
## Key Configuration
5865

59-
**svelte.config.js**: Adapter = static SPA (fallback: index.html), base path `/console`, aliases: `$lib`, `$routes`, `$themes`
60-
**vite.config.ts**: Dev port 3000, Vitest (client=jsdom, server=node), test files: `src/**/*.{test,spec}.{js,ts}`
66+
**svelte.config.js**: Adapter = static SPA (fallback: index.html), base path `/console`, aliases: `$lib`, `$routes`,
67+
`$themes`
68+
**vite.config.ts**: Dev port 3000
6169
**tsconfig.json**: Extends `.svelte-kit/tsconfig.json`, **NOT strict mode** (`strict: false`)
6270
**eslint.config.js**: Flat config (ESLint 9+), many rules disabled (see TODOs)
6371
**.prettierrc**: 4 spaces, single quotes, 100 char width, no trailing commas
6472

6573
## Testing
6674

67-
**Unit (Vitest)**: Tests in `src/lib/helpers/*.test.ts`, run with `TZ=EST` (timezone matters). Setup mocks SvelteKit (`$app/*`) in `vitest-setup-client.ts`.
68-
**E2E (Playwright)**: Tests in `e2e/journeys/*.spec.ts`, needs build+preview on port 4173, retries 3x, timeout 120s, Chromium only.
75+
**Unit (Bun test)**: Tests in `src/lib/helpers/*.test.ts`, run with `TZ=EST` (timezone matters). Setup mocks SvelteKit (
76+
`$app/*`) in `bun-test-setup.ts` via `bunfig.toml`.
77+
**E2E (Playwright)**: Tests in `e2e/journeys/*.spec.ts`, needs build+preview on port 4173, retries 3x, timeout 120s,
78+
Chromium only.
6979

7080
## Common Pitfalls
7181

72-
1. **Blank page in dev**: Disable ad blockers if seeing "Failed to fetch dynamically imported module" (known SvelteKit issue)
82+
1. **Blank page in dev**: Disable ad blockers if seeing "Failed to fetch dynamically imported module" (known SvelteKit
83+
issue)
7384
2. **Network errors on install**:
7485
- pkg.pr.new/pkg.vc deps may fail due to firewall/proxy restrictions
7586
- Check access: `curl -I https://pkg.pr.new` and `curl -I https://pkg.vc`
76-
- Configure proxy if needed: `npm config set proxy http://proxy:port` and `npm config set https-proxy http://proxy:port`
77-
- GitHub Actions: Ensure runner has internet access; use `pnpm/action-setup@v4` action
87+
- Configure proxy if needed: `npm config set proxy http://proxy:port` and
88+
`npm config set https-proxy http://proxy:port`
89+
- GitHub Actions: Ensure runner has internet access and Bun is installed
7890
- Local dev: Often safe to continue with cached versions if network fails
7991
3. **OOM on build**: Set `NODE_OPTIONS=--max_old_space_size=8192` (like Dockerfile does)
80-
4. **Test failures**: Always use `pnpm run test` (sets TZ=EST), not `vitest` directly
81-
5. **TS errors not showing**: Run `pnpm run check` explicitly (dev server doesn't always surface them)
82-
6. **Format vs lint conflicts**: Run `pnpm run format` before `pnpm run lint`
92+
4. **Test failures**: Always use `bun run test` (sets TZ=EST), not `bun test` directly
93+
5. **TS errors not showing**: Run `bun run check` explicitly (dev server doesn't always surface them)
94+
6. **Format vs lint conflicts**: Run `bun run format` before `bun run lint`
8395
7. **E2E timeouts**: Wait 120s for preview server startup, tests auto-retry 3x
84-
8. **Stale build**: Clear `.svelte-kit` if changes not reflected: `rm -rf .svelte-kit && pnpm run build`
96+
8. **Stale build**: Clear `.svelte-kit` if changes not reflected: `rm -rf .svelte-kit && bun run build`
8597

8698
## Code Conventions
8799

@@ -96,28 +108,31 @@ src/
96108

97109
1. Run Appwrite backend locally (see [docs](https://appwrite.io/docs/advanced/self-hosting))
98110
2. Configure `.env` with backend endpoint
99-
3. `pnpm install --frozen-lockfile`
100-
4. `pnpm dev` (hot reload on port 3000)
101-
5. Before commit: `pnpm run check && pnpm run format && pnpm run lint && pnpm run test && pnpm run build`
102-
6. **Take screenshots**: For any UI changes, capture screenshots and include them in the PR description or comments before finalizing
111+
3. `bun install --frozen-lockfile`
112+
4. `bun run dev` (hot reload on port 3000)
113+
5. Before commit: `bun run check && bun run format && bun run lint && bun run test && bun run build`
114+
6. **Take screenshots**: For any UI changes, capture screenshots and include them in the PR description or comments
115+
before finalizing
103116

104117
## Required Pre-Completion Checklist
105118

106-
**CRITICAL**: Before finishing any work or marking a task complete, agents MUST run the following commands in order and ensure all pass:
119+
**CRITICAL**: Before finishing any work or marking a task complete, agents MUST run the following commands in order and
120+
ensure all pass:
107121

108-
1. **`pnpm run format`** - Auto-fix all formatting issues
109-
2. **`pnpm run check`** - Verify TypeScript/Svelte types (must show 0 errors, 0 warnings)
110-
3. **`pnpm run lint`** - Check code style (ignore pre-existing issues in files you didn't modify)
111-
4. **`pnpm run test`** - Run all unit tests (all tests must pass)
112-
5. **`pnpm run build`** - Ensure production build succeeds
122+
1. **`bun run format`** - Auto-fix all formatting issues
123+
2. **`bun run check`** - Verify TypeScript/Svelte types (must show 0 errors, 0 warnings)
124+
3. **`bun run lint`** - Check code style (ignore pre-existing issues in files you didn't modify)
125+
4. **`bun run test`** - Run all unit tests (all tests must pass)
126+
5. **`bun run build`** - Ensure production build succeeds
113127

114128
If any command fails:
115129

116-
- **Format/Lint**: Run `pnpm run format` to auto-fix, then re-check
130+
- **Format/Lint**: Run `bun run format` to auto-fix, then re-check
117131
- **Type errors**: Fix all TypeScript errors in files you modified
118132
- **Test failures**: Fix failing tests or ensure failures are unrelated to your changes
119133
- **Build failures**: Debug and resolve build issues before proceeding
120134

121135
**Never skip these checks** - they are mandatory quality gates before any work is considered complete.
122136

123-
**Trust these instructions** - only search if incomplete/incorrect. See CONTRIBUTING.md for PR conventions. Use `--frozen-lockfile` always. Docker builds: multi-stage, final image is nginx serving static files from `/console` path.
137+
**Trust these instructions** - only search if incomplete/incorrect. See CONTRIBUTING.md for PR conventions. Use
138+
`--frozen-lockfile` always. Docker builds: multi-stage, final image is nginx serving static files from `/console` path.

0 commit comments

Comments
 (0)