mergestorm 0.3.7 → 0.3.9
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 +21 -38
- package/dist/api.d.ts +16 -4
- package/dist/api.js +98 -17
- package/dist/cli.js +20 -68
- package/dist/commands/jobs.js +1 -1
- package/dist/commands/login.d.ts +8 -2
- package/dist/commands/login.js +33 -21
- package/dist/commands/registry.d.ts +32 -0
- package/dist/commands/registry.js +219 -0
- package/dist/commands/review.d.ts +14 -5
- package/dist/commands/review.js +97 -31
- package/dist/commands/stack.d.ts +27 -0
- package/dist/commands/stack.js +56 -24
- package/dist/commands/status.js +2 -13
- package/dist/errors.d.ts +8 -1
- package/dist/errors.js +6 -1
- package/dist/git-stack.d.ts +5 -0
- package/dist/git-stack.js +12 -0
- package/dist/git.d.ts +6 -1
- package/dist/git.js +31 -5
- package/dist/node-version.d.ts +11 -0
- package/dist/node-version.js +19 -0
- package/dist/pr-body.d.ts +1 -1
- package/dist/pr-body.js +1 -1
- package/dist/repo-identity.js +22 -3
- package/dist/shell.d.ts +2 -2
- package/dist/shell.js +15 -71
- package/dist/stack-meta.js +4 -8
- package/dist/ui/banner.js +43 -6
- package/dist/ui/box.d.ts +8 -1
- package/dist/ui/box.js +15 -3
- package/dist/ui/findings.d.ts +28 -0
- package/dist/ui/findings.js +16 -0
- package/dist/ui/prompt.js +15 -8
- package/dist/ui/secret-input.d.ts +5 -0
- package/dist/ui/secret-input.js +73 -0
- package/package.json +14 -3
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createInterface } from "node:readline/promises";
|
|
2
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
3
|
+
import { CommandError } from "../errors.js";
|
|
4
|
+
/**
|
|
5
|
+
* Read a single line without echoing characters (TTY).
|
|
6
|
+
* Non-TTY (piped CI) falls back to a normal readline question.
|
|
7
|
+
*/
|
|
8
|
+
export async function readSecretLine(prompt) {
|
|
9
|
+
if (!input.isTTY || typeof input.setRawMode !== "function") {
|
|
10
|
+
const rl = createInterface({ input, output });
|
|
11
|
+
try {
|
|
12
|
+
return (await rl.question(prompt)).trim();
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
rl.close();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
output.write(prompt);
|
|
19
|
+
const wasRaw = input.isRaw;
|
|
20
|
+
input.setRawMode(true);
|
|
21
|
+
input.resume();
|
|
22
|
+
return await new Promise((resolve, reject) => {
|
|
23
|
+
const chars = [];
|
|
24
|
+
const cleanup = () => {
|
|
25
|
+
input.off("data", onData);
|
|
26
|
+
input.off("error", onError);
|
|
27
|
+
input.off("close", onClose);
|
|
28
|
+
try {
|
|
29
|
+
input.setRawMode(wasRaw ?? false);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// ignore
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const onData = (buf) => {
|
|
36
|
+
const s = typeof buf === "string" ? buf : buf.toString("utf8");
|
|
37
|
+
for (const ch of s) {
|
|
38
|
+
if (ch === "\n" || ch === "\r") {
|
|
39
|
+
cleanup();
|
|
40
|
+
output.write("\n");
|
|
41
|
+
resolve(chars.join("").trim());
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (ch === "\u0003") {
|
|
45
|
+
cleanup();
|
|
46
|
+
output.write("\n");
|
|
47
|
+
reject(new CommandError("Login cancelled."));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (ch === "\u007f" || ch === "\b") {
|
|
51
|
+
chars.pop();
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
// Ignore other control chars; accept printable.
|
|
55
|
+
if (ch >= " ")
|
|
56
|
+
chars.push(ch);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const onError = (err) => {
|
|
60
|
+
cleanup();
|
|
61
|
+
output.write("\n");
|
|
62
|
+
reject(err);
|
|
63
|
+
};
|
|
64
|
+
const onClose = () => {
|
|
65
|
+
cleanup();
|
|
66
|
+
output.write("\n");
|
|
67
|
+
reject(new CommandError("Login cancelled."));
|
|
68
|
+
};
|
|
69
|
+
input.on("data", onData);
|
|
70
|
+
input.on("error", onError);
|
|
71
|
+
input.on("close", onClose);
|
|
72
|
+
});
|
|
73
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mergestorm",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Mergestorm CLI —
|
|
3
|
+
"version": "0.3.9",
|
|
4
|
+
"description": "Mergestorm CLI (mg) — local reviews & stacked PRs. MIT; build from source: https://github.com/marginsystems/mergestorm-cli",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"author": "Margin Systems <hello@mergestorm.ai>",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"mergestorm",
|
|
10
|
+
"code-review",
|
|
11
|
+
"cli",
|
|
12
|
+
"git",
|
|
13
|
+
"pull-request",
|
|
14
|
+
"stacked-prs",
|
|
15
|
+
"review"
|
|
16
|
+
],
|
|
7
17
|
"bin": {
|
|
8
18
|
"mergestorm": "./dist/cli.js",
|
|
9
19
|
"mg": "./dist/cli.js"
|
|
@@ -26,7 +36,8 @@
|
|
|
26
36
|
"dev": "tsx src/cli.ts",
|
|
27
37
|
"start": "node dist/cli.js",
|
|
28
38
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
29
|
-
"test": "tsx --test src/*.test.ts src/**/*.test.ts"
|
|
39
|
+
"test": "tsx --test src/*.test.ts src/**/*.test.ts",
|
|
40
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build && node dist/cli.js --version"
|
|
30
41
|
},
|
|
31
42
|
"engines": {
|
|
32
43
|
"node": ">=22.0.0"
|