patchrelay 0.49.2 → 0.50.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/build-info.json
CHANGED
package/dist/cli/watch/App.js
CHANGED
|
@@ -11,7 +11,7 @@ import { buildWatchDetailExportText, exportWatchTextToTempFile, findLastAssistan
|
|
|
11
11
|
import { measureRenderedTextRows } from "./layout-measure.js";
|
|
12
12
|
import { PROMPT_COMPOSER_HINT, measurePromptComposerRows } from "./prompt-layout.js";
|
|
13
13
|
import { clearTransientStatus, defaultTimerApi, setPersistentStatus, showTransientStatus } from "./transient-status.js";
|
|
14
|
-
import {
|
|
14
|
+
import { getPromptEditAction } from "./input-keys.js";
|
|
15
15
|
async function postPrompt(baseUrl, issueKey, text, bearerToken) {
|
|
16
16
|
const headers = { "content-type": "application/json" };
|
|
17
17
|
if (bearerToken)
|
|
@@ -259,6 +259,7 @@ export function App({ baseUrl, bearerToken, initialIssueKey }) {
|
|
|
259
259
|
}, [promptBuffer, promptDraftBeforeHistory, promptHistory, promptHistoryIndex]);
|
|
260
260
|
useInput((input, key) => {
|
|
261
261
|
if (promptMode) {
|
|
262
|
+
const editAction = getPromptEditAction({ input, key, cursor: promptCursor, bufferLength: promptBuffer.length });
|
|
262
263
|
if (key.escape) {
|
|
263
264
|
resetPromptComposer();
|
|
264
265
|
}
|
|
@@ -286,14 +287,14 @@ export function App({ baseUrl, bearerToken, initialIssueKey }) {
|
|
|
286
287
|
else if (key.downArrow) {
|
|
287
288
|
recallPromptHistory("newer");
|
|
288
289
|
}
|
|
289
|
-
else if (
|
|
290
|
+
else if (editAction === "backspace") {
|
|
290
291
|
if (promptCursor > 0) {
|
|
291
292
|
setPromptBuffer((buffer) => `${buffer.slice(0, promptCursor - 1)}${buffer.slice(promptCursor)}`);
|
|
292
293
|
setPromptCursor((cursor) => Math.max(0, cursor - 1));
|
|
293
294
|
setPromptHistoryIndex(null);
|
|
294
295
|
}
|
|
295
296
|
}
|
|
296
|
-
else if (
|
|
297
|
+
else if (editAction === "delete") {
|
|
297
298
|
if (promptCursor < promptBuffer.length) {
|
|
298
299
|
setPromptBuffer((buffer) => `${buffer.slice(0, promptCursor)}${buffer.slice(promptCursor + 1)}`);
|
|
299
300
|
setPromptHistoryIndex(null);
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { issueTokenFor, prTokenFor } from "./issue-token.js";
|
|
4
|
-
import { truncate } from "./format-utils.js";
|
|
4
|
+
import { formatIssueAge, truncate } from "./format-utils.js";
|
|
5
5
|
const KEY_WIDTH = 8;
|
|
6
6
|
const GLYPH_WIDTH = 3;
|
|
7
7
|
const PHRASE_WIDTH = 18;
|
|
8
|
+
const AGE_WIDTH = 4;
|
|
9
|
+
const WIDE_PR_PHRASE_THRESHOLD = 34;
|
|
10
|
+
function shouldShowVerbosePrToken(titleWidth, compact) {
|
|
11
|
+
return !compact && (titleWidth ?? 60) >= WIDE_PR_PHRASE_THRESHOLD;
|
|
12
|
+
}
|
|
8
13
|
export function IssueRow({ issue, selected, titleWidth, compact = false, }) {
|
|
9
14
|
const key = issue.issueKey ?? issue.projectId;
|
|
10
15
|
const token = issueTokenFor(issue);
|
|
@@ -12,11 +17,18 @@ export function IssueRow({ issue, selected, titleWidth, compact = false, }) {
|
|
|
12
17
|
const cursorChar = selected ? "\u25b8" : " ";
|
|
13
18
|
const paddedKey = key.padEnd(KEY_WIDTH, " ");
|
|
14
19
|
const paddedPhrase = token.phrase.padEnd(PHRASE_WIDTH, " ");
|
|
15
|
-
const
|
|
20
|
+
const age = formatIssueAge(issue.updatedAt);
|
|
21
|
+
const verbosePr = pr && shouldShowVerbosePrToken(titleWidth, compact);
|
|
22
|
+
const prWidth = pr
|
|
23
|
+
? verbosePr
|
|
24
|
+
? `#${pr.prNumber} ${pr.glyph} ${pr.phrase}`.length
|
|
25
|
+
: `#${pr.prNumber} ${pr.glyph}`.length
|
|
26
|
+
: 0;
|
|
27
|
+
const availableTitleWidth = Math.max(0, (titleWidth ?? 60) - prWidth - (pr ? 2 : 0) - (AGE_WIDTH + 2));
|
|
16
28
|
const title = !compact && selected && issue.title
|
|
17
29
|
? ` ${truncate(issue.title, Math.max(0, availableTitleWidth))}`
|
|
18
30
|
: "";
|
|
19
|
-
return (_jsxs(Box, { children: [_jsx(Text, { color: selected ? "cyan" : "gray", children: cursorChar }), _jsx(Text, { bold: selected, color: token.color, children: ` ${paddedKey}` }), _jsx(Text, { color: token.color, children: ` ${token.glyph.padEnd(GLYPH_WIDTH - 1, " ")}` }), _jsx(Text, { children: ` ${paddedPhrase}` }), pr ? (_jsx(_Fragment, { children: _jsx(Text, { color: pr.color, children: `#${pr.prNumber} ${pr.glyph}` }) })) : null, title ? _jsx(Text, { dimColor: true, children: title }) : null] }));
|
|
31
|
+
return (_jsxs(Box, { children: [_jsx(Text, { color: selected ? "cyan" : "gray", children: cursorChar }), _jsx(Text, { bold: selected, color: token.color, children: ` ${paddedKey}` }), _jsx(Text, { color: token.color, children: ` ${token.glyph.padEnd(GLYPH_WIDTH - 1, " ")}` }), _jsx(Text, { children: ` ${paddedPhrase}` }), pr ? (_jsx(_Fragment, { children: _jsx(Text, { color: pr.color, children: verbosePr ? `#${pr.prNumber} ${pr.glyph} ${pr.phrase}` : `#${pr.prNumber} ${pr.glyph}` }) })) : null, _jsx(Text, { dimColor: true, children: ` ${age}` }), title ? _jsx(Text, { dimColor: true, children: title }) : null] }));
|
|
20
32
|
}
|
|
21
33
|
export function estimateIssueRowHeight(_issue, _selected, _cols, _titleWidth, _compact = false) {
|
|
22
34
|
return 1;
|
|
@@ -19,6 +19,9 @@ export function relativeTime(iso) {
|
|
|
19
19
|
const days = Math.floor(hours / 24);
|
|
20
20
|
return `${days}d`;
|
|
21
21
|
}
|
|
22
|
+
export function formatIssueAge(updatedAt) {
|
|
23
|
+
return relativeTime(updatedAt).padStart(4, " ");
|
|
24
|
+
}
|
|
22
25
|
/** Format millisecond duration as "2m 30s" or "45s". */
|
|
23
26
|
export function formatDuration(ms) {
|
|
24
27
|
const seconds = Math.floor(ms / 1000);
|
|
@@ -7,3 +7,18 @@ export function isPromptBackspaceKey(input, key) {
|
|
|
7
7
|
export function isPromptDeleteKey(input, key) {
|
|
8
8
|
return key.delete === true || input === "\u001b[3~";
|
|
9
9
|
}
|
|
10
|
+
export function getPromptEditAction(params) {
|
|
11
|
+
if (isPromptBackspaceKey(params.input, params.key)) {
|
|
12
|
+
return "backspace";
|
|
13
|
+
}
|
|
14
|
+
if (isPromptDeleteKey(params.input, params.key)) {
|
|
15
|
+
// Some terminal stacks normalize physical backspace as `delete` with
|
|
16
|
+
// empty input. At end-of-line, treat that as backward delete so prompt
|
|
17
|
+
// editing still works instead of turning into a no-op.
|
|
18
|
+
if (params.input === "" && params.cursor >= params.bufferLength) {
|
|
19
|
+
return "backspace";
|
|
20
|
+
}
|
|
21
|
+
return "delete";
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isUndelegatedPausedIssue } from "../../paused-issue-state.js";
|
|
2
|
+
import { hasFailedPrChecks, hasPendingPrChecks, isApprovedReviewState, isAwaitingReviewState, isChangesRequestedReviewState, prChecksFact, } from "./pr-status.js";
|
|
2
3
|
const GLYPH = {
|
|
3
4
|
running: "\u25cf",
|
|
4
5
|
queued: "\u25cb",
|
|
@@ -84,6 +85,7 @@ export function prTokenFor(issue) {
|
|
|
84
85
|
glyph: GLYPH[kind],
|
|
85
86
|
color: COLOR[kind],
|
|
86
87
|
kind,
|
|
88
|
+
phrase: prPhraseFor(issue),
|
|
87
89
|
};
|
|
88
90
|
}
|
|
89
91
|
function prKind(issue) {
|
|
@@ -101,3 +103,20 @@ function prKind(issue) {
|
|
|
101
103
|
return "approved";
|
|
102
104
|
return "running";
|
|
103
105
|
}
|
|
106
|
+
function prPhraseFor(issue) {
|
|
107
|
+
if (issue.prState === "merged")
|
|
108
|
+
return "merged";
|
|
109
|
+
if (issue.prState === "closed")
|
|
110
|
+
return "closed";
|
|
111
|
+
if (isChangesRequestedReviewState(issue.prReviewState))
|
|
112
|
+
return "changes req";
|
|
113
|
+
if (isApprovedReviewState(issue.prReviewState))
|
|
114
|
+
return "approved";
|
|
115
|
+
if (isAwaitingReviewState(issue.prReviewState))
|
|
116
|
+
return "awaiting review";
|
|
117
|
+
if (hasFailedPrChecks(issue))
|
|
118
|
+
return prChecksFact(issue)?.text ?? "checks failed";
|
|
119
|
+
if (hasPendingPrChecks(issue))
|
|
120
|
+
return prChecksFact(issue)?.text ?? "checks running";
|
|
121
|
+
return prChecksFact(issue)?.text ?? "open";
|
|
122
|
+
}
|