i18ntk 1.7.4 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,18 +2,17 @@
2
2
 
3
3
  ![i18ntk Logo](docs/screenshots/i18ntk-logo-public.PNG)
4
4
 
5
- **Version:** 1.7.4
5
+ **Version:** 1.8.0
6
6
  **Last Updated:** 2025-08-11
7
7
  **GitHub Repository:** [vladnoskv/i18ntk](https://github.com/vladnoskv/i18ntk)
8
8
 
9
- [![npm](https://img.shields.io/npm/dt/i18ntk.svg)](https://www.npmjs.com/package/i18ntk) [![npm version](https://badge.fury.io/js/i18ntk.svg)](https://badge.fury.io/js/i18ntk) [![Node.js Version](https://img.shields.io/badge/node-%3E%3D16.0.0-brightgreen.svg)](https://nodejs.org/) [![Downloads](https://img.shields.io/npm/dm/i18ntk.svg)](https://www.npmjs.com/package/i18ntk) [![GitHub stars](https://img.shields.io/github/stars/vladnoskv/i18ntk?style=social)](https://github.com/vladnoskv/i18ntk)
10
- [![Socket Badge](https://socket.dev/api/badge/npm/package/i18ntk/1.7.1)](https://socket.dev/npm/package/i18ntk/overview/1.7.4)
9
+ [![npm](https://img.shields.io/npm/dt/i18ntk.svg)](https://www.npmjs.com/package/i18ntk) [![npm version](https://badge.fury.io/js/i18ntk.svg)](https://badge.fury.io/js/i18ntk) [![Node.js Version](https://img.shields.io/badge/node-%3E%3D16.0.0-brightgreen.svg)](https://nodejs.org/) [![Downloads](https://img.shields.io/npm/dm/i18ntk.svg)](https://www.npmjs.com/package/i18ntk) [![Socket Badge](https://socket.dev/api/badge/npm/package/i18ntk/1.8.0)](https://socket.dev/npm/package/i18ntk/overview/1.8.0) [![GitHub stars](https://img.shields.io/github/stars/vladnoskv/i18ntk?style=social)](https://github.com/vladnoskv/i18ntk)
11
10
 
12
11
  **🚀 The fastest way to manage translations across any framework or vanilla JavaScript projects**
13
12
 
14
13
  **Framework Support:** Auto-detects popular libraries (React i18next, Vue i18n, i18next, Nuxt i18n, Svelte i18n) or works without a framework. i18ntk manages translation files and validation—it does NOT implement translation logic like i18next or Vue i18n.
15
14
 
16
- > **v1.7.4** – **NEW Interactive Translation Fixer Tool** with custom placeholder markers, selective language/file fixing, mass fix capabilities, and 7-language UI support; enhanced security logging, flexible 4-6 digit PIN authentication, configuration stability improvements, and CI/CD silent mode support; maintains 97% speed improvement (**15.38ms** for 200k keys)
15
+ > **v1.8.0** – **SAFER WORKFLOW** - Autorun workflow removed for enhanced safety. Enhanced Interactive Translation Fixer Tool with improved automatic detection, selective language/file fixing, mass fix capabilities, and 7-language UI support; enhanced security logging, flexible 4-6 digit PIN authentication, configuration stability improvements, and CI/CD silent mode support; maintains 97% speed improvement.
17
16
 
18
17
  ## 🚀 Quick Start
19
18
 
@@ -30,35 +29,64 @@ i18ntk complete --source ./src
30
29
  i18ntk validate --source ./locales
31
30
  ```
32
31
 
32
+ ---
33
+
33
34
  ## ⚡ Performance
34
35
 
35
- | Mode | Time (200k keys) | Memory | Package Size |
36
- |------|------------------|--------|--------------|
37
- | **Ultra-Extreme** | **15.38ms** | 1.62MB | 115KB-830KB |
38
- | **Extreme** | **38.90ms** | 0.61MB | 115KB-830KB |
39
- | Ultra | 336.8ms | 0.64MB | Configurable |
40
- | Optimized | 847.9ms | 0.45MB | Full package |
41
-
42
- ## 🎯 Key Features
43
-
44
- ### ✨ **MAJOR FEATURE FOR 1.7.4: Interactive Translation Fixer Tool**
45
-
46
- - **Ultra-Extreme Performance**: 97% speed improvement - **15.38ms** for 200k keys
47
- - **Enhanced Security**: Advanced PIN protection with exponential backoff & AES-256 encryption
48
- - **Edge Case Handling**: Robust handling of corrupt files, encoding issues, and network failures
49
- - **Smart Sizing**: Interactive locale optimizer (up to 86% size reduction)
50
- - **Interactive Translation Fixer**: New `i18ntk fixer` command with step-by-step guided fixing process
51
- - **Enterprise Backup**: Automated encrypted backups with cloud integration
52
- - **Zero Dependencies**: Lightweight, production-ready
53
- - **Watch Helper**: Optional `--watch` mode keeps translations synced in real time
54
- - **Lite Package Framework**: Build an English-only UI locale bundle for minimal footprint
55
- - **7 UI Languages**: English, Spanish, French, German, Japanese, Russian, Chinese
56
- - **Framework Support**: Auto-detects React i18next, Vue i18n, Angular, Next i18next, Nuxt i18next, Svelte i18n
57
- - **Memory Optimization**: 67% memory reduction with streaming processing
58
- - **Scalability**: Linear scaling up to 5M keys per second with ultra-extreme settings
59
- - **Smart Framework Detection**: Automatically skips unnecessary prompts when i18n frameworks are detected
60
-
61
- ### 📸 Screenshots
36
+ | Mode | Time (200k keys) | Memory | Package Size |
37
+ | ----------------- | ---------------- | ------ | ------------ |
38
+ | **UltraExtreme** | **15.38ms** | 1.62MB | 115KB830KB |
39
+ | **Extreme** | 38.90ms | 0.61MB | 115KB830KB |
40
+ | Ultra | 336.8ms | 0.64MB | Configurable |
41
+ | Optimized | 847.9ms | 0.45MB | Full package |
42
+
43
+ > Benchmarks are internal; actual results vary by CPU, filesystem, and dataset.
44
+
45
+ ---
46
+
47
+ ## 🎯 Highlights
48
+
49
+ - **NEW in 1.8.0:** **SAFER WORKFLOW** - Autorun workflow removed for enhanced safety and configuration protection.
50
+ - **Enhanced Interactive Translation Fixer:** Improved automatic detection with guided flows, selective language/file fixing, mass fix capabilities, and 7-language UI support.
51
+ - **Ultra‑Extreme performance:** 97% speed improvement **15.38ms** for 200k keys.
52
+ - **Security & Privacy:** PIN protection with AES‑256‑GCM; strict path and input validation.
53
+ - **Sizing tools:** Interactive locale optimizer (up to **86%** size reduction) and reports.
54
+ - **Zero dependencies:** Lightweight, production‑ready.
55
+ - **Watch helper:** Optional `--watch` keeps translations in sync.
56
+ - **Framework‑agnostic:** Works with React, Vue, Svelte, Nuxt, i18next, or plain JSON.
57
+ - **Scale:** Linear scaling up to 5M keys/second with ultra‑extreme settings.
58
+ - **Script-by-Script Safety:** Manual execution ensures proper setup before each operation.
59
+
60
+ ---
61
+
62
+ ## 🛡️ Security in 1.8.0
63
+
64
+ ### Summary
65
+
66
+ - **Zero Shell Access:** Removed `execSync`, `spawnSync`, and related calls from production paths.
67
+ - **Direct FS APIs:** Replaced shell calls with safe `fs`/`path` operations.
68
+ - **Path Safety:** Normalization + traversal prevention on all file inputs.
69
+ - **Input Validation:** Sanitization on CLI flags and config values.
70
+ - **Session Security:** PIN‑protected admin operations, session timeout, exponential backoff.
71
+ - **Encrypted Backups:** AES‑256‑GCM for stored PIN and backups.
72
+
73
+ ### Before → After
74
+
75
+ | Area | Before (risk) | After (1.7.5+) |
76
+ | --------------------- | ---------------------------- | --------------------------------- |
77
+ | Shell execution | Possible via `child_process` | **Removed entirely** |
78
+ | File ops | Mixed shell + Node | **Node fs/path only** |
79
+ | Input & path handling | Inconsistent in edge cases | **Validated + normalized** |
80
+ | Admin controls | Optional PIN | **PIN + cooldown + timeout** |
81
+ | Backups | Plain backups possible | **AES‑256‑GCM encrypted backups** |
82
+
83
+ > **Verification tip:** `grep -R "child_process" node_modules/i18ntk` should return nothing in 1.7.5 production code.
84
+
85
+ **Backward compatibility:** No breaking changes expected; commands and outputs are unchanged except for safer internals.
86
+
87
+ ---
88
+
89
+ ## 📸 Screenshots
62
90
 
63
91
  | **Logo & Branding** | **Framework Detection** |
64
92
  |:-------------------:|:----------------------:|
@@ -74,25 +102,45 @@ i18ntk validate --source ./locales
74
102
 
75
103
  ## 📊 Commands
76
104
 
77
- | Command | Purpose | Example |
78
- |---------|---------|---------|
79
- | `init` | Setup project | `i18ntk init --interactive` |
80
- | `analyze` | Find missing translations | `i18ntk analyze --source ./src` |
81
- | `complete` | Generate translations | `i18ntk complete --config=ultra-extreme` |
82
- | `validate` | Check translation quality | `i18ntk validate --strict` |
83
- | `sync` | Sync across languages | `i18ntk sync --languages en,es,fr` |
84
- | `usage` | Analyze usage patterns | `i18ntk usage --format=json` |
85
- | `doctor` | Diagnose configuration issues | `i18ntk doctor` |
86
- | `sizing` | Optimize package size | `i18ntk sizing --interactive` |
87
- | `fixer` | Fix broken translations & placeholders | `i18ntk fixer --interactive` |
105
+ | Command | Purpose | Example |
106
+ | ---------- | ------------------------------- | ---------------------------------------- |
107
+ | `init` | Setup project | `i18ntk init --interactive` |
108
+ | `analyze` | Find missing translations | `i18ntk analyze --source ./src` |
109
+ | `complete` | Generate translations | `i18ntk complete --config=ultra-extreme` |
110
+ | `validate` | Check translation quality | `i18ntk validate --strict` |
111
+ | `sync` | Sync across languages | `i18ntk sync --languages en,es,fr` |
112
+ | `usage` | Analyze usage patterns | `i18ntk usage --format=json` |
113
+ | `doctor` | Diagnose configuration issues | `i18ntk doctor` |
114
+ | `sizing` | Optimize package size | `i18ntk sizing --interactive` |
115
+ | `fixer` | **Enhanced:** Fix broken translations/markers | `i18ntk fixer --interactive` |
116
+
117
+ ---
118
+
119
+ ## 🔒 Safer Workflow (NEW in v1.8.0)
120
+
121
+ **Enhanced security through manual script execution:**
122
+
123
+ - **Autorun workflow removed** for enhanced safety and configuration protection
124
+ - **Script-by-script safety** - Each operation requires explicit user initiation
125
+ - **Enhanced validation** - All operations validated before execution
126
+ - **Improved security logging** - Comprehensive audit trail for all operations
127
+ - **Manual review encouraged** - Users maintain full control over each step
128
+
129
+ **Migration from previous versions:**
130
+ - The `workflow` command has been removed for security reasons
131
+ - Use individual commands (`analyze`, `validate`, `fixer`) for safer operations
132
+ - Enhanced fixer tool provides guided workflows for common tasks
133
+ - All previous functionality remains available through safer individual commands
134
+
135
+ ---
88
136
 
89
137
  ## 🔧 Configuration
90
138
 
91
- Configuration is managed through the `settings/i18ntk-config.json` file:
139
+ Create `settings/i18ntk-config.json` (auto‑generated by `init`):
92
140
 
93
141
  ```json
94
142
  {
95
- "version": "1.7.4",
143
+ "version": "1.8.0",
96
144
  "sourceDir": "./locales",
97
145
  "outputDir": "./i18ntk-reports",
98
146
  "defaultLanguage": "en",
@@ -120,21 +168,65 @@ Configuration is managed through the `settings/i18ntk-config.json` file:
120
168
 
121
169
  ### Environment Variables
122
170
 
123
- You can override common path settings with environment variables:
171
+ You can override paths with environment variables:
124
172
 
125
- | Variable | Overrides | Description |
126
- |----------|-----------|-------------|
127
- | `I18NTK_PROJECT_ROOT` | `projectRoot` | Base project directory |
128
- | `I18NTK_SOURCE_DIR` | `sourceDir` | Location of source translation files |
129
- | `I18NTK_I18N_DIR` | `i18nDir` | Working i18n directory |
130
- | `I18NTK_OUTPUT_DIR` | `outputDir` | Output directory for generated reports |
173
+ | Variable | Overrides | Description |
174
+ | --------------------- | ------------- | ------------------------------------ |
175
+ | `I18NTK_PROJECT_ROOT` | `projectRoot` | Base project directory |
176
+ | `I18NTK_SOURCE_DIR` | `sourceDir` | Location of source translation files |
177
+ | `I18NTK_I18N_DIR` | `i18nDir` | Working i18n directory |
178
+ | `I18NTK_OUTPUT_DIR` | `outputDir` | Output directory for reports |
131
179
 
132
- These values are merged into the loaded configuration at runtime.
180
+ **Precedence:** CLI flags environment vars config file defaults.
133
181
 
134
- ## 🌍 Language Optimization
182
+ ---
183
+
184
+ ## 🔧 Enhanced Translation Fixer (v1.8.0)
185
+
186
+ Interactive tool with improved automatic detection to locate and repair placeholders such as `{{NOT_TRANSLATED}}`, `__UNTRANSLATED__`, or custom markers.
187
+
188
+ **Enhanced Features:**
189
+ - **Improved Auto-Detection:** Smarter detection of broken translations and markers
190
+ - **Selective Fixing:** Choose specific languages or files to fix
191
+ - **Mass Fix Capabilities:** Fix all broken translations at once
192
+ - **7-Language UI Support:** Complete interface in 7 languages
193
+ - **Script-by-Script Safety:** Manual execution ensures proper review
194
+ - **Enhanced Security:** Creates encrypted backups before any changes
195
+
196
+ **Examples:**
135
197
 
136
198
  ```bash
137
- # Interactive locale selection
199
+ # Enhanced guided mode
200
+ i18ntk fixer --interactive
201
+
202
+ # Fix specific languages with custom markers
203
+ i18ntk fixer --languages en,es,fr --markers "{{NOT_TRANSLATED}},__MISSING__"
204
+
205
+ # Target a directory + auto-fix with reporting
206
+ i18ntk fixer --source ./src/locales --auto-fix --report
207
+
208
+ # Detect custom placeholder styles
209
+ i18ntk fixer --markers "TODO_TRANSLATE,PLACEHOLDER_TEXT,MISSING_TRANSLATION"
210
+
211
+ # Fix all available languages (default markers)
212
+ i18ntk fixer --languages all
213
+ ```
214
+
215
+ **Interactive flow:**
216
+
217
+ - Welcome & help panel with 7-language support
218
+ - Enhanced marker configuration (built‑in + custom)
219
+ - Language and directory selection with smart filtering
220
+ - Preview & confirmation with detailed change overview
221
+ - Real‑time progress + comprehensive stats
222
+ - Report generation (before/after, per‑file, per‑language, security log)
223
+
224
+ ---
225
+
226
+ ## 🌍 Locale Size Optimizer
227
+
228
+ ```bash
229
+ # Interactive selection
138
230
  node scripts/locale-optimizer.js --interactive
139
231
 
140
232
  # Keep specific languages
@@ -143,116 +235,46 @@ node scripts/locale-optimizer.js --keep en,es,de
143
235
  # Restore all languages
144
236
  node scripts/locale-optimizer.js --restore
145
237
 
146
- # Check sizes
238
+ # List sizes
147
239
  node scripts/locale-optimizer.js --list
148
240
  ```
149
241
 
242
+ > **Result:** Reduce UI locale bundle size by up to **86%** (e.g., 830.4KB → 115.3KB for English‑only).
243
+
244
+ ---
245
+
150
246
  ## 🏗️ Integration Examples
151
247
 
152
248
  ### React
153
- ```javascript
154
- // Extract from React components
249
+
250
+ ```bash
251
+ # Extract from React components
155
252
  i18ntk extract --source ./src --framework react
253
+ ```
156
254
 
157
- // Setup i18next
255
+ ```js
256
+ // i18next setup (example)
158
257
  import i18n from './i18n';
258
+ import i18next from 'i18next';
159
259
  i18next.init({ resources: i18n, lng: 'en' });
160
260
  ```
161
261
 
162
262
  ### Vue
163
- ```javascript
164
- // Extract from Vue components
263
+
264
+ ```bash
265
+ # Extract from Vue components
165
266
  i18ntk extract --source ./src --framework vue
267
+ ```
166
268
 
167
- // Setup vue-i18n
269
+ ```js
270
+ // vue-i18n setup (example)
168
271
  import { createI18n } from 'vue-i18n';
169
272
  const i18n = createI18n({ locale: 'en', messages: translations });
170
273
  ```
171
274
 
172
- ## 🔒 Security Features
173
-
174
- - **Admin PIN Protection**: AES-256-GCM encryption with 30-min sessions
175
- - **Advanced Input Sanitization**: Comprehensive path traversal prevention
176
- - **Zero-Trust Architecture**: All inputs validated and sanitized
177
- - **Session Management**: Automatic timeout & cleanup with exponential backoff
178
- - **File Validation**: Safe file operations with permission checks
179
- - **Edge Case Security**: Robust handling of security edge cases
180
- - **Encrypted Backups**: AES-256 encrypted backup storage
181
-
182
- ### 🎯 **NEW INTERACTIVE LOCALE OPTIMIZER** - up to 86% Package Size Reduction
183
-
184
- - **Package Size**: 830.4KB → 115.3KB (86% reduction for English only)
185
- - **Smart Management**: Interactive selection with automatic backups
186
- - **Zero Breaking Changes**: Safe restoration from backups
187
-
188
- ### 🔧 **NEW TRANSLATION FIXER TOOL** - Mass Fix Broken Translations
189
-
190
- **Interactive Translation Fixer with Multi-Marker Support**
191
-
192
- - **Interactive Mode**: Step-by-step guided fixing process
193
- - **Custom Placeholder Markers**: Configure any markers (e.g., `{{NOT_TRANSLATED}}`, `__UNTRANSLATED__`, `[PLACEHOLDER]`)
194
- - **Selective Language Fixing**: Choose specific languages or fix all
195
- - **Selective File Fixing**: Target specific files or directories
196
- - **Mass Fix Capability**: Fix thousands of broken translations at once
197
- - **Comprehensive Reports**: Detailed analysis and fix reports
198
- - **8 Language Support**: Full internationalization for all UI interactions
199
-
200
- **Usage Examples:**
201
-
202
- ```bash
203
- # Interactive mode with guided prompts
204
- i18ntk fixer --interactive
205
-
206
- # Fix specific languages with custom markers
207
- i18ntk fixer --languages en,es,fr --markers "{{NOT_TRANSLATED}},__MISSING__"
208
-
209
- # Fix specific directory with auto-fix
210
- i18ntk fixer --source ./src/locales --auto-fix --report
211
-
212
- # Custom placeholder detection
213
- i18ntk fixer --markers "TODO_TRANSLATE,PLACEHOLDER_TEXT,MISSING_TRANSLATION"
214
-
215
- # Fix all available languages
216
- i18ntk fixer --languages all --markers "[PLACEHOLDER],{{UNTRANSLATED}}"
217
- ```i18ntk fixer --interactive
218
-
219
- # Fix specific languages with custom markers
220
- i18ntk fixer --languages en,es,fr --markers "{{NOT_TRANSLATED}},__MISSING__"
221
-
222
- # Fix specific directory with default settings
223
- i18ntk fixer --source ./src/locales --languages all
224
-
225
- # Non-interactive mode with auto-fix
226
- i18ntk fixer --source ./locales --auto-fix --report
227
-
228
- # Custom placeholder detection
229
- i18ntk fixer --markers "TODO_TRANSLATE,PLACEHOLDER_TEXT,MISSING_TRANSLATION"
230
- ```
275
+ ---
231
276
 
232
- **Interactive Features:**
233
- - **Welcome Screen**: Introduction and tool overview
234
- - **Marker Configuration**: Custom placeholder marker setup
235
- - **Language Selection**: Choose specific languages to fix
236
- - **Directory Selection**: Target specific directories
237
- - **Progress Tracking**: Real-time progress and statistics
238
- - **Fix Confirmation**: Review before applying changes
239
- - **Report Generation**: Detailed fix reports with before/after analysis
240
-
241
- **Supported Placeholder Types:**
242
- - **Standard Markers**: `{{NOT_TRANSLATED}}`, `__UNTRANSLATED__`
243
- - **Custom Markers**: Any user-defined placeholder text
244
- - **Framework Markers**: Framework-specific placeholders
245
- - **Legacy Markers**: Support for old translation systems
246
-
247
- **Output Reports Include:**
248
- - Total issues found and fixed
249
- - Missing translations identified
250
- - Placeholder translations detected
251
- - Language-specific statistics
252
- - File-by-file analysis
253
- - Before/after comparison
254
-
255
- ## 📋 Project Structure
277
+ ## 📁 Project Structure for local package development
256
278
 
257
279
  ```
258
280
  your-project/
@@ -269,18 +291,18 @@ your-project/
269
291
 
270
292
  ## 🚨 Important Notes
271
293
 
272
- - **Locale files are backed up automatically** before optimization
273
- - **Use interactive optimizer** for safe locale management
274
- - **All versions prior to 1.7.1 are deprecated**
275
- - **All improvements applied automatically** on update
294
+ - Locale files are **auto‑backed up** before optimization.
295
+ - Prefer the **interactive optimizer** for safe locale management.
296
+ - Versions **prior to 1.7.1** are deprecated.
297
+ - Upgrades apply improvements automatically; no migration steps required for 1.7.5.
276
298
 
299
+ ---
277
300
 
278
- ## 📞 Support
301
+ ## 🤝 Contributing & Support
279
302
 
280
- - **Issues**: [GitHub Issues](https://github.com/vladnoskv/i18ntk/issues)
281
- - **Documentation**: [Complete docs](./docs)
282
- - **Performance**: [Benchmark results](./benchmarks/results)
283
- - **Version**: `i18ntk --version`
284
- ---
303
+ - **Issues:** [GitHub Issues](https://github.com/vladnoskv/i18ntk/issues)
304
+ - **Docs:** `./docs` (full walkthroughs and examples)
305
+ - **Benchmarks:** `./benchmarks/results`
306
+ - **Version:** `i18ntk --version`
285
307
 
286
- **Made for the global development community** ❤️
308
+ **Made for the global dev community.** ❤️
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  /**
3
3
  * I18N TRANSLATION ANALYSIS SCRIPT
4
4
  *