vibecodingmachine-cli 1.0.5 ā 1.0.6
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/.allnightai/REQUIREMENTS.md +11 -11
- package/.allnightai/temp/auto-status.json +6 -0
- package/.env +7 -0
- package/.eslintrc.js +16 -16
- package/README.md +85 -85
- package/bin/vibecodingmachine.js +274 -274
- package/jest.config.js +8 -8
- package/logs/audit/2025-11-07.jsonl +2 -2
- package/package.json +62 -62
- package/scripts/README.md +128 -128
- package/scripts/auto-start-wrapper.sh +92 -92
- package/scripts/postinstall.js +81 -81
- package/src/commands/auth.js +96 -96
- package/src/commands/auto-direct.js +1748 -1748
- package/src/commands/auto.js +4692 -4692
- package/src/commands/auto.js.bak +710 -710
- package/src/commands/ide.js +70 -70
- package/src/commands/repo.js +159 -159
- package/src/commands/requirements.js +161 -161
- package/src/commands/setup.js +91 -91
- package/src/commands/status.js +88 -88
- package/src/index.js +5 -5
- package/src/utils/auth.js +571 -577
- package/src/utils/auto-mode-ansi-ui.js +238 -238
- package/src/utils/auto-mode-simple-ui.js +161 -161
- package/src/utils/auto-mode-ui.js.bak.blessed +207 -207
- package/src/utils/auto-mode.js +65 -65
- package/src/utils/config.js +64 -64
- package/src/utils/interactive.js +3616 -3616
- package/src/utils/keyboard-handler.js +153 -152
- package/src/utils/logger.js +4 -4
- package/src/utils/persistent-header.js +116 -116
- package/src/utils/provider-registry.js +128 -128
- package/src/utils/status-card.js +120 -120
- package/src/utils/stdout-interceptor.js +127 -127
- package/tests/auto-mode.test.js +37 -37
- package/tests/config.test.js +34 -34
package/bin/vibecodingmachine.js
CHANGED
|
@@ -1,274 +1,274 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
|
|
6
|
-
// Auto-load .env.auth if it exists
|
|
7
|
-
const envAuthPath = path.join(__dirname, '..', '..', '.env.auth');
|
|
8
|
-
if (fs.existsSync(envAuthPath)) {
|
|
9
|
-
const envContent = fs.readFileSync(envAuthPath, 'utf8');
|
|
10
|
-
envContent.split('\n').forEach(line => {
|
|
11
|
-
const trimmed = line.trim();
|
|
12
|
-
if (trimmed && !trimmed.startsWith('#')) {
|
|
13
|
-
const [key, ...valueParts] = trimmed.split('=');
|
|
14
|
-
if (key && valueParts.length > 0) {
|
|
15
|
-
process.env[key.trim()] = valueParts.join('=').trim();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Vibe Coding Machine CLI - Command-line interface for autonomous AI development
|
|
23
|
-
* "Big Dreams + AI + VibeCodingMachine.com = Your money making apps"
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const { program } = require('commander');
|
|
27
|
-
const chalk = require('chalk');
|
|
28
|
-
// const path = require('path'); // Moved to top for .env.auth loading
|
|
29
|
-
const packageJson = require('../package.json');
|
|
30
|
-
|
|
31
|
-
// Import command modules
|
|
32
|
-
const repoCommands = require('../src/commands/repo');
|
|
33
|
-
const autoCommands = require('../src/commands/auto');
|
|
34
|
-
const reqCommands = require('../src/commands/requirements');
|
|
35
|
-
const ideCommands = require('../src/commands/ide');
|
|
36
|
-
const statusCommands = require('../src/commands/status');
|
|
37
|
-
|
|
38
|
-
// Detect which command was used (vcm or vibecodingmachine)
|
|
39
|
-
const commandName = path.basename(process.argv[1], '.js');
|
|
40
|
-
const altCommandName = commandName === 'vcm' ? 'vibecodingmachine' : 'vcm';
|
|
41
|
-
|
|
42
|
-
// Configure CLI
|
|
43
|
-
program
|
|
44
|
-
.name(commandName)
|
|
45
|
-
.usage(`[options] [command]\n\n You can use '${commandName}' or '${altCommandName}'`)
|
|
46
|
-
.description('Vibe Coding Machine CLI - Autonomous development')
|
|
47
|
-
.version(packageJson.version, '-v, --version', 'output the current version')
|
|
48
|
-
.helpOption('-h, --help', 'display help for command');
|
|
49
|
-
|
|
50
|
-
// Repository management commands
|
|
51
|
-
program
|
|
52
|
-
.command('repo')
|
|
53
|
-
.description('Manage repository settings')
|
|
54
|
-
.action(() => {
|
|
55
|
-
program.outputHelp();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
program
|
|
59
|
-
.command('repo:set <path>')
|
|
60
|
-
.description('Set the active repository path')
|
|
61
|
-
.action(repoCommands.setRepo);
|
|
62
|
-
|
|
63
|
-
program
|
|
64
|
-
.command('repo:get')
|
|
65
|
-
.description('Get the current repository path')
|
|
66
|
-
.action(repoCommands.getRepo);
|
|
67
|
-
|
|
68
|
-
program
|
|
69
|
-
.command('repo:init')
|
|
70
|
-
.description('Initialize Vibe Coding Machine in current directory')
|
|
71
|
-
.action(repoCommands.initRepo);
|
|
72
|
-
|
|
73
|
-
// Auto mode commands
|
|
74
|
-
program
|
|
75
|
-
.command('auto:start')
|
|
76
|
-
.description('Start autonomous development mode')
|
|
77
|
-
.option('-i, --ide <ide>', 'IDE to use (claude-code, aider, cursor, vscode, windsurf, cline)')
|
|
78
|
-
.option('-m, --max-chats <number>', 'Maximum number of chat iterations', parseInt)
|
|
79
|
-
.option('-n, --never-stop', 'Run indefinitely without stopping')
|
|
80
|
-
.option('-f, --force-provider-setup', 'Force provider selection even if already configured')
|
|
81
|
-
.action(autoCommands.start);
|
|
82
|
-
|
|
83
|
-
// Direct LLM auto mode (new simplified implementation)
|
|
84
|
-
const { handleAutoStart: handleDirectAutoStart } = require('../src/commands/auto-direct');
|
|
85
|
-
program
|
|
86
|
-
.command('auto:direct')
|
|
87
|
-
.description('Start autonomous mode with direct LLM API calls (recommended)')
|
|
88
|
-
.option('-m, --max-chats <number>', 'Maximum number of iterations', parseInt)
|
|
89
|
-
.action(handleDirectAutoStart);
|
|
90
|
-
|
|
91
|
-
program
|
|
92
|
-
.command('auto:stop')
|
|
93
|
-
.description('Stop autonomous development mode')
|
|
94
|
-
.action(autoCommands.stop);
|
|
95
|
-
|
|
96
|
-
program
|
|
97
|
-
.command('auto:status')
|
|
98
|
-
.description('Check autonomous mode status')
|
|
99
|
-
.action(autoCommands.status);
|
|
100
|
-
|
|
101
|
-
program
|
|
102
|
-
.command('auto:config')
|
|
103
|
-
.description('Configure auto mode settings')
|
|
104
|
-
.option('--max-chats <number>', 'Set maximum chat iterations', parseInt)
|
|
105
|
-
.option('--never-stop', 'Enable never stop mode')
|
|
106
|
-
.option('--no-never-stop', 'Disable never stop mode')
|
|
107
|
-
.action(autoCommands.config);
|
|
108
|
-
|
|
109
|
-
// Requirements management commands
|
|
110
|
-
program
|
|
111
|
-
.command('req:list')
|
|
112
|
-
.description('List all requirements')
|
|
113
|
-
.option('-s, --status <status>', 'Filter by status (pending, in-progress, completed)')
|
|
114
|
-
.action(reqCommands.list);
|
|
115
|
-
|
|
116
|
-
program
|
|
117
|
-
.command('req:add <requirement>')
|
|
118
|
-
.description('Add a new requirement')
|
|
119
|
-
.action(reqCommands.add);
|
|
120
|
-
|
|
121
|
-
program
|
|
122
|
-
.command('req:current')
|
|
123
|
-
.description('Show current requirement being worked on')
|
|
124
|
-
.action(reqCommands.current);
|
|
125
|
-
|
|
126
|
-
program
|
|
127
|
-
.command('req:next')
|
|
128
|
-
.description('Move to next requirement')
|
|
129
|
-
.action(reqCommands.next);
|
|
130
|
-
|
|
131
|
-
program
|
|
132
|
-
.command('req:edit')
|
|
133
|
-
.description('Open requirements file in editor')
|
|
134
|
-
.action(reqCommands.edit);
|
|
135
|
-
|
|
136
|
-
program
|
|
137
|
-
.command('req:watch')
|
|
138
|
-
.description('Watch requirements file for changes')
|
|
139
|
-
.action(reqCommands.watch);
|
|
140
|
-
|
|
141
|
-
// IDE integration commands
|
|
142
|
-
program
|
|
143
|
-
.command('ide:list')
|
|
144
|
-
.description('List available IDEs')
|
|
145
|
-
.action(ideCommands.list);
|
|
146
|
-
|
|
147
|
-
program
|
|
148
|
-
.command('ide:open <ide>')
|
|
149
|
-
.description('Open IDE with current repository')
|
|
150
|
-
.action(ideCommands.open);
|
|
151
|
-
|
|
152
|
-
program
|
|
153
|
-
.command('ide:send <message>')
|
|
154
|
-
.description('Send message to IDE AI chat')
|
|
155
|
-
.option('-i, --ide <ide>', 'IDE to use (cursor, vscode, windsurf)', 'cursor')
|
|
156
|
-
.action(ideCommands.send);
|
|
157
|
-
|
|
158
|
-
// Status and monitoring commands
|
|
159
|
-
program
|
|
160
|
-
.command('status')
|
|
161
|
-
.description('Show Vibe Coding Machine status and progress')
|
|
162
|
-
.action(statusCommands.show);
|
|
163
|
-
|
|
164
|
-
program
|
|
165
|
-
.command('progress')
|
|
166
|
-
.description('Show development progress')
|
|
167
|
-
.action(statusCommands.progress);
|
|
168
|
-
|
|
169
|
-
program
|
|
170
|
-
.command('logs')
|
|
171
|
-
.description('Show recent activity logs')
|
|
172
|
-
.option('-n, --lines <number>', 'Number of log lines to show', '50')
|
|
173
|
-
.action(statusCommands.logs);
|
|
174
|
-
|
|
175
|
-
// Setup command
|
|
176
|
-
program
|
|
177
|
-
.command('setup')
|
|
178
|
-
.description('Setup "vcm" alias for shell')
|
|
179
|
-
.action(async () => {
|
|
180
|
-
const { setupAlias } = require('../src/commands/setup');
|
|
181
|
-
await setupAlias();
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// Authentication commands
|
|
185
|
-
const authCommands = require('../src/commands/auth');
|
|
186
|
-
program
|
|
187
|
-
.command('auth:login')
|
|
188
|
-
.description('Login with Google')
|
|
189
|
-
.option('--headless', 'Use headless mode (manual URL paste) for SSH/no-GUI environments')
|
|
190
|
-
.action((options) => authCommands.login(options));
|
|
191
|
-
|
|
192
|
-
program
|
|
193
|
-
.command('auth:logout')
|
|
194
|
-
.description('Logout')
|
|
195
|
-
.action(authCommands.logout);
|
|
196
|
-
|
|
197
|
-
program
|
|
198
|
-
.command('auth:status')
|
|
199
|
-
.description('Check authentication status')
|
|
200
|
-
.action(authCommands.status);
|
|
201
|
-
|
|
202
|
-
// Interactive mode
|
|
203
|
-
program
|
|
204
|
-
.command('interactive')
|
|
205
|
-
.alias('i')
|
|
206
|
-
.description('Start interactive mode')
|
|
207
|
-
.action(async () => {
|
|
208
|
-
const { startInteractive } = require('../src/utils/interactive');
|
|
209
|
-
await startInteractive();
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
// Error handling
|
|
213
|
-
process.on('uncaughtException', (error) => {
|
|
214
|
-
console.error(chalk.red('Error:'), error.message);
|
|
215
|
-
process.exit(1);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
process.on('unhandledRejection', (error) => {
|
|
219
|
-
console.error(chalk.red('Error:'), error.message);
|
|
220
|
-
process.exit(1);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
// Check for updates and display notification
|
|
224
|
-
async function checkForUpdates() {
|
|
225
|
-
try {
|
|
226
|
-
const { checkForUpdatesWithCache } = require('@vibecodingmachine/core');
|
|
227
|
-
const updateInfo = await checkForUpdatesWithCache('vibecodingmachine-cli', packageJson.version);
|
|
228
|
-
|
|
229
|
-
if (updateInfo.hasUpdate) {
|
|
230
|
-
// Store update info globally for when auto mode starts
|
|
231
|
-
global.pendingUpdate = updateInfo;
|
|
232
|
-
|
|
233
|
-
// Display update notification
|
|
234
|
-
console.log(chalk.cyan(`\nš¦ Update available: v${updateInfo.currentVersion} ā v${updateInfo.latestVersion}`));
|
|
235
|
-
console.log(chalk.gray(` Published: ${updateInfo.publishedDate}`));
|
|
236
|
-
console.log(chalk.yellow(` Will be installed next time auto mode is started\n`));
|
|
237
|
-
}
|
|
238
|
-
} catch (error) {
|
|
239
|
-
// Silently fail - don't block CLI usage
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Start interactive mode if no command provided (check BEFORE parsing)
|
|
244
|
-
if (!process.argv.slice(2).length) {
|
|
245
|
-
(async () => {
|
|
246
|
-
// Check for updates first
|
|
247
|
-
await checkForUpdates();
|
|
248
|
-
|
|
249
|
-
// Check authentication before allowing interactive mode
|
|
250
|
-
const auth = require('../src/utils/auth');
|
|
251
|
-
const isAuth = await auth.isAuthenticated();
|
|
252
|
-
|
|
253
|
-
if (!isAuth) {
|
|
254
|
-
console.log(chalk.cyan('\nš Opening browser for authentication...\n'));
|
|
255
|
-
try {
|
|
256
|
-
await auth.login();
|
|
257
|
-
console.log(chalk.green('\nā Authentication successful!\n'));
|
|
258
|
-
} catch (error) {
|
|
259
|
-
console.log(chalk.red('\nā Authentication failed:'), error.message);
|
|
260
|
-
process.exit(1);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const { startInteractive } = require('../src/utils/interactive');
|
|
265
|
-
await startInteractive();
|
|
266
|
-
})();
|
|
267
|
-
} else {
|
|
268
|
-
// Check for updates before parsing commands
|
|
269
|
-
(async () => {
|
|
270
|
-
await checkForUpdates();
|
|
271
|
-
// Parse arguments only if commands were provided
|
|
272
|
-
program.parse(process.argv);
|
|
273
|
-
})();
|
|
274
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
// Auto-load .env.auth if it exists
|
|
7
|
+
const envAuthPath = path.join(__dirname, '..', '..', '.env.auth');
|
|
8
|
+
if (fs.existsSync(envAuthPath)) {
|
|
9
|
+
const envContent = fs.readFileSync(envAuthPath, 'utf8');
|
|
10
|
+
envContent.split('\n').forEach(line => {
|
|
11
|
+
const trimmed = line.trim();
|
|
12
|
+
if (trimmed && !trimmed.startsWith('#')) {
|
|
13
|
+
const [key, ...valueParts] = trimmed.split('=');
|
|
14
|
+
if (key && valueParts.length > 0) {
|
|
15
|
+
process.env[key.trim()] = valueParts.join('=').trim();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Vibe Coding Machine CLI - Command-line interface for autonomous AI development
|
|
23
|
+
* "Big Dreams + AI + VibeCodingMachine.com = Your money making apps"
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const { program } = require('commander');
|
|
27
|
+
const chalk = require('chalk');
|
|
28
|
+
// const path = require('path'); // Moved to top for .env.auth loading
|
|
29
|
+
const packageJson = require('../package.json');
|
|
30
|
+
|
|
31
|
+
// Import command modules
|
|
32
|
+
const repoCommands = require('../src/commands/repo');
|
|
33
|
+
const autoCommands = require('../src/commands/auto');
|
|
34
|
+
const reqCommands = require('../src/commands/requirements');
|
|
35
|
+
const ideCommands = require('../src/commands/ide');
|
|
36
|
+
const statusCommands = require('../src/commands/status');
|
|
37
|
+
|
|
38
|
+
// Detect which command was used (vcm or vibecodingmachine)
|
|
39
|
+
const commandName = path.basename(process.argv[1], '.js');
|
|
40
|
+
const altCommandName = commandName === 'vcm' ? 'vibecodingmachine' : 'vcm';
|
|
41
|
+
|
|
42
|
+
// Configure CLI
|
|
43
|
+
program
|
|
44
|
+
.name(commandName)
|
|
45
|
+
.usage(`[options] [command]\n\n You can use '${commandName}' or '${altCommandName}'`)
|
|
46
|
+
.description('Vibe Coding Machine CLI - Autonomous development')
|
|
47
|
+
.version(packageJson.version, '-v, --version', 'output the current version')
|
|
48
|
+
.helpOption('-h, --help', 'display help for command');
|
|
49
|
+
|
|
50
|
+
// Repository management commands
|
|
51
|
+
program
|
|
52
|
+
.command('repo')
|
|
53
|
+
.description('Manage repository settings')
|
|
54
|
+
.action(() => {
|
|
55
|
+
program.outputHelp();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
program
|
|
59
|
+
.command('repo:set <path>')
|
|
60
|
+
.description('Set the active repository path')
|
|
61
|
+
.action(repoCommands.setRepo);
|
|
62
|
+
|
|
63
|
+
program
|
|
64
|
+
.command('repo:get')
|
|
65
|
+
.description('Get the current repository path')
|
|
66
|
+
.action(repoCommands.getRepo);
|
|
67
|
+
|
|
68
|
+
program
|
|
69
|
+
.command('repo:init')
|
|
70
|
+
.description('Initialize Vibe Coding Machine in current directory')
|
|
71
|
+
.action(repoCommands.initRepo);
|
|
72
|
+
|
|
73
|
+
// Auto mode commands
|
|
74
|
+
program
|
|
75
|
+
.command('auto:start')
|
|
76
|
+
.description('Start autonomous development mode')
|
|
77
|
+
.option('-i, --ide <ide>', 'IDE to use (claude-code, aider, cursor, vscode, windsurf, cline)')
|
|
78
|
+
.option('-m, --max-chats <number>', 'Maximum number of chat iterations', parseInt)
|
|
79
|
+
.option('-n, --never-stop', 'Run indefinitely without stopping')
|
|
80
|
+
.option('-f, --force-provider-setup', 'Force provider selection even if already configured')
|
|
81
|
+
.action(autoCommands.start);
|
|
82
|
+
|
|
83
|
+
// Direct LLM auto mode (new simplified implementation)
|
|
84
|
+
const { handleAutoStart: handleDirectAutoStart } = require('../src/commands/auto-direct');
|
|
85
|
+
program
|
|
86
|
+
.command('auto:direct')
|
|
87
|
+
.description('Start autonomous mode with direct LLM API calls (recommended)')
|
|
88
|
+
.option('-m, --max-chats <number>', 'Maximum number of iterations', parseInt)
|
|
89
|
+
.action(handleDirectAutoStart);
|
|
90
|
+
|
|
91
|
+
program
|
|
92
|
+
.command('auto:stop')
|
|
93
|
+
.description('Stop autonomous development mode')
|
|
94
|
+
.action(autoCommands.stop);
|
|
95
|
+
|
|
96
|
+
program
|
|
97
|
+
.command('auto:status')
|
|
98
|
+
.description('Check autonomous mode status')
|
|
99
|
+
.action(autoCommands.status);
|
|
100
|
+
|
|
101
|
+
program
|
|
102
|
+
.command('auto:config')
|
|
103
|
+
.description('Configure auto mode settings')
|
|
104
|
+
.option('--max-chats <number>', 'Set maximum chat iterations', parseInt)
|
|
105
|
+
.option('--never-stop', 'Enable never stop mode')
|
|
106
|
+
.option('--no-never-stop', 'Disable never stop mode')
|
|
107
|
+
.action(autoCommands.config);
|
|
108
|
+
|
|
109
|
+
// Requirements management commands
|
|
110
|
+
program
|
|
111
|
+
.command('req:list')
|
|
112
|
+
.description('List all requirements')
|
|
113
|
+
.option('-s, --status <status>', 'Filter by status (pending, in-progress, completed)')
|
|
114
|
+
.action(reqCommands.list);
|
|
115
|
+
|
|
116
|
+
program
|
|
117
|
+
.command('req:add <requirement>')
|
|
118
|
+
.description('Add a new requirement')
|
|
119
|
+
.action(reqCommands.add);
|
|
120
|
+
|
|
121
|
+
program
|
|
122
|
+
.command('req:current')
|
|
123
|
+
.description('Show current requirement being worked on')
|
|
124
|
+
.action(reqCommands.current);
|
|
125
|
+
|
|
126
|
+
program
|
|
127
|
+
.command('req:next')
|
|
128
|
+
.description('Move to next requirement')
|
|
129
|
+
.action(reqCommands.next);
|
|
130
|
+
|
|
131
|
+
program
|
|
132
|
+
.command('req:edit')
|
|
133
|
+
.description('Open requirements file in editor')
|
|
134
|
+
.action(reqCommands.edit);
|
|
135
|
+
|
|
136
|
+
program
|
|
137
|
+
.command('req:watch')
|
|
138
|
+
.description('Watch requirements file for changes')
|
|
139
|
+
.action(reqCommands.watch);
|
|
140
|
+
|
|
141
|
+
// IDE integration commands
|
|
142
|
+
program
|
|
143
|
+
.command('ide:list')
|
|
144
|
+
.description('List available IDEs')
|
|
145
|
+
.action(ideCommands.list);
|
|
146
|
+
|
|
147
|
+
program
|
|
148
|
+
.command('ide:open <ide>')
|
|
149
|
+
.description('Open IDE with current repository')
|
|
150
|
+
.action(ideCommands.open);
|
|
151
|
+
|
|
152
|
+
program
|
|
153
|
+
.command('ide:send <message>')
|
|
154
|
+
.description('Send message to IDE AI chat')
|
|
155
|
+
.option('-i, --ide <ide>', 'IDE to use (cursor, vscode, windsurf)', 'cursor')
|
|
156
|
+
.action(ideCommands.send);
|
|
157
|
+
|
|
158
|
+
// Status and monitoring commands
|
|
159
|
+
program
|
|
160
|
+
.command('status')
|
|
161
|
+
.description('Show Vibe Coding Machine status and progress')
|
|
162
|
+
.action(statusCommands.show);
|
|
163
|
+
|
|
164
|
+
program
|
|
165
|
+
.command('progress')
|
|
166
|
+
.description('Show development progress')
|
|
167
|
+
.action(statusCommands.progress);
|
|
168
|
+
|
|
169
|
+
program
|
|
170
|
+
.command('logs')
|
|
171
|
+
.description('Show recent activity logs')
|
|
172
|
+
.option('-n, --lines <number>', 'Number of log lines to show', '50')
|
|
173
|
+
.action(statusCommands.logs);
|
|
174
|
+
|
|
175
|
+
// Setup command
|
|
176
|
+
program
|
|
177
|
+
.command('setup')
|
|
178
|
+
.description('Setup "vcm" alias for shell')
|
|
179
|
+
.action(async () => {
|
|
180
|
+
const { setupAlias } = require('../src/commands/setup');
|
|
181
|
+
await setupAlias();
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Authentication commands
|
|
185
|
+
const authCommands = require('../src/commands/auth');
|
|
186
|
+
program
|
|
187
|
+
.command('auth:login')
|
|
188
|
+
.description('Login with Google')
|
|
189
|
+
.option('--headless', 'Use headless mode (manual URL paste) for SSH/no-GUI environments')
|
|
190
|
+
.action((options) => authCommands.login(options));
|
|
191
|
+
|
|
192
|
+
program
|
|
193
|
+
.command('auth:logout')
|
|
194
|
+
.description('Logout')
|
|
195
|
+
.action(authCommands.logout);
|
|
196
|
+
|
|
197
|
+
program
|
|
198
|
+
.command('auth:status')
|
|
199
|
+
.description('Check authentication status')
|
|
200
|
+
.action(authCommands.status);
|
|
201
|
+
|
|
202
|
+
// Interactive mode
|
|
203
|
+
program
|
|
204
|
+
.command('interactive')
|
|
205
|
+
.alias('i')
|
|
206
|
+
.description('Start interactive mode')
|
|
207
|
+
.action(async () => {
|
|
208
|
+
const { startInteractive } = require('../src/utils/interactive');
|
|
209
|
+
await startInteractive();
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Error handling
|
|
213
|
+
process.on('uncaughtException', (error) => {
|
|
214
|
+
console.error(chalk.red('Error:'), error.message);
|
|
215
|
+
process.exit(1);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
process.on('unhandledRejection', (error) => {
|
|
219
|
+
console.error(chalk.red('Error:'), error.message);
|
|
220
|
+
process.exit(1);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// Check for updates and display notification
|
|
224
|
+
async function checkForUpdates() {
|
|
225
|
+
try {
|
|
226
|
+
const { checkForUpdatesWithCache } = require('@vibecodingmachine/core');
|
|
227
|
+
const updateInfo = await checkForUpdatesWithCache('vibecodingmachine-cli', packageJson.version);
|
|
228
|
+
|
|
229
|
+
if (updateInfo.hasUpdate) {
|
|
230
|
+
// Store update info globally for when auto mode starts
|
|
231
|
+
global.pendingUpdate = updateInfo;
|
|
232
|
+
|
|
233
|
+
// Display update notification
|
|
234
|
+
console.log(chalk.cyan(`\nš¦ Update available: v${updateInfo.currentVersion} ā v${updateInfo.latestVersion}`));
|
|
235
|
+
console.log(chalk.gray(` Published: ${updateInfo.publishedDate}`));
|
|
236
|
+
console.log(chalk.yellow(` Will be installed next time auto mode is started\n`));
|
|
237
|
+
}
|
|
238
|
+
} catch (error) {
|
|
239
|
+
// Silently fail - don't block CLI usage
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Start interactive mode if no command provided (check BEFORE parsing)
|
|
244
|
+
if (!process.argv.slice(2).length) {
|
|
245
|
+
(async () => {
|
|
246
|
+
// Check for updates first
|
|
247
|
+
await checkForUpdates();
|
|
248
|
+
|
|
249
|
+
// Check authentication before allowing interactive mode
|
|
250
|
+
const auth = require('../src/utils/auth');
|
|
251
|
+
const isAuth = await auth.isAuthenticated();
|
|
252
|
+
|
|
253
|
+
if (!isAuth) {
|
|
254
|
+
console.log(chalk.cyan('\nš Opening browser for authentication...\n'));
|
|
255
|
+
try {
|
|
256
|
+
await auth.login();
|
|
257
|
+
console.log(chalk.green('\nā Authentication successful!\n'));
|
|
258
|
+
} catch (error) {
|
|
259
|
+
console.log(chalk.red('\nā Authentication failed:'), error.message);
|
|
260
|
+
process.exit(1);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const { startInteractive } = require('../src/utils/interactive');
|
|
265
|
+
await startInteractive();
|
|
266
|
+
})();
|
|
267
|
+
} else {
|
|
268
|
+
// Check for updates before parsing commands
|
|
269
|
+
(async () => {
|
|
270
|
+
await checkForUpdates();
|
|
271
|
+
// Parse arguments only if commands were provided
|
|
272
|
+
program.parse(process.argv);
|
|
273
|
+
})();
|
|
274
|
+
}
|
package/jest.config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
testEnvironment: 'node',
|
|
3
|
-
testMatch: ['**/tests/**/*.test.js'],
|
|
4
|
-
testPathIgnorePatterns: ['/node_modules/'],
|
|
5
|
-
collectCoverageFrom: ['src/**/*.js'],
|
|
6
|
-
coverageDirectory: 'coverage',
|
|
7
|
-
verbose: true
|
|
8
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
testEnvironment: 'node',
|
|
3
|
+
testMatch: ['**/tests/**/*.test.js'],
|
|
4
|
+
testPathIgnorePatterns: ['/node_modules/'],
|
|
5
|
+
collectCoverageFrom: ['src/**/*.js'],
|
|
6
|
+
coverageDirectory: 'coverage',
|
|
7
|
+
verbose: true
|
|
8
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
{"timestamp":"2025-11-07T12:33:10.966Z","type":"auto-mode-stop","reason":"startup","message":"Auto Mode stopped (startup)"}
|
|
2
|
-
{"timestamp":"2025-11-07T12:33:47.590Z","type":"auto-mode-stop","reason":"startup","message":"Auto Mode stopped (startup)"}
|
|
1
|
+
{"timestamp":"2025-11-07T12:33:10.966Z","type":"auto-mode-stop","reason":"startup","message":"Auto Mode stopped (startup)"}
|
|
2
|
+
{"timestamp":"2025-11-07T12:33:47.590Z","type":"auto-mode-stop","reason":"startup","message":"Auto Mode stopped (startup)"}
|