@amirdaraee/namewise 0.5.2 โ 0.5.4
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 +9 -0
- package/dist/index.js +0 -0
- package/package.json +2 -2
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -82
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -61
- package/.github/workflows/auto-release.yml +0 -78
- package/.github/workflows/build.yml +0 -55
- package/.github/workflows/publish.yml +0 -134
- package/.github/workflows/test.yml +0 -47
- package/eng.traineddata +0 -0
- package/src/cli/commands.ts +0 -64
- package/src/cli/rename.ts +0 -171
- package/src/index.ts +0 -54
- package/src/parsers/excel-parser.ts +0 -66
- package/src/parsers/factory.ts +0 -38
- package/src/parsers/pdf-parser.ts +0 -99
- package/src/parsers/text-parser.ts +0 -43
- package/src/parsers/word-parser.ts +0 -50
- package/src/services/ai-factory.ts +0 -39
- package/src/services/claude-service.ts +0 -119
- package/src/services/file-renamer.ts +0 -141
- package/src/services/lmstudio-service.ts +0 -161
- package/src/services/ollama-service.ts +0 -191
- package/src/services/openai-service.ts +0 -117
- package/src/types/index.ts +0 -76
- package/src/types/pdf-extraction.d.ts +0 -7
- package/src/utils/ai-prompts.ts +0 -76
- package/src/utils/file-templates.ts +0 -275
- package/src/utils/naming-conventions.ts +0 -67
- package/src/utils/pdf-to-image.ts +0 -137
- package/tests/data/console-test-1.txt +0 -1
- package/tests/data/console-test-2.txt +0 -1
- package/tests/data/console-test-long-filename-for-display-testing.txt +0 -1
- package/tests/data/empty-file.txt +0 -0
- package/tests/data/failure.txt +0 -1
- package/tests/data/file1.txt +0 -1
- package/tests/data/file2.txt +0 -1
- package/tests/data/much-longer-filename-to-test-clearing.txt +0 -1
- package/tests/data/sample-markdown.md +0 -9
- package/tests/data/sample-pdf.pdf +0 -0
- package/tests/data/sample-text.txt +0 -25
- package/tests/data/short.txt +0 -1
- package/tests/data/single-file.txt +0 -1
- package/tests/data/success.txt +0 -1
- package/tests/data/this-is-a-very-long-filename-that-should-be-truncated-for-better-display-purposes.txt +0 -1
- package/tests/data/very-long-filename-that-should-be-cleared-properly.txt +0 -1
- package/tests/data/x.txt +0 -1
- package/tests/integration/ai-prompting.test.ts +0 -386
- package/tests/integration/end-to-end.test.ts +0 -209
- package/tests/integration/person-name-extraction.test.ts +0 -440
- package/tests/integration/workflow.test.ts +0 -336
- package/tests/mocks/mock-ai-service.ts +0 -58
- package/tests/unit/cli/commands.test.ts +0 -169
- package/tests/unit/parsers/factory.test.ts +0 -100
- package/tests/unit/parsers/pdf-parser.test.ts +0 -63
- package/tests/unit/parsers/text-parser.test.ts +0 -85
- package/tests/unit/services/ai-factory.test.ts +0 -85
- package/tests/unit/services/claude-service.test.ts +0 -188
- package/tests/unit/services/file-renamer.test.ts +0 -514
- package/tests/unit/services/lmstudio-service.test.ts +0 -326
- package/tests/unit/services/ollama-service.test.ts +0 -264
- package/tests/unit/services/openai-service.test.ts +0 -196
- package/tests/unit/utils/ai-prompts.test.ts +0 -213
- package/tests/unit/utils/file-templates.test.ts +0 -199
- package/tests/unit/utils/naming-conventions.test.ts +0 -88
- package/tests/unit/utils/pdf-to-image.test.ts +0 -127
- package/tsconfig.json +0 -20
- package/vitest.config.ts +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.5.4] - 2026-03-31
|
|
11
|
+
|
|
12
|
+
### Improved
|
|
13
|
+
- **๐งช Test Coverage**: Achieved 100% coverage across all metrics (statements, branches, functions, lines)
|
|
14
|
+
- 325 tests across 26 test files
|
|
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
|
|
18
|
+
|
|
10
19
|
## [0.5.0] - 2025-11-10
|
|
11
20
|
|
|
12
21
|
### Added
|
package/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amirdaraee/namewise",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prepublishOnly": "npm run test:run"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=20.0.0"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"ai",
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
name: Bug Report
|
|
2
|
-
description: File a bug report to help us improve
|
|
3
|
-
title: "[Bug]: "
|
|
4
|
-
labels: ["bug", "triage"]
|
|
5
|
-
body:
|
|
6
|
-
- type: markdown
|
|
7
|
-
attributes:
|
|
8
|
-
value: |
|
|
9
|
-
Thanks for taking the time to fill out this bug report!
|
|
10
|
-
|
|
11
|
-
- type: input
|
|
12
|
-
id: version
|
|
13
|
-
attributes:
|
|
14
|
-
label: Version
|
|
15
|
-
description: What version of smart-rename are you using?
|
|
16
|
-
placeholder: ex. 0.1.0
|
|
17
|
-
validations:
|
|
18
|
-
required: true
|
|
19
|
-
|
|
20
|
-
- type: dropdown
|
|
21
|
-
id: os
|
|
22
|
-
attributes:
|
|
23
|
-
label: Operating System
|
|
24
|
-
description: What operating system are you using?
|
|
25
|
-
options:
|
|
26
|
-
- Windows
|
|
27
|
-
- macOS
|
|
28
|
-
- Linux
|
|
29
|
-
- Other
|
|
30
|
-
validations:
|
|
31
|
-
required: true
|
|
32
|
-
|
|
33
|
-
- type: input
|
|
34
|
-
id: node-version
|
|
35
|
-
attributes:
|
|
36
|
-
label: Node.js Version
|
|
37
|
-
description: What version of Node.js are you using?
|
|
38
|
-
placeholder: ex. 20.0.0
|
|
39
|
-
validations:
|
|
40
|
-
required: true
|
|
41
|
-
|
|
42
|
-
- type: textarea
|
|
43
|
-
id: what-happened
|
|
44
|
-
attributes:
|
|
45
|
-
label: What happened?
|
|
46
|
-
description: A clear and concise description of what the bug is.
|
|
47
|
-
placeholder: Tell us what you see!
|
|
48
|
-
validations:
|
|
49
|
-
required: true
|
|
50
|
-
|
|
51
|
-
- type: textarea
|
|
52
|
-
id: steps
|
|
53
|
-
attributes:
|
|
54
|
-
label: Steps to Reproduce
|
|
55
|
-
description: Steps to reproduce the behavior
|
|
56
|
-
placeholder: |
|
|
57
|
-
1. Run command '...'
|
|
58
|
-
2. With files '...'
|
|
59
|
-
3. See error
|
|
60
|
-
validations:
|
|
61
|
-
required: true
|
|
62
|
-
|
|
63
|
-
- type: textarea
|
|
64
|
-
id: expected
|
|
65
|
-
attributes:
|
|
66
|
-
label: Expected Behavior
|
|
67
|
-
description: What did you expect to happen?
|
|
68
|
-
validations:
|
|
69
|
-
required: true
|
|
70
|
-
|
|
71
|
-
- type: textarea
|
|
72
|
-
id: logs
|
|
73
|
-
attributes:
|
|
74
|
-
label: Error Messages/Logs
|
|
75
|
-
description: If applicable, add error messages or logs
|
|
76
|
-
render: shell
|
|
77
|
-
|
|
78
|
-
- type: textarea
|
|
79
|
-
id: additional
|
|
80
|
-
attributes:
|
|
81
|
-
label: Additional Context
|
|
82
|
-
description: Add any other context about the problem here
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
name: Feature Request
|
|
2
|
-
description: Suggest an idea for this project
|
|
3
|
-
title: "[Feature]: "
|
|
4
|
-
labels: ["enhancement", "feature-request"]
|
|
5
|
-
body:
|
|
6
|
-
- type: markdown
|
|
7
|
-
attributes:
|
|
8
|
-
value: |
|
|
9
|
-
Thanks for suggesting a new feature!
|
|
10
|
-
|
|
11
|
-
- type: textarea
|
|
12
|
-
id: problem
|
|
13
|
-
attributes:
|
|
14
|
-
label: Problem Description
|
|
15
|
-
description: Is your feature request related to a problem? Please describe.
|
|
16
|
-
placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
17
|
-
|
|
18
|
-
- type: textarea
|
|
19
|
-
id: solution
|
|
20
|
-
attributes:
|
|
21
|
-
label: Proposed Solution
|
|
22
|
-
description: Describe the solution you'd like
|
|
23
|
-
placeholder: A clear and concise description of what you want to happen.
|
|
24
|
-
validations:
|
|
25
|
-
required: true
|
|
26
|
-
|
|
27
|
-
- type: textarea
|
|
28
|
-
id: alternatives
|
|
29
|
-
attributes:
|
|
30
|
-
label: Alternative Solutions
|
|
31
|
-
description: Describe alternatives you've considered
|
|
32
|
-
placeholder: A clear and concise description of any alternative solutions or features you've considered.
|
|
33
|
-
|
|
34
|
-
- type: dropdown
|
|
35
|
-
id: priority
|
|
36
|
-
attributes:
|
|
37
|
-
label: Priority
|
|
38
|
-
description: How important is this feature to you?
|
|
39
|
-
options:
|
|
40
|
-
- Low
|
|
41
|
-
- Medium
|
|
42
|
-
- High
|
|
43
|
-
- Critical
|
|
44
|
-
validations:
|
|
45
|
-
required: true
|
|
46
|
-
|
|
47
|
-
- type: checkboxes
|
|
48
|
-
id: implementation
|
|
49
|
-
attributes:
|
|
50
|
-
label: Implementation
|
|
51
|
-
description: Would you be willing to help implement this feature?
|
|
52
|
-
options:
|
|
53
|
-
- label: I would like to implement this feature
|
|
54
|
-
- label: I need help implementing this feature
|
|
55
|
-
- label: I can provide feedback during implementation
|
|
56
|
-
|
|
57
|
-
- type: textarea
|
|
58
|
-
id: additional
|
|
59
|
-
attributes:
|
|
60
|
-
label: Additional Context
|
|
61
|
-
description: Add any other context, screenshots, or examples about the feature request here.
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
name: Auto Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main ]
|
|
6
|
-
paths:
|
|
7
|
-
- 'package.json'
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
check-version:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
outputs:
|
|
13
|
-
should-release: ${{ steps.version-check.outputs.should-release }}
|
|
14
|
-
new-version: ${{ steps.version-check.outputs.new-version }}
|
|
15
|
-
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout code
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
with:
|
|
20
|
-
fetch-depth: 0
|
|
21
|
-
|
|
22
|
-
- name: Check if version changed
|
|
23
|
-
id: version-check
|
|
24
|
-
run: |
|
|
25
|
-
# Get current version from package.json
|
|
26
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
27
|
-
echo "Current version: $CURRENT_VERSION"
|
|
28
|
-
|
|
29
|
-
# Check if tag already exists
|
|
30
|
-
if git tag --list | grep -q "^v$CURRENT_VERSION$"; then
|
|
31
|
-
echo "should-release=false" >> $GITHUB_OUTPUT
|
|
32
|
-
echo "Tag v$CURRENT_VERSION already exists"
|
|
33
|
-
else
|
|
34
|
-
echo "should-release=true" >> $GITHUB_OUTPUT
|
|
35
|
-
echo "new-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
36
|
-
echo "New version detected: $CURRENT_VERSION"
|
|
37
|
-
fi
|
|
38
|
-
|
|
39
|
-
auto-release:
|
|
40
|
-
needs: check-version
|
|
41
|
-
runs-on: ubuntu-latest
|
|
42
|
-
if: needs.check-version.outputs.should-release == 'true'
|
|
43
|
-
permissions:
|
|
44
|
-
contents: write
|
|
45
|
-
|
|
46
|
-
steps:
|
|
47
|
-
- name: Checkout code
|
|
48
|
-
uses: actions/checkout@v4
|
|
49
|
-
|
|
50
|
-
- name: Setup Node.js
|
|
51
|
-
uses: actions/setup-node@v4
|
|
52
|
-
with:
|
|
53
|
-
node-version: '20.x'
|
|
54
|
-
cache: 'npm'
|
|
55
|
-
registry-url: 'https://registry.npmjs.org'
|
|
56
|
-
|
|
57
|
-
- name: Install dependencies
|
|
58
|
-
run: npm ci
|
|
59
|
-
|
|
60
|
-
- name: Run tests
|
|
61
|
-
run: npm run test:run
|
|
62
|
-
|
|
63
|
-
- name: Build project
|
|
64
|
-
run: npm run build
|
|
65
|
-
|
|
66
|
-
- name: Create and push tag
|
|
67
|
-
run: |
|
|
68
|
-
git config --local user.email "action@github.com"
|
|
69
|
-
git config --local user.name "GitHub Action"
|
|
70
|
-
git tag -a "v${{ needs.check-version.outputs.new-version }}" -m "Release v${{ needs.check-version.outputs.new-version }}"
|
|
71
|
-
git push origin "v${{ needs.check-version.outputs.new-version }}"
|
|
72
|
-
env:
|
|
73
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
74
|
-
|
|
75
|
-
- name: Publish to npm
|
|
76
|
-
run: npm publish
|
|
77
|
-
env:
|
|
78
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
name: Build Pipeline
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch: # Allows manual triggering
|
|
5
|
-
push:
|
|
6
|
-
branches: [ main ]
|
|
7
|
-
workflow_call: # Allows this workflow to be called by other workflows
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test:
|
|
11
|
-
name: Run Tests Before Build
|
|
12
|
-
uses: ./.github/workflows/test.yml
|
|
13
|
-
|
|
14
|
-
build:
|
|
15
|
-
name: Build Project
|
|
16
|
-
runs-on: ubuntu-latest
|
|
17
|
-
needs: [test]
|
|
18
|
-
if: ${{ needs.test.result == 'success' }}
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- name: Checkout code
|
|
22
|
-
uses: actions/checkout@v4
|
|
23
|
-
|
|
24
|
-
- name: Setup Node.js
|
|
25
|
-
uses: actions/setup-node@v4
|
|
26
|
-
with:
|
|
27
|
-
node-version: '22'
|
|
28
|
-
cache: 'npm'
|
|
29
|
-
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: npm ci
|
|
32
|
-
|
|
33
|
-
- name: Build project
|
|
34
|
-
run: npm run build
|
|
35
|
-
|
|
36
|
-
- name: Test CLI build
|
|
37
|
-
run: |
|
|
38
|
-
node dist/index.js --help
|
|
39
|
-
node dist/index.js --version
|
|
40
|
-
|
|
41
|
-
- name: Upload build artifacts
|
|
42
|
-
uses: actions/upload-artifact@v4
|
|
43
|
-
with:
|
|
44
|
-
name: build-artifacts-${{ github.sha }}
|
|
45
|
-
path: |
|
|
46
|
-
dist/
|
|
47
|
-
package.json
|
|
48
|
-
package-lock.json
|
|
49
|
-
README.md
|
|
50
|
-
LICENSE
|
|
51
|
-
CHANGELOG.md
|
|
52
|
-
retention-days: 30
|
|
53
|
-
|
|
54
|
-
- name: Build success notification
|
|
55
|
-
run: echo "โ
Build completed successfully for commit ${{ github.sha }}"
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
name: Publish Pipeline
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch: # Allows manual triggering
|
|
5
|
-
inputs:
|
|
6
|
-
use_artifact:
|
|
7
|
-
description: 'Use build artifact (provide artifact name or "latest")'
|
|
8
|
-
required: false
|
|
9
|
-
default: ''
|
|
10
|
-
release:
|
|
11
|
-
types: [published]
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
build:
|
|
15
|
-
name: Build for Publishing
|
|
16
|
-
uses: ./.github/workflows/build.yml
|
|
17
|
-
if: ${{ github.event.inputs.use_artifact == '' }}
|
|
18
|
-
|
|
19
|
-
publish:
|
|
20
|
-
name: Publish Package
|
|
21
|
-
runs-on: ubuntu-latest
|
|
22
|
-
needs: [build]
|
|
23
|
-
if: ${{ always() && (needs.build.result == 'success' || github.event.inputs.use_artifact != '') }}
|
|
24
|
-
environment: production # Requires environment approval for production
|
|
25
|
-
|
|
26
|
-
steps:
|
|
27
|
-
- name: Checkout code
|
|
28
|
-
uses: actions/checkout@v4
|
|
29
|
-
|
|
30
|
-
- name: Setup Node.js
|
|
31
|
-
uses: actions/setup-node@v4
|
|
32
|
-
with:
|
|
33
|
-
node-version: '22'
|
|
34
|
-
registry-url: 'https://registry.npmjs.org'
|
|
35
|
-
cache: 'npm'
|
|
36
|
-
|
|
37
|
-
- name: Download build artifacts (from current run)
|
|
38
|
-
if: ${{ github.event.inputs.use_artifact == '' }}
|
|
39
|
-
uses: actions/download-artifact@v4
|
|
40
|
-
with:
|
|
41
|
-
name: build-artifacts-${{ github.sha }}
|
|
42
|
-
path: ./
|
|
43
|
-
|
|
44
|
-
- name: Download build artifacts (from specific run)
|
|
45
|
-
if: ${{ github.event.inputs.use_artifact != '' && github.event.inputs.use_artifact != 'latest' }}
|
|
46
|
-
uses: actions/download-artifact@v4
|
|
47
|
-
with:
|
|
48
|
-
name: ${{ github.event.inputs.use_artifact }}
|
|
49
|
-
path: ./
|
|
50
|
-
|
|
51
|
-
- name: Download latest build artifacts
|
|
52
|
-
if: ${{ github.event.inputs.use_artifact == 'latest' }}
|
|
53
|
-
run: |
|
|
54
|
-
echo "Downloading latest build artifacts..."
|
|
55
|
-
gh run download --name "build-artifacts-*" --limit 1
|
|
56
|
-
env:
|
|
57
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
58
|
-
|
|
59
|
-
- name: Install dependencies (only for package.json)
|
|
60
|
-
run: npm ci --production
|
|
61
|
-
|
|
62
|
-
- name: Publish to NPM
|
|
63
|
-
run: npm publish
|
|
64
|
-
env:
|
|
65
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
66
|
-
|
|
67
|
-
- name: Publish success notification
|
|
68
|
-
run: echo "โ
Package published to NPM successfully"
|
|
69
|
-
|
|
70
|
-
publish-github:
|
|
71
|
-
name: Publish to GitHub Packages
|
|
72
|
-
runs-on: ubuntu-latest
|
|
73
|
-
needs: [build, publish]
|
|
74
|
-
if: ${{ always() && needs.publish.result == 'success' }}
|
|
75
|
-
permissions:
|
|
76
|
-
contents: read
|
|
77
|
-
packages: write
|
|
78
|
-
|
|
79
|
-
steps:
|
|
80
|
-
- name: Checkout code
|
|
81
|
-
uses: actions/checkout@v4
|
|
82
|
-
|
|
83
|
-
- name: Setup Node.js
|
|
84
|
-
uses: actions/setup-node@v4
|
|
85
|
-
with:
|
|
86
|
-
node-version: '22'
|
|
87
|
-
registry-url: 'https://npm.pkg.github.com'
|
|
88
|
-
cache: 'npm'
|
|
89
|
-
|
|
90
|
-
- name: Download build artifacts (reuse from publish job)
|
|
91
|
-
if: ${{ github.event.inputs.use_artifact == '' }}
|
|
92
|
-
uses: actions/download-artifact@v4
|
|
93
|
-
with:
|
|
94
|
-
name: build-artifacts-${{ github.sha }}
|
|
95
|
-
path: ./
|
|
96
|
-
|
|
97
|
-
- name: Download build artifacts (from specific run)
|
|
98
|
-
if: ${{ github.event.inputs.use_artifact != '' && github.event.inputs.use_artifact != 'latest' }}
|
|
99
|
-
uses: actions/download-artifact@v4
|
|
100
|
-
with:
|
|
101
|
-
name: ${{ github.event.inputs.use_artifact }}
|
|
102
|
-
path: ./
|
|
103
|
-
|
|
104
|
-
- name: Download latest build artifacts
|
|
105
|
-
if: ${{ github.event.inputs.use_artifact == 'latest' }}
|
|
106
|
-
run: |
|
|
107
|
-
echo "Downloading latest build artifacts..."
|
|
108
|
-
gh run download --name "build-artifacts-*" --limit 1
|
|
109
|
-
env:
|
|
110
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
111
|
-
|
|
112
|
-
- name: Install dependencies (only for package.json)
|
|
113
|
-
run: npm ci --production
|
|
114
|
-
|
|
115
|
-
- name: Configure package for GitHub Packages
|
|
116
|
-
run: |
|
|
117
|
-
cp package.json package.json.backup
|
|
118
|
-
node -e "
|
|
119
|
-
const pkg = require('./package.json');
|
|
120
|
-
pkg.name = '@${{ github.repository_owner }}/' + pkg.name.split('/').pop();
|
|
121
|
-
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
- name: Publish to GitHub Packages
|
|
125
|
-
run: npm publish
|
|
126
|
-
env:
|
|
127
|
-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
128
|
-
|
|
129
|
-
- name: Restore original package.json
|
|
130
|
-
run: mv package.json.backup package.json
|
|
131
|
-
if: always()
|
|
132
|
-
|
|
133
|
-
- name: GitHub Packages success notification
|
|
134
|
-
run: echo "โ
Package published to GitHub Packages successfully"
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
name: Test Pipeline
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch: # Allows manual triggering
|
|
5
|
-
workflow_call: # Allows this workflow to be called by other workflows
|
|
6
|
-
push:
|
|
7
|
-
branches: [ main, develop ]
|
|
8
|
-
pull_request:
|
|
9
|
-
branches: [ main ]
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
test:
|
|
13
|
-
name: Run Tests
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
|
|
16
|
-
strategy:
|
|
17
|
-
matrix:
|
|
18
|
-
node-version: [18, 20, 22]
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- name: Checkout code
|
|
22
|
-
uses: actions/checkout@v4
|
|
23
|
-
|
|
24
|
-
- name: Setup Node.js ${{ matrix.node-version }}
|
|
25
|
-
uses: actions/setup-node@v4
|
|
26
|
-
with:
|
|
27
|
-
node-version: ${{ matrix.node-version }}
|
|
28
|
-
cache: 'npm'
|
|
29
|
-
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: npm ci
|
|
32
|
-
|
|
33
|
-
- name: Run linter (if available)
|
|
34
|
-
run: npm run lint --if-present
|
|
35
|
-
|
|
36
|
-
- name: Run tests
|
|
37
|
-
run: npm run test:run
|
|
38
|
-
|
|
39
|
-
- name: Generate coverage report
|
|
40
|
-
run: npm run test:coverage
|
|
41
|
-
if: matrix.node-version == '22'
|
|
42
|
-
|
|
43
|
-
- name: Upload coverage reports
|
|
44
|
-
uses: codecov/codecov-action@v3
|
|
45
|
-
if: matrix.node-version == '22'
|
|
46
|
-
with:
|
|
47
|
-
fail_ci_if_error: false
|
package/eng.traineddata
DELETED
|
Binary file
|
package/src/cli/commands.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { renameFiles } from './rename.js';
|
|
3
|
-
|
|
4
|
-
export function setupCommands(program: Command): void {
|
|
5
|
-
program
|
|
6
|
-
.command('rename')
|
|
7
|
-
.description('๐ Rename files in a directory based on their content using AI analysis')
|
|
8
|
-
.argument('[directory]', 'Directory containing files to rename (default: current directory)', '.')
|
|
9
|
-
.option('-p, --provider <provider>', 'AI provider (claude|openai|ollama|lmstudio)', 'claude')
|
|
10
|
-
.option('-k, --api-key <key>', 'API key for cloud providers (or set CLAUDE_API_KEY/OPENAI_API_KEY)')
|
|
11
|
-
.option('-c, --case <convention>', 'Naming convention (kebab-case|snake_case|camelCase|PascalCase|lowercase|UPPERCASE)', 'kebab-case')
|
|
12
|
-
.option('-t, --template <category>', 'File category template (document|movie|music|series|photo|book|general|auto)', 'general')
|
|
13
|
-
.option('-n, --name <personalName>', 'Personal name to include in filenames (for document/photo templates)')
|
|
14
|
-
.option('-d, --date <format>', 'Date format to include (YYYY-MM-DD|YYYY|YYYYMMDD|none)', 'none')
|
|
15
|
-
.option('--dry-run', 'Preview changes without actually renaming files (RECOMMENDED first!)', false)
|
|
16
|
-
.option('--max-size <size>', 'Maximum file size in MB to process', '10')
|
|
17
|
-
.option('--base-url <url>', 'Base URL for local LLM providers (default: ollama=http://localhost:11434, lmstudio=http://localhost:1234)')
|
|
18
|
-
.option('--model <name>', 'Model name for local LLM providers (default: ollama=llama3.1, lmstudio=local-model)')
|
|
19
|
-
.addHelpText('after', `
|
|
20
|
-
|
|
21
|
-
๐ How it works:
|
|
22
|
-
1. Scans directory for supported files (PDF, DOCX, XLSX, TXT, MD, RTF)
|
|
23
|
-
2. Extracts content and metadata from each file
|
|
24
|
-
3. For scanned PDFs with no text, converts to image for AI vision analysis
|
|
25
|
-
4. Uses AI to analyze content and generate descriptive names
|
|
26
|
-
5. Applies your chosen template and naming convention
|
|
27
|
-
6. Renames files (or shows preview with --dry-run)
|
|
28
|
-
|
|
29
|
-
๐ก Pro Tips:
|
|
30
|
-
โข Always use --dry-run first to preview changes
|
|
31
|
-
โข Use 'auto' template for smart file type detection
|
|
32
|
-
โข Personal templates work great for documents and photos
|
|
33
|
-
โข Scanned PDFs are automatically handled via AI vision (Claude/OpenAI/Ollama)
|
|
34
|
-
โข Set API keys as environment variables for cloud providers
|
|
35
|
-
โข Local LLMs (Ollama/LMStudio) require running servers first
|
|
36
|
-
|
|
37
|
-
๐ฅ๏ธ Local LLM Setup:
|
|
38
|
-
โข Ollama: Start with 'ollama serve' (default: http://localhost:11434)
|
|
39
|
-
โข LMStudio: Enable local server mode (default: http://localhost:1234)
|
|
40
|
-
|
|
41
|
-
๐ Examples:
|
|
42
|
-
# Current directory (no directory argument needed)
|
|
43
|
-
namewise rename --dry-run
|
|
44
|
-
namewise rename --provider claude --template document --name "alice"
|
|
45
|
-
|
|
46
|
-
# Specific directory
|
|
47
|
-
namewise rename ./documents --dry-run
|
|
48
|
-
|
|
49
|
-
# Cloud providers (require API keys)
|
|
50
|
-
namewise rename ./docs --provider claude --template document --name "alice"
|
|
51
|
-
namewise rename ./media --provider openai --template auto
|
|
52
|
-
|
|
53
|
-
# Local LLMs (no API key needed)
|
|
54
|
-
namewise rename --provider ollama --model llama3.1 --dry-run
|
|
55
|
-
namewise rename ./documents --provider ollama --model llama3.1
|
|
56
|
-
namewise rename ./contracts --provider lmstudio --base-url http://localhost:1234
|
|
57
|
-
|
|
58
|
-
# Custom Ollama setup
|
|
59
|
-
namewise rename ./files --provider ollama --base-url http://192.168.1.100:11434 --model codellama
|
|
60
|
-
`)
|
|
61
|
-
.action(async (directory, options) => {
|
|
62
|
-
await renameFiles(directory, options);
|
|
63
|
-
});
|
|
64
|
-
}
|