Skip to content

Commit 6b9ec2a

Browse files
committed
Merge branch 'feat/sync' into 'main'
test(sync): measure bucket-source readFile call count with template patterns See merge request hack-projects/deepl-cli!2
2 parents c7c00b6 + 3cc27fd commit 6b9ec2a

297 files changed

Lines changed: 47042 additions & 389 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Bug report
3+
about: Report a bug in DeepL CLI
4+
title: 'bug: '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Summary
10+
11+
A clear, concise description of the bug.
12+
13+
## Environment
14+
15+
- **DeepL CLI version**: (run `deepl --version`)
16+
- **Node.js version**: (run `node --version`)
17+
- **Operating system**: (e.g., macOS 14.5, Ubuntu 22.04, Windows 11)
18+
- **Install method**: (source, npm link, other)
19+
20+
## Reproduction Steps
21+
22+
1.
23+
2.
24+
3.
25+
26+
## Expected Behavior
27+
28+
What you expected to happen.
29+
30+
## Actual Behavior
31+
32+
What actually happened. Include the full error output (redact any API keys):
33+
34+
```
35+
<paste error output here>
36+
```
37+
38+
## Additional Context
39+
40+
Anything else that might help — config snippets (redacted), example files,
41+
related issues, workarounds you've tried.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new feature or enhancement for DeepL CLI
4+
title: 'feat: '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem
10+
11+
What problem does this feature solve? Who is affected? What workflow is
12+
currently painful or impossible?
13+
14+
## Proposed Solution
15+
16+
A clear, concise description of what you'd like to see.
17+
18+
## Alternatives Considered
19+
20+
Other approaches you've thought about and why you believe the proposed
21+
solution is the best fit.
22+
23+
## Additional Context
24+
25+
Use cases, mockups, related tools, or links to similar features in other
26+
CLIs.

.gitignore

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,15 @@ logs/
6666
*.db-wal
6767
*.db-shm
6868

69-
# Claude Code local settings
70-
.claude/settings.local.json
69+
# Claude Code local tooling (settings, hooks, agent worktrees, session state)
70+
.claude/
71+
72+
# Playwright MCP local state
73+
.playwright-mcp/
7174

7275
# Beads issue tracking (local)
7376
.beads/
77+
issues.jsonl
78+
79+
# QA harness
80+
qa/

CHANGELOG.md

Lines changed: 251 additions & 2 deletions
Large diffs are not rendered by default.

CLAUDE.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@ DeepL CLI is a command-line interface for the DeepL API that integrates translat
66

77
### Current Status
88

9-
- **Version**: 1.0.0
10-
- **Tests**: 2757 tests passing (100% pass rate), ~91% coverage
9+
- **Version**: see `VERSION` file / `package.json`
10+
- **Tests**: see `npm test` output (target: all green; coverage thresholds enforced by jest config)
1111
- **Test mix**: ~70-75% unit, ~25-30% integration/e2e
12-
- **Next Milestone**: 1.0.0 (stable public API)
1312

1413
### Architecture
1514

1615
```
17-
CLI Commands (translate, write, watch, glossary, etc.)
16+
CLI Commands (translate, write, voice, sync, watch, glossary, tm, …)
1817
19-
Service Layer (Translation, Write, Batch, Watch, GitHooks, Cache, Glossary)
18+
Service Layer (Translation, Write, Voice, Batch, Watch, Glossary,
19+
TranslationMemory, StyleRules, Admin, Document,
20+
GitHooks, Usage, Detect, Languages)
21+
↓ ↓
22+
Sync Engine (src/sync) Format Parsers (src/formats — 11 i18n formats)
23+
↓ ↓
24+
API Client (Translate, Write, Glossary, Document, Voice,
25+
StyleRules, Admin, TMS)
2026
21-
API Client (DeepL API: /v2/translate, /v2/write, /v3/glossaries)
22-
23-
Storage (SQLite Cache, Config Management)
27+
Storage (SQLite Cache, Config) + Static Data (src/data — language registry)
2428
```
2529

2630
### Configuration
@@ -98,8 +102,11 @@ Use **Semantic Versioning** with **Conventional Commits**:
98102
src/
99103
├── cli/ # CLI interface and commands
100104
├── services/ # Business logic
105+
├── sync/ # Continuous localization engine (scan, diff, translate, write, lock)
106+
├── formats/ # i18n file format parsers (JSON, YAML, PO, XLIFF, Android XML, etc.)
101107
├── api/ # DeepL API client
102-
├── storage/ # Data persistence
108+
├── storage/ # Data persistence (SQLite cache, config)
109+
├── data/ # Static data (language registry)
103110
├── utils/ # Utility functions
104111
└── types/ # Type definitions
105112
```

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ Contributions must be licensed under the same license as the project:
195195
- [ ] `README.md` updated if user-facing feature changed
196196
- [ ] `docs/API.md` updated if command/flag added or changed
197197
- [ ] Example script added/updated in `examples/` for new features
198+
- [ ] Added new example script to `examples/run-all.sh` EXAMPLES array (for new CLI commands)
198199

199200
## Adding a New CLI Command
200201

@@ -227,4 +228,4 @@ When filing a bug report, include:
227228
- [docs/API.md](./docs/API.md) -- Complete CLI command reference
228229
- [DeepL API Docs](https://www.deepl.com/docs-api) -- Official API documentation
229230

230-
[issues]: https://github.com/kwey/deepl-cli/issues
231+
[issues]: https://github.com/DeepLcom/deepl-cli/issues

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2026 DeepL
3+
Copyright (c) 2026 DeepL SE
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
## 🌟 Key Features
1111

1212
- **🌍 Translation** - High-quality translation using DeepL's next-gen LLM
13+
- **🔄 Continuous Localization (`deepl sync`)** - Incremental i18n file sync with 11 format parsers
1314
- **📄 Document Translation** - Translate PDF, DOCX, PPTX, XLSX with formatting preservation
14-
- **🎙️ Voice Translation** - Real-time speech translation via WebSocket streaming (Voice API)
15+
- **🎙️ Voice Translation (Pro/Enterprise)** - Real-time speech translation via WebSocket streaming (Voice API)
1516
- **👀 Watch Mode** - Real-time file watching with auto-translation
1617
- **✍️ Writing Enhancement** - Grammar, style, and tone suggestions (DeepL Write API)
1718
- **💾 Smart Caching** - Local SQLite cache with LRU eviction
@@ -31,26 +32,27 @@ For security policy and vulnerability reporting, see [SECURITY.md](SECURITY.md).
3132
- [Verbose Mode](#verbose-mode)
3233
- [Quiet Mode](#quiet-mode)
3334
- [Custom Configuration Files](#custom-configuration-files)
35+
- [Configuration Paths](#configuration-paths)
36+
- [Proxy Configuration](#proxy-configuration)
37+
- [Retry and Timeout Configuration](#retry-and-timeout-configuration)
3438
- [Usage](#-usage)
3539
- **Core Commands:** [Translation](#translation) | [Writing Enhancement](#writing-enhancement) | [Voice Translation](#voice-translation)
36-
- **Resources:** [Glossaries](#glossaries)
40+
- **Resources:** [Glossaries](#glossaries) | [Translation Memories](#translation-memories)
3741
- **Workflow:** [Watch Mode](#watch-mode) | [Git Hooks](#git-hooks)
3842
- **Configuration:** [Setup Wizard](#setup-wizard) | [Authentication](#authentication) | [Configure Defaults](#configure-defaults) | [Cache Management](#cache-management) | [Style Rules](#style-rules)
39-
- **Information:** [Usage Statistics](#api-usage-statistics) | [Language Detection](#language-detection) | [Languages](#supported-languages) | [Shell Completion](#shell-completion)
43+
- **Information:** [Usage Statistics](#api-usage-statistics) | [Language Detection](#language-detection) | [Languages](#supported-languages) | [Shell Completion](#shell-completion) | [Command Suggestions](#command-suggestions)
4044
- **Administration:** [Admin API](#admin-api)
4145
- [Development](#-development)
4246
- [Architecture](#-architecture)
47+
- [Testing](#-testing)
48+
- [Documentation](#-documentation)
49+
- [Environment Variables](#-environment-variables)
50+
- [Security & Privacy](#-security--privacy)
4351
- [Contributing](#-contributing)
4452
- [License](#-license)
4553

4654
## 📦 Installation
4755

48-
### From npm (Coming Soon)
49-
50-
```bash
51-
npm install -g deepl-cli
52-
```
53-
5456
### From Source
5557

5658
```bash
@@ -69,7 +71,7 @@ npm link
6971

7072
# Verify installation
7173
deepl --version
72-
# Output: 1.0.0
74+
# Output: deepl-cli 1.x.x
7375
```
7476

7577
> **Note:** This project uses [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3) for local caching, which requires native compilation. If `npm install` fails with build errors, ensure you have:
@@ -78,6 +80,12 @@ deepl --version
7880
> - **Linux**: `python3`, `make`, and `gcc` (`apt install python3 make gcc g++`)
7981
> - **Windows**: Visual Studio Build Tools or `windows-build-tools` (`npm install -g windows-build-tools`)
8082
83+
### From npm (not yet published)
84+
85+
An npm package is not yet published; install from source until then.
86+
87+
> **CI examples below** (and generated hook output) assume a published npm package; source-installed users should substitute the source-install path.
88+
8189
## 🚀 Quick Start
8290

8391
### 1. Get Your DeepL API Key
@@ -288,13 +296,13 @@ deepl translate locales/en.json --to es,fr,de --output locales/
288296

289297
**Smart Caching for Text Files:**
290298

291-
Small text-based files (under 100 KB) automatically use the cached text translation API for faster performance and reduced API calls. Larger files automatically fall back to the document translation API (not cached).
299+
Small text-based files (under 100 KiB) automatically use the cached text translation API for faster performance and reduced API calls. Larger files automatically fall back to the document translation API (not cached).
292300

293-
- **Cached formats:** `.txt`, `.md`, `.html`, `.htm`, `.srt`, `.xlf`, `.xliff` (files under 100 KB only)
301+
- **Cached formats:** `.txt`, `.md`, `.html`, `.htm`, `.srt`, `.xlf`, `.xliff` (files under 100 KiB only)
294302
- **Structured formats:** `.json`, `.yaml`, `.yml` — parsed and translated via batch text API (no size limit)
295-
- **Large file fallback:** Files ≥100 KB use document API (not cached, always makes API calls)
303+
- **Large file fallback:** Files ≥100 KiB use document API (not cached, always makes API calls)
296304
- **Binary formats:** `.pdf`, `.docx`, `.pptx`, `.xlsx` always use document API (not cached)
297-
- **Performance:** Only small text files (<100 KB) benefit from instant cached translations
305+
- **Performance:** Only small text files (<100 KiB) benefit from instant cached translations
298306
- **Cost savings:** Only small text files avoid repeated API calls
299307

300308
```bash
@@ -840,6 +848,8 @@ deepl init
840848
# - Basic configuration
841849
```
842850

851+
> To configure continuous localization for an existing project, see also [`deepl sync init`](#sync-init) or run the wizard directly.
852+
843853
#### Authentication
844854

845855
```bash
@@ -1040,7 +1050,7 @@ DeepL CLI includes built-in retry logic and timeout handling for robust API comm
10401050
- ✅ Automatic retry on transient failures
10411051
- ✅ Exponential backoff to avoid overwhelming the API
10421052
- ✅ Smart error detection (retries 5xx, not 4xx)
1043-
- ✅ Configurable timeout and retry limits (programmatic API only)
1053+
- ✅ Configurable via library-consumer options; not exposed as a CLI flag
10441054
- ✅ Works across all DeepL API endpoints
10451055

10461056
**Retry Behavior Examples:**
@@ -1313,7 +1323,7 @@ Cache location: `~/.cache/deepl-cli/cache.db` (or `~/.deepl-cli/cache.db` for le
13131323

13141324
### Prerequisites
13151325

1316-
- Node.js >= 20.0.0
1326+
- Node.js >= 20.19.0
13171327
- npm >= 9.0.0
13181328
- DeepL API key
13191329

@@ -1387,25 +1397,33 @@ deepl translate "Hello" --to es
13871397
DeepL CLI follows a layered architecture:
13881398

13891399
```
1390-
CLI Interface (Commands, Parsing, Help)
1391-
1392-
Core Application (Command Handlers, Interactive Shell)
1400+
CLI Commands (translate, write, voice, sync, watch, glossary, tm, …)
13931401
1394-
Service Layer (Translation, Write, Cache, Watch, Glossary)
1402+
Service Layer (Translation, Write, Voice, Batch, Watch, Glossary,
1403+
TranslationMemory, StyleRules, Admin, Document,
1404+
GitHooks, Usage, Detect, Languages)
1405+
↓ ↓
1406+
Sync Engine (src/sync) Format Parsers (src/formats — 11 i18n formats)
1407+
↓ ↓
1408+
API Client (Translate, Write, Glossary, Document, Voice,
1409+
StyleRules, Admin, TMS)
13951410
1396-
API Client (DeepL Translate, Write, Glossary APIs)
1397-
1398-
Storage (SQLite Cache, Config, Translation Memory)
1411+
Storage (SQLite Cache, Config) + Static Data (src/data — language registry)
13991412
```
14001413

14011414
### Key Components
14021415

1403-
- **Translation Service** - Core translation logic with caching and preservation
1404-
- **Write Service** - Grammar and style enhancement
1405-
- **Cache Service** - SQLite-based cache with LRU eviction
1406-
- **Preservation Service** - Preserves code blocks, variables, formatting
1407-
- **Watch Service** - File watching with debouncing
1408-
- **Glossary Service** - Glossary management and application
1416+
- **Translation Service** — core translation with caching and text preservation
1417+
- **Write Service** — grammar, style, and tone suggestions
1418+
- **Voice Service** — real-time speech translation over WebSocket
1419+
- **Sync Engine** — continuous localization: scan, diff, translate, write, lock
1420+
- **Format Parsers** — 11 i18n parsers (JSON, YAML, TOML, PO, Android XML, iOS Strings, xcstrings, ARB, XLIFF, Properties, Laravel PHP) with format-preserving reconstruct
1421+
- **Batch Service** — parallel multi-file translation
1422+
- **Watch Service** — file watching with debouncing
1423+
- **Glossary Service** — glossary management and application
1424+
- **Translation Memory Service** — reuse approved translations (`--translation-memory`)
1425+
- **Cache** — SQLite cache with LRU eviction (`src/storage/cache.ts`)
1426+
- **Preservation utilities**`src/utils/` helpers for code blocks, variables, and ICU MessageFormat
14091427

14101428
## 🧪 Testing
14111429

@@ -1452,6 +1470,10 @@ npm run examples:fast
14521470
| `DEEPL_CONFIG_DIR` | Override config and cache directory |
14531471
| `XDG_CONFIG_HOME` | Override XDG config base (default: `~/.config`) |
14541472
| `XDG_CACHE_HOME` | Override XDG cache base (default: `~/.cache`) |
1473+
| `HTTP_PROXY` | HTTP proxy URL for outbound DeepL API traffic |
1474+
| `HTTPS_PROXY` | HTTPS proxy URL (takes precedence over `HTTP_PROXY`) |
1475+
| `TMS_API_KEY` | API key for the configured TMS server (`sync push`/`pull`) |
1476+
| `TMS_TOKEN` | Alternative auth token for the configured TMS server |
14551477
| `NO_COLOR` | Disable colored output |
14561478
| `FORCE_COLOR` | Force colored output even when terminal doesn't support it. Useful in CI. `NO_COLOR` takes priority if both are set. |
14571479
| `TERM=dumb` | Disables colored output and progress spinners. Automatically set by some CI environments and editors. |
@@ -1464,12 +1486,14 @@ See [docs/API.md#environment-variables](./docs/API.md#environment-variables) for
14641486
- **Local caching** - All cached data stored locally in SQLite, never shared
14651487
- **No telemetry** - Zero usage tracking or data collection
14661488
- **Environment variable support** - Use `DEEPL_API_KEY` environment variable for CI/CD
1467-
- **GDPR compliant** - Follows DeepL's GDPR compliance guidelines
1489+
- **GDPR-aligned with DeepL's DPA** - Follows DeepL's Data Processing Agreement terms
14681490

14691491
## 📄 License
14701492

14711493
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
14721494

1495+
DeepL® is a registered trademark of DeepL SE.
1496+
14731497
---
14741498

14751499
_Powered by DeepL's next-generation language model_

SECURITY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
# Security Policy
2+
13
## Supported Versions
24

35
| Version | Supported |
46
|---------|--------------------|
7+
| 1.1.x | :white_check_mark: |
58
| 1.0.x | :white_check_mark: |
69
| < 1.0 | :x: |
710

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.0
1+
1.1.0

0 commit comments

Comments
 (0)