mira-harness 0.1.2 → 0.1.3
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/cli.js +56 -27
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -20,6 +20,56 @@ import {
|
|
|
20
20
|
// src/cli.ts
|
|
21
21
|
import { Command } from "commander";
|
|
22
22
|
|
|
23
|
+
// src/ui.ts
|
|
24
|
+
import pc from "picocolors";
|
|
25
|
+
var c = pc;
|
|
26
|
+
function note(msg) {
|
|
27
|
+
process.stderr.write(`${msg}
|
|
28
|
+
`);
|
|
29
|
+
}
|
|
30
|
+
var MASCOT = [
|
|
31
|
+
" * . *",
|
|
32
|
+
" .-------.",
|
|
33
|
+
" | o o |",
|
|
34
|
+
" | ~ |",
|
|
35
|
+
" '-------'"
|
|
36
|
+
];
|
|
37
|
+
var WORDMARK = [
|
|
38
|
+
" __ __ ___ ____ _",
|
|
39
|
+
"| \\/ |_ _| _ \\ / \\",
|
|
40
|
+
"| |\\/| || || |_) | / _ \\",
|
|
41
|
+
"| | | || || _ < / ___ \\",
|
|
42
|
+
"|_| |_|___|_| \\_\\/_/ \\_\\"
|
|
43
|
+
];
|
|
44
|
+
function banner(version2, opts = {}) {
|
|
45
|
+
if (opts.quiet || process.env.MIRA_NO_BANNER || !process.stderr.isTTY) return;
|
|
46
|
+
const lines = [
|
|
47
|
+
...MASCOT.map((l) => c.magenta(l)),
|
|
48
|
+
...WORDMARK.map((l) => c.cyan(l)),
|
|
49
|
+
c.dim(`mira-harness v${version2} \xB7 drive @mira from your terminal`)
|
|
50
|
+
];
|
|
51
|
+
process.stderr.write(`
|
|
52
|
+
${lines.map((l) => ` ${l}`).join("\n")}
|
|
53
|
+
|
|
54
|
+
`);
|
|
55
|
+
}
|
|
56
|
+
async function withProgress(label, fn, quiet = false) {
|
|
57
|
+
if (quiet || !process.stderr.isTTY) return fn();
|
|
58
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
59
|
+
const start = Date.now();
|
|
60
|
+
let i = 0;
|
|
61
|
+
const timer = setInterval(() => {
|
|
62
|
+
const s = ((Date.now() - start) / 1e3).toFixed(0);
|
|
63
|
+
process.stderr.write(`\r${pc.cyan(frames[i++ % frames.length])} ${label} ${pc.dim(`${s}s`)} `);
|
|
64
|
+
}, 100);
|
|
65
|
+
try {
|
|
66
|
+
return await fn();
|
|
67
|
+
} finally {
|
|
68
|
+
clearInterval(timer);
|
|
69
|
+
process.stderr.write("\r\x1B[K");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
23
73
|
// src/commands/login.ts
|
|
24
74
|
import { TelegramClient } from "telegram";
|
|
25
75
|
import { StringSession } from "telegram/sessions/index.js";
|
|
@@ -48,32 +98,6 @@ async function login() {
|
|
|
48
98
|
|
|
49
99
|
// src/commands/send.ts
|
|
50
100
|
import { existsSync } from "fs";
|
|
51
|
-
|
|
52
|
-
// src/ui.ts
|
|
53
|
-
import pc from "picocolors";
|
|
54
|
-
var c = pc;
|
|
55
|
-
function note(msg) {
|
|
56
|
-
process.stderr.write(`${msg}
|
|
57
|
-
`);
|
|
58
|
-
}
|
|
59
|
-
async function withProgress(label, fn, quiet = false) {
|
|
60
|
-
if (quiet || !process.stderr.isTTY) return fn();
|
|
61
|
-
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
62
|
-
const start = Date.now();
|
|
63
|
-
let i = 0;
|
|
64
|
-
const timer = setInterval(() => {
|
|
65
|
-
const s = ((Date.now() - start) / 1e3).toFixed(0);
|
|
66
|
-
process.stderr.write(`\r${pc.cyan(frames[i++ % frames.length])} ${label} ${pc.dim(`${s}s`)} `);
|
|
67
|
-
}, 100);
|
|
68
|
-
try {
|
|
69
|
-
return await fn();
|
|
70
|
-
} finally {
|
|
71
|
-
clearInterval(timer);
|
|
72
|
-
process.stderr.write("\r\x1B[K");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/commands/send.ts
|
|
77
101
|
var STOP_FILE = "STOP_MIRA";
|
|
78
102
|
async function readStdin() {
|
|
79
103
|
if (process.stdin.isTTY) return "";
|
|
@@ -382,7 +406,11 @@ function posInt(name, v) {
|
|
|
382
406
|
return n;
|
|
383
407
|
}
|
|
384
408
|
var program = new Command();
|
|
385
|
-
|
|
409
|
+
var version = getVersion();
|
|
410
|
+
program.name("mira-harness").description("Automated probe harness for the @mira Telegram bot (GramJS userbot).").version(version, "-V, --version");
|
|
411
|
+
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
412
|
+
banner(version, { quiet: Boolean(actionCommand.opts().quiet) });
|
|
413
|
+
});
|
|
386
414
|
program.command("login").description("One-time interactive login -> prints TG_SESSION for .env").action(login);
|
|
387
415
|
program.command("doctor").description("Check .env, session, connectivity and @mira resolution (read-only)").action(doctor);
|
|
388
416
|
program.command("send").description("Send one probe to @mira and print the full settled reply as JSON").argument("[message...]", "the message (omit to read from stdin)").option("-q, --quiet", "suppress the progress spinner / status line", false).option("--settle <ms>", "quiet window before concluding a reply").option("--timeout <ms>", "give up if no reply by this many ms").option("--no-log", "do not append the result to the run log").action(async (parts, opts) => {
|
|
@@ -435,6 +463,7 @@ Examples:
|
|
|
435
463
|
$ mira-harness report --category core --out report.md
|
|
436
464
|
`
|
|
437
465
|
);
|
|
466
|
+
program.action(() => program.outputHelp());
|
|
438
467
|
program.parseAsync(process.argv).then(() => process.exit(0)).catch((e) => {
|
|
439
468
|
console.error(e instanceof Error ? e.message : e);
|
|
440
469
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mira-harness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A CLI + MCP dev-tool for communicating with the @mira Telegram bot — capture its full reply (buttons/links/media) and run a self-driving experiment catalog.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|