@goldensheepai/toknxr-cli 0.3.0 → 0.4.1
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 +55 -2
- package/lib/branding.js +209 -0
- package/lib/cli.js +666 -117
- package/lib/commands/hallucination-commands.js +453 -0
- package/lib/enhanced-hallucination-detector.js +622 -0
- package/lib/execution-based-detector.js +538 -0
- package/lib/execution-sandbox.js +602 -0
- package/lib/feedback.js +406 -0
- package/lib/hallucination-database-service.js +447 -0
- package/lib/hallucination-patterns.js +490 -0
- package/lib/types/database-types.js +5 -0
- package/lib/types/hallucination-types.js +74 -0
- package/lib/types/index.js +8 -0
- package/lib/ui.js +153 -6
- package/package.json +1 -1
- package/lib/auth.js +0 -73
- package/lib/cli.test.js +0 -49
- package/lib/code-review.js +0 -319
- package/lib/config.js +0 -7
- package/lib/sync.js +0 -117
package/README.md
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
-
# TokNXR - AI Usage Analytics &
|
|
1
|
+
# TokNXR CLI - AI Usage Analytics & Code Quality Analysis
|
|
2
2
|
|
|
3
|
-
🚀 **
|
|
3
|
+
🚀 **Enhanced CLI Experience** - Beautiful, branded interface with comprehensive AI analytics, cost monitoring, and code quality analysis.
|
|
4
|
+
|
|
5
|
+
## 🎨 Enhanced CLI Interface
|
|
6
|
+
|
|
7
|
+
TokNXR now features a completely redesigned CLI experience with:
|
|
8
|
+
|
|
9
|
+
### ✨ **Golden Sheep AI Branding**
|
|
10
|
+
- Beautiful ASCII art logos and welcome messages
|
|
11
|
+
- Professional visual identity throughout the interface
|
|
12
|
+
- Contextual greetings and time-of-day messages
|
|
13
|
+
- Consistent color schemes and styling
|
|
14
|
+
|
|
15
|
+
### 🖥️ **Interactive Menu System**
|
|
16
|
+
```bash
|
|
17
|
+
# Launch the enhanced interactive menu
|
|
18
|
+
toknxr menu
|
|
19
|
+
|
|
20
|
+
# Or simply run without commands for automatic menu
|
|
21
|
+
toknxr
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 🎯 **Smart Welcome Experience**
|
|
25
|
+
```bash
|
|
26
|
+
# See the full branding and onboarding experience
|
|
27
|
+
toknxr welcome
|
|
28
|
+
|
|
29
|
+
# Display just the logos and branding
|
|
30
|
+
toknxr logo
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 🏥 **Enhanced System Diagnostics**
|
|
34
|
+
```bash
|
|
35
|
+
# Professional diagnostic interface with categorized results
|
|
36
|
+
toknxr doctor
|
|
37
|
+
|
|
38
|
+
# Visual status indicators and smart recommendations
|
|
39
|
+
toknxr init
|
|
40
|
+
```
|
|
4
41
|
|
|
5
42
|
## 🔥 Quick Start (ONE COMMAND!)
|
|
6
43
|
|
|
@@ -379,6 +416,22 @@ result = response.json()
|
|
|
379
416
|
|
|
380
417
|
## 📊 Analytics & Monitoring
|
|
381
418
|
|
|
419
|
+
### Enhanced CLI Commands
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# Interactive menu with branding and system status
|
|
423
|
+
toknxr menu # Full interactive experience
|
|
424
|
+
toknxr # Same as menu (default command)
|
|
425
|
+
|
|
426
|
+
# Welcome and branding
|
|
427
|
+
toknxr welcome # Complete onboarding experience
|
|
428
|
+
toknxr logo # Display TokNXR and Golden Sheep AI logos
|
|
429
|
+
|
|
430
|
+
# System management
|
|
431
|
+
toknxr init # Enhanced setup wizard
|
|
432
|
+
toknxr doctor # Professional diagnostic interface
|
|
433
|
+
```
|
|
434
|
+
|
|
382
435
|
### View Usage Statistics
|
|
383
436
|
|
|
384
437
|
```bash
|
package/lib/branding.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* ASCII Art and Branding for TokNXR CLI
|
|
4
|
+
* Contains all the visual elements that make the CLI experience more engaging
|
|
5
|
+
*/
|
|
6
|
+
// Golden Sheep AI Logo - ASCII Art
|
|
7
|
+
export const GOLDEN_SHEEP_LOGO = `
|
|
8
|
+
${chalk.yellow.bold('*******************************************************************')}
|
|
9
|
+
${chalk.yellow.bold('* *')}
|
|
10
|
+
${chalk.yellow.bold('* *')}
|
|
11
|
+
${chalk.yellow.bold('* :::===== :::==== ::: :::==== :::===== :::= === *')}
|
|
12
|
+
${chalk.yellow.bold('* ::: ::: === ::: ::: === ::: :::===== *')}
|
|
13
|
+
${chalk.yellow.bold('* === ===== === === === === === ====== ======== *')}
|
|
14
|
+
${chalk.yellow.bold('* === === === === === === === === === ==== *')}
|
|
15
|
+
${chalk.yellow.bold('* ======= ====== ======== ======= ======== === === *')}
|
|
16
|
+
${chalk.yellow.bold('* *')}
|
|
17
|
+
${chalk.yellow.bold('* :::=== ::: === :::===== :::===== :::==== :::==== ::: *')}
|
|
18
|
+
${chalk.yellow.bold('* ::: ::: === ::: ::: ::: === ::: === ::: *')}
|
|
19
|
+
${chalk.yellow.bold('* ===== ======== ====== ====== ======= ======== === *')}
|
|
20
|
+
${chalk.yellow.bold('* === === === === === === === === === *')}
|
|
21
|
+
${chalk.yellow.bold('* ====== === === ======== ======== === === === === *')}
|
|
22
|
+
${chalk.yellow.bold('* *')}
|
|
23
|
+
${chalk.yellow.bold('* *')}
|
|
24
|
+
${chalk.yellow.bold('*******************************************************************')}
|
|
25
|
+
`;
|
|
26
|
+
// TokNXR Brand Logo
|
|
27
|
+
export const TOKNXR_LOGO = `
|
|
28
|
+
${chalk.cyan.bold('████████╗ ██████╗ ██╗ ██╗███╗ ██╗██╗ ██╗██████╗ ')}
|
|
29
|
+
${chalk.cyan.bold('╚══██╔══╝██╔═══██╗██║ ██╔╝████╗ ██║╚██╗██╔╝██╔══██╗')}
|
|
30
|
+
${chalk.cyan.bold(' ██║ ██║ ██║█████╔╝ ██╔██╗ ██║ ╚███╔╝ ██████╔╝')}
|
|
31
|
+
${chalk.cyan.bold(' ██║ ██║ ██║██╔═██╗ ██║╚██╗██║ ██╔██╗ ██╔══██╗')}
|
|
32
|
+
${chalk.cyan.bold(' ██║ ╚██████╔╝██║ ██╗██║ ╚████║██╔╝ ██╗██║ ██║')}
|
|
33
|
+
${chalk.cyan.bold(' ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝')}
|
|
34
|
+
|
|
35
|
+
${chalk.gray(' AI Effectiveness & Code Quality Analysis')}
|
|
36
|
+
`;
|
|
37
|
+
// TokNXR Compact Logo for constrained spaces
|
|
38
|
+
export const TOKNXR_COMPACT_LOGO = `
|
|
39
|
+
${chalk.cyan.bold('████████╗ ██████╗ ██╗ ██╗███╗ ██╗██╗ ██╗██████╗ ')}
|
|
40
|
+
${chalk.cyan.bold('╚══██╔══╝██╔═══██╗██║ ██╔╝████╗ ██║╚██╗██╔╝██╔══██╗')}
|
|
41
|
+
${chalk.cyan.bold(' ██║ ██║ ██║█████╔╝ ██╔██╗ ██║ ╚███╔╝ ██████╔╝')}
|
|
42
|
+
${chalk.cyan.bold(' ██║ ██║ ██║██╔═██╗ ██║╚██╗██║ ██╔██╗ ██╔══██╗')}
|
|
43
|
+
${chalk.cyan.bold(' ██║ ╚██████╔╝██║ ██╗██║ ╚████║██╔╝ ██╗██║ ██║')}
|
|
44
|
+
${chalk.cyan.bold(' ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝')}
|
|
45
|
+
`;
|
|
46
|
+
// Custom TokNXR logo with 00000 pattern
|
|
47
|
+
export const TOKNXR_CUSTOM_LOGO = `
|
|
48
|
+
${chalk.cyan.bold(' ')}
|
|
49
|
+
${chalk.cyan.bold(' ')}
|
|
50
|
+
${chalk.cyan.bold(' ')}
|
|
51
|
+
${chalk.cyan.bold(' ')}
|
|
52
|
+
${chalk.cyan.bold(' 00000 ')}
|
|
53
|
+
${chalk.cyan.bold(' 00000000 ')}
|
|
54
|
+
${chalk.cyan.bold(' 000000000 ')}
|
|
55
|
+
${chalk.cyan.bold(' 000000000 ')}
|
|
56
|
+
${chalk.cyan.bold(' 00000000000 00000 000000 000000000 000000 00000 0000000 ')}
|
|
57
|
+
${chalk.cyan.bold(' 00000000000 00000 000000 00000 00000 0000000000 ')}
|
|
58
|
+
${chalk.cyan.bold(' 00000000000 00000 00000 0000000000 00000000000 ')}
|
|
59
|
+
${chalk.cyan.bold(' 000000 0000000000 0000000000 0000000000 00000000 00000 00000 ')}
|
|
60
|
+
${chalk.cyan.bold(' 000000 000000000000 0000000000 00000000000 00000000 00000000000 ')}
|
|
61
|
+
${chalk.cyan.bold(' 000000 00000000000000000000000 00000000000 0000000 0000000000 ')}
|
|
62
|
+
${chalk.cyan.bold(' 000000 000000 0000000000000000 00000 00000 00000000 0000000000 ')}
|
|
63
|
+
${chalk.cyan.bold(' 000000 0000000000000 00000 00000 00000 00000 0000000000 00000000000 ')}
|
|
64
|
+
${chalk.cyan.bold(' 000000 00000000000 00000 000000 00000 00000 000000000000 00000 00000 ')}
|
|
65
|
+
${chalk.cyan.bold(' 000000 0000000 00000 00000000000 00000 00000 00000 00000 00000 ')}
|
|
66
|
+
${chalk.cyan.bold(' ')}
|
|
67
|
+
${chalk.cyan.bold(' ')}
|
|
68
|
+
${chalk.cyan.bold(' 000000000 ')}
|
|
69
|
+
${chalk.cyan.bold(' 000000000 ')}
|
|
70
|
+
${chalk.cyan.bold(' 00000 ')}
|
|
71
|
+
`;
|
|
72
|
+
// Welcome message from Golden Sheep AI
|
|
73
|
+
export const WELCOME_MESSAGE = () => {
|
|
74
|
+
const messages = [
|
|
75
|
+
'Welcome to the most advanced AI development analytics platform!',
|
|
76
|
+
'Ready to supercharge your AI development workflow?',
|
|
77
|
+
'Let\'s analyze some AI code quality together!',
|
|
78
|
+
'Time to turn AI interactions into actionable insights!',
|
|
79
|
+
'Your AI development companion is ready to serve!'
|
|
80
|
+
];
|
|
81
|
+
const randomMessage = messages[Math.floor(Math.random() * messages.length)];
|
|
82
|
+
return `
|
|
83
|
+
${chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
|
|
84
|
+
|
|
85
|
+
${chalk.yellow.bold('👋 Message from Golden Sheep AI:')}
|
|
86
|
+
${chalk.white(randomMessage)}
|
|
87
|
+
|
|
88
|
+
${chalk.gray('TokNXR helps you track token usage, analyze code quality, and detect hallucinations')}
|
|
89
|
+
${chalk.gray('in your AI-generated code. Everything runs locally for maximum privacy and speed.')}
|
|
90
|
+
|
|
91
|
+
${chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
|
|
92
|
+
`;
|
|
93
|
+
};
|
|
94
|
+
// System status indicators
|
|
95
|
+
export const createSystemStatus = (proxyRunning, configExists, hasData) => `
|
|
96
|
+
${chalk.bold('🔧 System Status:')}
|
|
97
|
+
${proxyRunning ? chalk.green('✅ Proxy Server') : chalk.red('❌ Proxy Server')} ${chalk.gray('(8788)')}
|
|
98
|
+
${configExists ? chalk.green('✅ Configuration') : chalk.red('❌ Configuration')} ${chalk.gray('(toknxr.config.json)')}
|
|
99
|
+
${hasData ? chalk.green('✅ Analytics Data') : chalk.yellow('⚠️ Analytics Data')} ${chalk.gray('(interactions.log)')}
|
|
100
|
+
`;
|
|
101
|
+
// Quick stats display
|
|
102
|
+
export const createQuickStats = (totalCost, totalRequests, avgQuality) => `
|
|
103
|
+
${chalk.bold('📊 Quick Stats:')}
|
|
104
|
+
${chalk.cyan('Total Spent:')} ${chalk.green(`$${totalCost.toFixed(2)}`)}
|
|
105
|
+
${chalk.cyan('AI Requests:')} ${chalk.blue(totalRequests.toLocaleString())}
|
|
106
|
+
${chalk.cyan('Avg Quality:')} ${avgQuality >= 80 ? chalk.green(`${avgQuality}/100`) : avgQuality >= 60 ? chalk.yellow(`${avgQuality}/100`) : chalk.red(`${avgQuality}/100`)}
|
|
107
|
+
`;
|
|
108
|
+
// Animated loading indicators
|
|
109
|
+
export const createLoadingAnimation = (message) => {
|
|
110
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
111
|
+
let i = 0;
|
|
112
|
+
return setInterval(() => {
|
|
113
|
+
process.stdout.write(`\r${chalk.cyan(frames[i++ % frames.length])} ${message}`);
|
|
114
|
+
}, 100);
|
|
115
|
+
};
|
|
116
|
+
// Success/Error decorative boxes
|
|
117
|
+
export const createSuccessBox = (title, message) => `
|
|
118
|
+
${chalk.green('╔══════════════════════════════════════════════════════════════════════════════════╗')}
|
|
119
|
+
${chalk.green('║')} ${chalk.green.bold('✨ ' + title)} ${' '.repeat(Math.max(0, 75 - title.length))} ${chalk.green('║')}
|
|
120
|
+
${chalk.green('╠══════════════════════════════════════════════════════════════════════════════════╣')}
|
|
121
|
+
${chalk.green('║')} ${message} ${' '.repeat(Math.max(0, 78 - message.length))} ${chalk.green('║')}
|
|
122
|
+
${chalk.green('╚══════════════════════════════════════════════════════════════════════════════════╝')}
|
|
123
|
+
`;
|
|
124
|
+
export const createErrorBox = (title, message, hint) => `
|
|
125
|
+
${chalk.red('╔══════════════════════════════════════════════════════════════════════════════════╗')}
|
|
126
|
+
${chalk.red('║')} ${chalk.red.bold('❌ ' + title)} ${' '.repeat(Math.max(0, 75 - title.length))} ${chalk.red('║')}
|
|
127
|
+
${chalk.red('╠══════════════════════════════════════════════════════════════════════════════════╣')}
|
|
128
|
+
${chalk.red('║')} ${message} ${' '.repeat(Math.max(0, 78 - message.length))} ${chalk.red('║')}
|
|
129
|
+
${hint ? `${chalk.red('║')} ${chalk.yellow('💡 ' + hint)} ${' '.repeat(Math.max(0, 75 - hint.length))} ${chalk.red('║')}` : ''}
|
|
130
|
+
${chalk.red('╚══════════════════════════════════════════════════════════════════════════════════╝')}
|
|
131
|
+
`;
|
|
132
|
+
// Version and build info
|
|
133
|
+
export const createVersionInfo = (version) => `
|
|
134
|
+
${chalk.gray(`v${version}`)} ${chalk.gray('•')} ${chalk.gray('Built by Golden Sheep AI')} ${chalk.gray('•')} ${chalk.gray('Open Source')}
|
|
135
|
+
${chalk.gray('Report issues:')} ${chalk.blue('https://github.com/goldensheepai/toknxr')}
|
|
136
|
+
`;
|
|
137
|
+
// Menu section headers with emojis and styling
|
|
138
|
+
export const MENU_SECTIONS = {
|
|
139
|
+
CORE_OPERATIONS: {
|
|
140
|
+
title: chalk.cyan.bold('🚀 Core Operations'),
|
|
141
|
+
description: chalk.gray('Essential tracking and monitoring features')
|
|
142
|
+
},
|
|
143
|
+
ANALYTICS: {
|
|
144
|
+
title: chalk.magenta.bold('📊 Analytics & Insights'),
|
|
145
|
+
description: chalk.gray('Deep dive into your AI usage patterns')
|
|
146
|
+
},
|
|
147
|
+
QUALITY_CONTROL: {
|
|
148
|
+
title: chalk.yellow.bold('🔍 Quality Control'),
|
|
149
|
+
description: chalk.gray('Code quality and hallucination detection')
|
|
150
|
+
},
|
|
151
|
+
SYSTEM_MANAGEMENT: {
|
|
152
|
+
title: chalk.red.bold('⚙️ System Management'),
|
|
153
|
+
description: chalk.gray('Configuration and maintenance tools')
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
// Tip of the day/random helpful tips
|
|
157
|
+
export const getRandomTip = () => {
|
|
158
|
+
const tips = [
|
|
159
|
+
'💡 Use "toknxr start" to begin tracking AI interactions in real-time',
|
|
160
|
+
'💡 Check "toknxr stats" regularly to monitor your AI spending',
|
|
161
|
+
'💡 Run "toknxr doctor" if you encounter any issues',
|
|
162
|
+
'💡 Set up budget alerts with "toknxr budget --set 50" to control costs',
|
|
163
|
+
'💡 Use "toknxr search" to find specific interactions quickly',
|
|
164
|
+
'💡 Export your data with "toknxr export" for external analysis',
|
|
165
|
+
'💡 Monitor code quality with "toknxr code-analysis" after coding sessions',
|
|
166
|
+
'💡 The proxy server runs on port 8788 by default',
|
|
167
|
+
'💡 All data is stored locally for maximum privacy',
|
|
168
|
+
'💡 Use "toknxr browse" to explore your interaction history'
|
|
169
|
+
];
|
|
170
|
+
return tips[Math.floor(Math.random() * tips.length)];
|
|
171
|
+
};
|
|
172
|
+
// Seasonal/contextual decorations
|
|
173
|
+
export const getContextualDecoration = () => {
|
|
174
|
+
const hour = new Date().getHours();
|
|
175
|
+
if (hour < 6)
|
|
176
|
+
return '🌙 Late night coding session?';
|
|
177
|
+
if (hour < 12)
|
|
178
|
+
return '🌅 Good morning, developer!';
|
|
179
|
+
if (hour < 17)
|
|
180
|
+
return '☀️ Productive afternoon ahead!';
|
|
181
|
+
if (hour < 21)
|
|
182
|
+
return '🌆 Evening development time!';
|
|
183
|
+
return '🌃 Night owl mode activated!';
|
|
184
|
+
};
|
|
185
|
+
// Color scheme helpers
|
|
186
|
+
export const COLORS = {
|
|
187
|
+
primary: chalk.cyan,
|
|
188
|
+
secondary: chalk.blue,
|
|
189
|
+
success: chalk.green,
|
|
190
|
+
warning: chalk.yellow,
|
|
191
|
+
error: chalk.red,
|
|
192
|
+
muted: chalk.gray,
|
|
193
|
+
highlight: chalk.magenta,
|
|
194
|
+
accent: chalk.white.bold
|
|
195
|
+
};
|
|
196
|
+
// Box drawing characters for consistent styling
|
|
197
|
+
export const BOX_CHARS = {
|
|
198
|
+
topLeft: '╔',
|
|
199
|
+
topRight: '╗',
|
|
200
|
+
bottomLeft: '╚',
|
|
201
|
+
bottomRight: '╝',
|
|
202
|
+
horizontal: '═',
|
|
203
|
+
vertical: '║',
|
|
204
|
+
teeDown: '╦',
|
|
205
|
+
teeUp: '╩',
|
|
206
|
+
teeRight: '╠',
|
|
207
|
+
teeLeft: '╣',
|
|
208
|
+
cross: '╬'
|
|
209
|
+
};
|