pokt-cli 1.0.0
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 +96 -0
- package/dist/auth/google.d.ts +1 -0
- package/dist/auth/google.js +49 -0
- package/dist/bin/pokt.d.ts +2 -0
- package/dist/bin/pokt.js +304 -0
- package/dist/chat/client.d.ts +3 -0
- package/dist/chat/client.js +59 -0
- package/dist/chat/loop.d.ts +2 -0
- package/dist/chat/loop.js +162 -0
- package/dist/chat/tools.d.ts +3 -0
- package/dist/chat/tools.js +215 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +16 -0
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.js +41 -0
- package/dist/commands/config.d.ts +7 -0
- package/dist/commands/config.js +76 -0
- package/dist/commands/mcp.d.ts +11 -0
- package/dist/commands/mcp.js +127 -0
- package/dist/commands/models.d.ts +8 -0
- package/dist/commands/models.js +195 -0
- package/dist/commands/provider.d.ts +6 -0
- package/dist/commands/provider.js +53 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.js +66 -0
- package/dist/mcp/client.d.ts +59 -0
- package/dist/mcp/client.js +130 -0
- package/dist/ui.d.ts +31 -0
- package/dist/ui.js +93 -0
- package/package.json +61 -0
package/dist/ui.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
const VERSION = '1.0.0';
|
|
6
|
+
/** Logo em estilo chevron com gradiente (azul → rosa → roxo) */
|
|
7
|
+
function logo() {
|
|
8
|
+
const c = (s, color) => color(s);
|
|
9
|
+
const block = (char, col) => col(char);
|
|
10
|
+
const blue = chalk.rgb(100, 149, 237);
|
|
11
|
+
const pink = chalk.rgb(255, 105, 180);
|
|
12
|
+
const purple = chalk.rgb(147, 112, 219);
|
|
13
|
+
return block('▸', blue) + ' ' + block('▸', pink) + ' ' + block('▸', purple);
|
|
14
|
+
}
|
|
15
|
+
export const ui = {
|
|
16
|
+
title: (text) => chalk.whiteBright.bold(text),
|
|
17
|
+
subtitle: (text) => chalk.gray(text),
|
|
18
|
+
success: (text) => chalk.green('✔ ' + text),
|
|
19
|
+
error: (text) => chalk.red(text),
|
|
20
|
+
warn: (text) => chalk.yellow(text),
|
|
21
|
+
dim: (text) => chalk.gray(text),
|
|
22
|
+
labelYou: () => chalk.cyan('You:'),
|
|
23
|
+
labelPokt: () => chalk.green('Pokt:'),
|
|
24
|
+
accent: (text) => chalk.blue(text),
|
|
25
|
+
muted: (text) => chalk.gray(text),
|
|
26
|
+
/** Banner principal estilo Gemini CLI: logo + nome + versão */
|
|
27
|
+
banner: (customVersion) => {
|
|
28
|
+
const ver = customVersion ?? VERSION;
|
|
29
|
+
const line1 = logo() + ' ' + chalk.whiteBright.bold('Pokt CLI') + chalk.gray(` v${ver}`);
|
|
30
|
+
return line1;
|
|
31
|
+
},
|
|
32
|
+
/** Status de login / provider (uma linha) */
|
|
33
|
+
statusLine: (providerLabel, configPath = '/config') => {
|
|
34
|
+
const auth = chalk.gray(`Logged in with ${providerLabel} ${chalk.underline(configPath)}`);
|
|
35
|
+
return auth;
|
|
36
|
+
},
|
|
37
|
+
/** Seção "Tips for getting started" */
|
|
38
|
+
tips: () => {
|
|
39
|
+
const title = chalk.white('Tips for getting started:');
|
|
40
|
+
const tips = [
|
|
41
|
+
chalk.gray('1. /help for more information'),
|
|
42
|
+
chalk.gray('2. Ask coding questions, edit code or run commands'),
|
|
43
|
+
chalk.gray('3. Be specific for the best results'),
|
|
44
|
+
].join('\n');
|
|
45
|
+
return title + '\n' + tips;
|
|
46
|
+
},
|
|
47
|
+
/** Linha de atalhos acima do input */
|
|
48
|
+
shortcutsLine: (left = 'shift+tab to accept edits', right = '? for shortcuts', center) => {
|
|
49
|
+
const l = chalk.gray(left);
|
|
50
|
+
const r = chalk.gray(right);
|
|
51
|
+
const c = center ? chalk.gray(center) : '';
|
|
52
|
+
const cl = center?.length ?? 0;
|
|
53
|
+
if (c)
|
|
54
|
+
return l + ' '.repeat(Math.max(0, 40 - left.length - cl)) + c + ' '.repeat(Math.max(0, 20 - right.length)) + r;
|
|
55
|
+
return l + ' '.repeat(Math.max(0, 60 - left.length - right.length)) + r;
|
|
56
|
+
},
|
|
57
|
+
/** Placeholder do input */
|
|
58
|
+
inputPlaceholder: () => chalk.gray('Type your message or @path/to/file'),
|
|
59
|
+
/** Barra de status inferior: path, branch, sandbox, model */
|
|
60
|
+
statusBar: (opts) => {
|
|
61
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
62
|
+
const short = cwd.replace(process.env.HOME || process.env.USERPROFILE || '', '~');
|
|
63
|
+
const branch = opts.branch ?? getGitBranch();
|
|
64
|
+
const sandbox = opts.sandbox ?? chalk.red('no sandbox') + chalk.gray(' (see /docs)');
|
|
65
|
+
const model = opts.model ?? chalk.gray('/model Auto');
|
|
66
|
+
const left = chalk.white(short + (branch ? ` (${branch})` : ''));
|
|
67
|
+
return left + ' ' + sandbox + ' ' + model;
|
|
68
|
+
},
|
|
69
|
+
/** Separador visual sutil */
|
|
70
|
+
separator: () => chalk.gray('─'.repeat(50)),
|
|
71
|
+
};
|
|
72
|
+
function getGitBranch() {
|
|
73
|
+
try {
|
|
74
|
+
const gitHead = path.join(process.cwd(), '.git', 'HEAD');
|
|
75
|
+
if (!fs.existsSync(gitHead))
|
|
76
|
+
return '';
|
|
77
|
+
const content = fs.readFileSync(gitHead, 'utf8').trim();
|
|
78
|
+
const match = content.match(/ref: refs\/heads\/(.+)/);
|
|
79
|
+
return match ? match[1] + (hasUncommitted() ? '*' : '') : '';
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function hasUncommitted() {
|
|
86
|
+
try {
|
|
87
|
+
execSync('git diff --quiet && git diff --cached --quiet', { stdio: 'ignore' });
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pokt-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
+
}
|