AGENTS.md
packages/frontend/apps/ios/AGENTS.mdAGENTS.md
Quality
83/100
Scores the file, not the repository.Length
665 words
23 headings · 0 code blocksRepository
71k
— · pushed 0 days agoLast changed
2 days ago
First indexed 2 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Project Overview67This is the AFFiNE iOS application built with Capacitor, React, and TypeScript. It's a hybrid mobile app that wraps a React web application in a native iOS shell.89## Development Commands1011### Build and Development1213- `yarn dev` - Start development server with live reload14- `yarn build` - Build the web application15- `yarn sync` - Sync web assets with Capacitor iOS project16- `yarn sync:dev` - Sync with development server (CAP_SERVER_URL=http://localhost:8080)17- `yarn xcode` - Open Xcode project18- `yarn codegen` - Generate GraphQL and Rust bindings19- `xcodebuild -workspace App.xcworkspace -scheme App -destination 'platform=iOS Simulator,name=iPhone 15' build | xcbeautify` - Build iOS project with xcbeautify2021### iOS Build Process22231. `BUILD_TYPE=canary PUBLIC_PATH="/" yarn affine @affine/ios build` - Build web assets242. `yarn affine @affine/ios cap sync` - Sync with iOS project253. `yarn affine @affine/ios cap open ios` - Open in Xcode2627### Live Reload Setup28291. Run `yarn dev` and select `ios` for Distribution option302. Run `yarn affine @affine/ios sync:dev`313. Run `yarn affine @affine/ios cap open ios`3233## Architecture3435### Core Technologies3637- **Capacitor 7.x** - Native iOS bridge38- **React 19** - UI framework39- **TypeScript** - Language40- **Blocksuite** - Document editor41- **DI Framework** - Dependency injection via `@toeverything/infra`4243### Key Directories4445- `src/` - React application source46- `App/` - Native iOS Swift code47- `dist/` - Built web assets48- `capacitor-cordova-ios-plugins/` - Capacitor plugins4950### Native Bridge Integration5152The app exposes JavaScript APIs to native iOS code through `window` object:5354- `getCurrentServerBaseUrl()` - Get current server URL55- `getCurrentI18nLocale()` - Get current locale56- `getAiButtonFeatureFlag()` - Check AI button feature flag57- `getCurrentWorkspaceId()` - Get current workspace ID58- `getCurrentDocId()` - Get current document ID59- `getCurrentDocContentInMarkdown()` - Export current doc as markdown60- `createNewDocByMarkdownInCurrentWorkspace()` - Import markdown as new doc6162### Swift Code Style6364Follow the guidelines in `AGENTS.md`:6566- 2-space indentation67- PascalCase for types, camelCase for properties/methods68- Modern Swift features: `@Observable`, `async/await`, `actor`69- Protocol-oriented design, dependency injection70- Early returns, guard statements for optional unwrapping7172### Build Configuration7374- TypeScript config extends `../../../../tsconfig.web.json`75- Webpack bundling via `@affine-tools/cli`76- Capacitor config in `capacitor.config.ts`77- GraphQL codegen via Apollo78- Rust bindings generated via Uniffi7980### Dependencies8182- Workspace packages: `@affine/core`, `@affine/component`, `@affine/env`83- Capacitor plugins: App, Browser, Haptics, Keyboard84- React ecosystem: React Router, Next Themes85- Storage: IDB, Yjs for collaborative editing8687### Testing and Quality8889- TypeScript strict mode enabled90- ESLint/Prettier configuration from workspace root91- No specific test commands in this package (tests likely in workspace root)9293# Swift Code Style Guidelines9495## Core Style9697- **Indentation**: 2 spaces98- **Braces**: Opening brace on same line99- **Spacing**: Single space around operators and commas100- **Naming**: PascalCase for types, camelCase for properties/methods101102## File Organization103104- Logical directory grouping105- PascalCase files for types, `+` for extensions106- Modular design with extensions107108## Modern Swift Features109110- **@Observable macro**: Replace `ObservableObject`/`@Published`111- **Swift concurrency**: `async/await`, `Task`, `actor`, `@MainActor`112- **Result builders**: Declarative APIs113- **Property wrappers**: Use line breaks for long declarations114- **Opaque types**: `some` for protocol returns115116## Code Structure117118- Early returns to reduce nesting119- Guard statements for optional unwrapping120- Single responsibility per type/extension121- Value types over reference types122123## Error Handling124125- `Result` enum for typed errors126- `throws`/`try` for propagation127- Optional chaining with `guard let`/`if let`128- Typed error definitions129130## Architecture131132- Avoid using protocol-oriented design unless necessary133- Dependency injection over singletons134- Composition over inheritance135- Factory/Repository patterns136137## Debug Assertions138139- Use `assert()` for development-time invariant checking140- Use `assertionFailure()` for unreachable code paths141- Assertions removed in release builds for performance142- Precondition checking with `precondition()` for fatal errors143144## Memory Management145146- `weak` references for cycles147- `unowned` when guaranteed non-nil148- Capture lists in closures149- `deinit` for cleanup150
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| elastic/elasticsearchx-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/AGENTS.md · 78k | AGENTS.md | buildtestlint-formatstyle+2 | 100/100 | 3 days ago |
