pokt-cli 1.0.4 → 1.0.5

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/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', '? for shortcuts'));
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,6 @@
1
+ import type * as Yargs from 'yargs';
2
+ export declare const proCommand: Yargs.CommandModule<{}, {
3
+ url?: boolean;
4
+ }>;
5
+ /** Usado pelo menu principal e pelo chat (/pro). */
6
+ export declare function runProFlow(printOnlyUrl?: boolean): void;
@@ -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');
@@ -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.1' });
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.4';
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,2 @@
1
+ /** Abre a URL no navegador padrão (Windows / macOS / Linux). */
2
+ export declare function openBrowser(url: string): void;
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "pokt-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Vibe Coding AI CLI for OpenRouter and Ollama",
5
5
  "main": "./dist/bin/pokt.js",
6
6
  "type": "module",