ai-renamer
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"license": "GPL-3.0", | ||
@@ -4,0 +4,0 @@ "name": "ai-renamer", |
@@ -8,2 +8,6 @@ # ai-renamer | ||
## Preview | ||
https://github.com/ozgrozer/ai-renamer/assets/651938/7ac84a2d-8e05-4756-8827-3bd746b3edae | ||
## Usage | ||
@@ -41,2 +45,3 @@ | ||
(e.g. 25) [number] | ||
-l, --set-language Set the output language (e.g. English, Turkish) [string] | ||
``` | ||
@@ -43,0 +48,0 @@ |
@@ -45,2 +45,7 @@ const os = require('os') | ||
description: 'Set the maximum number of characters in the new filename (e.g. 25)' | ||
}) | ||
.option('set-language', { | ||
alias: 'l', | ||
type: 'string', | ||
description: 'Set the output language (e.g. English, Turkish)' | ||
}).argv | ||
@@ -74,3 +79,10 @@ | ||
if (argv['set-language']) { | ||
config.defaultLanguage = argv['set-language'] | ||
await saveConfig({ config }) | ||
console.log(`⚪ Language set to: ${config.defaultLanguage}`) | ||
process.exit(1) | ||
} | ||
return { argv, config } | ||
} |
const ollama = require('ollama').default | ||
module.exports = async ({ model, _case, chars, content }) => { | ||
module.exports = async ({ model, _case, chars, content, language }) => { | ||
try { | ||
@@ -9,2 +9,3 @@ const prompt = ` | ||
- Maximum ${chars} characters | ||
- Use ${language} language in the filename | ||
- Exclude file extension | ||
@@ -14,3 +15,3 @@ - Avoid special characters | ||
IMPORTANT: Your entire response should be just the filename in ${_case} format and max ${chars} characters. Do not include any other text. | ||
IMPORTANT: Your entire response should be just the filename in ${_case} format, in ${language} language, and max ${chars} characters. Do not include any other text. | ||
@@ -17,0 +18,0 @@ Content: |
@@ -9,3 +9,3 @@ #!/usr/bin/env node | ||
const [inputPath] = argv._ | ||
const { defaultCase, defaultModel, defaultChars } = config | ||
const { defaultCase, defaultModel, defaultChars, defaultLanguage } = config | ||
@@ -17,5 +17,5 @@ if (!inputPath) { | ||
await processPath({ inputPath, defaultCase, defaultModel, defaultChars }) | ||
await processPath({ inputPath, defaultCase, defaultModel, defaultChars, defaultLanguage }) | ||
} | ||
main() |
@@ -8,3 +8,3 @@ const path = require('path') | ||
module.exports = async ({ model, _case, chars, filePath }) => { | ||
module.exports = async ({ model, _case, chars, language, filePath }) => { | ||
try { | ||
@@ -26,3 +26,3 @@ const fileName = path.basename(filePath) | ||
const newName = await getNewName({ model, _case, chars, content }) | ||
const newName = await getNewName({ model, _case, chars, content, language }) | ||
if (!newName) { | ||
@@ -29,0 +29,0 @@ console.log(`🔴 No new name: ${fileName}`) |
@@ -7,3 +7,3 @@ const path = require('path') | ||
module.exports = async ({ inputPath, defaultCase, defaultModel, defaultChars }) => { | ||
module.exports = async ({ inputPath, defaultCase, defaultModel, defaultChars, defaultLanguage }) => { | ||
try { | ||
@@ -19,2 +19,5 @@ const model = defaultModel || await chooseModel() | ||
const language = defaultLanguage || 'English' | ||
console.log(`⚪ Chosen language: ${language}`) | ||
console.log('--------------------------------------------------') | ||
@@ -30,7 +33,7 @@ | ||
if (fileStats.isFile()) { | ||
await processFile({ model, _case, chars, filePath }) | ||
await processFile({ model, _case, chars, language, filePath }) | ||
} | ||
} | ||
} else if (stats.isFile()) { | ||
await processFile({ model, _case, chars, filePath: inputPath }) | ||
await processFile({ model, _case, chars, language, filePath: inputPath }) | ||
} | ||
@@ -37,0 +40,0 @@ } catch (err) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46145
260
54