vigthoria-cli 1.9.9 → 1.9.19
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 +5 -5
- package/dist/commands/auth.js +48 -65
- package/dist/commands/bridge.js +12 -19
- package/dist/commands/cancel.js +15 -22
- package/dist/commands/chat.d.ts +11 -0
- package/dist/commands/chat.js +404 -248
- package/dist/commands/config.js +31 -71
- package/dist/commands/deploy.js +83 -123
- package/dist/commands/device.d.ts +35 -0
- package/dist/commands/device.js +239 -0
- package/dist/commands/edit.js +32 -39
- package/dist/commands/explain.js +18 -25
- package/dist/commands/fork.js +22 -27
- package/dist/commands/generate.js +37 -44
- package/dist/commands/history.js +20 -25
- package/dist/commands/hub.js +95 -102
- package/dist/commands/index.js +41 -46
- package/dist/commands/legion.d.ts +1 -0
- package/dist/commands/legion.js +162 -209
- package/dist/commands/preview.js +60 -98
- package/dist/commands/replay.js +27 -32
- package/dist/commands/repo.js +103 -141
- package/dist/commands/review.js +29 -36
- package/dist/commands/security.js +5 -12
- package/dist/commands/update.js +15 -49
- package/dist/commands/workflow.d.ts +8 -1
- package/dist/commands/workflow.js +53 -19
- package/dist/index.js +409 -234
- package/dist/utils/api.d.ts +5 -0
- package/dist/utils/api.js +398 -176
- package/dist/utils/bridge-client.js +11 -52
- package/dist/utils/cli-state.d.ts +54 -0
- package/dist/utils/cli-state.js +185 -0
- package/dist/utils/config.d.ts +5 -0
- package/dist/utils/config.js +35 -14
- package/dist/utils/context-ranker.js +15 -21
- package/dist/utils/files.js +5 -42
- package/dist/utils/logger.js +42 -50
- package/dist/utils/post-write-validator.js +22 -29
- package/dist/utils/project-memory.d.ts +56 -0
- package/dist/utils/project-memory.js +289 -0
- package/dist/utils/session.d.ts +29 -3
- package/dist/utils/session.js +137 -85
- package/dist/utils/task-display.js +13 -20
- package/dist/utils/tools.d.ts +19 -0
- package/dist/utils/tools.js +84 -87
- package/dist/utils/workspace-cache.js +18 -26
- package/dist/utils/workspace-stream.js +26 -64
- package/install.ps1 +14 -0
- package/package.json +5 -3
- package/scripts/release/LOCAL_MACHINE_USER_VERIFICATION.md +1 -1
- package/scripts/release/validate-no-go-gates.sh +2 -2
package/dist/commands/preview.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Vigthoria CLI - Preview Command
|
|
4
3
|
*
|
|
@@ -10,51 +9,15 @@
|
|
|
10
9
|
* vigthoria preview --proof - Run Template Service preview gate
|
|
11
10
|
* vigthoria preview -p /path/to/project - Preview specific project
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.PreviewCommand = void 0;
|
|
51
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
52
|
-
const fs = __importStar(require("fs"));
|
|
53
|
-
const path = __importStar(require("path"));
|
|
54
|
-
const http = __importStar(require("http"));
|
|
55
|
-
const diff_1 = require("diff");
|
|
56
|
-
const logger_js_1 = require("../utils/logger.js");
|
|
57
|
-
const api_js_1 = require("../utils/api.js");
|
|
12
|
+
import chalk from 'chalk';
|
|
13
|
+
import * as fs from 'fs';
|
|
14
|
+
import * as path from 'path';
|
|
15
|
+
import * as http from 'http';
|
|
16
|
+
import { createRequire } from 'node:module';
|
|
17
|
+
import { structuredPatch } from 'diff';
|
|
18
|
+
import { createSpinner, CH } from '../utils/logger.js';
|
|
19
|
+
import { APIClient } from '../utils/api.js';
|
|
20
|
+
const require = createRequire(import.meta.url);
|
|
58
21
|
// Common MIME types for static file serving
|
|
59
22
|
const MIME_TYPES = {
|
|
60
23
|
'.html': 'text/html',
|
|
@@ -83,7 +46,7 @@ const MIME_TYPES = {
|
|
|
83
46
|
'.txt': 'text/plain',
|
|
84
47
|
'.map': 'application/json',
|
|
85
48
|
};
|
|
86
|
-
class PreviewCommand {
|
|
49
|
+
export class PreviewCommand {
|
|
87
50
|
config;
|
|
88
51
|
logger;
|
|
89
52
|
api;
|
|
@@ -91,7 +54,7 @@ class PreviewCommand {
|
|
|
91
54
|
constructor(config, logger) {
|
|
92
55
|
this.config = config;
|
|
93
56
|
this.logger = logger;
|
|
94
|
-
this.api = new
|
|
57
|
+
this.api = new APIClient(config, logger);
|
|
95
58
|
}
|
|
96
59
|
async run(options) {
|
|
97
60
|
const projectPath = path.resolve(options.project || process.cwd());
|
|
@@ -101,8 +64,8 @@ class PreviewCommand {
|
|
|
101
64
|
return;
|
|
102
65
|
}
|
|
103
66
|
console.log();
|
|
104
|
-
console.log(
|
|
105
|
-
console.log(
|
|
67
|
+
console.log(chalk.bold.white(` ${CH.hLine.repeat(3)} Vigthoria Preview ${CH.hLine.repeat(40)}`));
|
|
68
|
+
console.log(chalk.gray(` Project: ${projectPath}`));
|
|
106
69
|
console.log();
|
|
107
70
|
// Show consolidated diff of recent agent changes
|
|
108
71
|
if (options.diff) {
|
|
@@ -230,10 +193,10 @@ class PreviewCommand {
|
|
|
230
193
|
});
|
|
231
194
|
this.server.listen(port, () => {
|
|
232
195
|
const url = `http://localhost:${port}/${entryFile}`;
|
|
233
|
-
console.log(
|
|
234
|
-
console.log(
|
|
235
|
-
console.log(
|
|
236
|
-
console.log(
|
|
196
|
+
console.log(chalk.green(` ${CH.success} Preview server running`));
|
|
197
|
+
console.log(chalk.gray(` URL: `) + chalk.cyan.underline(url));
|
|
198
|
+
console.log(chalk.gray(` Entry: ${entryFile}`));
|
|
199
|
+
console.log(chalk.gray(` Press Ctrl+C to stop`));
|
|
237
200
|
console.log();
|
|
238
201
|
if (autoOpen) {
|
|
239
202
|
this.openBrowser(url);
|
|
@@ -241,7 +204,7 @@ class PreviewCommand {
|
|
|
241
204
|
});
|
|
242
205
|
// Handle graceful shutdown
|
|
243
206
|
const shutdown = () => {
|
|
244
|
-
console.log(
|
|
207
|
+
console.log(chalk.gray('\n Stopping preview server...'));
|
|
245
208
|
this.server?.close();
|
|
246
209
|
this.api.destroy();
|
|
247
210
|
resolve();
|
|
@@ -289,7 +252,7 @@ class PreviewCommand {
|
|
|
289
252
|
* Show consolidated diff of recent agent changes using git
|
|
290
253
|
*/
|
|
291
254
|
async showConsolidatedDiff(projectPath) {
|
|
292
|
-
console.log(
|
|
255
|
+
console.log(chalk.bold.white(` ${CH.hLine.repeat(3)} Change Summary ${CH.hLine.repeat(43)}`));
|
|
293
256
|
console.log();
|
|
294
257
|
const proofDir = path.join(projectPath, '.vigthoria', 'proof', 'preview');
|
|
295
258
|
const hasProof = fs.existsSync(proofDir);
|
|
@@ -301,7 +264,7 @@ class PreviewCommand {
|
|
|
301
264
|
// Get list of changed files (unstaged + staged)
|
|
302
265
|
const statusOutput = execSync('git status --porcelain', { cwd: projectPath, encoding: 'utf-8' }).trim();
|
|
303
266
|
if (!statusOutput) {
|
|
304
|
-
console.log(
|
|
267
|
+
console.log(chalk.gray(' No changes detected (working tree clean).'));
|
|
305
268
|
console.log();
|
|
306
269
|
return;
|
|
307
270
|
}
|
|
@@ -321,13 +284,13 @@ class PreviewCommand {
|
|
|
321
284
|
}
|
|
322
285
|
// Summary header
|
|
323
286
|
const total = created.length + modified.length + deleted.length;
|
|
324
|
-
console.log(
|
|
287
|
+
console.log(chalk.white(` ${total} file${total !== 1 ? 's' : ''} changed:`));
|
|
325
288
|
for (const f of created)
|
|
326
|
-
console.log(
|
|
289
|
+
console.log(chalk.green(` + ${f}`));
|
|
327
290
|
for (const f of modified)
|
|
328
|
-
console.log(
|
|
291
|
+
console.log(chalk.yellow(` ~ ${f}`));
|
|
329
292
|
for (const f of deleted)
|
|
330
|
-
console.log(
|
|
293
|
+
console.log(chalk.red(` - ${f}`));
|
|
331
294
|
console.log();
|
|
332
295
|
// Show unified diffs for modified and created files (limit to keep terminal manageable)
|
|
333
296
|
const diffTargets = [...modified, ...created].slice(0, 20);
|
|
@@ -353,23 +316,23 @@ class PreviewCommand {
|
|
|
353
316
|
// File is new or not tracked
|
|
354
317
|
}
|
|
355
318
|
}
|
|
356
|
-
const patch =
|
|
319
|
+
const patch = structuredPatch(relPath, relPath, oldContent, newContent, 'before', 'after', { context: 3 });
|
|
357
320
|
if (patch.hunks.length === 0)
|
|
358
321
|
continue;
|
|
359
|
-
console.log(
|
|
360
|
-
console.log(
|
|
361
|
-
console.log(
|
|
322
|
+
console.log(chalk.bold.white(` ${CH.hLine.repeat(3)} ${relPath} ${CH.hLine.repeat(Math.max(1, 50 - relPath.length))}`));
|
|
323
|
+
console.log(chalk.gray(` --- a/${relPath}`));
|
|
324
|
+
console.log(chalk.gray(` +++ b/${relPath}`));
|
|
362
325
|
for (const hunk of patch.hunks) {
|
|
363
|
-
console.log(
|
|
326
|
+
console.log(chalk.cyan(` @@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`));
|
|
364
327
|
for (const line of hunk.lines) {
|
|
365
328
|
if (line.startsWith('+')) {
|
|
366
|
-
console.log(
|
|
329
|
+
console.log(chalk.green(` ${line}`));
|
|
367
330
|
}
|
|
368
331
|
else if (line.startsWith('-')) {
|
|
369
|
-
console.log(
|
|
332
|
+
console.log(chalk.red(` ${line}`));
|
|
370
333
|
}
|
|
371
334
|
else {
|
|
372
|
-
console.log(
|
|
335
|
+
console.log(chalk.gray(` ${line}`));
|
|
373
336
|
}
|
|
374
337
|
}
|
|
375
338
|
}
|
|
@@ -380,7 +343,7 @@ class PreviewCommand {
|
|
|
380
343
|
}
|
|
381
344
|
}
|
|
382
345
|
if (diffTargets.length < modified.length + created.length) {
|
|
383
|
-
console.log(
|
|
346
|
+
console.log(chalk.gray(` ... and ${modified.length + created.length - diffTargets.length} more files`));
|
|
384
347
|
console.log();
|
|
385
348
|
}
|
|
386
349
|
return;
|
|
@@ -397,23 +360,23 @@ class PreviewCommand {
|
|
|
397
360
|
.reverse()
|
|
398
361
|
.slice(0, 5);
|
|
399
362
|
if (manifests.length > 0) {
|
|
400
|
-
console.log(
|
|
363
|
+
console.log(chalk.white(' Recent proof bundles:'));
|
|
401
364
|
for (const m of manifests) {
|
|
402
365
|
try {
|
|
403
366
|
const manifest = JSON.parse(fs.readFileSync(path.join(proofDir, m), 'utf-8'));
|
|
404
|
-
const passed = manifest.previewGate?.passed ?
|
|
405
|
-
console.log(
|
|
367
|
+
const passed = manifest.previewGate?.passed ? chalk.green('passed') : chalk.red('failed');
|
|
368
|
+
console.log(chalk.gray(` ${manifest.createdAt || m} `) + passed + chalk.gray(` ${manifest.entryPath || '-'}`));
|
|
406
369
|
}
|
|
407
370
|
catch {
|
|
408
|
-
console.log(
|
|
371
|
+
console.log(chalk.gray(` ${m}`));
|
|
409
372
|
}
|
|
410
373
|
}
|
|
411
374
|
console.log();
|
|
412
375
|
}
|
|
413
376
|
}
|
|
414
377
|
else {
|
|
415
|
-
console.log(
|
|
416
|
-
console.log(
|
|
378
|
+
console.log(chalk.gray(' No git history or proof bundles found.'));
|
|
379
|
+
console.log(chalk.gray(' Run an agent task first to generate changes.'));
|
|
417
380
|
console.log();
|
|
418
381
|
}
|
|
419
382
|
}
|
|
@@ -421,7 +384,7 @@ class PreviewCommand {
|
|
|
421
384
|
* Run Template Service preview gate and persist proof bundle
|
|
422
385
|
*/
|
|
423
386
|
async runProofGate(projectPath, captureScreenshot) {
|
|
424
|
-
const spinner =
|
|
387
|
+
const spinner = createSpinner('Running preview proof gate...').start();
|
|
425
388
|
try {
|
|
426
389
|
const result = await this.api.runTemplateServicePreviewGate('', {
|
|
427
390
|
workspacePath: projectPath,
|
|
@@ -429,39 +392,39 @@ class PreviewCommand {
|
|
|
429
392
|
targetPath: projectPath,
|
|
430
393
|
});
|
|
431
394
|
spinner.stop();
|
|
432
|
-
console.log(
|
|
395
|
+
console.log(chalk.bold.white(` ${CH.hLine.repeat(3)} Preview Proof Gate ${CH.hLine.repeat(39)}`));
|
|
433
396
|
console.log();
|
|
434
397
|
if (!result.required) {
|
|
435
|
-
console.log(
|
|
398
|
+
console.log(chalk.gray(' Preview gate: not required (no frontend artifacts detected)'));
|
|
436
399
|
console.log();
|
|
437
400
|
return;
|
|
438
401
|
}
|
|
439
|
-
const statusIcon = result.passed ?
|
|
440
|
-
console.log(` ${statusIcon} Preview gate: ${result.passed ?
|
|
402
|
+
const statusIcon = result.passed ? chalk.green(CH.success) : chalk.red(CH.error);
|
|
403
|
+
console.log(` ${statusIcon} Preview gate: ${result.passed ? chalk.green('PASSED') : chalk.red('FAILED')}`);
|
|
441
404
|
if (result.error) {
|
|
442
|
-
console.log(
|
|
405
|
+
console.log(chalk.yellow(` Error: ${result.error}`));
|
|
443
406
|
}
|
|
444
407
|
// Show modes
|
|
445
408
|
if (result.modes) {
|
|
446
409
|
const modes = result.modes;
|
|
447
410
|
console.log();
|
|
448
411
|
if (modes.design) {
|
|
449
|
-
const designStatus = modes.design.ready ?
|
|
450
|
-
console.log(
|
|
412
|
+
const designStatus = modes.design.ready ? chalk.green('ready') : chalk.gray('not ready');
|
|
413
|
+
console.log(chalk.gray(` Design mode: `) + designStatus);
|
|
451
414
|
if (modes.design.devices) {
|
|
452
|
-
console.log(
|
|
415
|
+
console.log(chalk.gray(` Devices: ${modes.design.devices.join(', ')}`));
|
|
453
416
|
}
|
|
454
417
|
}
|
|
455
418
|
if (modes.live) {
|
|
456
|
-
const liveStatus = modes.live.ready ?
|
|
457
|
-
console.log(
|
|
419
|
+
const liveStatus = modes.live.ready ? chalk.green('ready') : chalk.gray('not ready');
|
|
420
|
+
console.log(chalk.gray(` Live mode: `) + liveStatus);
|
|
458
421
|
if (modes.live.entryPoint) {
|
|
459
|
-
console.log(
|
|
422
|
+
console.log(chalk.gray(` Entry: ${modes.live.entryPoint}`));
|
|
460
423
|
}
|
|
461
424
|
}
|
|
462
425
|
if (modes.production) {
|
|
463
|
-
const prodStatus = modes.production.ready ?
|
|
464
|
-
console.log(
|
|
426
|
+
const prodStatus = modes.production.ready ? chalk.green('ready') : chalk.gray('not ready');
|
|
427
|
+
console.log(chalk.gray(` Production mode: `) + prodStatus);
|
|
465
428
|
}
|
|
466
429
|
}
|
|
467
430
|
// Show summary
|
|
@@ -469,29 +432,29 @@ class PreviewCommand {
|
|
|
469
432
|
console.log();
|
|
470
433
|
const summary = result.summary;
|
|
471
434
|
if (summary.hasViewportMeta !== undefined) {
|
|
472
|
-
console.log(
|
|
435
|
+
console.log(chalk.gray(` Viewport meta: `) + (summary.hasViewportMeta ? chalk.green('yes') : chalk.yellow('missing')));
|
|
473
436
|
}
|
|
474
437
|
if (summary.hasResponsiveSignals !== undefined) {
|
|
475
|
-
console.log(
|
|
438
|
+
console.log(chalk.gray(` Responsive CSS: `) + (summary.hasResponsiveSignals ? chalk.green('yes') : chalk.gray('no')));
|
|
476
439
|
}
|
|
477
440
|
if (summary.hasInteractiveSignals !== undefined) {
|
|
478
|
-
console.log(
|
|
441
|
+
console.log(chalk.gray(` Interactive JS: `) + (summary.hasInteractiveSignals ? chalk.green('yes') : chalk.gray('no')));
|
|
479
442
|
}
|
|
480
443
|
if (typeof summary.sectionCount === 'number') {
|
|
481
|
-
console.log(
|
|
444
|
+
console.log(chalk.gray(` Section count: ${summary.sectionCount}`));
|
|
482
445
|
}
|
|
483
446
|
}
|
|
484
447
|
// Show artifacts
|
|
485
448
|
if (result.artifacts) {
|
|
486
449
|
console.log();
|
|
487
450
|
if (result.artifacts.manifestPath) {
|
|
488
|
-
console.log(
|
|
451
|
+
console.log(chalk.gray(` Manifest: ${result.artifacts.manifestPath}`));
|
|
489
452
|
}
|
|
490
453
|
if (result.artifacts.screenshotCaptured && result.artifacts.screenshotPath) {
|
|
491
|
-
console.log(
|
|
454
|
+
console.log(chalk.gray(` Screenshot: ${result.artifacts.screenshotPath}`));
|
|
492
455
|
}
|
|
493
456
|
if (result.artifacts.previewFileUrl) {
|
|
494
|
-
console.log(
|
|
457
|
+
console.log(chalk.gray(` File URL: `) + chalk.cyan.underline(result.artifacts.previewFileUrl));
|
|
495
458
|
}
|
|
496
459
|
}
|
|
497
460
|
console.log();
|
|
@@ -502,4 +465,3 @@ class PreviewCommand {
|
|
|
502
465
|
}
|
|
503
466
|
}
|
|
504
467
|
}
|
|
505
|
-
exports.PreviewCommand = PreviewCommand;
|
package/dist/commands/replay.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ReplayCommand = void 0;
|
|
7
|
-
const api_js_1 = require("../utils/api.js");
|
|
1
|
+
import { isServerRuntime } from '../utils/api.js';
|
|
8
2
|
/**
|
|
9
3
|
* replay.ts — Replay events from a V3 agent run step-by-step.
|
|
10
4
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { createSpinner, CH } from '../utils/logger.js';
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
export class ReplayCommand {
|
|
14
10
|
config;
|
|
15
11
|
logger;
|
|
16
12
|
constructor(config, logger) {
|
|
@@ -33,7 +29,7 @@ class ReplayCommand {
|
|
|
33
29
|
}
|
|
34
30
|
getBaseUrl() {
|
|
35
31
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
36
|
-
const allowLocal =
|
|
32
|
+
const allowLocal = isServerRuntime() && process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
37
33
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
38
34
|
process.env.V3_AGENT_URL ||
|
|
39
35
|
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
|
@@ -59,7 +55,7 @@ class ReplayCommand {
|
|
|
59
55
|
const speed = options.speed || 200;
|
|
60
56
|
const project = options.project || process.cwd();
|
|
61
57
|
const workspace = this.resolveWorkspaceRoot(project);
|
|
62
|
-
const spinner =
|
|
58
|
+
const spinner = createSpinner(`Loading events for run ${runId}...`).start();
|
|
63
59
|
try {
|
|
64
60
|
const baseUrl = this.getBaseUrl();
|
|
65
61
|
const params = new URLSearchParams({ workspace_root: workspace });
|
|
@@ -85,72 +81,72 @@ class ReplayCommand {
|
|
|
85
81
|
console.log(JSON.stringify(data, null, 2));
|
|
86
82
|
return;
|
|
87
83
|
}
|
|
88
|
-
console.log(
|
|
84
|
+
console.log(chalk.bold(`\n${CH.success} Replaying run ${chalk.cyan(runId)} (${data.count} events)\n`));
|
|
89
85
|
let toolCallNum = 0;
|
|
90
86
|
for (let i = 0; i < data.events.length; i++) {
|
|
91
87
|
const evt = data.events[i];
|
|
92
88
|
const type = evt.type || 'unknown';
|
|
93
|
-
const idx =
|
|
89
|
+
const idx = chalk.dim(`[${String(i + 1).padStart(3)}/${data.count}]`);
|
|
94
90
|
switch (type) {
|
|
95
91
|
case 'context':
|
|
96
|
-
console.log(`${idx} ${
|
|
92
|
+
console.log(`${idx} ${chalk.blue('context')} workspace=${evt.workspace_root || '?'}`);
|
|
97
93
|
break;
|
|
98
94
|
case 'start':
|
|
99
|
-
console.log(`${idx} ${
|
|
95
|
+
console.log(`${idx} ${chalk.green('▶ START')} task=${evt.task_id || '?'} ${evt.continuation ? chalk.dim(`(continuation #${evt.continuation})`) : ''}`);
|
|
100
96
|
break;
|
|
101
97
|
case 'thinking':
|
|
102
|
-
console.log(`${idx} ${
|
|
98
|
+
console.log(`${idx} ${chalk.dim('💭 thinking')} ${(evt.content || '').substring(0, 100)}`);
|
|
103
99
|
break;
|
|
104
100
|
case 'plan':
|
|
105
101
|
const taskCount = evt.tasks?.length || 0;
|
|
106
|
-
console.log(`${idx} ${
|
|
102
|
+
console.log(`${idx} ${chalk.magenta('📋 PLAN')} ${taskCount} tasks`);
|
|
107
103
|
if (evt.tasks) {
|
|
108
104
|
for (const t of evt.tasks.slice(0, 5)) {
|
|
109
|
-
console.log(` ${
|
|
105
|
+
console.log(` ${chalk.dim('├')} ${t.id || '?'}: ${(t.title || '').substring(0, 60)}`);
|
|
110
106
|
}
|
|
111
107
|
if (taskCount > 5)
|
|
112
|
-
console.log(` ${
|
|
108
|
+
console.log(` ${chalk.dim('└')} ...and ${taskCount - 5} more`);
|
|
113
109
|
}
|
|
114
110
|
break;
|
|
115
111
|
case 'tool_call':
|
|
116
112
|
toolCallNum++;
|
|
117
|
-
console.log(`${idx} ${
|
|
113
|
+
console.log(`${idx} ${chalk.yellow(`🔧 tool_call #${toolCallNum}`)} ${chalk.bold(evt.name || '?')}(${JSON.stringify(evt.arguments || {}).substring(0, 80)})`);
|
|
118
114
|
break;
|
|
119
115
|
case 'tool_result': {
|
|
120
116
|
const success = evt.success !== false;
|
|
121
|
-
const icon = success ?
|
|
117
|
+
const icon = success ? chalk.green('✓') : chalk.red('✗');
|
|
122
118
|
const output = (evt.output || '').substring(0, 120);
|
|
123
|
-
console.log(`${idx} ${icon} ${evt.name || '?'}: ${
|
|
119
|
+
console.log(`${idx} ${icon} ${evt.name || '?'}: ${chalk.dim(output)}`);
|
|
124
120
|
break;
|
|
125
121
|
}
|
|
126
122
|
case 'message':
|
|
127
|
-
console.log(`${idx} ${
|
|
123
|
+
console.log(`${idx} ${chalk.cyan('💬 message')} ${(evt.content || '').substring(0, 120)}`);
|
|
128
124
|
break;
|
|
129
125
|
case 'complete': {
|
|
130
126
|
const summary = (evt.summary || '').substring(0, 200);
|
|
131
127
|
const seal = evt.seal_score ? ` [${evt.seal_score.tier} ${evt.seal_score.overall}]` : '';
|
|
132
|
-
console.log(`${idx} ${
|
|
128
|
+
console.log(`${idx} ${chalk.green(`✅ COMPLETE`)}${chalk.yellow(seal)} ${evt.iterations || '?'} iterations, ${evt.tool_calls || '?'} tool calls`);
|
|
133
129
|
if (summary)
|
|
134
|
-
console.log(` ${
|
|
130
|
+
console.log(` ${chalk.dim(summary)}`);
|
|
135
131
|
break;
|
|
136
132
|
}
|
|
137
133
|
case 'error':
|
|
138
|
-
console.log(`${idx} ${
|
|
134
|
+
console.log(`${idx} ${chalk.red('❌ ERROR')} ${(evt.message || '').substring(0, 200)}`);
|
|
139
135
|
if (evt.checkpointed)
|
|
140
|
-
console.log(` ${
|
|
136
|
+
console.log(` ${chalk.yellow('Checkpointed — can be continued or forked')}`);
|
|
141
137
|
break;
|
|
142
138
|
case 'file_mutation':
|
|
143
|
-
console.log(`${idx} ${
|
|
139
|
+
console.log(`${idx} ${chalk.blue('📁 file_mutation')} ${evt.kind || '?'} ${evt.path || '?'}`);
|
|
144
140
|
break;
|
|
145
141
|
default:
|
|
146
|
-
console.log(`${idx} ${
|
|
142
|
+
console.log(`${idx} ${chalk.dim(type)} ${JSON.stringify(evt).substring(0, 100)}`);
|
|
147
143
|
}
|
|
148
144
|
// Delay between events for replay effect
|
|
149
145
|
if (i < data.events.length - 1) {
|
|
150
146
|
await this.sleep(speed);
|
|
151
147
|
}
|
|
152
148
|
}
|
|
153
|
-
console.log(
|
|
149
|
+
console.log(chalk.bold(`\n${CH.success} Replay complete (${data.count} events)\n`));
|
|
154
150
|
}
|
|
155
151
|
catch (err) {
|
|
156
152
|
spinner.stop();
|
|
@@ -158,4 +154,3 @@ class ReplayCommand {
|
|
|
158
154
|
}
|
|
159
155
|
}
|
|
160
156
|
}
|
|
161
|
-
exports.ReplayCommand = ReplayCommand;
|