vmcode-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/INSTALLATION_METHODS.md +181 -0
- package/LICENSE +21 -0
- package/README.md +199 -0
- package/bin/npm-wrapper.js +171 -0
- package/bin/rg +0 -0
- package/bin/rg.exe +0 -0
- package/config.yaml.example +159 -0
- package/package.json +42 -0
- package/requirements.txt +7 -0
- package/scripts/install.js +132 -0
- package/setup.bat +114 -0
- package/setup.sh +135 -0
- package/src/__init__.py +4 -0
- package/src/core/__init__.py +1 -0
- package/src/core/agentic.py +2342 -0
- package/src/core/chat_manager.py +1201 -0
- package/src/core/config_manager.py +269 -0
- package/src/core/init.py +161 -0
- package/src/core/sub_agent.py +174 -0
- package/src/exceptions.py +75 -0
- package/src/llm/__init__.py +1 -0
- package/src/llm/client.py +149 -0
- package/src/llm/config.py +445 -0
- package/src/llm/prompts.py +569 -0
- package/src/llm/providers.py +402 -0
- package/src/llm/token_tracker.py +220 -0
- package/src/ui/__init__.py +1 -0
- package/src/ui/banner.py +103 -0
- package/src/ui/commands.py +489 -0
- package/src/ui/displays.py +167 -0
- package/src/ui/main.py +351 -0
- package/src/ui/prompt_utils.py +162 -0
- package/src/utils/__init__.py +1 -0
- package/src/utils/editor.py +158 -0
- package/src/utils/gitignore_filter.py +149 -0
- package/src/utils/logger.py +254 -0
- package/src/utils/markdown.py +32 -0
- package/src/utils/settings.py +94 -0
- package/src/utils/tools/__init__.py +55 -0
- package/src/utils/tools/command_executor.py +217 -0
- package/src/utils/tools/create_file.py +143 -0
- package/src/utils/tools/definitions.py +193 -0
- package/src/utils/tools/directory.py +374 -0
- package/src/utils/tools/file_editor.py +345 -0
- package/src/utils/tools/file_helpers.py +109 -0
- package/src/utils/tools/file_reader.py +331 -0
- package/src/utils/tools/formatters.py +458 -0
- package/src/utils/tools/parallel_executor.py +195 -0
- package/src/utils/validation.py +117 -0
- package/src/utils/web_search.py +71 -0
- package/vmcode-proxy/.env.example +5 -0
- package/vmcode-proxy/README.md +235 -0
- package/vmcode-proxy/package-lock.json +947 -0
- package/vmcode-proxy/package.json +20 -0
- package/vmcode-proxy/server.js +248 -0
- package/vmcode-proxy/server.js.bak +157 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# vmCode Configuration Example
|
|
3
|
+
# =============================================================================
|
|
4
|
+
#
|
|
5
|
+
# Copy this file to config.yaml and add your API keys
|
|
6
|
+
#
|
|
7
|
+
# API keys can also be set via environment variables (they take precedence):
|
|
8
|
+
# export OPENAI_API_KEY="sk-your-key-here"
|
|
9
|
+
# export ANTHROPIC_API_KEY="sk-ant-your-key-here"
|
|
10
|
+
# export GLM_API_KEY="your-glm-key-here"
|
|
11
|
+
# export GEMINI_API_KEY="your-gemini-key-here"
|
|
12
|
+
# export OPENROUTER_API_KEY="sk-or-your-key-here"
|
|
13
|
+
# export KIMI_API_KEY="your-kimi-key-here"
|
|
14
|
+
# export MINIMAX_API_KEY="your-minimax-key-here"
|
|
15
|
+
#
|
|
16
|
+
# Or set interactively in the app:
|
|
17
|
+
# /key sk-your-api-key-here
|
|
18
|
+
# /provider openai
|
|
19
|
+
#
|
|
20
|
+
# =============================================================================
|
|
21
|
+
|
|
22
|
+
# Last selected provider (saved automatically)
|
|
23
|
+
LAST_PROVIDER: vmcode_free
|
|
24
|
+
|
|
25
|
+
# =============================================================================
|
|
26
|
+
# API KEYS
|
|
27
|
+
# =============================================================================
|
|
28
|
+
|
|
29
|
+
# OpenAI (GPT models)
|
|
30
|
+
OPENAI_API_KEY: "sk-your-openai-key-here"
|
|
31
|
+
OPENAI_MODEL: gpt-4o-mini
|
|
32
|
+
OPENAI_API_BASE: "https://api.openai.com/v1"
|
|
33
|
+
|
|
34
|
+
# Anthropic (Claude models)
|
|
35
|
+
ANTHROPIC_API_KEY: "sk-ant-your-anthropic-key-here"
|
|
36
|
+
ANTHROPIC_MODEL: claude-3-5-sonnet-20241022
|
|
37
|
+
ANTHROPIC_API_BASE: "https://api.anthropic.com/v1"
|
|
38
|
+
|
|
39
|
+
# Google (Gemini models)
|
|
40
|
+
GEMINI_API_KEY: "your-gemini-key-here"
|
|
41
|
+
GEMINI_MODEL: gemini-1.5-flash
|
|
42
|
+
GEMINI_API_BASE: "https://generativelanguage.googleapis.com/v1beta"
|
|
43
|
+
|
|
44
|
+
# Zhipu AI (GLM models)
|
|
45
|
+
GLM_API_KEY: "your-glm-key-here"
|
|
46
|
+
GLM_MODEL: glm-4-flash
|
|
47
|
+
GLM_API_BASE: "https://open.bigmodel.cn/api/paas/v4"
|
|
48
|
+
|
|
49
|
+
# OpenRouter (multi-provider API)
|
|
50
|
+
OPENROUTER_API_KEY: "sk-or-your-openrouter-key-here"
|
|
51
|
+
OPENROUTER_MODEL: openai/gpt-4o-mini
|
|
52
|
+
OPENROUTER_API_BASE: "https://openrouter.ai/api/v1"
|
|
53
|
+
|
|
54
|
+
# Kimi (Moonshot AI)
|
|
55
|
+
KIMI_API_KEY: "your-kimi-key-here"
|
|
56
|
+
KIMI_MODEL: moonshot-v1-8k
|
|
57
|
+
KIMI_API_BASE: "https://api.moonshot.cn/v1"
|
|
58
|
+
|
|
59
|
+
# MiniMax
|
|
60
|
+
MINIMAX_API_KEY: "your-minimax-key-here"
|
|
61
|
+
MINIMAX_MODEL: "abab6.5s-chat"
|
|
62
|
+
MINIMAX_API_BASE: "https://api.minimax.chat/v1"
|
|
63
|
+
|
|
64
|
+
# vmCode Free Tier (no API key needed - managed by vmCode proxy)
|
|
65
|
+
VMCODE_FREE_API_BASE: "https://vmcode-five.vercel.app"
|
|
66
|
+
|
|
67
|
+
# =============================================================================
|
|
68
|
+
# LOCAL MODEL SETTINGS (Optional)
|
|
69
|
+
# =============================================================================
|
|
70
|
+
# Uncomment to use local models via llama.cpp
|
|
71
|
+
|
|
72
|
+
LOCAL_MODEL_PATH: "/path/to/your/model.gguf"
|
|
73
|
+
LOCAL_SERVER_PATH: "/path/to/llama.cpp/build/bin/llama-server"
|
|
74
|
+
|
|
75
|
+
# =============================================================================
|
|
76
|
+
# SETTINGS
|
|
77
|
+
# =============================================================================
|
|
78
|
+
|
|
79
|
+
# =============================================================================
|
|
80
|
+
# TOOL SETTINGS
|
|
81
|
+
# =============================================================================
|
|
82
|
+
|
|
83
|
+
# Tool execution limits and defaults
|
|
84
|
+
TOOL_SETTINGS:
|
|
85
|
+
max_tool_calls: 100 # Maximum number of tool calls per interaction
|
|
86
|
+
command_timeout_sec: 30 # Timeout for shell commands in seconds
|
|
87
|
+
enable_parallel_execution: true # Enable parallel tool execution
|
|
88
|
+
max_parallel_workers: 10 # Maximum number of parallel tool workers
|
|
89
|
+
max_command_output_lines: 100 # Maximum lines to show from command output
|
|
90
|
+
max_file_preview_lines: 200 # Maximum lines to show in file creation previews
|
|
91
|
+
|
|
92
|
+
# =============================================================================
|
|
93
|
+
# FILE SETTINGS
|
|
94
|
+
# =============================================================================
|
|
95
|
+
|
|
96
|
+
# File scanning and reading limits
|
|
97
|
+
FILE_SETTINGS:
|
|
98
|
+
max_file_bytes: 200000 # Maximum bytes to read from a single file (~200KB)
|
|
99
|
+
max_total_bytes: 1500000 # Maximum total bytes across all file reads (~1.5MB)
|
|
100
|
+
exclude_dirs: # Directories to exclude from file operations
|
|
101
|
+
- .git
|
|
102
|
+
- .venv
|
|
103
|
+
- __pycache__
|
|
104
|
+
- node_modules
|
|
105
|
+
- venv
|
|
106
|
+
- env
|
|
107
|
+
|
|
108
|
+
# =============================================================================
|
|
109
|
+
# SERVER SETTINGS (Optional)
|
|
110
|
+
# =============================================================================
|
|
111
|
+
# Local llama-server configuration (only used for local models)
|
|
112
|
+
SERVER_SETTINGS:
|
|
113
|
+
ngl_layers: 30 # Number of GPU layers for llama.cpp
|
|
114
|
+
ctx_size: 8192 # Context size for local model
|
|
115
|
+
n_predict: 8192 # Maximum tokens to predict
|
|
116
|
+
rope_scale: 1.0 # RoPE scaling factor
|
|
117
|
+
health_check_timeout_sec: 120 # Timeout for server health check
|
|
118
|
+
health_check_interval_sec: 1.0 # Interval between health checks
|
|
119
|
+
|
|
120
|
+
# =============================================================================
|
|
121
|
+
# CONTEXT SETTINGS
|
|
122
|
+
# =============================================================================
|
|
123
|
+
# Context compaction thresholds and defaults
|
|
124
|
+
CONTEXT_SETTINGS:
|
|
125
|
+
compact_trigger_tokens: 100000 # Tokens threshold for auto-compaction
|
|
126
|
+
log_conversations: false # Whether to log conversations to disk
|
|
127
|
+
conversations_dir: conversations # Directory for conversation logs
|
|
128
|
+
tool_compaction:
|
|
129
|
+
enable_per_message_compaction: true # Enable per-message tool result compaction
|
|
130
|
+
keep_recent_tool_blocks: 3 # Number of recent tool blocks to keep
|
|
131
|
+
compact_failed_tools: true # Whether to compact failed tool results
|
|
132
|
+
|
|
133
|
+
# =============================================================================
|
|
134
|
+
# SUB AGENT SETTINGS
|
|
135
|
+
# =============================================================================
|
|
136
|
+
# Configuration for sub-agent token limits and behavior
|
|
137
|
+
SUB_AGENT_SETTINGS:
|
|
138
|
+
soft_limit_tokens: 75000 # Budget shown to agent in prompt (advisory)
|
|
139
|
+
hard_limit_tokens: 300000 # Hard stop - fail fast when exceeded (mandatory)
|
|
140
|
+
enable_compaction: false # Disable auto-compaction for sub-agent sessions
|
|
141
|
+
|
|
142
|
+
# =============================================================================
|
|
143
|
+
# MODEL PRICING (Optional)
|
|
144
|
+
# =============================================================================
|
|
145
|
+
# Override default pricing for specific models (cost per 1M tokens)
|
|
146
|
+
# Format: MODEL_PRICES:
|
|
147
|
+
# model_name:
|
|
148
|
+
# cost_in: 0.50
|
|
149
|
+
# cost_out: 1.50
|
|
150
|
+
|
|
151
|
+
MODEL_PRICES: {}
|
|
152
|
+
|
|
153
|
+
# =============================================================================
|
|
154
|
+
# NOTES
|
|
155
|
+
# =============================================================================
|
|
156
|
+
# - Keep this file private! Never commit it to version control
|
|
157
|
+
# - Set file permissions: chmod 600 config.yaml
|
|
158
|
+
# - Environment variables override values in this file
|
|
159
|
+
# - Run 'vmcode /help' for command reference
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vmcode-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A terminal-based AI coding assistant powered by OpenAI-style function calling",
|
|
5
|
+
"main": "src/ui/main.py",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vmcode": "./bin/npm-wrapper.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"install": "node scripts/install.js",
|
|
11
|
+
"postinstall": "echo 'vmcode installed! Run with: vmcode'",
|
|
12
|
+
"start": "node bin/npm-wrapper.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ai",
|
|
16
|
+
"coding-assistant",
|
|
17
|
+
"terminal",
|
|
18
|
+
"llm",
|
|
19
|
+
"function-calling",
|
|
20
|
+
"python",
|
|
21
|
+
"gpt",
|
|
22
|
+
"claude"
|
|
23
|
+
],
|
|
24
|
+
"author": "Vincent Miranda <vincentmiranda65@gmail.com>",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/vincentm65/vmCode-CLI"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/vincentm65/vmCode-CLI/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/vincentm65/vmCode-CLI",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=14.0.0"
|
|
36
|
+
},
|
|
37
|
+
"os": [
|
|
38
|
+
"darwin",
|
|
39
|
+
"linux",
|
|
40
|
+
"win32"
|
|
41
|
+
]
|
|
42
|
+
}
|
package/requirements.txt
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* vmCode npm install script
|
|
4
|
+
* Handles Python dependency installation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { spawn, spawnSync } = require('child_process');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
|
|
11
|
+
const packageDir = path.resolve(__dirname, '..');
|
|
12
|
+
const requirementsFile = path.join(packageDir, 'requirements.txt');
|
|
13
|
+
|
|
14
|
+
console.log('Installing vmCode...\n');
|
|
15
|
+
|
|
16
|
+
function findPython() {
|
|
17
|
+
const possibleCommands = ['python3', 'python', 'python3.9', 'python3.10', 'python3.11', 'python3.12'];
|
|
18
|
+
|
|
19
|
+
for (const cmd of possibleCommands) {
|
|
20
|
+
try {
|
|
21
|
+
const result = spawnSync(cmd, ['--version'], { stdio: 'pipe' });
|
|
22
|
+
if (result.status === 0) {
|
|
23
|
+
const version = result.stdout.toString() || result.stderr.toString();
|
|
24
|
+
console.log(`✓ Found ${cmd}: ${version.trim()}`);
|
|
25
|
+
return cmd;
|
|
26
|
+
}
|
|
27
|
+
} catch (e) {
|
|
28
|
+
// Continue to next command
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function installDependencies(pythonCmd) {
|
|
36
|
+
if (!fs.existsSync(requirementsFile)) {
|
|
37
|
+
console.log('⚠️ No requirements.txt found, skipping Python dependencies');
|
|
38
|
+
return Promise.resolve();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log('\nInstalling Python dependencies...\n');
|
|
42
|
+
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
const installProcess = spawn(pythonCmd, ['-m', 'pip', 'install', '-r', requirementsFile], {
|
|
45
|
+
stdio: 'inherit',
|
|
46
|
+
cwd: packageDir
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
installProcess.on('close', (code) => {
|
|
50
|
+
if (code === 0) {
|
|
51
|
+
console.log('\n✓ Python dependencies installed successfully\n');
|
|
52
|
+
resolve();
|
|
53
|
+
} else {
|
|
54
|
+
reject(new Error(`pip install failed with exit code ${code}`));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
installProcess.on('error', (err) => {
|
|
59
|
+
reject(new Error(`Failed to run pip: ${err.message}`));
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function setupConfig() {
|
|
65
|
+
const configFile = path.join(packageDir, 'config.yaml');
|
|
66
|
+
const configExample = path.join(packageDir, 'config.yaml.example');
|
|
67
|
+
|
|
68
|
+
if (!fs.existsSync(configFile) && fs.existsSync(configExample)) {
|
|
69
|
+
console.log('Creating config.yaml from example...');
|
|
70
|
+
try {
|
|
71
|
+
fs.copyFileSync(configExample, configFile);
|
|
72
|
+
console.log('✓ config.yaml created');
|
|
73
|
+
console.log('\n⚠️ IMPORTANT: Edit config.yaml and add your API keys!');
|
|
74
|
+
console.log(' Or set them via environment variables:\n');
|
|
75
|
+
console.log(' export OPENAI_API_KEY="sk-your-key-here"\n');
|
|
76
|
+
} catch (e) {
|
|
77
|
+
console.log('⚠️ Failed to create config.yaml:', e.message);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function main() {
|
|
83
|
+
try {
|
|
84
|
+
// Find Python
|
|
85
|
+
const pythonCmd = findPython();
|
|
86
|
+
|
|
87
|
+
if (!pythonCmd) {
|
|
88
|
+
console.error('\n❌ Error: Python 3.9+ is not installed or not in PATH');
|
|
89
|
+
console.error('Please install Python from https://python.org');
|
|
90
|
+
console.error('\nAfter installing Python, run: npm install vmcode\n');
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Check Python version
|
|
95
|
+
const versionResult = spawnSync(pythonCmd, ['-c', 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")'], {
|
|
96
|
+
stdio: 'pipe'
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
if (versionResult.status === 0) {
|
|
100
|
+
const version = versionResult.stdout.toString().trim();
|
|
101
|
+
const [major, minor] = version.split('.').map(Number);
|
|
102
|
+
|
|
103
|
+
if (major < 3 || (major === 3 && minor < 9)) {
|
|
104
|
+
console.error(`\n❌ Error: Python 3.9+ is required (found ${version})`);
|
|
105
|
+
console.error('Please install a newer version of Python from https://python.org\n');
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Install dependencies
|
|
111
|
+
await installDependencies(pythonCmd);
|
|
112
|
+
|
|
113
|
+
// Setup config
|
|
114
|
+
setupConfig();
|
|
115
|
+
|
|
116
|
+
console.log('='.repeat(60));
|
|
117
|
+
console.log('vmCode installation complete!');
|
|
118
|
+
console.log('='.repeat(60));
|
|
119
|
+
console.log('\nRun vmcode with:');
|
|
120
|
+
console.log(' vmcode\n');
|
|
121
|
+
console.log('Or with npx:');
|
|
122
|
+
console.log(' npx vmcode\n');
|
|
123
|
+
|
|
124
|
+
} catch (err) {
|
|
125
|
+
console.error('\n❌ Installation failed:', err.message);
|
|
126
|
+
console.error('\nTry installing dependencies manually:');
|
|
127
|
+
console.error(' python3 -m pip install -r requirements.txt\n');
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
main();
|
package/setup.bat
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
REM vmCode setup script for Windows (git clone installation)
|
|
3
|
+
REM This script sets up vmcode as a system command
|
|
4
|
+
|
|
5
|
+
echo ==========================================
|
|
6
|
+
echo vmCode Setup
|
|
7
|
+
echo ==========================================
|
|
8
|
+
echo.
|
|
9
|
+
|
|
10
|
+
REM Get script directory
|
|
11
|
+
set "SCRIPT_DIR=%~dp0"
|
|
12
|
+
set "PROJECT_ROOT=%SCRIPT_DIR%.."
|
|
13
|
+
|
|
14
|
+
echo Project root: %PROJECT_ROOT%
|
|
15
|
+
echo.
|
|
16
|
+
|
|
17
|
+
REM Check Python
|
|
18
|
+
echo Checking for Python 3.9+...
|
|
19
|
+
python --version >nul 2>&1
|
|
20
|
+
if errorlevel 1 (
|
|
21
|
+
echo Error: Python is not installed or not in PATH
|
|
22
|
+
echo Please install Python 3.9 or later from https://python.org
|
|
23
|
+
pause
|
|
24
|
+
exit /b 1
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
for /f "tokens=2" %%i in ('python --version 2^>^&1') do set PYTHON_VERSION=%%i
|
|
28
|
+
echo Found Python %PYTHON_VERSION%
|
|
29
|
+
|
|
30
|
+
REM Install Python dependencies
|
|
31
|
+
echo.
|
|
32
|
+
echo Installing Python dependencies...
|
|
33
|
+
cd /d "%PROJECT_ROOT%"
|
|
34
|
+
pip install -q -r requirements.txt
|
|
35
|
+
|
|
36
|
+
if errorlevel 1 (
|
|
37
|
+
echo Failed to install Python dependencies
|
|
38
|
+
pause
|
|
39
|
+
exit /b 1
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
echo Python dependencies installed
|
|
43
|
+
echo.
|
|
44
|
+
|
|
45
|
+
REM Setup config
|
|
46
|
+
if not exist "config.yaml" (
|
|
47
|
+
if exist "config.yaml.example" (
|
|
48
|
+
echo Creating config.yaml from example...
|
|
49
|
+
copy config.yaml.example config.yaml >nul
|
|
50
|
+
echo config.yaml created
|
|
51
|
+
echo.
|
|
52
|
+
echo IMPORTANT: Edit config.yaml and add your API keys!
|
|
53
|
+
echo Or set them via environment variables:
|
|
54
|
+
echo set OPENAI_API_KEY=sk-your-key-here
|
|
55
|
+
echo.
|
|
56
|
+
) else (
|
|
57
|
+
echo Warning: config.yaml.example not found
|
|
58
|
+
)
|
|
59
|
+
) else (
|
|
60
|
+
echo config.yaml already exists
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
REM Create vmcode command
|
|
64
|
+
echo.
|
|
65
|
+
echo Setting up vmcode command...
|
|
66
|
+
|
|
67
|
+
REM Option 1: Create batch file in PATH
|
|
68
|
+
set "USER_BIN=%USERPROFILE%\bin"
|
|
69
|
+
if not exist "%USER_BIN%" mkdir "%USER_BIN%"
|
|
70
|
+
|
|
71
|
+
REM Create vmcode.bat launcher
|
|
72
|
+
(
|
|
73
|
+
echo @echo off
|
|
74
|
+
echo REM vmCode launcher
|
|
75
|
+
echo cd /d "%PROJECT_ROOT%"
|
|
76
|
+
echo python src/ui/main.py %%*
|
|
77
|
+
) > "%USER_BIN%\vmcode.bat"
|
|
78
|
+
|
|
79
|
+
echo Created command: %USER_BIN%\vmcode.bat
|
|
80
|
+
|
|
81
|
+
REM Check if USER_BIN is in PATH
|
|
82
|
+
echo %PATH% | find /i /c "%USER_BIN%" >nul
|
|
83
|
+
if errorlevel 1 (
|
|
84
|
+
echo.
|
|
85
|
+
echo WARNING: %USER_BIN% is not in your PATH
|
|
86
|
+
echo.
|
|
87
|
+
echo To add to PATH ^(recommended^):
|
|
88
|
+
echo 1. Press Win key, search for "Environment Variables"
|
|
89
|
+
echo 2. Click "Edit the system environment variables"
|
|
90
|
+
echo 3. Click "Environment Variables..."
|
|
91
|
+
echo 4. Under "User variables", select "Path" and click "Edit"
|
|
92
|
+
echo 5. Click "New" and add: %%USERBIN%%
|
|
93
|
+
echo 6. Click OK on all dialogs
|
|
94
|
+
echo.
|
|
95
|
+
echo Or run this command in PowerShell ^(temporary^):
|
|
96
|
+
echo $env:Path += ";%%USERBIN%%"
|
|
97
|
+
) else (
|
|
98
|
+
echo %USER_BIN% is already in PATH
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
echo.
|
|
102
|
+
echo ==========================================
|
|
103
|
+
echo Setup Complete!
|
|
104
|
+
echo ==========================================
|
|
105
|
+
echo.
|
|
106
|
+
echo Run vmcode:
|
|
107
|
+
echo vmcode
|
|
108
|
+
echo.
|
|
109
|
+
echo Or run directly:
|
|
110
|
+
echo cd %PROJECT_ROOT%
|
|
111
|
+
echo python src/ui/main.py
|
|
112
|
+
echo.
|
|
113
|
+
|
|
114
|
+
pause
|
package/setup.sh
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# vmCode setup script for git clone installation
|
|
3
|
+
# This script sets up vmcode as a system command
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "=========================================="
|
|
8
|
+
echo " vmCode Setup"
|
|
9
|
+
echo "=========================================="
|
|
10
|
+
echo ""
|
|
11
|
+
|
|
12
|
+
# Get the directory where this script is located
|
|
13
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
14
|
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
15
|
+
|
|
16
|
+
echo "📁 Project root: $PROJECT_ROOT"
|
|
17
|
+
echo ""
|
|
18
|
+
|
|
19
|
+
# Check Python
|
|
20
|
+
echo "🐍 Checking for Python 3.9+..."
|
|
21
|
+
|
|
22
|
+
if ! command -v python3 &> /dev/null; then
|
|
23
|
+
echo "❌ Error: python3 is not installed"
|
|
24
|
+
echo "Please install Python 3.9 or later from https://python.org"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
|
|
29
|
+
PYTHON_MAJOR=$(python3 -c 'import sys; print(sys.version_info.major)')
|
|
30
|
+
PYTHON_MINOR=$(python3 -c 'import sys; print(sys.version_info.minor)')
|
|
31
|
+
|
|
32
|
+
echo "✓ Found Python $PYTHON_VERSION"
|
|
33
|
+
|
|
34
|
+
if [ "$PYTHON_MAJOR" -lt 3 ] || ([ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 9 ]); then
|
|
35
|
+
echo "❌ Error: Python 3.9+ is required (found $PYTHON_VERSION)"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo ""
|
|
40
|
+
|
|
41
|
+
# Install Python dependencies
|
|
42
|
+
echo "📦 Installing Python dependencies..."
|
|
43
|
+
cd "$PROJECT_ROOT"
|
|
44
|
+
pip3 install -q -r requirements.txt
|
|
45
|
+
|
|
46
|
+
if [ $? -eq 0 ]; then
|
|
47
|
+
echo "✓ Python dependencies installed"
|
|
48
|
+
else
|
|
49
|
+
echo "❌ Failed to install Python dependencies"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
echo ""
|
|
54
|
+
|
|
55
|
+
# Setup config
|
|
56
|
+
if [ ! -f "config.yaml" ]; then
|
|
57
|
+
if [ -f "config.yaml.example" ]; then
|
|
58
|
+
echo "⚙️ Creating config.yaml from example..."
|
|
59
|
+
cp config.yaml.example config.yaml
|
|
60
|
+
echo "✓ config.yaml created"
|
|
61
|
+
echo ""
|
|
62
|
+
echo "⚠️ IMPORTANT: Edit config.yaml and add your API keys!"
|
|
63
|
+
echo " Or set them via environment variables:"
|
|
64
|
+
echo " export OPENAI_API_KEY='sk-your-key-here'"
|
|
65
|
+
echo ""
|
|
66
|
+
else
|
|
67
|
+
echo "⚠️ Warning: config.yaml.example not found"
|
|
68
|
+
fi
|
|
69
|
+
else
|
|
70
|
+
echo "✓ config.yaml already exists"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Create vmcode alias/command
|
|
74
|
+
echo ""
|
|
75
|
+
echo "🔗 Setting up vmcode command..."
|
|
76
|
+
|
|
77
|
+
# Option 1: Create symlink to user's bin directory
|
|
78
|
+
USER_BIN="$HOME/.local/bin"
|
|
79
|
+
mkdir -p "$USER_BIN"
|
|
80
|
+
|
|
81
|
+
if [ -w "$USER_BIN" ]; then
|
|
82
|
+
# Create a symlink to the main.py script
|
|
83
|
+
cat > "$USER_BIN/vmcode" << 'EOF'
|
|
84
|
+
#!/bin/bash
|
|
85
|
+
# vmCode launcher
|
|
86
|
+
cd "$(dirname "$(readlink -f "$0")")/../.." || exit 1"
|
|
87
|
+
python3 src/ui/main.py "$@"
|
|
88
|
+
EOF
|
|
89
|
+
|
|
90
|
+
chmod +x "$USER_BIN/vmcode"
|
|
91
|
+
echo "✓ Created command: $USER_BIN/vmcode"
|
|
92
|
+
|
|
93
|
+
# Check if USER_BIN is in PATH
|
|
94
|
+
if [[ ":$PATH:" != *":$USER_BIN:"* ]]; then
|
|
95
|
+
echo ""
|
|
96
|
+
echo "⚠️ Add $USER_BIN to your PATH:"
|
|
97
|
+
echo ""
|
|
98
|
+
echo " For bash (add to ~/.bashrc):"
|
|
99
|
+
echo " export PATH=\"\$PATH:$USER_BIN\""
|
|
100
|
+
echo ""
|
|
101
|
+
echo " For zsh (add to ~/.zshrc):"
|
|
102
|
+
echo " export PATH=\"\$PATH:$USER_BIN\""
|
|
103
|
+
echo ""
|
|
104
|
+
echo " Then reload your shell:"
|
|
105
|
+
echo " source ~/.bashrc # or source ~/.zshrc"
|
|
106
|
+
echo ""
|
|
107
|
+
echo " Or just run:"
|
|
108
|
+
echo " export PATH=\"\$PATH:$USER_BIN\""
|
|
109
|
+
echo ""
|
|
110
|
+
else
|
|
111
|
+
echo "✓ $USER_BIN is already in PATH"
|
|
112
|
+
fi
|
|
113
|
+
else
|
|
114
|
+
# Option 2: Create alias in shell config
|
|
115
|
+
echo "⚠️ Cannot write to $USER_BIN"
|
|
116
|
+
echo ""
|
|
117
|
+
echo "Add this alias to your shell config (~/.bashrc or ~/.zshrc):"
|
|
118
|
+
echo ""
|
|
119
|
+
echo " alias vmcode='cd $PROJECT_ROOT && python3 src/ui/main.py'"
|
|
120
|
+
echo ""
|
|
121
|
+
echo "Then reload your shell: source ~/.bashrc"
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
echo ""
|
|
125
|
+
echo "=========================================="
|
|
126
|
+
echo " Setup Complete!"
|
|
127
|
+
echo "=========================================="
|
|
128
|
+
echo ""
|
|
129
|
+
echo "Run vmcode:"
|
|
130
|
+
echo " vmcode"
|
|
131
|
+
echo ""
|
|
132
|
+
echo "Or run directly:"
|
|
133
|
+
echo " cd $PROJECT_ROOT"
|
|
134
|
+
echo " python3 src/ui/main.py"
|
|
135
|
+
echo ""
|
package/src/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Core business logic for vmCode."""
|