50 lines
1.9 KiB
Markdown
50 lines
1.9 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Git
|
|
|
|
Always stage newly created files that permanently belong to the project with `git add <file>`.
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
./gradlew run # Run the app
|
|
./gradlew compileKotlin # Compile only
|
|
./gradlew packageDmg # Build macOS DMG
|
|
```
|
|
|
|
## Architecture
|
|
|
|
**AnyTask** is a Kotlin/Compose desktop app that runs in the background and shows a task creation window via a global hotkey (Ctrl+Shift+Space).
|
|
|
|
### Components
|
|
|
|
- **`Main.kt`** — Entry point. Sets `apple.awt.UIElement=true` (no dock icon), starts the Compose `application {}`, sets up system tray and HotkeyManager.
|
|
- **`hotkey/HotkeyManager.kt`** — JNativeHook wrapper. Registers Ctrl+Shift+Space as a system-wide hotkey and dispatches the callback on the AWT EDT.
|
|
- **`ui/TaskWindow.kt`** — Compose UI with a form (title, details). Escape closes, ⌘↵ creates.
|
|
- **`api/AnyTypeApi.kt`** — Ktor HTTP client for the local AnyType API (`localhost:31009`). Currently a skeleton — API details still need to be verified.
|
|
|
|
### Stack
|
|
|
|
- Kotlin 2.1.0 / Compose Multiplatform 1.7.1
|
|
- JNativeHook 2.2.2 (global hotkeys)
|
|
- Ktor 3.0.0 + kotlinx.serialization (AnyType API)
|
|
- Gradle 9.2.1
|
|
|
|
## Code Style
|
|
|
|
- One class per file — file name matches the class name.
|
|
- No wildcard imports (`import foo.*`).
|
|
- Code, comments, and documentation in English.
|
|
- Exceptions: always handle or at least log them (with full stacktrace).
|
|
|
|
## macOS Notes
|
|
|
|
- **Accessibility permission** for JNativeHook: System Settings → Privacy & Security → Accessibility → add the app. Without this permission the global hotkey will not work.
|
|
- The tray icon appears in the menu bar (no dock icon, since `apple.awt.UIElement=true`).
|
|
|
|
## AnyType API
|
|
|
|
The local AnyType API runs via `anytype-heart` on `http://localhost:31007`. `apiKey` and `spaceId` are configured via `anytask.yaml`.
|