pokt-cli 1.0.4 → 1.0.6
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 +26 -3
- package/dist/bin/pokt.js +7 -0
- package/dist/chat/loop.js +16 -1
- package/dist/commands/pro.d.ts +6 -0
- package/dist/commands/pro.js +37 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -0
- package/dist/mcp/client.js +1 -1
- package/dist/ui.js +1 -1
- package/dist/util/openBrowser.d.ts +2 -0
- package/dist/util/openBrowser.js +13 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -8,14 +8,37 @@ CLI de **Vibe Coding** com IA: OpenRouter, Ollama (local e cloud), Gemini e prov
|
|
|
8
8
|
|
|
9
9
|
## Instalação
|
|
10
10
|
|
|
11
|
+
O pacote no npm chama-se **`pokt-cli`**; o comando no terminal é **`pokt`** (ou **`pokt-cli`**).
|
|
12
|
+
|
|
11
13
|
```bash
|
|
12
|
-
# Instalação global
|
|
14
|
+
# Instalação global (recomendado para o comando `pokt` no PATH)
|
|
13
15
|
npm install -g pokt-cli
|
|
14
16
|
|
|
15
|
-
#
|
|
16
|
-
npx pokt-cli
|
|
17
|
+
# Sem instalar (sempre funciona em qualquer máquina)
|
|
18
|
+
npx --yes pokt-cli
|
|
17
19
|
```
|
|
18
20
|
|
|
21
|
+
### O comando `pokt` não é reconhecido?
|
|
22
|
+
|
|
23
|
+
1. **Instalação local** (`npm install pokt-cli` dentro de um projeto): o `pokt` **não** fica no PATH global. Use:
|
|
24
|
+
- `npx pokt-cli` ou
|
|
25
|
+
- `npm exec pokt-cli` ou
|
|
26
|
+
- `./node_modules/.bin/pokt` (Git Bash / WSL / macOS/Linux).
|
|
27
|
+
|
|
28
|
+
2. **Windows – pasta do npm no PATH**: após `npm install -g pokt-cli`, o executável fica na pasta global do npm. Confira:
|
|
29
|
+
```bash
|
|
30
|
+
npm config get prefix
|
|
31
|
+
```
|
|
32
|
+
O diretório **`prefix`** e a subpasta **`prefix\bin`** (ou no Windows muitas vezes **`%AppData%\npm`**) precisam estar no **PATH** do sistema. Reinicie o terminal após alterar.
|
|
33
|
+
|
|
34
|
+
3. **Windows PowerShell – “running scripts is disabled”**: o npm cria `pokt.ps1`. Se a política bloquear scripts, use **Prompt de Comando (cmd)** para rodar `pokt`, ou:
|
|
35
|
+
```powershell
|
|
36
|
+
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
|
|
37
|
+
```
|
|
38
|
+
Ou continue usando **`npx pokt-cli`**, que costuma contornar o problema.
|
|
39
|
+
|
|
40
|
+
4. **Linux/macOS – “bad interpreter” ou comando não encontrado**: em versões antigas publicadas com **CRLF** no arquivo da CLI, reinstale a versão mais recente (`npm install -g pokt-cli@latest`).
|
|
41
|
+
|
|
19
42
|
## Uso
|
|
20
43
|
|
|
21
44
|
Sem argumentos, o Pokt abre um menu interativo:
|
package/dist/bin/pokt.js
CHANGED
|
@@ -8,6 +8,7 @@ import { providerCommand } from '../commands/provider.js';
|
|
|
8
8
|
import { mcpCommand } from '../commands/mcp.js';
|
|
9
9
|
import { updateCommand } from '../commands/update.js';
|
|
10
10
|
import { uninstallCommand } from '../commands/uninstall.js';
|
|
11
|
+
import { proCommand, runProFlow } from '../commands/pro.js';
|
|
11
12
|
import prompts from 'prompts';
|
|
12
13
|
import chalk from 'chalk';
|
|
13
14
|
import { ui } from '../ui.js';
|
|
@@ -26,6 +27,7 @@ else {
|
|
|
26
27
|
.command(mcpCommand)
|
|
27
28
|
.command(updateCommand)
|
|
28
29
|
.command(uninstallCommand)
|
|
30
|
+
.command(proCommand)
|
|
29
31
|
.demandCommand(1, 'You need at least one command before moving on')
|
|
30
32
|
.help()
|
|
31
33
|
.parse();
|
|
@@ -51,6 +53,7 @@ async function showMenu() {
|
|
|
51
53
|
{ title: '🏠 Switch API Provider (casa de API)', value: 'provider' },
|
|
52
54
|
{ title: '🔌 MCP Servers (tools externos)', value: 'mcp' },
|
|
53
55
|
{ title: '⚙️ Configure API Keys / Tokens', value: 'config' },
|
|
56
|
+
{ title: '⭐ Torne-se Pro (site — pagamento + chave)', value: 'pro' },
|
|
54
57
|
{ title: '🔄 Atualizar Pokt CLI', value: 'update' },
|
|
55
58
|
{ title: '🗑️ Remover Pokt CLI', value: 'uninstall' },
|
|
56
59
|
{ title: '❌ Exit', value: 'exit' }
|
|
@@ -75,6 +78,10 @@ async function showMenu() {
|
|
|
75
78
|
else if (response.action === 'config') {
|
|
76
79
|
await handleConfigMenu();
|
|
77
80
|
}
|
|
81
|
+
else if (response.action === 'pro') {
|
|
82
|
+
runProFlow();
|
|
83
|
+
return showMenu();
|
|
84
|
+
}
|
|
78
85
|
else if (response.action === 'update') {
|
|
79
86
|
const { updateCommand } = await import('../commands/update.js');
|
|
80
87
|
await updateCommand.handler({});
|
package/dist/chat/loop.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import prompts from 'prompts';
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import { ui } from '../ui.js';
|
|
4
|
+
import { runProFlow } from '../commands/pro.js';
|
|
4
5
|
import { config } from '../config.js';
|
|
5
6
|
import { getClient } from './client.js';
|
|
6
7
|
import { tools, executeTool } from './tools.js';
|
|
@@ -65,7 +66,7 @@ export async function startChatLoop(modelConfig) {
|
|
|
65
66
|
console.log('');
|
|
66
67
|
const cwd = process.cwd();
|
|
67
68
|
console.log(ui.dim(`Diretório atual: ${cwd}`));
|
|
68
|
-
console.log(ui.shortcutsLine('shift+tab to accept edits', '?
|
|
69
|
+
console.log(ui.shortcutsLine('shift+tab to accept edits', '? · /pro (Torne-se Pro)'));
|
|
69
70
|
const response = await prompts({
|
|
70
71
|
type: 'text',
|
|
71
72
|
name: 'input',
|
|
@@ -79,6 +80,20 @@ export async function startChatLoop(modelConfig) {
|
|
|
79
80
|
console.log(ui.dim('Goodbye!'));
|
|
80
81
|
break;
|
|
81
82
|
}
|
|
83
|
+
const trimmed = userInput.trim();
|
|
84
|
+
const low = trimmed.toLowerCase();
|
|
85
|
+
if (low === '/pro' || low === '/torne-se-pro' || low === 'torne-se pro') {
|
|
86
|
+
runProFlow();
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (trimmed === '?') {
|
|
90
|
+
console.log(ui.dim(`
|
|
91
|
+
Atalhos:
|
|
92
|
+
${ui.accent('/pro')} ou ${ui.accent('/torne-se-pro')} — abrir Pokt Pro no navegador (pagamento + chave)
|
|
93
|
+
exit, ${ui.accent('/quit')} — sair do chat
|
|
94
|
+
`));
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
82
97
|
messages.push({ role: 'user', content: userInput });
|
|
83
98
|
// Primeiro o modelo vê o pedido; depois carregamos a estrutura do projeto para ele entender e então criar/editar
|
|
84
99
|
const isFirstUserMessage = messages.filter(m => m.role === 'user').length === 1;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getProPurchaseUrl } from '../config.js';
|
|
2
|
+
import { openBrowser } from '../util/openBrowser.js';
|
|
3
|
+
import { ui } from '../ui.js';
|
|
4
|
+
export const proCommand = {
|
|
5
|
+
command: 'pro',
|
|
6
|
+
aliases: ['Pro'],
|
|
7
|
+
describe: 'Abre a página inicial do Controller (botão "Torne-se Pro"). Use --url só para imprimir o link.',
|
|
8
|
+
builder: (yargs) => yargs.option('url', {
|
|
9
|
+
type: 'boolean',
|
|
10
|
+
default: false,
|
|
11
|
+
describe: 'Só mostra a URL no terminal (não abre o navegador)',
|
|
12
|
+
}),
|
|
13
|
+
handler: (argv) => {
|
|
14
|
+
if (argv.url) {
|
|
15
|
+
console.log(getProPurchaseUrl());
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
runProFlow();
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
/** Usado pelo menu principal e pelo chat (/pro). */
|
|
22
|
+
export function runProFlow(printOnlyUrl = false) {
|
|
23
|
+
const proHomeUrl = getProPurchaseUrl();
|
|
24
|
+
if (printOnlyUrl) {
|
|
25
|
+
console.log(proHomeUrl);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
console.log(ui.dim('Pokt Pro — abra o site e clique em "Torne-se Pro" (pagamento + chave imediata).\n'));
|
|
29
|
+
console.log(ui.accent(proHomeUrl));
|
|
30
|
+
try {
|
|
31
|
+
openBrowser(proHomeUrl);
|
|
32
|
+
console.log(ui.success('\nAbrindo no navegador… Se não abrir, copie o link acima.\n'));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
console.log(ui.warn('Não foi possível abrir o navegador. Copie o link acima.\n'));
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/config.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ interface AppConfig {
|
|
|
30
30
|
}
|
|
31
31
|
export declare const config: Conf<AppConfig>;
|
|
32
32
|
export declare const getControllerBaseUrl: () => string;
|
|
33
|
+
/** Página inicial do Pokt Pro (aí tem o botão de assinatura/pagamento). */
|
|
34
|
+
export declare const getProPurchaseUrl: () => string;
|
|
33
35
|
/** Prioridade: modelo ativo explícito → Pokt (controller) se token setado → OpenRouter → Gemini → Ollama Cloud → Ollama local */
|
|
34
36
|
export declare function getEffectiveActiveModel(): ModelConfig | null;
|
|
35
37
|
export {};
|
package/dist/config.js
CHANGED
|
@@ -33,6 +33,8 @@ export const getControllerBaseUrl = () => {
|
|
|
33
33
|
const url = config.get('controllerBaseUrl') || DEFAULT_CONTROLLER_URL;
|
|
34
34
|
return url.replace(/\/$/, '');
|
|
35
35
|
};
|
|
36
|
+
/** Página inicial do Pokt Pro (aí tem o botão de assinatura/pagamento). */
|
|
37
|
+
export const getProPurchaseUrl = () => getControllerBaseUrl();
|
|
36
38
|
/** Prioridade: modelo ativo explícito → Pokt (controller) se token setado → OpenRouter → Gemini → Ollama Cloud → Ollama local */
|
|
37
39
|
export function getEffectiveActiveModel() {
|
|
38
40
|
const explicit = config.get('activeModel');
|
package/dist/mcp/client.js
CHANGED
|
@@ -39,7 +39,7 @@ export async function connectMcpServer(serverConfig) {
|
|
|
39
39
|
args: serverConfig.args ?? [],
|
|
40
40
|
env: process.env,
|
|
41
41
|
});
|
|
42
|
-
const client = new Client({ name: 'pokt-cli', version: '1.0.
|
|
42
|
+
const client = new Client({ name: 'pokt-cli', version: '1.0.5' });
|
|
43
43
|
await client.connect(transport);
|
|
44
44
|
const list = await client.listTools();
|
|
45
45
|
const tools = (list.tools ?? []).map((t) => ({
|
package/dist/ui.js
CHANGED
|
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
|
-
const VERSION = '1.0.
|
|
5
|
+
const VERSION = '1.0.5';
|
|
6
6
|
/** Logo em estilo chevron com gradiente (azul → rosa → roxo) */
|
|
7
7
|
function logo() {
|
|
8
8
|
const c = (s, color) => color(s);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
/** Abre a URL no navegador padrão (Windows / macOS / Linux). */
|
|
3
|
+
export function openBrowser(url) {
|
|
4
|
+
if (process.platform === 'win32') {
|
|
5
|
+
spawn('cmd', ['/c', 'start', '""', url], { detached: true, stdio: 'ignore' }).unref();
|
|
6
|
+
}
|
|
7
|
+
else if (process.platform === 'darwin') {
|
|
8
|
+
spawn('open', [url], { detached: true, stdio: 'ignore' }).unref();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
spawn('xdg-open', [url], { detached: true, stdio: 'ignore' }).unref();
|
|
12
|
+
}
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pokt-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Vibe Coding AI CLI for OpenRouter and Ollama",
|
|
5
5
|
"main": "./dist/bin/pokt.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"pokt": "dist/bin/pokt.js"
|
|
8
|
+
"pokt": "dist/bin/pokt.js",
|
|
9
|
+
"pokt-cli": "dist/bin/pokt.js"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
|
-
"build": "tsc",
|
|
12
|
+
"build": "tsc && node scripts/ensure-bin-lf.js",
|
|
12
13
|
"start": "node ./dist/bin/pokt.js",
|
|
13
14
|
"dev": "tsx ./src/bin/pokt.ts",
|
|
14
15
|
"prepublishOnly": "npm run build"
|