diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1fd670d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 + +[*.py] +indent_size = 4 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c14bf46 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,34 @@ +# Auto-detect text files and normalize line endings +* text=auto eol=lf + +# Explicitly declare text files +*.ts text +*.tsx text +*.js text +*.jsx text +*.json text +*.css text +*.html text +*.md text +*.yml text +*.yaml text + +# Declare binary files +*.ico binary +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.webp binary +*.wav binary +*.mp3 binary +*.exe binary +*.dll binary +*.whl binary +*.sqlite binary +*.db binary + +# Linguist overrides +docs/** linguist-documentation +site/** linguist-documentation +tests/** linguist-detectable=false diff --git a/.gitignore b/.gitignore index d7a8e7e..3c0587f 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,25 @@ resources/sox/*.dll # IDE .idea/ +.vscode/ *.swp *.swo + +# Site build +site/dist/ +site/node_modules/ + +# OS +.DS_Store +Thumbs.db +Desktop.ini + +# Python +__pycache__/ +*.pyc +*.pyo +venv/ +.venv/ + +# Whisper models (large files) +resources/models/ diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..fc2772c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,126 @@ +# Changelog + +All notable changes to D3RO Voice 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). + +## [1.0.0] - 2026-04-06 + +### Added + +#### Core Pipeline (Phase 1-3) +- Electron 33 + React 19 + MUI 7 + TypeScript strict mode +- AudioCaptureService: SoX-based PCM16 16kHz mono microphone capture +- LocalSTTService: faster-whisper Python sidecar (dual-condition flush pattern) +- VoiceModeService: 9-state RecognitionState + 4-state AudioState dual state machine +- HotkeyService: uiohook-napi global keyboard hooking (hold/toggle/double-press) +- TextInsertService: clipboard save/set/Ctrl+V/restore via @nut-tree-fork/nut-js +- RecordingTip popup: 9 wave bars with cosine distribution, thinking progress bar +- ResultPopup: auto-close with mouse hover pause, copy button +- Settings modal: General/Audio/STT/LLM tabs +- System tray with close-to-tray support + +#### Cursor History Popup (Phase 3.5) +- Ctrl+Shift+V global shortcut opens recent transcription history at cursor position +- Arrow key navigation, Enter to paste, 1-9 direct select, ESC dismiss +- focusable: false maintains active app focus + +#### LLM Integration (Phase 4) +- LocalLLMService: Ollama REST API with NDJSON streaming +- 6 system prompts: refine/translate/summarize/grammar/expand/custom +- VoiceModeService LLM integration with original text fallback + +#### Database & History (Phase 5) +- better-sqlite3 + drizzle-orm (WAL mode) +- HistoryService: CRUD + search + stats + 30-day retention policy +- DictionaryService: custom words + STT initialPrompt injection +- Dashboard with real statistics + +#### Custom Instructions & i18n (Phase 6) +- CustomInstructionService: 5 presets + user-defined CRUD +- i18n system: ko/en with t() function and React context + +#### Build & Test (Phase 7) +- vitest: 41 unit tests (HistoryService, DictionaryService, VoiceModeService, etc.) +- electron-builder: NSIS installer for Windows x64 +- GitLab CI/CD: lint, typecheck, test, build, release pipeline +- SoX download script, PyInstaller sidecar build script + +#### Speakly Pattern Enhancement (Phase 7.5) +- SoundEffectService: WAV preload, fire-and-forget playback +- AutoLaunchService: app.setLoginItemSettings +- TextInsertService: basic insertion verification +- VoiceModeService: sound effect integration on session events + +#### UI Redesign (Phase 8) +- Industrial instrument aesthetic (dark theme, amber #f25b29 accent) +- Design system: 9 DS components (CrtDisplay, InstrumentPanel, Led, PhysicalButton, MetalCard, PhosphorText, MetalDial, ScreenPanel, ButtonGroup) +- d3roPalette SSOT: all colors via CSS custom properties +- HotkeyRecordModal: key combination recording UI +- DashboardPage: feature-focused layout with stats + history + system status + +#### Quality & UX (Phase 9) +- 4-step onboarding wizard (welcome, mic, hotkey, Ollama) +- Microphone test UI with level meter +- Audio recording WAV file saving +- MetalDial component with drag rotation +- Ctrl+Shift+C command popup at cursor position +- Dictionary inline editing +- Ollama installation guide with nudging bubble +- Real-time UI refresh on data changes + +#### Killer Features (Phase 10) +- CaptionService: 3-second chunk continuous transcription with overlay popup +- VoiceCommandService: keyword-to-command matching engine (4 preset keywords) +- ScreenContextService: active window detection + selected text capture +- ChainService: sequential LLM command pipeline with step-by-step events +- MemoService: memo tags DB table + tag CRUD + markdown export +- Shared components: EmptyStateCard, SearchInput, PageHeader, HistoryEntryCard +- Shared utilities: formatters.ts (formatDuration, getDateKey, formatNumber) + +#### Monetization (Phase 11) +- LicenseService: Free/Pro/Pro+ 3-tier system +- Feature gating with 16 feature enums and tier-based access mapping +- Daily usage quota tracking (Free: 20 dictation/day, 10 LLM/day) +- LemonSqueezy API integration for license key activation +- UpgradePromptModal, ProBadge, useProFeature hook +- Settings License tab with tier comparison table + +#### Pro Features (Phase 12) +- FileTranscriptionService: ffmpeg PCM conversion, 30s chunk sequential STT +- MeetingSummaryService: caption session LLM summarization +- DictationTemplateService: CRUD + session state machine, 3 presets + +#### Pro+ Premium (Phase 13) +- VoiceConversationService: STT-LLM-TTS loop for voice conversations +- TTSPlaybackService: Windows SAPI via PowerShell +- RAGService: Ollama nomic-embed-text embeddings, SQLite vector storage, cosine similarity +- KnowledgeBasePage: document management, indexing progress, Q&A UI +- VoiceActionService: LLM JSON action plans, 6 presets, dangerous command blocking + +#### Landing Page +- Promotional website at `site/` directory +- Vite + React 19 + Tailwind CSS +- 4 design references integrated into D3RO brand identity +- CRT screen effects, crosshair decorations, noise textures (CSS only) +- 10-language i18n: en/ko/ja/zh/es/fr/de/pt/ru/vi +- GitHub Pages auto-deployment workflow + +### Technical Details +- Total IPC channels: ~200+ +- Total services: 20+ +- Total error codes: 0-878 +- Design system components: 9 +- Supported languages (app): ko, en +- Supported languages (landing): 10 +- Test count: 41 unit tests +- Build target: Windows x64 NSIS installer + +## [Unreleased] + +### Planned +- macOS / Linux support +- Additional Whisper model management UI +- Cloud-optional backup (encrypted, opt-in) +- Plugin system for custom pipelines diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..fa298fb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,83 @@ +# Contributing to D3RO Voice + +Thank you for your interest in contributing to D3RO Voice! + +## Development Setup + +### Prerequisites +- Node.js 20+ +- Python 3.10+ (for faster-whisper sidecar) +- Ollama (for LLM features) +- Windows 10/11 (primary platform) + +### Getting Started + +```bash +# Clone the repository +git clone https://gitlab.twentyoz.kr:8443/d3r0/voice.git +cd voice + +# Install dependencies +npm install + +# Download SoX binary (Windows) +npm run setup:sox + +# Start development +npm run dev +``` + +### Project Structure + +``` +src/ + main/ # Electron main process (services, IPC, DB) + renderer/ # React app (MUI, components, pages) + preload/ # contextBridge IPC bridge + shared/ # Shared types, IPC channels, errors +site/ # Landing page (Vite + React + Tailwind) +docs/ # Design documents and phase specs +tests/ # Unit tests (vitest) +``` + +### Code Standards + +- TypeScript strict mode (`noImplicitAny`, `strictNullChecks`) +- No `any` types +- No `console.log` (use electron-log via LoggerService) +- Colors via `d3roPalette` CSS variables (no hardcoded hex in components) +- UI strings via `t()` i18n function (no hardcoded Korean/English) +- Services: singleton + EventEmitter pattern +- IPC channels defined in `src/shared/ipc-channels.ts` + +### Running Tests + +```bash +npm run typecheck # Type checking +npm run lint # ESLint +npm run test # Unit tests +``` + +### Building + +```bash +npm run build # Production build +npm run dist # Build + NSIS installer +``` + +## Design Documents + +Before implementing, always reference: +- `docs/design/00-master-architecture.md` +- `docs/design/01-service-specifications.md` +- `docs/design/02-ipc-and-types.md` +- `docs/design/03-db-and-ui.md` + +## Pull Request Process + +1. Create a feature branch from `main` +2. Follow the coding standards above +3. Ensure `npm run typecheck` passes +4. Ensure `npm run test` passes +5. Update CHANGELOG.md if applicable +6. Submit a merge request with a clear description diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4ec4810 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 D3RO + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..94ec7f9 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,34 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 1.0.x | :white_check_mark: | + +## Privacy by Design + +D3RO Voice processes all data locally. No audio, text, or telemetry is transmitted to external servers. The application is designed to work completely offline after initial model download. + +- **Audio**: Captured and processed in-memory, optionally saved to local SQLite +- **STT**: faster-whisper runs as a local sidecar process +- **LLM**: Ollama runs on localhost:11434 +- **License**: One-time online activation, 30-day offline grace period + +## Reporting a Vulnerability + +If you discover a security vulnerability, please report it responsibly: + +1. **DO NOT** open a public issue +2. Email: security@d3ro.dev +3. Include steps to reproduce and potential impact +4. We will respond within 48 hours + +## Scope + +Security concerns include: +- Local data exposure or leakage +- IPC channel injection or privilege escalation +- Unintended network traffic +- Clipboard data exposure +- Sidecar process escape