merge-steward 0.8.4 → 0.8.5
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 +5 -0
- package/dist/watch/format.js +8 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15,6 +15,11 @@ export async function runCli(argv, options) {
|
|
|
15
15
|
const runCommand = options?.runCommand ?? defaultRunCommand;
|
|
16
16
|
try {
|
|
17
17
|
const parsed = parseArgs(argv);
|
|
18
|
+
if (parsed.flags.get("version") === true || parsed.positionals[0] === "version") {
|
|
19
|
+
const { version } = await import("../package.json", { with: { type: "json" } }).then((m) => m.default);
|
|
20
|
+
writeOutput(stdout, `merge-steward ${version}\n`);
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
18
23
|
validateFlags(parsed);
|
|
19
24
|
const command = parsed.positionals[0] ?? "help";
|
|
20
25
|
if (hasHelpFlag(parsed) || command === "help") {
|
package/dist/watch/format.js
CHANGED
|
@@ -128,17 +128,23 @@ const STATUS_DISPLAY = {
|
|
|
128
128
|
function displayStatus(status) {
|
|
129
129
|
return STATUS_DISPLAY[status] ?? status;
|
|
130
130
|
}
|
|
131
|
+
/** Truncate hex strings longer than 12 chars (SHAs, run IDs) to 8 chars. */
|
|
132
|
+
function shortenHashes(text) {
|
|
133
|
+
return text.replace(/\b[0-9a-f]{13,}\b/g, (match) => match.slice(0, 8));
|
|
134
|
+
}
|
|
131
135
|
export function formatEventSummary(event) {
|
|
132
136
|
const from = event.fromStatus ? displayStatus(event.fromStatus) : null;
|
|
133
137
|
const to = displayStatus(event.toStatus);
|
|
134
138
|
const transition = from ? `${from} \u2192 ${to}` : to;
|
|
135
|
-
|
|
139
|
+
const detail = event.detail ? ` (${shortenHashes(event.detail)})` : "";
|
|
140
|
+
return `#${event.prNumber} ${transition}${detail}`;
|
|
136
141
|
}
|
|
137
142
|
export function formatEntryEvent(event) {
|
|
138
143
|
const from = event.fromStatus ? displayStatus(event.fromStatus) : null;
|
|
139
144
|
const to = displayStatus(event.toStatus);
|
|
140
145
|
const transition = from ? `${from} \u2192 ${to}` : to;
|
|
141
|
-
|
|
146
|
+
const detail = event.detail ? ` (${shortenHashes(event.detail)})` : "";
|
|
147
|
+
return `${transition}${detail}`;
|
|
142
148
|
}
|
|
143
149
|
export function formatDuration(ms) {
|
|
144
150
|
const seconds = Math.floor(ms / 1000);
|