mirror of
https://github.com/tcsenpai/vvk.git
synced 2025-06-07 11:45:38 +00:00
patch
This commit is contained in:
parent
8c4d3768be
commit
f92c96be1d
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@ dist
|
||||
*.exe
|
||||
*.pkg
|
||||
*.blob
|
||||
pkg-root
|
||||
uninstall-scripts
|
1
.husky/pre-commit
Normal file
1
.husky/pre-commit
Normal file
@ -0,0 +1 @@
|
||||
pnpm lint
|
@ -68,7 +68,7 @@ pnpm remove -g vvk
|
||||
Use the `vvk config set` command to configure your settings:
|
||||
|
||||
```bash
|
||||
# Set your OpenAI API key
|
||||
# If using your own Openai API key, set it in the config
|
||||
vvk config set openaiApiKey your_api_key_here
|
||||
|
||||
# Enable or disable command confirmation (default: true)
|
||||
@ -86,7 +86,7 @@ vvk config list
|
||||
|
||||
## **Login**
|
||||
|
||||
Use the `vvk login` command to log in in the browser:
|
||||
If using VVK Cloud, use the `vvk login` command to log in through the browser
|
||||
|
||||
```bash
|
||||
# Sets the key and userId values
|
||||
|
11
eslint.config.mjs
Normal file
11
eslint.config.mjs
Normal file
@ -0,0 +1,11 @@
|
||||
import globals from 'globals';
|
||||
import pluginJs from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
/** @type {import('eslint').Linter.Config[]} */
|
||||
export default [
|
||||
{ files: ['**/*.{js,mjs,cjs,ts}'] },
|
||||
{ languageOptions: { globals: globals.browser } },
|
||||
pluginJs.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
];
|
25
package.json
25
package.json
@ -1,10 +1,13 @@
|
||||
{
|
||||
"name": "vvk",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "A command-line interface tool that converts natural language instructions into shell commands using OpenAI's GPT-4.",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "rimraf dist && webpack"
|
||||
"build": "rimraf dist && webpack",
|
||||
"lint": "eslint src/**",
|
||||
"lint:fix": "eslint src/** --fix",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"bin": {
|
||||
"vvk": "dist/index.js"
|
||||
@ -15,19 +18,29 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"keywords": [],
|
||||
"author": "Matyi Kari",
|
||||
"author": "Matyi Kari <matykari@gmail.com>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://vvk.ai",
|
||||
"bugs": {
|
||||
"url": "https://github.com/matyik/vvk/issues",
|
||||
"email": "matykari@gmail.com"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.13.5",
|
||||
"@eslint/js": "^9.21.0",
|
||||
"@types/node": "^22.13.9",
|
||||
"eslint": "^9.21.0",
|
||||
"globals": "^16.0.0",
|
||||
"husky": "^9.1.7",
|
||||
"rimraf": "^6.0.1",
|
||||
"ts-loader": "^9.5.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript": "^5.8.2",
|
||||
"typescript-eslint": "^8.26.0",
|
||||
"webpack": "^5.98.0",
|
||||
"webpack-cli": "^6.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.8.1",
|
||||
"openai": "^4.85.4"
|
||||
"openai": "^4.86.2"
|
||||
}
|
||||
}
|
||||
|
873
pnpm-lock.yaml
generated
873
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -11,14 +11,14 @@ export function configCommand(args: string[]) {
|
||||
process.exit(1);
|
||||
}
|
||||
// For boolean fields, parse the value
|
||||
let parsedValue: any = value;
|
||||
let parsedValue: string | boolean = value;
|
||||
if (key === 'confirmCommand') {
|
||||
parsedValue = value.toLowerCase() === 'true' || value.toLowerCase() === 'y';
|
||||
}
|
||||
const updated = updateConfig({ [key]: parsedValue });
|
||||
console.log('Configuration updated:', updated);
|
||||
} else if (command === 'get' || command === 'list') {
|
||||
let config = loadConfig();
|
||||
const config = loadConfig();
|
||||
if (config.key && config.key.length > 0) {
|
||||
config.key = '********';
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ if (args[0] === 'config') {
|
||||
`);
|
||||
process.exit(0);
|
||||
} else if ((args[0] === '--version' || args[0] === '-v') && args.length === 1) {
|
||||
console.log('1.1.1');
|
||||
console.log('1.1.2');
|
||||
} else if (args[0] === 'login' && args.length === 1) {
|
||||
login();
|
||||
} else if (args[0] === 'logout' && args.length === 1) {
|
||||
@ -78,6 +78,7 @@ function confirmExecution(command: string) {
|
||||
}
|
||||
} else if (normalized === 'y') {
|
||||
executeCommand(command);
|
||||
process.exit(0);
|
||||
} else {
|
||||
console.log('Command execution canceled.');
|
||||
process.exit(0);
|
||||
|
@ -43,7 +43,7 @@ export async function login() {
|
||||
key = data.key;
|
||||
userId = data.userId;
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// Ignore errors while waiting
|
||||
}
|
||||
}
|
||||
@ -59,8 +59,12 @@ export async function logout() {
|
||||
updateConfig({ key: '', userId: '' });
|
||||
console.log('✅ Logged out successfully!');
|
||||
process.exit(0);
|
||||
} catch (err: any) {
|
||||
} catch (err: unknown) {
|
||||
if (err instanceof Error) {
|
||||
console.error('❌ Error during logout:', err.message);
|
||||
} else {
|
||||
console.error('❌ Error during logout:', err);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user