@wacht/bench 0.1.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/dist/ui.js ADDED
@@ -0,0 +1,104 @@
1
+ function color(code, value) {
2
+ return process.env.NO_COLOR === undefined && process.stdout.isTTY
3
+ ? `\u001b[${code}m${value}\u001b[0m`
4
+ : value;
5
+ }
6
+ export function muted(value) {
7
+ return color(90, value);
8
+ }
9
+ export function accent(value) {
10
+ return color(36, value);
11
+ }
12
+ export function strong(value) {
13
+ return color(1, value);
14
+ }
15
+ export function success(value) {
16
+ return color(32, value);
17
+ }
18
+ export function warning(value) {
19
+ return color(33, value);
20
+ }
21
+ export function failure(value) {
22
+ return color(31, value);
23
+ }
24
+ export function banner() {
25
+ return [
26
+ accent(' __ __ _ _ ____ _ '),
27
+ accent(' \\ \\ / /_ _ ___| |__ | |_ | __ ) ___ _ __ ___| |__ '),
28
+ accent(' \\ \\/\\/ / _` / __| `_ \\| __| | _ \\ / _ \\ `_ \\ / __| `_ \\ '),
29
+ accent(' \\_/\\_/ (_| \\__ \\ | | | |_ | |_) | __/ | | | (__| | | |'),
30
+ accent(' \\__,_|___/_| |_|\\__| |____/ \\___|_| |_|\\___|_| |_|'),
31
+ muted(' AI development workbench for Wacht'),
32
+ ].join('\n');
33
+ }
34
+ export function printBanner() {
35
+ console.log(banner());
36
+ console.log('');
37
+ }
38
+ export function printBannerFor(ctx) {
39
+ if (ctx.json || ctx.quiet || !ctx.banner)
40
+ return;
41
+ printBanner();
42
+ }
43
+ export function section(title) {
44
+ return strong(title);
45
+ }
46
+ export function command(value) {
47
+ return accent(value);
48
+ }
49
+ export function field(label, value) {
50
+ return `${muted(`${label}:`)} ${value}`;
51
+ }
52
+ export function printError(error) {
53
+ const message = error instanceof Error ? error.message : String(error);
54
+ console.error(`${failure('Error:')} ${message}`);
55
+ }
56
+ export function log(ctx, message = '') {
57
+ if (ctx.json || ctx.quiet)
58
+ return;
59
+ console.log(message);
60
+ }
61
+ export function printJson(value) {
62
+ console.log(JSON.stringify(value, null, 2));
63
+ }
64
+ export class Spinner {
65
+ ctx;
66
+ text;
67
+ enabled;
68
+ timer = null;
69
+ index = 0;
70
+ frames = ['-', '\\', '|', '/'];
71
+ constructor(ctx, text) {
72
+ this.ctx = ctx;
73
+ this.text = text;
74
+ this.enabled = process.stdout.isTTY && !ctx.json && !ctx.quiet;
75
+ }
76
+ start() {
77
+ if (!this.enabled)
78
+ return this;
79
+ this.timer = setInterval(() => {
80
+ process.stdout.write(`\r${accent(this.frames[this.index % this.frames.length])} ${this.text}`);
81
+ this.index += 1;
82
+ }, 80);
83
+ return this;
84
+ }
85
+ update(text) {
86
+ this.text = text;
87
+ }
88
+ stop(message) {
89
+ if (!this.enabled)
90
+ return;
91
+ if (this.timer)
92
+ clearInterval(this.timer);
93
+ this.timer = null;
94
+ process.stdout.write('\r\x1b[K');
95
+ if (message)
96
+ console.log(message);
97
+ }
98
+ succeed(message) {
99
+ this.stop(`${success('Done:')} ${message}`);
100
+ }
101
+ fail(message) {
102
+ this.stop(`${failure('Failed:')} ${message}`);
103
+ }
104
+ }
package/dist/util.js ADDED
@@ -0,0 +1,6 @@
1
+ export function valueAfter(args, flag) {
2
+ const index = args.indexOf(flag);
3
+ if (index === -1)
4
+ return undefined;
5
+ return args[index + 1];
6
+ }
package/dist/wacht.js ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from './commands.js';
3
+ import { printError } from './ui.js';
4
+ try {
5
+ await runCli(process.argv.slice(2));
6
+ }
7
+ catch (error) {
8
+ if (process.argv.includes('--json')) {
9
+ console.error(JSON.stringify({
10
+ ok: false,
11
+ error: error instanceof Error ? error.message : String(error),
12
+ }, null, 2));
13
+ }
14
+ else {
15
+ printError(error);
16
+ }
17
+ process.exitCode = 1;
18
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@wacht/bench",
3
+ "version": "0.1.0",
4
+ "description": "CLI for Wacht Bench, the AI development workbench for Wacht.",
5
+ "type": "module",
6
+ "bin": {
7
+ "wacht": "./dist/wacht.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "keywords": [
13
+ "wacht",
14
+ "bench",
15
+ "ai",
16
+ "skills",
17
+ "mcp"
18
+ ],
19
+ "license": "Apache-2.0",
20
+ "engines": {
21
+ "node": ">=20"
22
+ },
23
+ "dependencies": {
24
+ "commander": "^12.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^20.19.0",
28
+ "typescript": "^5.8.3"
29
+ },
30
+ "scripts": {
31
+ "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json"
32
+ }
33
+ }