@amirdaraee/namewise 0.5.5 โ 0.6.1
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/CHANGELOG.md +70 -182
- package/README.md +135 -120
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +46 -27
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/rename.d.ts +3 -0
- package/dist/cli/rename.d.ts.map +1 -1
- package/dist/cli/rename.js +73 -30
- package/dist/cli/rename.js.map +1 -1
- package/dist/cli/undo.d.ts +4 -0
- package/dist/cli/undo.d.ts.map +1 -0
- package/dist/cli/undo.js +66 -0
- package/dist/cli/undo.js.map +1 -0
- package/dist/parsers/factory.d.ts.map +1 -1
- package/dist/parsers/factory.js +2 -11
- package/dist/parsers/factory.js.map +1 -1
- package/dist/services/ai-factory.js +2 -2
- package/dist/services/ai-factory.js.map +1 -1
- package/dist/services/claude-service.d.ts +2 -1
- package/dist/services/claude-service.d.ts.map +1 -1
- package/dist/services/claude-service.js +6 -6
- package/dist/services/claude-service.js.map +1 -1
- package/dist/services/file-renamer.d.ts +1 -1
- package/dist/services/file-renamer.d.ts.map +1 -1
- package/dist/services/file-renamer.js +61 -31
- package/dist/services/file-renamer.js.map +1 -1
- package/dist/services/openai-service.d.ts +2 -1
- package/dist/services/openai-service.d.ts.map +1 -1
- package/dist/services/openai-service.js +6 -6
- package/dist/services/openai-service.js.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/ai-prompts.js +2 -2
- package/dist/utils/config-loader.d.ts +16 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +25 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/file-templates.d.ts +1 -1
- package/dist/utils/file-templates.d.ts.map +1 -1
- package/dist/utils/file-templates.js +25 -11
- package/dist/utils/file-templates.js.map +1 -1
- package/dist/utils/history.d.ts +13 -0
- package/dist/utils/history.d.ts.map +1 -0
- package/dist/utils/history.js +21 -0
- package/dist/utils/history.js.map +1 -0
- package/package.json +1 -1
- package/RELEASE.md +0 -167
package/CHANGELOG.md
CHANGED
|
@@ -7,233 +7,121 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.1] - 2026-04-02
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Movie, music, series, and book templates now produce correct filenames; the AI is explicitly instructed to include the release year, artist name, season/episode, or author in the output rather than leaving unfilled `{year}`, `{artist}`, `{author}`, `{season}`, `{episode}` placeholders that were silently stripped
|
|
14
|
+
- `--date` flag for document and photo templates now uses the document's own creation date from file metadata when available, instead of always substituting today's date
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- `--model` flag now works for all providers (Claude, OpenAI, Ollama, LMStudio), not just local LLMs; defaults are `claude-sonnet-4-5-20250929` for Claude and `gpt-4o` for OpenAI
|
|
18
|
+
- Content sent to AI increased from 2000 to 5000 characters for more accurate filename generation on longer documents
|
|
19
|
+
|
|
20
|
+
## [0.6.0] - 2026-04-02
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- `--recursive` / `-r` flag to scan subdirectories, with optional `--depth <n>` to limit depth
|
|
24
|
+
- `namewise undo [session-id]` command to reverse any previous rename session
|
|
25
|
+
- `namewise undo --list` to view recent sessions with their IDs
|
|
26
|
+
- Cascading config file support: `~/.namewise.json` (user) and `<dir>/.namewise.json` (project); CLI flags take highest priority
|
|
27
|
+
- `--concurrency <n>` flag to process files in parallel (default: 3)
|
|
28
|
+
- `--output <path>` flag to save a full JSON rename report after each run
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- Conflict handling: instead of erroring when a target filename already exists, the tool now auto-numbers the new file (`report-2.pdf`, `report-3.pdf`, etc.)
|
|
32
|
+
- Rename history is now saved to `~/.namewise/history.json` after every run
|
|
33
|
+
|
|
10
34
|
## [0.5.4] - 2026-03-31
|
|
11
35
|
|
|
12
|
-
###
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
- Added tests for all error branches including non-Error exception paths
|
|
16
|
-
- Full coverage for scanned PDF handling, folder-based categorization, and naming convention truncation
|
|
17
|
-
- Added polyfill tests for `process.getBuiltinModule` in Node.js < 22.3.0 environments
|
|
36
|
+
### Changed
|
|
37
|
+
- Achieved 100% test coverage across all metrics (statements, branches, functions, lines)
|
|
38
|
+
- Expanded test suite to 325 tests across 26 test files
|
|
18
39
|
|
|
19
40
|
## [0.5.0] - 2025-11-10
|
|
20
41
|
|
|
21
42
|
### Added
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- Smart size calculation to ensure API compatibility
|
|
29
|
-
|
|
30
|
-
### Enhanced
|
|
31
|
-
- **๐ PDF Processing**: Replaced PDF.js with pdf-to-png-converter for better Node.js compatibility
|
|
32
|
-
- Resolves canvas rendering issues in Node.js environment
|
|
33
|
-
- More reliable PDF-to-image conversion
|
|
34
|
-
- Better error handling and debugging
|
|
35
|
-
- **๐ค AI Model**: Updated to Claude Sonnet 4.5 (claude-sonnet-4-5-20250929)
|
|
36
|
-
- Latest Claude model with enhanced vision capabilities
|
|
37
|
-
- Improved accuracy for document analysis
|
|
38
|
-
- Better understanding of complex document layouts
|
|
39
|
-
|
|
40
|
-
### Technical
|
|
41
|
-
- Replaced `pdfjs-dist` with `pdf-to-png-converter` package
|
|
42
|
-
- Enhanced PDFToImageConverter with size optimization algorithms
|
|
43
|
-
- Added comprehensive test suite for PDF-to-image conversion (12 new tests)
|
|
44
|
-
- Improved error logging with detailed stack traces
|
|
43
|
+
- Scanned PDF support: image-only PDFs are automatically detected and sent to vision AI for analysis
|
|
44
|
+
- Automatic image optimization to stay within the Claude 5MB API limit (progressive JPEG compression and dimension scaling)
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
- Replaced `pdfjs-dist` with `pdf-to-png-converter` for more reliable PDF-to-image conversion in Node.js
|
|
48
|
+
- Updated default Claude model to claude-sonnet-4-5-20250929
|
|
45
49
|
|
|
46
50
|
### Fixed
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
### Examples
|
|
52
|
-
```bash
|
|
53
|
-
# Process directory with scanned PDFs
|
|
54
|
-
namewise rename ./documents --dry-run
|
|
55
|
-
|
|
56
|
-
# Scanned PDFs are automatically detected and processed:
|
|
57
|
-
# Input: Iran-criminal-record-2.pdf (scanned, no text)
|
|
58
|
-
# Output: iran-criminal-record-certificate.pdf
|
|
59
|
-
#
|
|
60
|
-
# Input: Luxembourg-identity-2025.pdf (scanned, 14.7MB image)
|
|
61
|
-
# Output: luxembourg-identity-card-2025.pdf (optimized to <5MB)
|
|
62
|
-
```
|
|
51
|
+
- "Image or Canvas expected" errors when processing scanned PDFs
|
|
52
|
+
- "image exceeds 5 MB maximum" errors with large scanned documents
|
|
53
|
+
- Deprecated model warnings from the Anthropic API
|
|
63
54
|
|
|
64
55
|
## [0.4.1] - 2025-09-15
|
|
65
56
|
|
|
66
|
-
###
|
|
67
|
-
-
|
|
68
|
-
- **๐ Documentation**: Improved examples and usage documentation
|
|
57
|
+
### Changed
|
|
58
|
+
- Improved stability and consistency across all AI providers
|
|
69
59
|
|
|
70
60
|
## [0.4.0] - 2025-09-15
|
|
71
61
|
|
|
72
62
|
### Added
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
- Smart folder name filtering to ignore irrelevant names like "no", "temp", "downloads"
|
|
83
|
-
- Enhanced prompts that focus on document content rather than metadata
|
|
84
|
-
- Support for detecting visa applications, contracts, medical records, certificates
|
|
85
|
-
|
|
86
|
-
### Architecture
|
|
87
|
-
- **๐ Centralized Prompt System**: Single source of truth for all AI prompts
|
|
88
|
-
- Model-agnostic prompting that works across Claude, OpenAI, LMStudio, and Ollama
|
|
89
|
-
- Consolidated prompt building in `/src/utils/ai-prompts.ts`
|
|
90
|
-
- Consistent behavior across all AI providers
|
|
91
|
-
- Easier maintenance and updates
|
|
92
|
-
|
|
93
|
-
### Examples
|
|
94
|
-
```bash
|
|
95
|
-
# Use local Ollama service
|
|
96
|
-
namewise rename ./documents --provider ollama --dry-run
|
|
97
|
-
|
|
98
|
-
# Use LMStudio with custom model
|
|
99
|
-
namewise rename ./files --provider lmstudio --base-url http://localhost:1234 --model codellama
|
|
100
|
-
|
|
101
|
-
# Enhanced person name detection (Sarah example)
|
|
102
|
-
# Input: visitor-visa-application-for-family-in-canada.pdf (in folder "no")
|
|
103
|
-
# Output: sarah-visitor-visa-application-for-family-members-in-canada.pdf
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Technical
|
|
107
|
-
- Enhanced CLI with new provider options and base URL configuration
|
|
108
|
-
- Added availability checking and model discovery for local providers
|
|
63
|
+
- Ollama provider support for local LLM inference (`--provider ollama`)
|
|
64
|
+
- LMStudio provider support with OpenAI-compatible API (`--provider lmstudio`)
|
|
65
|
+
- `--base-url` flag to configure a custom endpoint for local LLM providers
|
|
66
|
+
- `--model` flag to specify the model for local LLM providers
|
|
67
|
+
|
|
68
|
+
### Changed
|
|
69
|
+
- AI prompts now extract person names from document content and include them at the start of the filename
|
|
70
|
+
- Folder name hints are filtered to ignore common irrelevant names (e.g., "no", "temp", "downloads")
|
|
71
|
+
- Centralized all AI prompt logic into `src/utils/ai-prompts.ts` for consistency across providers
|
|
109
72
|
|
|
110
73
|
## [0.3.1] - 2025-09-05
|
|
111
74
|
|
|
112
75
|
### Security
|
|
113
|
-
-
|
|
114
|
-
- Enhanced Excel file parsing with improved security and reliability
|
|
76
|
+
- Replaced vulnerable `xlsx` package with `exceljs` for Excel file parsing
|
|
115
77
|
|
|
116
|
-
###
|
|
117
|
-
-
|
|
118
|
-
- Updated Node.js versions in CI pipelines
|
|
119
|
-
- Improved test workflow reliability and build process
|
|
78
|
+
### Changed
|
|
79
|
+
- Updated CI pipelines to test against Node.js 20, 22, and 24
|
|
120
80
|
|
|
121
81
|
## [0.3.0] - 2025-09-05
|
|
122
82
|
|
|
123
83
|
### Added
|
|
124
|
-
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
- `photo`: Photos with personal info (e.g., `vacation-paris-john-20240715.jpg`)
|
|
130
|
-
- `book`: Books with author names (e.g., `george-orwell-1984.pdf`)
|
|
131
|
-
- `general`: General files without special formatting
|
|
132
|
-
- **๐ค Smart File Categorization**: Automatically detects file type based on extension and content
|
|
133
|
-
- **๐ค Personal Name Integration**: `-n, --name` option to include your name in documents
|
|
134
|
-
- **๐
Flexible Date Formats**: `-d, --date` option with formats:
|
|
135
|
-
- `YYYY-MM-DD`: 2025-09-05
|
|
136
|
-
- `YYYY`: 2025
|
|
137
|
-
- `YYYYMMDD`: 20250905
|
|
138
|
-
- `none`: No date (default)
|
|
139
|
-
- **๐ Category Templates**: `-t, --template` option to specify file category or use auto-detection
|
|
140
|
-
|
|
141
|
-
### Enhanced
|
|
142
|
-
- AI prompts now include category-specific instructions for better filename generation
|
|
143
|
-
- File processing pipeline includes template application after AI generation
|
|
144
|
-
- Comprehensive test coverage with 131 tests (23 new tests for templates)
|
|
145
|
-
|
|
146
|
-
### Examples
|
|
147
|
-
```bash
|
|
148
|
-
# Personal documents with your name and date
|
|
149
|
-
namewise rename ./documents -t document -n "amirhossein" -d "YYYYMMDD" --dry-run
|
|
150
|
-
# Result: driving-license-amirhossein-20250905.pdf
|
|
151
|
-
|
|
152
|
-
# Movies with auto-detection
|
|
153
|
-
namewise rename ./movies --dry-run
|
|
154
|
-
# Result: the-dark-knight-2008.mkv
|
|
155
|
-
|
|
156
|
-
# Series with season/episode detection
|
|
157
|
-
namewise rename ./shows --dry-run
|
|
158
|
-
# Result: breaking-bad-s01e01.mkv
|
|
159
|
-
|
|
160
|
-
# Music with artist names
|
|
161
|
-
namewise rename ./music -t music --dry-run
|
|
162
|
-
# Result: the-beatles-hey-jude.mp3
|
|
163
|
-
```
|
|
84
|
+
- File category templates: `document`, `movie`, `music`, `series`, `photo`, `book`, `general`, `auto`
|
|
85
|
+
- `-t, --template` flag to select a category template
|
|
86
|
+
- `-n, --name` flag to include a personal name in filenames
|
|
87
|
+
- `-d, --date` flag with format options: `YYYY-MM-DD`, `YYYY`, `YYYYMMDD`, `none`
|
|
88
|
+
- Auto-categorization based on file extension, folder path, and content keywords
|
|
164
89
|
|
|
165
90
|
## [0.2.0] - 2025-09-05
|
|
166
91
|
|
|
167
92
|
### Added
|
|
168
|
-
-
|
|
169
|
-
- `kebab-case`: lowercase-with-hyphens (default)
|
|
170
|
-
- `snake_case`: lowercase_with_underscores
|
|
171
|
-
- `camelCase`: camelCaseFormat
|
|
172
|
-
- `PascalCase`: PascalCaseFormat
|
|
173
|
-
- `lowercase`: lowercaseformat
|
|
174
|
-
- `UPPERCASE`: UPPERCASEFORMAT
|
|
175
|
-
- AI services now receive naming convention instructions and generate appropriately formatted filenames
|
|
176
|
-
- Enhanced filename sanitization with convention-aware processing
|
|
177
|
-
|
|
178
|
-
### Example Usage
|
|
179
|
-
```bash
|
|
180
|
-
# Use snake_case naming
|
|
181
|
-
namewise rename ./docs --case snake_case --dry-run
|
|
182
|
-
|
|
183
|
-
# Use camelCase naming
|
|
184
|
-
namewise rename ./docs --case camelCase --provider openai
|
|
185
|
-
```
|
|
93
|
+
- `-c, --case` flag for naming convention: `kebab-case`, `snake_case`, `camelCase`, `PascalCase`, `lowercase`, `UPPERCASE`
|
|
186
94
|
|
|
187
95
|
## [0.1.5] - 2025-09-05
|
|
188
96
|
|
|
189
|
-
###
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
- Added progress counter showing current file being processed `(3/7)`
|
|
193
|
-
- Cleaner console output with proper line clearing after processing
|
|
97
|
+
### Changed
|
|
98
|
+
- Progress display now updates in place on a single line with a `[current/total]` counter
|
|
99
|
+
- Results output changed to `original-name -> new-name` format for clarity
|
|
194
100
|
|
|
195
101
|
## [0.1.4] - 2025-09-05
|
|
196
102
|
|
|
197
103
|
### Fixed
|
|
198
|
-
-
|
|
199
|
-
- Console output now properly displays line breaks for better readability
|
|
104
|
+
- Console output was printing literal `\n` instead of newlines
|
|
200
105
|
|
|
201
106
|
## [0.1.3] - 2025-09-05
|
|
202
107
|
|
|
203
108
|
### Changed
|
|
204
|
-
-
|
|
205
|
-
- CLI binary
|
|
206
|
-
- All documentation and references updated to reflect new name
|
|
109
|
+
- Renamed package from `ai-rename` to `namewise`
|
|
110
|
+
- Renamed CLI binary from `ai-rename` to `namewise`
|
|
207
111
|
|
|
208
112
|
## [0.1.1] - 2025-09-05
|
|
209
113
|
|
|
210
114
|
### Changed
|
|
211
|
-
-
|
|
212
|
-
- CLI binary
|
|
213
|
-
- All documentation and references updated to reflect new name
|
|
115
|
+
- Renamed package from `smart-rename` to `ai-rename` (original name was taken on npm)
|
|
116
|
+
- Renamed CLI binary from `smart-rename` to `ai-rename`
|
|
214
117
|
|
|
215
118
|
## [0.1.0] - 2025-09-05
|
|
216
119
|
|
|
217
120
|
### Added
|
|
218
|
-
- Initial
|
|
121
|
+
- Initial release
|
|
219
122
|
- AI-powered file renaming using Claude or OpenAI
|
|
220
|
-
- Support for PDF,
|
|
221
|
-
- Dry-run mode
|
|
222
|
-
- File conflict detection
|
|
223
|
-
- Configurable file size
|
|
224
|
-
- Interactive API key
|
|
225
|
-
- Comprehensive test suite (65 tests, 90%+ branch coverage)
|
|
226
|
-
- CLI with intuitive commands and options
|
|
227
|
-
|
|
228
|
-
### Features
|
|
229
|
-
- **Document Parsers**: PDF, DOCX, DOC, XLSX, XLS, TXT, MD, RTF
|
|
230
|
-
- **AI Providers**: Claude (Anthropic) and OpenAI support
|
|
231
|
-
- **Safety Features**: Dry-run mode, conflict detection, error handling
|
|
232
|
-
- **Configuration**: Flexible options for provider, API keys, and file sizes
|
|
233
|
-
|
|
234
|
-
### Technical
|
|
235
|
-
- TypeScript implementation with strict typing
|
|
236
|
-
- ESM module support
|
|
237
|
-
- Node.js 18+ compatibility
|
|
238
|
-
- Vitest testing framework
|
|
239
|
-
- Commander.js CLI framework
|
|
123
|
+
- Support for PDF, DOCX, DOC, XLSX, XLS, TXT, MD, and RTF files
|
|
124
|
+
- Dry-run mode to preview changes without renaming
|
|
125
|
+
- File conflict detection
|
|
126
|
+
- Configurable file size limit
|
|
127
|
+
- Interactive API key prompt when no key is set in the environment
|