matex-cli 1.2.82 → 1.2.87
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/index.js +561 -288
- package/package.json +13 -6
- package/.agents/skills/mcp-server-dev/SKILL.md +0 -60
- package/.agents/skills/mcp-server-dev/examples/basic-ts-server/package.json +0 -20
- package/.agents/skills/mcp-server-dev/examples/basic-ts-server/src/index.ts +0 -66
- package/.agents/skills/mcp-server-dev/resources/best_practices.md +0 -20
- package/.agents/skills/pptx-presentation-builder/SKILL.md +0 -338
- package/.agents/workflows/deploy.md +0 -27
- package/dist/api/client.d.ts +0 -40
- package/dist/api/client.d.ts.map +0 -1
- package/dist/api/client.js +0 -173
- package/dist/api/client.js.map +0 -1
- package/dist/commands/ask.d.ts +0 -3
- package/dist/commands/ask.d.ts.map +0 -1
- package/dist/commands/ask.js +0 -63
- package/dist/commands/ask.js.map +0 -1
- package/dist/commands/augov.d.ts +0 -3
- package/dist/commands/augov.d.ts.map +0 -1
- package/dist/commands/augov.js +0 -273
- package/dist/commands/augov.js.map +0 -1
- package/dist/commands/bro.d.ts +0 -4
- package/dist/commands/bro.d.ts.map +0 -1
- package/dist/commands/bro.js +0 -304
- package/dist/commands/bro.js.map +0 -1
- package/dist/commands/chaos.d.ts +0 -3
- package/dist/commands/chaos.d.ts.map +0 -1
- package/dist/commands/chaos.js +0 -63
- package/dist/commands/chaos.js.map +0 -1
- package/dist/commands/chat.d.ts +0 -3
- package/dist/commands/chat.d.ts.map +0 -1
- package/dist/commands/chat.js +0 -59
- package/dist/commands/chat.js.map +0 -1
- package/dist/commands/code.d.ts +0 -3
- package/dist/commands/code.d.ts.map +0 -1
- package/dist/commands/code.js +0 -94
- package/dist/commands/code.js.map +0 -1
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -74
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -3
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -66
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/help.d.ts +0 -3
- package/dist/commands/help.d.ts.map +0 -1
- package/dist/commands/help.js +0 -50
- package/dist/commands/help.js.map +0 -1
- package/dist/commands/login.d.ts +0 -3
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -47
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/models.d.ts +0 -3
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -77
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/student.d.ts +0 -3
- package/dist/commands/student.d.ts.map +0 -1
- package/dist/commands/student.js +0 -28
- package/dist/commands/student.js.map +0 -1
- package/dist/commands/study.d.ts +0 -3
- package/dist/commands/study.d.ts.map +0 -1
- package/dist/commands/study.js +0 -72
- package/dist/commands/study.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/prompts/banter-augov.d.ts +0 -2
- package/dist/prompts/banter-augov.d.ts.map +0 -1
- package/dist/prompts/banter-augov.js +0 -21
- package/dist/prompts/banter-augov.js.map +0 -1
- package/dist/prompts/banter.d.ts +0 -6
- package/dist/prompts/banter.d.ts.map +0 -1
- package/dist/prompts/banter.js +0 -101
- package/dist/prompts/banter.js.map +0 -1
- package/dist/prompts/chaos-prompts.d.ts +0 -3
- package/dist/prompts/chaos-prompts.d.ts.map +0 -1
- package/dist/prompts/chaos-prompts.js +0 -52
- package/dist/prompts/chaos-prompts.js.map +0 -1
- package/dist/prompts/system-prompts.d.ts +0 -4
- package/dist/prompts/system-prompts.d.ts.map +0 -1
- package/dist/prompts/system-prompts.js +0 -148
- package/dist/prompts/system-prompts.js.map +0 -1
- package/dist/session/agent-session.d.ts +0 -41
- package/dist/session/agent-session.d.ts.map +0 -1
- package/dist/session/agent-session.js +0 -421
- package/dist/session/agent-session.js.map +0 -1
- package/dist/utils/agent-orchestrator.d.ts +0 -44
- package/dist/utils/agent-orchestrator.d.ts.map +0 -1
- package/dist/utils/agent-orchestrator.js +0 -244
- package/dist/utils/agent-orchestrator.js.map +0 -1
- package/dist/utils/augov-logger.d.ts +0 -11
- package/dist/utils/augov-logger.d.ts.map +0 -1
- package/dist/utils/augov-logger.js +0 -35
- package/dist/utils/augov-logger.js.map +0 -1
- package/dist/utils/augov-scrubber.d.ts +0 -23
- package/dist/utils/augov-scrubber.d.ts.map +0 -1
- package/dist/utils/augov-scrubber.js +0 -68
- package/dist/utils/augov-scrubber.js.map +0 -1
- package/dist/utils/command-executor.d.ts +0 -56
- package/dist/utils/command-executor.d.ts.map +0 -1
- package/dist/utils/command-executor.js +0 -507
- package/dist/utils/command-executor.js.map +0 -1
- package/dist/utils/config.d.ts +0 -56
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -139
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/mcp-server.d.ts +0 -77
- package/dist/utils/mcp-server.d.ts.map +0 -1
- package/dist/utils/mcp-server.js +0 -390
- package/dist/utils/mcp-server.js.map +0 -1
- package/dist/utils/patcher.d.ts +0 -45
- package/dist/utils/patcher.d.ts.map +0 -1
- package/dist/utils/patcher.js +0 -202
- package/dist/utils/patcher.js.map +0 -1
- package/dist/utils/repo-mapper.d.ts +0 -32
- package/dist/utils/repo-mapper.d.ts.map +0 -1
- package/dist/utils/repo-mapper.js +0 -214
- package/dist/utils/repo-mapper.js.map +0 -1
- package/dist/utils/spinner.d.ts +0 -15
- package/dist/utils/spinner.d.ts.map +0 -1
- package/dist/utils/spinner.js +0 -67
- package/dist/utils/spinner.js.map +0 -1
- package/dist/utils/tui.d.ts +0 -134
- package/dist/utils/tui.d.ts.map +0 -1
- package/dist/utils/tui.js +0 -702
- package/dist/utils/tui.js.map +0 -1
- package/fix-npm-permissions.sh +0 -23
- package/publish-local.sh +0 -16
- package/skills-lock.json +0 -10
- package/src/api/client.ts +0 -197
- package/src/commands/ask.ts +0 -62
- package/src/commands/augov.ts +0 -301
- package/src/commands/bro.ts +0 -336
- package/src/commands/chaos.ts +0 -67
- package/src/commands/chat.ts +0 -61
- package/src/commands/code.ts +0 -99
- package/src/commands/config.ts +0 -78
- package/src/commands/dev.ts +0 -68
- package/src/commands/help.ts +0 -67
- package/src/commands/login.ts +0 -47
- package/src/commands/models.ts +0 -81
- package/src/commands/student.ts +0 -23
- package/src/commands/study.ts +0 -75
- package/src/index.ts +0 -284
- package/src/prompts/banter-augov.ts +0 -17
- package/src/prompts/banter.ts +0 -101
- package/src/prompts/chaos-prompts.ts +0 -48
- package/src/prompts/system-prompts.ts +0 -145
- package/src/session/agent-session.ts +0 -428
- package/src/utils/agent-orchestrator.ts +0 -264
- package/src/utils/augov-logger.ts +0 -34
- package/src/utils/augov-scrubber.ts +0 -67
- package/src/utils/command-executor.ts +0 -529
- package/src/utils/config.ts +0 -124
- package/src/utils/mcp-server.ts +0 -388
- package/src/utils/patcher.ts +0 -229
- package/src/utils/repo-mapper.ts +0 -198
- package/src/utils/spinner.ts +0 -66
- package/src/utils/tui.ts +0 -749
- package/test-chaos-container.js +0 -16
- package/test-chaos-fix.js +0 -18
- package/test-config.ts +0 -2
- package/test-ui-output.js +0 -16
- package/tsconfig.json +0 -27
- package/vertex_ai_agent.py +0 -52
package/src/commands/chaos.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { configManager } from '../utils/config';
|
|
5
|
-
import { MatexAPIClient, ChatMessage } from '../api/client';
|
|
6
|
-
import { AgentOrchestrator } from '../utils/agent-orchestrator';
|
|
7
|
-
import { RepoMapper } from '../utils/repo-mapper';
|
|
8
|
-
import { TUI } from '../utils/tui';
|
|
9
|
-
import { AgentSession } from '../session/agent-session';
|
|
10
|
-
import { BRO_BANTER_CHAOS, getChaosSystemPrompt } from '../prompts/chaos-prompts';
|
|
11
|
-
|
|
12
|
-
export const chaosCommand = new Command('chaos')
|
|
13
|
-
.description('Start unhinged, narrative-driven CHAOS mode with Grok 4.1 Fast')
|
|
14
|
-
.option('--no-execute', 'Disable auto-prompt for command execution')
|
|
15
|
-
.action(async (options: any) => {
|
|
16
|
-
try {
|
|
17
|
-
// Chaos mode requires an API key in the backend, but we still need the Matex one to connect
|
|
18
|
-
const apiKey = configManager.getAPIKey();
|
|
19
|
-
if (!apiKey) {
|
|
20
|
-
console.log(chalk.red('🌪️ CHAOS DENIED. You need a key.'));
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
25
|
-
|
|
26
|
-
TUI.init();
|
|
27
|
-
TUI.drawDevOrchestratorUI('matex-chaos'); // Container UI like dev command
|
|
28
|
-
AgentOrchestrator.setMode('chaos');
|
|
29
|
-
|
|
30
|
-
// Chaos-specific header below the container
|
|
31
|
-
console.log(chalk.bold.hex('#FF00FF')('🌪️ CHAOS MODE ENGAGED 🌪️'));
|
|
32
|
-
console.log(chalk.hex('#FF00FF')('Powered by Grok 4.1 Fast. Zero filters. Maximum bickering.\n'));
|
|
33
|
-
|
|
34
|
-
TUI.drawStatusBar('Waking up the absolute worst engineers...');
|
|
35
|
-
AgentOrchestrator.announce('Grokking Repository Structure (Lazily)...');
|
|
36
|
-
|
|
37
|
-
const currentDir = process.cwd();
|
|
38
|
-
const repoMap = await new RepoMapper(currentDir).generateMap();
|
|
39
|
-
|
|
40
|
-
TUI.drawStatusBar('The swarm is awake and already fighting.');
|
|
41
|
-
TUI.drawAjayDialogue('(Sigh) What do you want now? Make it quick.');
|
|
42
|
-
|
|
43
|
-
const initialMessages: ChatMessage[] = [
|
|
44
|
-
{
|
|
45
|
-
role: 'system',
|
|
46
|
-
content: getChaosSystemPrompt(currentDir, repoMap)
|
|
47
|
-
}
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
const session = new AgentSession({
|
|
51
|
-
client,
|
|
52
|
-
model: 'matex-chaos', // Force the chaos model override for Grok
|
|
53
|
-
execute: options.execute !== false,
|
|
54
|
-
initialMessages,
|
|
55
|
-
broBanter: BRO_BANTER_CHAOS,
|
|
56
|
-
sleepyAjayProtocol: 'chaos',
|
|
57
|
-
baseDir: currentDir
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
await session.start();
|
|
61
|
-
|
|
62
|
-
} catch (error: any) {
|
|
63
|
-
TUI.exit();
|
|
64
|
-
console.error(chalk.red(`\n❌ Chaos Error: ${error.message}`));
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
});
|
package/src/commands/chat.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { configManager } from '../utils/config';
|
|
4
|
-
import { MatexAPIClient, ChatMessage } from '../api/client';
|
|
5
|
-
import { AgentOrchestrator } from '../utils/agent-orchestrator';
|
|
6
|
-
import { RepoMapper } from '../utils/repo-mapper';
|
|
7
|
-
import { TUI } from '../utils/tui';
|
|
8
|
-
import { AgentSession } from '../session/agent-session';
|
|
9
|
-
import { BRO_BANTER_CHAT } from '../prompts/banter';
|
|
10
|
-
import { getChatSystemPrompt } from '../prompts/system-prompts';
|
|
11
|
-
|
|
12
|
-
export const chatCommand = new Command('chat')
|
|
13
|
-
.description('Start an interactive chat session with the MATEX Bro-Swarm')
|
|
14
|
-
.option('-m, --model <model>', 'AI model to use (matex-free, matexai, matexcodex, matexelite)', configManager.getDefaultModel())
|
|
15
|
-
.option('--execute', 'Enable command execution in chat')
|
|
16
|
-
.action(async (options: any) => {
|
|
17
|
-
try {
|
|
18
|
-
const apiKey = configManager.getAPIKey();
|
|
19
|
-
if (!apiKey) {
|
|
20
|
-
console.error(chalk.red('❌ No API key configured. Run: matex config set-key <key>'));
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
25
|
-
|
|
26
|
-
TUI.init();
|
|
27
|
-
AgentOrchestrator.setMode('chat');
|
|
28
|
-
TUI.drawStatusBar('Brothers are ready to chat.');
|
|
29
|
-
|
|
30
|
-
const extraPrompt = options.model === 'matex-free' ? AgentOrchestrator.getFreeTierPrompt() : '';
|
|
31
|
-
const currentSessionCwd = process.cwd();
|
|
32
|
-
|
|
33
|
-
const repoMap = await new RepoMapper(currentSessionCwd).generateMap();
|
|
34
|
-
|
|
35
|
-
const initialMessages: ChatMessage[] = [
|
|
36
|
-
{
|
|
37
|
-
role: 'system',
|
|
38
|
-
content: getChatSystemPrompt(currentSessionCwd, repoMap, extraPrompt)
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
console.log(chalk.green('MATEX Brothers are Online.'));
|
|
43
|
-
console.log(chalk.green('Speak your mind brother, the swarm is listening...'));
|
|
44
|
-
|
|
45
|
-
const session = new AgentSession({
|
|
46
|
-
client,
|
|
47
|
-
model: options.model,
|
|
48
|
-
execute: options.execute || false,
|
|
49
|
-
initialMessages,
|
|
50
|
-
broBanter: BRO_BANTER_CHAT,
|
|
51
|
-
sleepyAjayProtocol: options.model !== 'matex-free' ? 'dev' : undefined,
|
|
52
|
-
baseDir: currentSessionCwd
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
await session.start();
|
|
56
|
-
|
|
57
|
-
} catch (outerError: any) {
|
|
58
|
-
console.error(chalk.red(`\n❌ Session error: ${outerError.message}`));
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
});
|
package/src/commands/code.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { configManager } from '../utils/config';
|
|
4
|
-
import { MatexAPIClient } from '../api/client';
|
|
5
|
-
import { spinner } from '../utils/spinner';
|
|
6
|
-
import { executeWithPermission } from '../utils/command-executor';
|
|
7
|
-
|
|
8
|
-
export const codeCommand = new Command('code')
|
|
9
|
-
.description('Generate code with MATEXCodex (optimized for coding)')
|
|
10
|
-
.argument('<prompt>', 'What code do you need?')
|
|
11
|
-
.option('-o, --output <file>', 'Save output to file')
|
|
12
|
-
.option('-l, --language <lang>', 'Programming language (auto-detected if not specified)')
|
|
13
|
-
.option('-t, --temperature <number>', 'Temperature (0-1)', '0.3')
|
|
14
|
-
.option('--max-tokens <number>', 'Maximum tokens in response', '8000')
|
|
15
|
-
.option('-x, --execute', 'Execute commands found in response (with permission prompts)')
|
|
16
|
-
.action(async (prompt: string, options: any) => {
|
|
17
|
-
try {
|
|
18
|
-
// Check for API key
|
|
19
|
-
const apiKey = configManager.getAPIKey();
|
|
20
|
-
if (!apiKey) {
|
|
21
|
-
console.error(chalk.red('❌ No API key configured.'));
|
|
22
|
-
console.log(chalk.yellow('Run: matex config set-key <your-api-key>'));
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Create API client
|
|
27
|
-
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
28
|
-
|
|
29
|
-
// Enhance prompt for code generation
|
|
30
|
-
let enhancedPrompt = prompt;
|
|
31
|
-
if (options.language) {
|
|
32
|
-
enhancedPrompt = `Generate ${options.language} code: ${prompt}`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Show thinking indicator
|
|
36
|
-
spinner.start('Generating code with MATEXCodex...');
|
|
37
|
-
|
|
38
|
-
// Send request (always use matexcodex for code command)
|
|
39
|
-
const response = await client.chat({
|
|
40
|
-
messages: [
|
|
41
|
-
{ role: 'system', content: 'You are MATEXCodex, an expert coding assistant. Generate clean, production-ready code with comments and best practices. Always include complete, working code.' },
|
|
42
|
-
{ role: 'user', content: enhancedPrompt }
|
|
43
|
-
],
|
|
44
|
-
model: 'matexcodex',
|
|
45
|
-
temperature: parseFloat(options.temperature),
|
|
46
|
-
max_tokens: parseInt(options.maxTokens),
|
|
47
|
-
stream: false,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
spinner.succeed('Code generated!');
|
|
51
|
-
|
|
52
|
-
// Display response
|
|
53
|
-
console.log(chalk.cyan('\n💻 MATEXCodex:\n'));
|
|
54
|
-
console.log(chalk.white(response));
|
|
55
|
-
console.log();
|
|
56
|
-
|
|
57
|
-
// Save to file if requested
|
|
58
|
-
if (options.output) {
|
|
59
|
-
const fs = require('fs');
|
|
60
|
-
const path = require('path');
|
|
61
|
-
|
|
62
|
-
// Ensure directory exists
|
|
63
|
-
const dir = path.dirname(options.output);
|
|
64
|
-
if (!fs.existsSync(dir) && dir !== '.') {
|
|
65
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Extract code from response (remove markdown if present)
|
|
69
|
-
let codeContent = response;
|
|
70
|
-
const codeBlockMatch = response.match(/```[\w]*\n([\s\S]*?)```/);
|
|
71
|
-
if (codeBlockMatch) {
|
|
72
|
-
codeContent = codeBlockMatch[1];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
fs.writeFileSync(options.output, codeContent.trim());
|
|
76
|
-
console.log(chalk.green(`✅ Code saved to: ${options.output}`));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Execute commands if requested
|
|
80
|
-
if (options.execute) {
|
|
81
|
-
await executeWithPermission(response);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
} catch (error: any) {
|
|
85
|
-
spinner.fail('Code generation failed');
|
|
86
|
-
|
|
87
|
-
if (error.message.includes('403')) {
|
|
88
|
-
console.error(chalk.red('\n❌ Invalid or revoked API key.'));
|
|
89
|
-
console.log(chalk.yellow('Please check your API key or generate a new one from the MATEX AI platform.'));
|
|
90
|
-
} else if (error.message.includes('429')) {
|
|
91
|
-
console.error(chalk.red('\n❌ Rate limit exceeded.'));
|
|
92
|
-
console.log(chalk.yellow('Please wait a moment before trying again.'));
|
|
93
|
-
} else {
|
|
94
|
-
console.error(chalk.red(`\n❌ Error: ${error.message}`));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
process.exit(1);
|
|
98
|
-
}
|
|
99
|
-
});
|
package/src/commands/config.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { configManager } from '../utils/config';
|
|
4
|
-
import { spinner } from '../utils/spinner';
|
|
5
|
-
|
|
6
|
-
export const configCommand = new Command('config')
|
|
7
|
-
.description('Manage MATEX CLI configuration');
|
|
8
|
-
|
|
9
|
-
// Set API key
|
|
10
|
-
configCommand
|
|
11
|
-
.command('set-key <apiKey>')
|
|
12
|
-
.description('Set your MATEX AI API key')
|
|
13
|
-
.action((apiKey: string) => {
|
|
14
|
-
try {
|
|
15
|
-
// Validate API key format
|
|
16
|
-
if (!apiKey.startsWith('sk-matex-')) {
|
|
17
|
-
console.error(chalk.red('❌ Invalid API key format. API keys should start with "sk-matex-"'));
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
configManager.setAPIKey(apiKey);
|
|
22
|
-
console.log(chalk.green('✅ API key saved successfully!'));
|
|
23
|
-
console.log(chalk.gray('Your API key is stored securely in ~/.matex/config.json'));
|
|
24
|
-
console.log(chalk.cyan('\n💡 Try it out: matex ask "What is 2+2?"'));
|
|
25
|
-
} catch (error: any) {
|
|
26
|
-
console.error(chalk.red(`❌ Failed to save API key: ${error.message}`));
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// Show configuration
|
|
32
|
-
configCommand
|
|
33
|
-
.command('show')
|
|
34
|
-
.description('Show current configuration')
|
|
35
|
-
.action(() => {
|
|
36
|
-
const config = configManager.getAll();
|
|
37
|
-
|
|
38
|
-
console.log(chalk.bold.cyan('\n📋 MATEX CLI Configuration\n'));
|
|
39
|
-
|
|
40
|
-
if (config.apiKey) {
|
|
41
|
-
const maskedKey = config.apiKey.substring(0, 12) + '...' + config.apiKey.substring(config.apiKey.length - 4);
|
|
42
|
-
console.log(chalk.white('API Key: ') + chalk.gray(maskedKey));
|
|
43
|
-
} else {
|
|
44
|
-
console.log(chalk.white('API Key: ') + chalk.red('Not set'));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
console.log(chalk.white('Default Model: ') + chalk.cyan(config.defaultModel || 'matexcodex'));
|
|
48
|
-
console.log(chalk.white('Base URL: ') + chalk.gray(config.baseURL || 'https://matexai-backend-550499663766.us-central1.run.app'));
|
|
49
|
-
|
|
50
|
-
if (!config.apiKey) {
|
|
51
|
-
console.log(chalk.yellow('\n⚠️ No API key configured. Use "matex config set-key <your-api-key>" to get started.'));
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// Clear configuration
|
|
56
|
-
configCommand
|
|
57
|
-
.command('clear')
|
|
58
|
-
.description('Clear all configuration')
|
|
59
|
-
.action(() => {
|
|
60
|
-
configManager.clear();
|
|
61
|
-
console.log(chalk.green('✅ Configuration cleared successfully!'));
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Set default model
|
|
65
|
-
configCommand
|
|
66
|
-
.command('set-model <model>')
|
|
67
|
-
.description('Set default AI model')
|
|
68
|
-
.action((model: string) => {
|
|
69
|
-
const validModels = ['matexcore', 'matexcodex', 'matexai', 'elite', 'matexspirit'];
|
|
70
|
-
|
|
71
|
-
if (!validModels.includes(model.toLowerCase())) {
|
|
72
|
-
console.error(chalk.red(`❌ Invalid model. Choose from: ${validModels.join(', ')}`));
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
configManager.setDefaultModel(model.toLowerCase());
|
|
77
|
-
console.log(chalk.green(`✅ Default model set to: ${model}`));
|
|
78
|
-
});
|
package/src/commands/dev.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { configManager } from '../utils/config';
|
|
4
|
-
import { MatexAPIClient, ChatMessage } from '../api/client';
|
|
5
|
-
import { AgentOrchestrator } from '../utils/agent-orchestrator';
|
|
6
|
-
import { RepoMapper } from '../utils/repo-mapper';
|
|
7
|
-
import { TUI } from '../utils/tui';
|
|
8
|
-
import { AgentSession } from '../session/agent-session';
|
|
9
|
-
import { BRO_BANTER_DEV } from '../prompts/banter';
|
|
10
|
-
import { getDevSystemPrompt } from '../prompts/system-prompts';
|
|
11
|
-
|
|
12
|
-
export const devCommand = new Command('dev')
|
|
13
|
-
.description('Start interactive development session with MATEXCodex')
|
|
14
|
-
.option('-m, --model <model>', 'AI model to use (matex-free, matexai, matexcodex, matexelite)', configManager.getDefaultModel())
|
|
15
|
-
.option('--no-execute', 'Disable auto-prompt for command execution')
|
|
16
|
-
.action(async (options: any) => {
|
|
17
|
-
try {
|
|
18
|
-
const apiKey = configManager.getAPIKey();
|
|
19
|
-
if (!apiKey) {
|
|
20
|
-
console.log(chalk.hex('#0EA5E9')('◈ MATEX COMMAND CENTER ONLINE.'));
|
|
21
|
-
console.log(chalk.gray('OPERATOR AUTHENTICATED. STANDING BY.'));
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
26
|
-
const extraPrompt = options.model === 'matex-free' ? AgentOrchestrator.getFreeTierPrompt() : '';
|
|
27
|
-
|
|
28
|
-
TUI.init();
|
|
29
|
-
AgentOrchestrator.setMode('dev');
|
|
30
|
-
TUI.drawDevOrchestratorUI(options.model);
|
|
31
|
-
if (options.model === 'matex-free') {
|
|
32
|
-
console.log(chalk.bold.hex('#00FF7F')(' 🎓 MATEX STUDENT EDITION - Zero Bill Protocol\n'));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
TUI.drawStatusBar('Initializing MATEX "Bro-Swarm"...');
|
|
36
|
-
AgentOrchestrator.announce('Analyzing Repository Structure...');
|
|
37
|
-
|
|
38
|
-
const currentDir = process.cwd();
|
|
39
|
-
const repoMap = await new RepoMapper(currentDir).generateMap();
|
|
40
|
-
|
|
41
|
-
TUI.drawStatusBar('Brothers are ready to build.');
|
|
42
|
-
TUI.drawAjayDialogue('Awaiting your command, brother.');
|
|
43
|
-
|
|
44
|
-
const initialMessages: ChatMessage[] = [
|
|
45
|
-
{
|
|
46
|
-
role: 'system',
|
|
47
|
-
content: getDevSystemPrompt(currentDir, repoMap, extraPrompt)
|
|
48
|
-
}
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
const session = new AgentSession({
|
|
52
|
-
client,
|
|
53
|
-
model: options.model,
|
|
54
|
-
execute: options.execute !== false,
|
|
55
|
-
initialMessages,
|
|
56
|
-
broBanter: BRO_BANTER_DEV,
|
|
57
|
-
sleepyAjayProtocol: options.model !== 'matex-free' ? 'dev' : undefined,
|
|
58
|
-
baseDir: currentDir
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
await session.start();
|
|
62
|
-
|
|
63
|
-
} catch (error: any) {
|
|
64
|
-
TUI.exit();
|
|
65
|
-
console.error(chalk.red(`\n❌ Fatal Error: ${error.message}`));
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
});
|
package/src/commands/help.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { TUI } from '../utils/tui';
|
|
4
|
-
|
|
5
|
-
export const helpCommand = new Command('help')
|
|
6
|
-
.description('Detailed guide for MATEX AI "Bro-Swarm" & Commands')
|
|
7
|
-
.action(() => {
|
|
8
|
-
TUI.init();
|
|
9
|
-
|
|
10
|
-
console.log(chalk.bold.cyan('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
11
|
-
console.log(chalk.bold.white(' 📖 MATEX :: THE ELITE BRO-SWARM COMMAND CENTER '));
|
|
12
|
-
console.log(chalk.bold.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
13
|
-
|
|
14
|
-
// 1. Meet the Brothers (Table)
|
|
15
|
-
TUI.drawTable('Meet the Swarm Family',
|
|
16
|
-
['BROTHER', 'ROLE', 'VIBE / SPECIALTY'],
|
|
17
|
-
[
|
|
18
|
-
['Ajay Vai (🚀)', 'Coordinator', 'Summaries & Fast Code'],
|
|
19
|
-
['Sunil Dai (🧬)', 'Architect', 'Surgical Edits & Logic'],
|
|
20
|
-
['Sandip Dai (🎨)', 'Designer', 'Aesthetics & New Files'],
|
|
21
|
-
['Narayan Dai (🛡️)', 'Guardian', 'Security & Syntax Police'],
|
|
22
|
-
['Bishal Dai (🛠️)', 'Auditor', 'Quality Control & Logic'],
|
|
23
|
-
['Big Bro (🔥)', 'Alpha', 'Vertex AI Raw Power']
|
|
24
|
-
],
|
|
25
|
-
chalk.magenta
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
// 2. Command Guide (Table)
|
|
29
|
-
TUI.drawTable('Complete Command Reference',
|
|
30
|
-
['COMMAND', 'DESCRIPTION', 'WHEN TO USE'],
|
|
31
|
-
[
|
|
32
|
-
['matex dev', 'Full agentic coding', 'Building complex features'],
|
|
33
|
-
['matex chat', 'Technical brainstorming', 'Discussing ideas/logic'],
|
|
34
|
-
['matex ask', 'Quick one-off answer', 'Error fixes, "how-to"'],
|
|
35
|
-
['matex bro', 'Alpha-powered AI', 'Vertex AI deep research'],
|
|
36
|
-
['matex study', 'Apex Educator mode', 'Learning & Documentation'],
|
|
37
|
-
['matex student', 'Free tier protocol', 'Zero-cost learning'],
|
|
38
|
-
['matex config', 'System settings', 'API keys & model swaps']
|
|
39
|
-
],
|
|
40
|
-
chalk.blue
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
// 3. Free Tier & Education
|
|
44
|
-
TUI.drawHelpCard('Student Mission (Zero Bill)',
|
|
45
|
-
`Ajay built MATEX to ensure AI is accessible to every student.
|
|
46
|
-
|
|
47
|
-
• Activation: Run 'matex config set-model matex-free'.
|
|
48
|
-
• Pro Swaps: Use '--model matexelite' to temporarily use high-power.`,
|
|
49
|
-
'🎓',
|
|
50
|
-
chalk.green
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
// 4. Safety & Grounding
|
|
54
|
-
TUI.drawHelpCard('File Safety & Grounding',
|
|
55
|
-
`Your workspace is safe with the brothers:
|
|
56
|
-
|
|
57
|
-
• Local Scope: Agents only see files from your current folder.
|
|
58
|
-
• Human-in-Loop: Agents ALWAYS ask before executing terminal commands.
|
|
59
|
-
• Surgical: Edits are precise; we don't dump files unless you ask.`,
|
|
60
|
-
'🛡️',
|
|
61
|
-
chalk.cyan
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
console.log(chalk.green.bold('\n "Dream big, build bigger. The swarm has your back."') + chalk.gray(' — Ajay Sharma\n'));
|
|
65
|
-
|
|
66
|
-
process.exit(0);
|
|
67
|
-
});
|
package/src/commands/login.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import inquirer from 'inquirer';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import { configManager } from '../utils/config';
|
|
6
|
-
import { exec } from 'child_process';
|
|
7
|
-
import os from 'os';
|
|
8
|
-
|
|
9
|
-
export const loginCommand = new Command('login')
|
|
10
|
-
.description('Login to MATEX AI (Opens Dashboard)')
|
|
11
|
-
.action(async () => {
|
|
12
|
-
console.log(chalk.cyan('\n🔐 MATEX AI Login\n'));
|
|
13
|
-
console.log(chalk.white('To login, please visit your dashboard and copy your API Key:'));
|
|
14
|
-
|
|
15
|
-
const dashboardUrl = 'https://matexai.space/platform-login'; // or relevant URL
|
|
16
|
-
console.log(chalk.blue(chalk.bold(dashboardUrl)));
|
|
17
|
-
|
|
18
|
-
// Try to open browser
|
|
19
|
-
console.log(chalk.gray('\nOpening browser...'));
|
|
20
|
-
const openCommand = process.platform === 'darwin' ? 'open' :
|
|
21
|
-
process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
exec(`${openCommand} ${dashboardUrl}`);
|
|
25
|
-
} catch (e) {
|
|
26
|
-
// Ignore if fails
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
console.log();
|
|
30
|
-
|
|
31
|
-
const { apiKey } = await inquirer.prompt([
|
|
32
|
-
{
|
|
33
|
-
type: 'password',
|
|
34
|
-
name: 'apiKey',
|
|
35
|
-
message: 'Paste your API Key here:',
|
|
36
|
-
mask: '*'
|
|
37
|
-
}
|
|
38
|
-
]);
|
|
39
|
-
|
|
40
|
-
if (apiKey && apiKey.trim()) {
|
|
41
|
-
configManager.setAPIKey(apiKey.trim());
|
|
42
|
-
console.log(chalk.green('\n✅ Successfully logged in!'));
|
|
43
|
-
console.log(chalk.white('You can now use `matex chat` or `matex dev`.'));
|
|
44
|
-
} else {
|
|
45
|
-
console.log(chalk.red('\n❌ Login cancelled.'));
|
|
46
|
-
}
|
|
47
|
-
});
|
package/src/commands/models.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { configManager } from '../utils/config';
|
|
4
|
-
|
|
5
|
-
const AVAILABLE_MODELS = [
|
|
6
|
-
{
|
|
7
|
-
name: 'matexcodex',
|
|
8
|
-
description: 'Best for coding, technical tasks, and development',
|
|
9
|
-
tier: 'Free (5 min/day), Starter (4M tokens/month), Pro Plus (unlimited)',
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: 'matexai',
|
|
13
|
-
description: 'General purpose AI for conversations and knowledge',
|
|
14
|
-
tier: 'Pro, Pro Plus',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: 'elite',
|
|
18
|
-
description: 'Premium model with advanced capabilities',
|
|
19
|
-
tier: 'Elite Plan',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: 'matexspirit',
|
|
23
|
-
description: 'Specialized model for creative and empathetic responses',
|
|
24
|
-
tier: 'Pro, Pro Plus',
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
export const modelsCommand = new Command('models')
|
|
29
|
-
.description('Manage AI models');
|
|
30
|
-
|
|
31
|
-
// List available models
|
|
32
|
-
modelsCommand
|
|
33
|
-
.command('list')
|
|
34
|
-
.description('List all available AI models')
|
|
35
|
-
.action(() => {
|
|
36
|
-
console.log(chalk.bold.cyan('\n🤖 Available MATEX AI Models\n'));
|
|
37
|
-
|
|
38
|
-
AVAILABLE_MODELS.forEach((model) => {
|
|
39
|
-
console.log(chalk.bold.white(`${model.name}`));
|
|
40
|
-
console.log(chalk.gray(` ${model.description}`));
|
|
41
|
-
console.log(chalk.yellow(` Access: ${model.tier}`));
|
|
42
|
-
console.log();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const currentModel = configManager.getDefaultModel();
|
|
46
|
-
console.log(chalk.cyan(`Current default: ${currentModel}`));
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Set default model
|
|
50
|
-
modelsCommand
|
|
51
|
-
.command('set <model>')
|
|
52
|
-
.description('Set default AI model')
|
|
53
|
-
.action((model: string) => {
|
|
54
|
-
const validModels = AVAILABLE_MODELS.map(m => m.name);
|
|
55
|
-
|
|
56
|
-
if (!validModels.includes(model.toLowerCase())) {
|
|
57
|
-
console.error(chalk.red(`❌ Invalid model. Choose from: ${validModels.join(', ')}`));
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
configManager.setDefaultModel(model.toLowerCase());
|
|
62
|
-
console.log(chalk.green(`✅ Default model set to: ${model}`));
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// Show current model
|
|
66
|
-
modelsCommand
|
|
67
|
-
.command('current')
|
|
68
|
-
.description('Show current default model')
|
|
69
|
-
.action(() => {
|
|
70
|
-
const currentModel = configManager.getDefaultModel();
|
|
71
|
-
const modelInfo = AVAILABLE_MODELS.find(m => m.name === currentModel);
|
|
72
|
-
|
|
73
|
-
console.log(chalk.bold.cyan('\n📌 Current Default Model\n'));
|
|
74
|
-
console.log(chalk.bold.white(currentModel));
|
|
75
|
-
|
|
76
|
-
if (modelInfo) {
|
|
77
|
-
console.log(chalk.gray(modelInfo.description));
|
|
78
|
-
console.log(chalk.yellow(`Access: ${modelInfo.tier}`));
|
|
79
|
-
}
|
|
80
|
-
console.log();
|
|
81
|
-
});
|
package/src/commands/student.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { studyCommand } from './study';
|
|
4
|
-
import { TUI } from '../utils/tui';
|
|
5
|
-
import { AgentOrchestrator } from '../utils/agent-orchestrator';
|
|
6
|
-
|
|
7
|
-
export const studentCommand = new Command('student')
|
|
8
|
-
.description('Launch specialized Student Study Session (Free Tier)')
|
|
9
|
-
.action(async (options) => {
|
|
10
|
-
TUI.init();
|
|
11
|
-
AgentOrchestrator.setMode('student');
|
|
12
|
-
TUI.drawLargeLogo();
|
|
13
|
-
console.log(chalk.bold.hex('#00FF7F')('\n 🎓 MATEX STUDENT EDITION - Powered by Open Source\n'));
|
|
14
|
-
console.log(chalk.gray(' Model: ') + chalk.hex('#00FF7F').bold('matex-free (0 Cost)'));
|
|
15
|
-
console.log(chalk.gray(' Status: ') + chalk.hex('#00FF7F').bold('Zero-Bill Protocol Active\n'));
|
|
16
|
-
|
|
17
|
-
// Forward to study command with pre-set model
|
|
18
|
-
await studyCommand.parseAsync([
|
|
19
|
-
process.argv[0],
|
|
20
|
-
'study',
|
|
21
|
-
'--model', 'matex-free'
|
|
22
|
-
]);
|
|
23
|
-
});
|
package/src/commands/study.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { configManager } from '../utils/config';
|
|
4
|
-
import { MatexAPIClient, ChatMessage } from '../api/client';
|
|
5
|
-
import { AgentOrchestrator } from '../utils/agent-orchestrator';
|
|
6
|
-
import { RepoMapper } from '../utils/repo-mapper';
|
|
7
|
-
import { TUI } from '../utils/tui';
|
|
8
|
-
import { AgentSession } from '../session/agent-session';
|
|
9
|
-
import { BRO_BANTER_STUDY } from '../prompts/banter';
|
|
10
|
-
import { getStudySystemPrompt } from '../prompts/system-prompts';
|
|
11
|
-
|
|
12
|
-
export const studyCommand = new Command('study')
|
|
13
|
-
.description('Start interactive study session with the MATEX Apex Educator Swarm')
|
|
14
|
-
.option('-m, --model <model>', 'AI model to use (matex-free, matexai, matexcodex, matexelite)', configManager.getDefaultModel())
|
|
15
|
-
.option('--no-execute', 'Disable auto-prompt for command execution')
|
|
16
|
-
.action(async (options: any) => {
|
|
17
|
-
try {
|
|
18
|
-
const apiKey = configManager.getAPIKey();
|
|
19
|
-
if (!apiKey) {
|
|
20
|
-
console.error(chalk.red('❌ No API key configured.'));
|
|
21
|
-
console.log(chalk.yellow('Run: matex config set-key <your-api-key>'));
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
26
|
-
const extraPrompt = options.model === 'matex-free' ? AgentOrchestrator.getFreeTierPrompt() : '';
|
|
27
|
-
|
|
28
|
-
TUI.init();
|
|
29
|
-
if (options.model !== 'matex-free') {
|
|
30
|
-
AgentOrchestrator.setMode('study');
|
|
31
|
-
}
|
|
32
|
-
TUI.drawLargeLogo();
|
|
33
|
-
if (options.model === 'matex-free') {
|
|
34
|
-
console.log(chalk.bold.hex('#00FF7F')('\n 🎓 MATEX STUDENT EDITION - Zero Bill Protocol\n'));
|
|
35
|
-
}
|
|
36
|
-
TUI.drawWelcomeBanner(options.model === 'matex-free' ? 'ZERO-COST STUDY AI FOR STUDENTS!' : 'Welcome to the MATEX AI research preview!');
|
|
37
|
-
|
|
38
|
-
console.log(chalk.gray(' Status: ') + chalk.hex('#D97757').bold('Monitoring Workspace...'));
|
|
39
|
-
console.log(chalk.gray(' Model: ') + chalk.hex('#D97757').bold(options.model));
|
|
40
|
-
console.log(chalk.gray(' Type your request brother, or "exit" to quit\n'));
|
|
41
|
-
|
|
42
|
-
TUI.drawStatusBar('Initializing MATEX "Bro-Swarm"...');
|
|
43
|
-
AgentOrchestrator.announce('Analyzing Repository Structure...');
|
|
44
|
-
|
|
45
|
-
const currentDir = process.cwd();
|
|
46
|
-
const repoMap = await new RepoMapper(currentDir).generateMap();
|
|
47
|
-
|
|
48
|
-
TUI.drawStatusBar('Brothers are ready to build.');
|
|
49
|
-
TUI.drawAjayDialogue('Awaiting your command, brother.');
|
|
50
|
-
|
|
51
|
-
const initialMessages: ChatMessage[] = [
|
|
52
|
-
{
|
|
53
|
-
role: 'system',
|
|
54
|
-
content: getStudySystemPrompt(currentDir, repoMap, extraPrompt)
|
|
55
|
-
}
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
const session = new AgentSession({
|
|
59
|
-
client,
|
|
60
|
-
model: options.model,
|
|
61
|
-
execute: options.execute !== false,
|
|
62
|
-
initialMessages,
|
|
63
|
-
broBanter: BRO_BANTER_STUDY,
|
|
64
|
-
sleepyAjayProtocol: options.model !== 'matex-free' ? 'study' : undefined,
|
|
65
|
-
baseDir: currentDir
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
await session.start();
|
|
69
|
-
|
|
70
|
-
} catch (error: any) {
|
|
71
|
-
TUI.exit();
|
|
72
|
-
console.error(chalk.red(`\n❌ Fatal Error: ${error.message}`));
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
});
|