pokt-cli 1.0.2 → 1.0.3

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
@@ -1,96 +1,96 @@
1
- # Pokt CLI
2
-
3
- CLI de **Vibe Coding** com IA: OpenRouter, Ollama (local e cloud), Gemini e provedor Pokt (controller).
4
-
5
- ## Requisitos
6
-
7
- - **Node.js** >= 18.0.0
8
-
9
- ## Instalação
10
-
11
- ```bash
12
- # Instalação global
13
- npm install -g pokt-cli
14
-
15
- # Ou use sem instalar
16
- npx pokt-cli
17
- ```
18
-
19
- ## Uso
20
-
21
- Sem argumentos, o Pokt abre um menu interativo:
22
-
23
- ```bash
24
- pokt
25
- ```
26
-
27
- Ou use os comandos diretamente:
28
-
29
- ```bash
30
- pokt chat # Iniciar chat (Vibe Coding)
31
- pokt models list # Listar modelos
32
- pokt provider use openrouter
33
- pokt config show
34
- pokt --help
35
- ```
36
-
37
- ## Comandos
38
-
39
- | Comando | Descrição |
40
- |--------|-----------|
41
- | `pokt` | Menu interativo |
42
- | `pokt chat` | Iniciar sessão de chat com a IA |
43
- | `pokt config <action>` | Configurar chaves e tokens |
44
- | `pokt models <action>` | Gerenciar modelos (listar, adicionar, trocar) |
45
- | `pokt provider use <provider>` | Trocar provedor de API |
46
- | `pokt mcp [action]` | Gerenciar servidores MCP (ferramentas externas) |
47
-
48
- ### Config (`config`)
49
-
50
- - `pokt config show` — Mostra a configuração atual (tokens mascarados).
51
- - `pokt config set-openrouter -v <token>` — Token OpenRouter.
52
- - `pokt config set-ollama -v <url>` — URL base do Ollama local.
53
- - `pokt config set-ollama-cloud -v <key>` — API key Ollama Cloud.
54
- - `pokt config set-gemini -v <key>` — API key Google Gemini.
55
- - `pokt config set-pokt-token -v <token>` — Token do controller Pokt.
56
- - `pokt config clear-openrouter` — Remove o token OpenRouter.
57
-
58
- ### Modelos (`models`)
59
-
60
- - `pokt models list` — Lista modelos registrados e o ativo.
61
- - `pokt models fetch-openrouter` — Busca modelos disponíveis no OpenRouter.
62
- - `pokt models fetch-ollama` — Busca modelos do Ollama local.
63
- - `pokt models fetch-ollama-cloud` — Busca modelos do Ollama Cloud.
64
- - `pokt models add-openrouter`, `add-ollama`, `add-ollama-cloud` — Adiciona modelo (use `-i <id>`).
65
- - `pokt models use -i <id> -p <provider>` — Define o modelo ativo.
66
-
67
- ### Provedores (`provider`)
68
-
69
- Provedores suportados: `controller` (Pokt), `openrouter`, `gemini`, `ollama`, `ollama-cloud`.
70
-
71
- ```bash
72
- pokt provider use openrouter
73
- pokt provider use ollama
74
- ```
75
-
76
- ## Desenvolvimento
77
-
78
- ```bash
79
- # Clonar e instalar
80
- git clone https://github.com/PoktWeb/Pokt_CLI.git
81
- cd Pokt_CLI
82
- npm install
83
-
84
- # Desenvolvimento (executa o TypeScript direto)
85
- npm run dev
86
-
87
- # Build
88
- npm run build
89
-
90
- # Executar após o build
91
- npm start
92
- ```
93
-
94
- ## Licença
95
-
96
- ISC · **PoktWeb**
1
+ # Pokt CLI
2
+
3
+ CLI de **Vibe Coding** com IA: OpenRouter, Ollama (local e cloud), Gemini e provedor Pokt (controller).
4
+
5
+ ## Requisitos
6
+
7
+ - **Node.js** >= 18.0.0
8
+
9
+ ## Instalação
10
+
11
+ ```bash
12
+ # Instalação global
13
+ npm install -g pokt-cli
14
+
15
+ # Ou use sem instalar
16
+ npx pokt-cli
17
+ ```
18
+
19
+ ## Uso
20
+
21
+ Sem argumentos, o Pokt abre um menu interativo:
22
+
23
+ ```bash
24
+ pokt
25
+ ```
26
+
27
+ Ou use os comandos diretamente:
28
+
29
+ ```bash
30
+ pokt chat # Iniciar chat (Vibe Coding)
31
+ pokt models list # Listar modelos
32
+ pokt provider use openrouter
33
+ pokt config show
34
+ pokt --help
35
+ ```
36
+
37
+ ## Comandos
38
+
39
+ | Comando | Descrição |
40
+ |--------|-----------|
41
+ | `pokt` | Menu interativo |
42
+ | `pokt chat` | Iniciar sessão de chat com a IA |
43
+ | `pokt config <action>` | Configurar chaves e tokens |
44
+ | `pokt models <action>` | Gerenciar modelos (listar, adicionar, trocar) |
45
+ | `pokt provider use <provider>` | Trocar provedor de API |
46
+ | `pokt mcp [action]` | Gerenciar servidores MCP (ferramentas externas) |
47
+
48
+ ### Config (`config`)
49
+
50
+ - `pokt config show` — Mostra a configuração atual (tokens mascarados).
51
+ - `pokt config set-openrouter -v <token>` — Token OpenRouter.
52
+ - `pokt config set-ollama -v <url>` — URL base do Ollama local.
53
+ - `pokt config set-ollama-cloud -v <key>` — API key Ollama Cloud.
54
+ - `pokt config set-gemini -v <key>` — API key Google Gemini.
55
+ - `pokt config set-pokt-token -v <token>` — Token do controller Pokt.
56
+ - `pokt config clear-openrouter` — Remove o token OpenRouter.
57
+
58
+ ### Modelos (`models`)
59
+
60
+ - `pokt models list` — Lista modelos registrados e o ativo.
61
+ - `pokt models fetch-openrouter` — Busca modelos disponíveis no OpenRouter.
62
+ - `pokt models fetch-ollama` — Busca modelos do Ollama local.
63
+ - `pokt models fetch-ollama-cloud` — Busca modelos do Ollama Cloud.
64
+ - `pokt models add-openrouter`, `add-ollama`, `add-ollama-cloud` — Adiciona modelo (use `-i <id>`).
65
+ - `pokt models use -i <id> -p <provider>` — Define o modelo ativo.
66
+
67
+ ### Provedores (`provider`)
68
+
69
+ Provedores suportados: `controller` (Pokt), `openrouter`, `gemini`, `ollama`, `ollama-cloud`.
70
+
71
+ ```bash
72
+ pokt provider use openrouter
73
+ pokt provider use ollama
74
+ ```
75
+
76
+ ## Desenvolvimento
77
+
78
+ ```bash
79
+ # Clonar e instalar
80
+ git clone https://github.com/PoktWeb/Pokt_CLI.git
81
+ cd Pokt_CLI
82
+ npm install
83
+
84
+ # Desenvolvimento (executa o TypeScript direto)
85
+ npm run dev
86
+
87
+ # Build
88
+ npm run build
89
+
90
+ # Executar após o build
91
+ npm start
92
+ ```
93
+
94
+ ## Licença
95
+
96
+ ISC · **PoktWeb**
@@ -1 +1 @@
1
- export declare function loginWithGoogle(): Promise<void>;
1
+ export declare function loginWithGoogle(): Promise<void>;
@@ -1,49 +1,49 @@
1
- import { OAuth2Client } from 'google-auth-library';
2
- import http from 'http';
3
- import url from 'url';
4
- import open from 'open';
5
- import { config } from '../config.js';
6
- import chalk from 'chalk';
7
- import ora from 'ora';
8
- const REDIRECT_URI = 'http://localhost:3000/oauth2callback';
9
- export async function loginWithGoogle() {
10
- const clientId = config.get('googleClientId');
11
- const clientSecret = config.get('googleClientSecret');
12
- if (!clientId || !clientSecret) {
13
- console.log(chalk.red('\nError: Google OAuth Client ID or Secret not configured.'));
14
- console.log(chalk.yellow('To use Google Login, follow these steps:'));
15
- console.log(chalk.gray('1. Create a project at: https://console.cloud.google.com/'));
16
- console.log(chalk.gray('2. Enable the "Generative Language API"'));
17
- console.log(chalk.gray('3. Create OAuth 2.0 Client ID (Type: Web application)'));
18
- console.log(chalk.gray(`4. Add Authorized redirect URI: ${REDIRECT_URI}`));
19
- console.log(chalk.yellow('\nThen configure Pokt CLI:'));
20
- console.log(chalk.cyan(` pokt config set-google-client-id -v YOUR_CLIENT_ID`));
21
- console.log(chalk.cyan(` pokt config set-google-client-secret -v YOUR_CLIENT_SECRET`));
22
- return;
23
- }
24
- const spinner = ora('Starting Google Login...').start();
25
- const oAuth2Client = new OAuth2Client(clientId, clientSecret, REDIRECT_URI);
26
- const authorizeUrl = oAuth2Client.generateAuthUrl({
27
- access_type: 'offline',
28
- scope: ['https://www.googleapis.com/auth/generative-language'],
29
- });
30
- const server = http.createServer(async (req, res) => {
31
- try {
32
- if (req.url && req.url.includes('/oauth2callback') && req.url.includes('code=')) {
33
- const qs = new url.URL(req.url, 'http://localhost:3000').searchParams;
34
- const code = qs.get('code');
35
- res.end('Authentication successful! You can close this tab.');
36
- server.close();
37
- const { tokens } = await oAuth2Client.getToken(code);
38
- config.set('googleToken', tokens);
39
- console.log(chalk.green('\n✔ Google account connected successfully.'));
40
- }
41
- }
42
- catch (e) {
43
- console.error(chalk.red(`\nAuthentication failed: ${e.message}`));
44
- res.end('Authentication failed.');
45
- }
46
- }).listen(3000);
47
- spinner.succeed(chalk.blue('Opening browser for Google login...'));
48
- await open(authorizeUrl);
49
- }
1
+ import { OAuth2Client } from 'google-auth-library';
2
+ import http from 'http';
3
+ import url from 'url';
4
+ import open from 'open';
5
+ import { config } from '../config.js';
6
+ import chalk from 'chalk';
7
+ import ora from 'ora';
8
+ const REDIRECT_URI = 'http://localhost:3000/oauth2callback';
9
+ export async function loginWithGoogle() {
10
+ const clientId = config.get('googleClientId');
11
+ const clientSecret = config.get('googleClientSecret');
12
+ if (!clientId || !clientSecret) {
13
+ console.log(chalk.red('\nError: Google OAuth Client ID or Secret not configured.'));
14
+ console.log(chalk.yellow('To use Google Login, follow these steps:'));
15
+ console.log(chalk.gray('1. Create a project at: https://console.cloud.google.com/'));
16
+ console.log(chalk.gray('2. Enable the "Generative Language API"'));
17
+ console.log(chalk.gray('3. Create OAuth 2.0 Client ID (Type: Web application)'));
18
+ console.log(chalk.gray(`4. Add Authorized redirect URI: ${REDIRECT_URI}`));
19
+ console.log(chalk.yellow('\nThen configure Pokt CLI:'));
20
+ console.log(chalk.cyan(` pokt config set-google-client-id -v YOUR_CLIENT_ID`));
21
+ console.log(chalk.cyan(` pokt config set-google-client-secret -v YOUR_CLIENT_SECRET`));
22
+ return;
23
+ }
24
+ const spinner = ora('Starting Google Login...').start();
25
+ const oAuth2Client = new OAuth2Client(clientId, clientSecret, REDIRECT_URI);
26
+ const authorizeUrl = oAuth2Client.generateAuthUrl({
27
+ access_type: 'offline',
28
+ scope: ['https://www.googleapis.com/auth/generative-language'],
29
+ });
30
+ const server = http.createServer(async (req, res) => {
31
+ try {
32
+ if (req.url && req.url.includes('/oauth2callback') && req.url.includes('code=')) {
33
+ const qs = new url.URL(req.url, 'http://localhost:3000').searchParams;
34
+ const code = qs.get('code');
35
+ res.end('Authentication successful! You can close this tab.');
36
+ server.close();
37
+ const { tokens } = await oAuth2Client.getToken(code);
38
+ config.set('googleToken', tokens);
39
+ console.log(chalk.green('\n✔ Google account connected successfully.'));
40
+ }
41
+ }
42
+ catch (e) {
43
+ console.error(chalk.red(`\nAuthentication failed: ${e.message}`));
44
+ res.end('Authentication failed.');
45
+ }
46
+ }).listen(3000);
47
+ spinner.succeed(chalk.blue('Opening browser for Google login...'));
48
+ await open(authorizeUrl);
49
+ }
@@ -1,2 +1,2 @@
1
- import { CommandModule } from 'yargs';
2
- export declare const authCommand: CommandModule;
1
+ import { CommandModule } from 'yargs';
2
+ export declare const authCommand: CommandModule;
@@ -1,16 +1,16 @@
1
- import { loginWithGoogle } from '../auth/google.js';
2
- export const authCommand = {
3
- command: 'auth <action>',
4
- describe: 'Manage authentication',
5
- builder: (yargs) => yargs
6
- .positional('action', {
7
- describe: 'Action to perform',
8
- type: 'string',
9
- choices: ['login-google']
10
- }),
11
- handler: async (argv) => {
12
- if (argv.action === 'login-google') {
13
- await loginWithGoogle();
14
- }
15
- }
16
- };
1
+ import { loginWithGoogle } from '../auth/google.js';
2
+ export const authCommand = {
3
+ command: 'auth <action>',
4
+ describe: 'Manage authentication',
5
+ builder: (yargs) => yargs
6
+ .positional('action', {
7
+ describe: 'Action to perform',
8
+ type: 'string',
9
+ choices: ['login-google']
10
+ }),
11
+ handler: async (argv) => {
12
+ if (argv.action === 'login-google') {
13
+ await loginWithGoogle();
14
+ }
15
+ }
16
+ };
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "pokt-cli",
3
- "version": "1.0.2",
4
- "description": "Vibe Coding AI CLI for OpenRouter and Ollama",
5
- "main": "./dist/bin/pokt.js",
6
- "type": "module",
7
- "bin": {
8
- "pokt": "dist/bin/pokt.js"
9
- },
10
- "scripts": {
11
- "build": "tsc",
12
- "start": "node ./dist/bin/pokt.js",
13
- "dev": "tsx ./src/bin/pokt.ts",
14
- "prepublishOnly": "npm run build"
15
- },
16
- "files": [
17
- "dist",
18
- "package.json",
19
- "README.md"
20
- ],
21
- "keywords": [
22
- "ai",
23
- "cli",
24
- "coding",
25
- "agent",
26
- "openrouter",
27
- "ollama"
28
- ],
29
- "author": "PoktWeb",
30
- "license": "ISC",
31
- "engines": {
32
- "node": ">=18.0.0"
33
- },
34
- "repository": {
35
- "type": "git",
36
- "url": "git+https://github.com/PoktWeb/Pokt_CLI.git"
37
- },
38
- "homepage": "https://github.com/PoktWeb/Pokt_CLI#readme",
39
- "bugs": {
40
- "url": "https://github.com/PoktWeb/Pokt_CLI/issues"
41
- },
42
- "dependencies": {
43
- "@modelcontextprotocol/sdk": "^1.27.1",
44
- "chalk": "^5.3.0",
45
- "conf": "^12.0.0",
46
- "diff": "^8.0.3",
47
- "openai": "^4.28.4",
48
- "ora": "^8.0.1",
49
- "prompts": "^2.4.2",
50
- "yargs": "^17.7.2",
51
- "zod": "^3.23.8"
52
- },
53
- "devDependencies": {
54
- "@types/diff": "^7.0.2",
55
- "@types/node": "^20.11.24",
56
- "@types/prompts": "^2.4.9",
57
- "@types/yargs": "^17.0.32",
58
- "tsx": "^4.7.1",
59
- "typescript": "^5.3.3"
60
- }
61
- }
1
+ {
2
+ "name": "pokt-cli",
3
+ "version": "1.0.3",
4
+ "description": "Vibe Coding AI CLI for OpenRouter and Ollama",
5
+ "main": "./dist/bin/pokt.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "pokt": "dist/bin/pokt.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "start": "node ./dist/bin/pokt.js",
13
+ "dev": "tsx ./src/bin/pokt.ts",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "package.json",
19
+ "README.md"
20
+ ],
21
+ "keywords": [
22
+ "ai",
23
+ "cli",
24
+ "coding",
25
+ "agent",
26
+ "openrouter",
27
+ "ollama"
28
+ ],
29
+ "author": "PoktWeb",
30
+ "license": "ISC",
31
+ "engines": {
32
+ "node": ">=18.0.0"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/PoktWeb/Pokt_CLI.git"
37
+ },
38
+ "homepage": "https://github.com/PoktWeb/Pokt_CLI#readme",
39
+ "bugs": {
40
+ "url": "https://github.com/PoktWeb/Pokt_CLI/issues"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.27.1",
44
+ "chalk": "^5.3.0",
45
+ "conf": "^12.0.0",
46
+ "diff": "^8.0.3",
47
+ "openai": "^4.28.4",
48
+ "ora": "^8.0.1",
49
+ "prompts": "^2.4.2",
50
+ "yargs": "^17.7.2",
51
+ "zod": "^3.23.8"
52
+ },
53
+ "devDependencies": {
54
+ "@types/diff": "^7.0.2",
55
+ "@types/node": "^20.11.24",
56
+ "@types/prompts": "^2.4.9",
57
+ "@types/yargs": "^17.0.32",
58
+ "tsx": "^4.7.1",
59
+ "typescript": "^5.3.3"
60
+ }
61
+ }