Files
SideImpactor/AGENTS.md
Lakr afec333aa0 refactor: migrate frontend to React + Tailwind, add Docker + tests
Replace the vanilla-TS innerHTML frontend with a type-checked React
component tree (React 19 + Tailwind v4 + Vite).

Frontend:
- 14 components: Header, Stepper, LoginPage, LoginModal, SignPage,
  DropZone, DevicePicker, ProgressCard, SavedAccountsList, TrustModal,
  TwoFactorModal, Button, Field, Chip, Modal
- lib/ extracts: storage (10 localStorage keys preserved), pair-record,
  account-session, log-parser, ids, use-log hook
- flows/ encapsulate async pair/login/sign/install with dependency injection
- Accounts page as main view with Add Account modal
- Fullscreen progress overlay during sign/install
- Account selector + device picker on Sign page
- Security notice in login modal (server trust warning)
- All addLog calls mirrored to console.log for devtools debugging

Build:
- bun run dev: submodule init + install + wasm dist + vite + wrangler
- bun run setup: one-shot project bootstrap
- Docker: multi-stage bun build → nginx on :3000
- build:wasm:dist copies pre-built src→dist (no Rust/Emscripten needed)
- jszip/node-forge/fflate pre-bundled for CJS→ESM conversion

Tests:
- 163 vitest tests (happy-dom): all lib, components, App integration,
  WASM dist artifact checks, libcurl Apple connectivity, anisette init
  error handling

Cleanup:
- Delete yarn.lock (bun.lock canonical), expand .gitignore
- Remove README.zh.md, rewrite README.md + AGENTS.md
- Update libcurl.js submodule to f65d440 (CI build artifacts)
2026-04-13 17:02:45 +08:00

37 lines
1.3 KiB
Markdown

# AGENTS Guide
## Package Manager
- Use `bun` for all Node.js dependency and script operations.
## Project Layout
- Core npm package source: `dependencies/webmuxd/src/`
- High-level iMobileDevice interactions: `dependencies/webmuxd/src/core/imobiledevice-client.ts`
- Frontend React app: `frontend/src/`
- Frontend entry: `frontend/src/main.tsx``App.tsx`
- Frontend components: `frontend/src/components/`
- Frontend business logic: `frontend/src/lib/` (storage, pair-record, account-session) + `frontend/src/flows/` (pair, login, sign, install)
- Cloudflare Workers backend: `backend/`
- WASM packages: `wasm/openssl/`, `wasm/libcurl-wasm/`, `wasm/zsign-wasm/`
## Key Rule: Avoid Logic Duplication
- Do not re-implement usbmux/lockdown/AFC/InstProxy protocol logic in `frontend`.
- Frontend must consume workspace package exports from `webmuxd` via the vite alias.
- If behavior changes are needed, modify `dependencies/webmuxd/` first, then wire it in frontend.
## Build & Validate
- WASM dist (always run before frontend): `bun run build:wasm:dist`
- Dev server: `bun run dev`
- Frontend build: `bun run build:frontend`
- Root lint: `bun run lint`
- Root test: `bun run test`
- Frontend tests: `bun run test:frontend`
## Change Style
- Keep changes minimal, focused, and consistent with existing style.
- Prefer removing dead code over keeping legacy paths.