diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index 6e7acef..cce6ff1 100644 --- a/.github/workflows/ci-check.yml +++ b/.github/workflows/ci-check.yml @@ -22,3 +22,6 @@ jobs: - run: pnpm typecheck - run: pnpm test + + - name: Verify documentation consistency + run: ./scripts/verify-docs.sh diff --git a/AGENTS.md b/AGENTS.md index 66cd1ae..9545464 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,3 +1,5 @@ +> **Note:** The content below has been migrated to the project root as `CLAUDE.md` so that Claude Code auto-loads it. Please read `CLAUDE.md` first; this file is kept for backward references. + # CLAUDE.md Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..459b9b9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,37 @@ +# Changelog + +All notable changes to NeoCompanion will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added + +- Documentation quality improvement initiative: added `LICENSE`, `CLAUDE.md`, `CONTRIBUTING.md`, `CHANGELOG.md`, `docs/DEVELOPMENT.md`, `docs/API.md`, `docs/TTS_SETUP.md`, `docs/GLOSSARY.md`, `docs/TODO_INVENTORY.md`, `docs/TESTING.md`, and `scripts/verify-docs.sh`. + +### Fixed + +- Corrected stale product name references in `docs/ARCHITECTURE.md` to match the project name. +- Replaced broken Windows-absolute `file:///` links in `docs/PRD_overview.md` with relative paths. +- Updated MiMo TTS missing-base-URL error to point to `docs/TTS_SETUP.md`. +- Marked the GitHub Actions implementation plan as implemented. + +## [0.1.0] - 2026-06-19 + +### Added + +- Floating desktop companion widget with 2D sprite animation and TTS feedback. +- Companion panel window for task management, AI chat, settings, and Hook approvals. +- Wallpaper status layer (Windows) embedding weather, time, focus ring, task progress, and assistant messages via `tauri-plugin-wallpaper`. +- Local Fastify sidecar exposing REST API and WebSocket hub on `localhost:10103`. +- SQLite persistence for tasks, focus sessions, conversations, messages, settings, and window events via Drizzle ORM. +- Pomodoro-style focus timer with companion feedback. +- Local task list with create/update/status change support. +- AI chat adapter for DeepSeek with streaming responses. +- MiMo TTS adapter for spoken companion feedback. +- Weather summary service. +- Active-window snapshot service with focused/distracted/stuck classification. +- Hook system for external agents to push status updates and request permissions. +- Knowledge workspace UI (v3.3) with Projects, Notes, Kanban Board, and Tasks — front-end mock stage; real backend storage and search are planned. +- GitHub Actions workflows for PR checks, cross-platform Tauri builds, and tag-triggered releases. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..b297274 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,118 @@ +# NeoCompanion — Claude Code Project Context + +## Project Overview + +NeoCompanion is a local-first desktop AI assistant built with **Tauri v2** (Rust) + **Vue 3** (Vite) + **Fastify** (TypeScript sidecar) + **SQLite** (Drizzle ORM). + +It provides: + +- A floating companion widget (`?view=pet`) +- A panel window for tasks, AI chat, and settings (`?view=panel`) +- A wallpaper status layer (`?view=wallpaper`) embedded via `tauri-plugin-wallpaper` (Windows) +- A knowledge workspace (`?view=knowledge`) introduced in v3.3 +- A local Hook API for external scripts to push notifications and permission requests + +## Architecture at a Glance + +``` +Tauri Rust Core + ├─ window management, tray, wallpaper embedding, system credentials + └─ hosts Fastify sidecar (localhost:10103 by default) + +Fastify Sidecar + ├─ REST API for tasks, focus timer, AI chat, TTS, weather, hooks, windows + ├─ WebSocket hub at /ws for streaming AI replies and companion feedback + └─ SQLite via Drizzle ORM + +Vue 3 Frontend + ├─ 5 views selected by ?view= query param + └─ communicates with sidecar via HTTP + WebSocket, with Rust via Tauri IPC +``` + +## Key Directories + +| Path | Purpose | +|------|---------| +| `apps/desktop/src-tauri/` | Rust backend, Tauri commands, window config | +| `apps/desktop/src/` | Vue 3 frontend, views, components, composables | +| `packages/server-local/` | Fastify sidecar with all business logic | +| `packages/db/` | SQLite schema and stores via Drizzle ORM | +| `packages/shared/` | Shared TypeScript types | +| `packages/ai/` | DeepSeek streaming chat adapter | +| `packages/tts/` | MiMo TTS adapter | +| `docs/` | Product and technical documentation | + +## Current State Notes + +- The **knowledge workspace** UI exists but is backed by a front-end mock (`useKnowledgeMock.ts`). The real SQLite-backed API, FTS5 full-text search, and `sqlite-vec` vector retrieval described in the architecture doc are **planned for v2**, not yet implemented. +- The codebase still uses `pet`/`companion` identifiers in many places (`components/pet/`, `usePetState.ts`, `pet.css`). The product-facing terminology is **assistant**, but a full code-level rename is out of scope for documentation-only work. +- The sidecar runs on `http://127.0.0.1:10103` by default (configurable via `NEO_SERVER_PORT`). + +## Development Quick Reference + +```bash +# Install dependencies +pnpm install + +# Run desktop + sidecar in development +pnpm dev:tauri + +# Typecheck all packages +pnpm typecheck + +# Run tests +pnpm test +``` + +See `docs/DEVELOPMENT.md` for the full setup guide. + +## Documentation Index + +| Document | Purpose | +|----------|---------| +| `README.md` | Project overview and feature summary | +| `docs/PRD_overview.md` | Product requirements and roadmap | +| `docs/ARCHITECTURE.md` | System architecture and data flow | +| `docs/具体能力构思.md` | Detailed capability design (Chinese) | +| `docs/WALLPAPER_STATUS_LAYER.md` | Wallpaper layer design | +| `docs/SOUL_CONFIG.md` | Assistant persona configuration spec | +| `docs/DEVELOPMENT.md` | Development environment setup | +| `docs/API.md` | Sidecar REST API and WebSocket reference | +| `docs/TTS_SETUP.md` | MiMo TTS configuration guide | +| `docs/TESTING.md` | Testing strategy and commands | +| `docs/GLOSSARY.md` | Terminology conventions | +| `docs/TODO_INVENTORY.md` | Known doc-to-code mismatch TODOs | + +## Coding Guidelines + +Behavioral guidelines to reduce common LLM coding mistakes. These bias toward caution over speed; use judgment for trivial tasks. + +### 1. Think Before Coding + +- State assumptions explicitly. If uncertain, ask. +- If multiple interpretations exist, present them — don't pick silently. +- If a simpler approach exists, say so. Push back when warranted. + +### 2. Simplicity First + +- Minimum code that solves the problem. Nothing speculative. +- No features beyond what was asked. +- No abstractions for single-use code. +- No error handling for impossible scenarios. + +### 3. Surgical Changes + +- Touch only what you must. Clean up only your own mess. +- Don't "improve" adjacent code, comments, or formatting. +- Match existing style, even if you'd do it differently. +- If you notice unrelated dead code, mention it — don't delete it unless asked. + +### 4. Goal-Driven Execution + +- Transform tasks into verifiable goals. +- For multi-step tasks, state a brief plan with verification steps. +- Strong success criteria let you loop independently. + +--- + +*These guidelines are working if: fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..0165100 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,89 @@ +# Contributing to NeoCompanion + +Thanks for your interest in NeoCompanion! This guide covers how to set up the project, make changes, and open pull requests. + +## Prerequisites + +- **Node.js** 22 or later +- **pnpm** 10.32 or later (project uses `pnpm@10.32.0`) +- **Rust** stable toolchain (for Tauri v2) +- Platform dependencies for Tauri v2: + - **Windows**: WebView2 runtime (usually preinstalled on Windows 11) + - **macOS**: Xcode Command Line Tools + - **Linux**: `libwebkit2gtk-4.1-dev`, `build-essential`, `libssl-dev`, `libayatana-appindicator3-dev`, `librsvg2-dev`, and related packages + +See [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md) for the full environment setup. + +## Quick Start + +```bash +# Clone the repository +git clone +cd NeoCompanion + +# Install dependencies +pnpm install + +# Run the desktop app + sidecar in development mode +pnpm dev:tauri +``` + +## Branch and Commit Conventions + +- Create feature branches from the current active branch (`feat/v3.3-knowledge-workspace` at the time of writing): + ```bash + git checkout -b docs/your-change-name + ``` +- Use [Conventional Commits](https://www.conventionalcommits.org/): + - `feat:` new feature + - `fix:` bug fix + - `docs:` documentation only + - `refactor:` code change that neither fixes a bug nor adds a feature + - `test:` adding or updating tests + - `chore:` tooling, dependencies, or maintenance +- Keep commits focused and atomic. + +## Before Submitting a Pull Request + +1. **Typecheck everything:** + ```bash + pnpm typecheck + ``` +2. **Run tests:** + ```bash + pnpm test + ``` +3. **Run the documentation verification script (if it exists):** + ```bash + ./scripts/verify-docs.sh + ``` +4. **Update relevant documentation:** if your change adds an environment variable, API endpoint, or feature flag, update: + - `.env.example` + - `docs/DEVELOPMENT.md` + - `docs/API.md` + - `CHANGELOG.md` + +## Code Style + +- TypeScript: prefer explicit types on public APIs, immutable updates, and early returns. +- Vue 3: use the Composition API and `