beth-copilot 1.0.13 → 1.0.14
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/CHANGELOG.md +7 -0
- package/bin/cli.js +65 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,13 @@ All notable changes to Beth are documented here. Format based on [Keep a Changel
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [1.0.14] - 2026-02-04
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **User-friendly error messages** — CLI errors now display formatted boxes with clear problem descriptions, fix instructions, and the exact command to run. No more raw stack traces.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
9
16
|
## [1.0.13] - 2026-02-04
|
|
10
17
|
|
|
11
18
|
### Fixed
|
package/bin/cli.js
CHANGED
|
@@ -409,6 +409,54 @@ function logError(message) {
|
|
|
409
409
|
log(`✗ ${message}`, COLORS.red);
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
+
/**
|
|
413
|
+
* User-facing error with actionable fix instructions
|
|
414
|
+
*/
|
|
415
|
+
class UserError extends Error {
|
|
416
|
+
constructor(message, { problem, fix, command } = {}) {
|
|
417
|
+
super(message);
|
|
418
|
+
this.name = 'UserError';
|
|
419
|
+
this.problem = problem;
|
|
420
|
+
this.fix = fix;
|
|
421
|
+
this.command = command;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Display a user-friendly error with fix instructions
|
|
427
|
+
*/
|
|
428
|
+
function showUserError(error) {
|
|
429
|
+
console.log('');
|
|
430
|
+
console.log(`${COLORS.red}╔════════════════════════════════════════════════════════════╗${COLORS.reset}`);
|
|
431
|
+
console.log(`${COLORS.red}║${COLORS.reset} ${COLORS.bright}${COLORS.red}Installation Error${COLORS.reset} ${COLORS.red}║${COLORS.reset}`);
|
|
432
|
+
console.log(`${COLORS.red}╚════════════════════════════════════════════════════════════╝${COLORS.reset}`);
|
|
433
|
+
console.log('');
|
|
434
|
+
|
|
435
|
+
if (error.problem) {
|
|
436
|
+
console.log(`${COLORS.bright}Problem:${COLORS.reset}`);
|
|
437
|
+
console.log(` ${error.problem}`);
|
|
438
|
+
console.log('');
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
if (error.fix) {
|
|
442
|
+
console.log(`${COLORS.bright}Fix:${COLORS.reset}`);
|
|
443
|
+
console.log(` ${error.fix}`);
|
|
444
|
+
console.log('');
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
if (error.command) {
|
|
448
|
+
console.log(`${COLORS.bright}Run this command:${COLORS.reset}`);
|
|
449
|
+
console.log(` ${COLORS.cyan}${error.command}${COLORS.reset}`);
|
|
450
|
+
console.log('');
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
if (globalThis.VERBOSE) {
|
|
454
|
+
console.log(`${COLORS.dim}Stack trace:${COLORS.reset}`);
|
|
455
|
+
console.log(`${COLORS.dim}${error.stack}${COLORS.reset}`);
|
|
456
|
+
console.log('');
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
412
460
|
function logInfo(message) {
|
|
413
461
|
log(` ${message}`, COLORS.cyan);
|
|
414
462
|
}
|
|
@@ -737,9 +785,14 @@ function copyDirRecursive(src, dest, options = {}) {
|
|
|
737
785
|
unlinkSync(dest);
|
|
738
786
|
mkdirSync(dest, { recursive: true });
|
|
739
787
|
} else {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
`
|
|
788
|
+
const relativePath = relative(process.cwd(), dest);
|
|
789
|
+
throw new UserError(
|
|
790
|
+
`Path conflict: ${relativePath}`,
|
|
791
|
+
{
|
|
792
|
+
problem: `"${relativePath}" exists as a file, but Beth needs it to be a directory.`,
|
|
793
|
+
fix: 'Either remove the file manually, or use --force to let Beth handle it.',
|
|
794
|
+
command: 'npx beth-copilot@latest init --force'
|
|
795
|
+
}
|
|
743
796
|
);
|
|
744
797
|
}
|
|
745
798
|
}
|
|
@@ -1075,7 +1128,15 @@ if (unknownFlags.length > 0) {
|
|
|
1075
1128
|
|
|
1076
1129
|
switch (command) {
|
|
1077
1130
|
case 'init':
|
|
1078
|
-
|
|
1131
|
+
try {
|
|
1132
|
+
await init(options);
|
|
1133
|
+
} catch (error) {
|
|
1134
|
+
if (error instanceof UserError) {
|
|
1135
|
+
showUserError(error);
|
|
1136
|
+
process.exit(1);
|
|
1137
|
+
}
|
|
1138
|
+
throw error;
|
|
1139
|
+
}
|
|
1079
1140
|
break;
|
|
1080
1141
|
case 'doctor':
|
|
1081
1142
|
{
|