santree 0.7.0 → 0.7.2
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/commands/dashboard.js +418 -70
- package/dist/lib/ai.d.ts +13 -0
- package/dist/lib/ai.js +16 -0
- package/dist/lib/dashboard/DetailPanel.d.ts +18 -2
- package/dist/lib/dashboard/DetailPanel.js +144 -1
- package/dist/lib/dashboard/IssueList.d.ts +9 -1
- package/dist/lib/dashboard/IssueList.js +35 -8
- package/dist/lib/dashboard/Overlays.js +20 -5
- package/dist/lib/dashboard/TriageScheduleOverlay.d.ts +16 -0
- package/dist/lib/dashboard/TriageScheduleOverlay.js +78 -0
- package/dist/lib/dashboard/data.d.ts +2 -0
- package/dist/lib/dashboard/data.js +26 -4
- package/dist/lib/dashboard/due.d.ts +24 -0
- package/dist/lib/dashboard/due.js +32 -0
- package/dist/lib/dashboard/types.d.ts +90 -5
- package/dist/lib/dashboard/types.js +129 -4
- package/dist/lib/git.d.ts +1 -1
- package/dist/lib/git.js +7 -1
- package/dist/lib/trackers/linear/api.d.ts +2 -1
- package/dist/lib/trackers/linear/api.js +137 -1
- package/dist/lib/trackers/linear/index.js +17 -1
- package/dist/lib/trackers/types.d.ts +58 -0
- package/dist/lib/trackers/types.js +5 -1
- package/package.json +1 -1
- package/prompts/ask.njk +10 -0
package/dist/lib/ai.d.ts
CHANGED
|
@@ -88,6 +88,19 @@ export declare function runAgentAsync(prompt: string, opts?: {
|
|
|
88
88
|
* Clean up cached image downloads for an issue identifier on the active tracker.
|
|
89
89
|
*/
|
|
90
90
|
export declare function cleanupImages(ticketId: string): void;
|
|
91
|
+
/**
|
|
92
|
+
* Ask Claude a clarifying question about a triage issue. The full issue —
|
|
93
|
+
* description plus every comment — is rendered via the shared `ticket.njk`
|
|
94
|
+
* template and injected into `ask.njk`. Read-only codebase tools are granted
|
|
95
|
+
* (Read for downloaded issue images, Grep/Glob so Claude can judge whether the
|
|
96
|
+
* issue is fixable against the real code). Runs non-interactively and returns
|
|
97
|
+
* the captured answer text. Async so the Ink dashboard keeps animating.
|
|
98
|
+
*/
|
|
99
|
+
export declare function askTicketQuestion(opts: {
|
|
100
|
+
ticket: Issue;
|
|
101
|
+
trackerName: string;
|
|
102
|
+
question: string;
|
|
103
|
+
}): Promise<RunAgentResult>;
|
|
91
104
|
export interface FillCommitOpts {
|
|
92
105
|
branch: string;
|
|
93
106
|
ticketId: string | null;
|
package/dist/lib/ai.js
CHANGED
|
@@ -267,6 +267,22 @@ export function cleanupImages(ticketId) {
|
|
|
267
267
|
const repoRoot = findMainRepoRoot();
|
|
268
268
|
getIssueTracker(repoRoot).cleanupCache(ticketId);
|
|
269
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Ask Claude a clarifying question about a triage issue. The full issue —
|
|
272
|
+
* description plus every comment — is rendered via the shared `ticket.njk`
|
|
273
|
+
* template and injected into `ask.njk`. Read-only codebase tools are granted
|
|
274
|
+
* (Read for downloaded issue images, Grep/Glob so Claude can judge whether the
|
|
275
|
+
* issue is fixable against the real code). Runs non-interactively and returns
|
|
276
|
+
* the captured answer text. Async so the Ink dashboard keeps animating.
|
|
277
|
+
*/
|
|
278
|
+
export async function askTicketQuestion(opts) {
|
|
279
|
+
const prompt = renderPrompt("ask", {
|
|
280
|
+
ticket_id: opts.ticket.identifier,
|
|
281
|
+
ticket_content: renderTicket(opts.ticket, opts.trackerName),
|
|
282
|
+
user_question: opts.question,
|
|
283
|
+
});
|
|
284
|
+
return runAgentAsync(prompt, { allowedTools: ["Read", "Grep", "Glob"] });
|
|
285
|
+
}
|
|
270
286
|
/**
|
|
271
287
|
* Generate a short imperative commit message from a staged diff.
|
|
272
288
|
* Async so callers (the Ink dashboard, the CLI commit flow) keep the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DashboardIssue, DashboardTab } from "./types.js";
|
|
1
|
+
import type { Comment, DashboardIssue, DashboardTab, DeleteStatus } from "./types.js";
|
|
2
2
|
interface Props {
|
|
3
3
|
issue: DashboardIssue | null;
|
|
4
4
|
scrollOffset: number;
|
|
@@ -6,6 +6,22 @@ interface Props {
|
|
|
6
6
|
width: number;
|
|
7
7
|
creatingForTicket: string | null;
|
|
8
8
|
creationLogs: string;
|
|
9
|
+
/** Deletion progress for the selected worktree, when one is being removed. */
|
|
10
|
+
deleteStatus?: DeleteStatus;
|
|
11
|
+
/** Triage mode: hide worktree/PR/checks sections (they never apply to an
|
|
12
|
+
* inbox issue) and show the discussion instead. */
|
|
13
|
+
triage?: boolean;
|
|
14
|
+
/** Comments for the selected triage issue. `undefined` = not yet loaded
|
|
15
|
+
* (shows "loading…"); an array (possibly empty) = loaded. Only consulted in
|
|
16
|
+
* triage mode. */
|
|
17
|
+
comments?: Comment[];
|
|
18
|
+
/** Compact triage on-call summary, shown as the first line in triage mode. */
|
|
19
|
+
onCall?: {
|
|
20
|
+
currentName: string | null;
|
|
21
|
+
currentIsMe: boolean;
|
|
22
|
+
/** Formatted start of the viewer's next shift (e.g. "Jun 5"), if any. */
|
|
23
|
+
myNext: string | null;
|
|
24
|
+
};
|
|
9
25
|
}
|
|
10
26
|
export type IssueActionItem = {
|
|
11
27
|
key: string;
|
|
@@ -22,5 +38,5 @@ export declare function buildIssueActions(di: DashboardIssue, trackerName: strin
|
|
|
22
38
|
tab?: DashboardTab;
|
|
23
39
|
canMutate?: boolean;
|
|
24
40
|
}): IssueActionItem[];
|
|
25
|
-
export default function DetailPanel({ issue, scrollOffset, height, width, creatingForTicket, creationLogs, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export default function DetailPanel({ issue, scrollOffset, height, width, creatingForTicket, creationLogs, deleteStatus, triage, comments, onCall, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
26
42
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
+
import { formatDueDate } from "./due.js";
|
|
4
|
+
import { issueReadiness } from "../trackers/types.js";
|
|
3
5
|
function stateColor(type) {
|
|
4
6
|
switch (type) {
|
|
5
7
|
case "started":
|
|
@@ -77,6 +79,18 @@ export function buildIssueActions(di, trackerName, opts) {
|
|
|
77
79
|
}
|
|
78
80
|
return items;
|
|
79
81
|
}
|
|
82
|
+
// Triage tab = the incoming inbox. Read the discussion, ask Claude a
|
|
83
|
+
// clarifying question, and — once it looks fixable — send it to a tree
|
|
84
|
+
// (`w`, same worktree-creation flow as the Issues tab).
|
|
85
|
+
if (opts?.tab === "triage") {
|
|
86
|
+
items.push({ key: "w", label: "Send to tree", color: "cyan" });
|
|
87
|
+
items.push({ key: "a", label: "Ask", color: "cyan" });
|
|
88
|
+
items.push({ key: "s", label: "Schedule", color: "cyan" });
|
|
89
|
+
if (issue.url) {
|
|
90
|
+
items.push({ key: "o", label: trackerName, color: "gray" });
|
|
91
|
+
}
|
|
92
|
+
return items;
|
|
93
|
+
}
|
|
80
94
|
// The synthetic "Main repo" row is special: no PR/Switch/Resume/Remove,
|
|
81
95
|
// no work-launching (you're already on it). Only commit / diff /
|
|
82
96
|
// editor — the actions that make sense for "I have changes in main and
|
|
@@ -137,7 +151,22 @@ function sectionHeader(icon, label, iconColor = "cyan") {
|
|
|
137
151
|
],
|
|
138
152
|
};
|
|
139
153
|
}
|
|
140
|
-
export default function DetailPanel({ issue, scrollOffset, height, width, creatingForTicket, creationLogs, }) {
|
|
154
|
+
export default function DetailPanel({ issue, scrollOffset, height, width, creatingForTicket, creationLogs, deleteStatus, triage = false, comments, onCall, }) {
|
|
155
|
+
// Show deletion progress when the selected worktree is being removed.
|
|
156
|
+
if (issue && deleteStatus) {
|
|
157
|
+
const logLines = deleteStatus.logs.split("\n");
|
|
158
|
+
const contentRows = height - 1;
|
|
159
|
+
const startIdx = Math.max(0, logLines.length - contentRows);
|
|
160
|
+
const visible = logLines.slice(startIdx, startIdx + contentRows);
|
|
161
|
+
const clampLine = (s) => s.length > width ? s.slice(0, Math.max(0, width - 1)) + "…" : s;
|
|
162
|
+
const headerColor = deleteStatus.phase === "error" ? "red" : "yellow";
|
|
163
|
+
const header = deleteStatus.phase === "error"
|
|
164
|
+
? `Failed to remove ${issue.issue.identifier}`
|
|
165
|
+
: deleteStatus.phase === "done"
|
|
166
|
+
? `Removed ${issue.issue.identifier}`
|
|
167
|
+
: `Removing worktree for ${issue.issue.identifier}…`;
|
|
168
|
+
return (_jsxs(Box, { flexDirection: "column", width: width, height: height, children: [_jsx(Text, { color: deleteStatus.phase === "done" ? "green" : headerColor, bold: true, children: clampLine(header) }), visible.map((line, i) => (_jsx(Box, { children: _jsx(Text, { dimColor: true, children: clampLine(line) }) }, i))), deleteStatus.phase === "error" && deleteStatus.error ? (_jsx(Text, { color: "red", children: clampLine(deleteStatus.error) })) : null] }));
|
|
169
|
+
}
|
|
141
170
|
// Show creation logs when selected issue is being created
|
|
142
171
|
if (issue && issue.issue.identifier === creatingForTicket) {
|
|
143
172
|
const logLines = creationLogs.split("\n");
|
|
@@ -157,6 +186,27 @@ export default function DetailPanel({ issue, scrollOffset, height, width, creati
|
|
|
157
186
|
const lines = [];
|
|
158
187
|
const rule = "─".repeat(width);
|
|
159
188
|
const ruleLine = { text: rule, dim: true };
|
|
189
|
+
// ── Triage on-call (compact) ───────────────────────────────────────
|
|
190
|
+
// First line in triage mode: who's on call now + when the viewer is next up.
|
|
191
|
+
// The full rotation lives behind the [s] schedule overlay.
|
|
192
|
+
if (triage && onCall && onCall.currentName) {
|
|
193
|
+
const segs = [
|
|
194
|
+
{ text: "◷ ", color: onCall.currentIsMe ? "cyan" : "green", bold: true },
|
|
195
|
+
{ text: "on call: ", dim: true },
|
|
196
|
+
{
|
|
197
|
+
text: onCall.currentName,
|
|
198
|
+
color: onCall.currentIsMe ? "cyan" : "green",
|
|
199
|
+
bold: true,
|
|
200
|
+
},
|
|
201
|
+
];
|
|
202
|
+
if (onCall.myNext) {
|
|
203
|
+
segs.push({ text: " · you're up ", dim: true });
|
|
204
|
+
segs.push({ text: onCall.myNext, color: "cyan" });
|
|
205
|
+
}
|
|
206
|
+
segs.push({ text: " · [s] schedule", dim: true });
|
|
207
|
+
lines.push({ text: "", segments: segs });
|
|
208
|
+
lines.push(ruleLine);
|
|
209
|
+
}
|
|
160
210
|
// ── Hero: identifier + title, then a status pill row ───────────────
|
|
161
211
|
lines.push({ text: `${li.identifier} ${li.title}`, bold: true });
|
|
162
212
|
const sc = stateColor(li.state.type);
|
|
@@ -171,6 +221,19 @@ export default function DetailPanel({ issue, scrollOffset, height, width, creati
|
|
|
171
221
|
heroSegs.push({ text: li.labels.join(", "), dim: true });
|
|
172
222
|
}
|
|
173
223
|
lines.push({ text: "", segments: heroSegs });
|
|
224
|
+
// ── Due date ──────────────────────────────────────────────────────
|
|
225
|
+
// Urgency-coded; shown whenever the issue carries one (most relevant on the
|
|
226
|
+
// Triage tab, harmless elsewhere).
|
|
227
|
+
const due = formatDueDate(li.dueDate);
|
|
228
|
+
if (due) {
|
|
229
|
+
lines.push({
|
|
230
|
+
text: "",
|
|
231
|
+
segments: [
|
|
232
|
+
{ text: "◷ ", color: due.color, bold: due.urgent },
|
|
233
|
+
{ text: due.label, color: due.color, bold: due.urgent },
|
|
234
|
+
],
|
|
235
|
+
});
|
|
236
|
+
}
|
|
174
237
|
// ── Description ───────────────────────────────────────────────────
|
|
175
238
|
if (li.description) {
|
|
176
239
|
lines.push({ text: "" });
|
|
@@ -178,6 +241,81 @@ export default function DetailPanel({ issue, scrollOffset, height, width, creati
|
|
|
178
241
|
lines.push({ text: dLine });
|
|
179
242
|
}
|
|
180
243
|
}
|
|
244
|
+
// ── Dependencies ──────────────────────────────────────────────────
|
|
245
|
+
// Blocking relations from the tracker. Header carries a readiness badge so
|
|
246
|
+
// the user can tell at a glance whether the issue is startable.
|
|
247
|
+
const blockedBy = li.blockedBy ?? [];
|
|
248
|
+
const blocking = li.blocking ?? [];
|
|
249
|
+
if (!triage && (blockedBy.length > 0 || blocking.length > 0)) {
|
|
250
|
+
const readiness = issueReadiness(li.blockedBy);
|
|
251
|
+
lines.push(ruleLine);
|
|
252
|
+
const headerSegs = [
|
|
253
|
+
{ text: "⇄ ", color: "cyan", bold: true },
|
|
254
|
+
{ text: "Dependencies", bold: true },
|
|
255
|
+
{ text: " " },
|
|
256
|
+
readiness === "ready"
|
|
257
|
+
? { text: "✓ ready to start", color: "green", bold: true }
|
|
258
|
+
: { text: "⊘ blocked", color: "yellow", bold: true },
|
|
259
|
+
];
|
|
260
|
+
lines.push({ text: "", segments: headerSegs });
|
|
261
|
+
if (blockedBy.length > 0) {
|
|
262
|
+
lines.push({ text: " blocked by", dim: true });
|
|
263
|
+
for (const b of blockedBy) {
|
|
264
|
+
lines.push({
|
|
265
|
+
text: "",
|
|
266
|
+
segments: [
|
|
267
|
+
{ text: ` ${b.done ? "✓" : "○"} `, color: b.done ? "green" : "yellow" },
|
|
268
|
+
{ text: b.identifier, color: b.done ? undefined : "yellow", dim: b.done },
|
|
269
|
+
...(b.done ? [{ text: " done", dim: true }] : []),
|
|
270
|
+
],
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (blocking.length > 0) {
|
|
275
|
+
lines.push({ text: " blocks", dim: true });
|
|
276
|
+
lines.push({
|
|
277
|
+
text: "",
|
|
278
|
+
segments: [{ text: " " }, { text: blocking.map((b) => b.identifier).join(", ") }],
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// ── Triage: discussion only ───────────────────────────────────────
|
|
283
|
+
// Triage issues live in the inbox — no worktree/PR/checks apply yet. Show
|
|
284
|
+
// the comment thread (lazily fetched by the dashboard) so the user can read
|
|
285
|
+
// the back-and-forth before deciding to ask a question or send it to a tree.
|
|
286
|
+
if (triage) {
|
|
287
|
+
lines.push(ruleLine);
|
|
288
|
+
lines.push(sectionHeader("≡", "Comments", "cyan"));
|
|
289
|
+
if (comments === undefined) {
|
|
290
|
+
lines.push({ text: " loading…", dim: true });
|
|
291
|
+
}
|
|
292
|
+
else if (comments.length === 0) {
|
|
293
|
+
lines.push({ text: " no comments", dim: true });
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
const renderComment = (c, depth) => {
|
|
297
|
+
const indent = " ".repeat(depth + 1);
|
|
298
|
+
lines.push({
|
|
299
|
+
text: "",
|
|
300
|
+
segments: [
|
|
301
|
+
{ text: indent },
|
|
302
|
+
{ text: c.author, color: "cyan", bold: true },
|
|
303
|
+
{ text: ` ${new Date(c.createdAt).toLocaleDateString()}`, dim: true },
|
|
304
|
+
],
|
|
305
|
+
});
|
|
306
|
+
for (const bodyLine of c.body.trimEnd().split("\n")) {
|
|
307
|
+
lines.push({ text: `${indent}${bodyLine}` });
|
|
308
|
+
}
|
|
309
|
+
lines.push({ text: "" });
|
|
310
|
+
for (const child of c.children)
|
|
311
|
+
renderComment(child, depth + 1);
|
|
312
|
+
};
|
|
313
|
+
for (const c of comments)
|
|
314
|
+
renderComment(c, 0);
|
|
315
|
+
}
|
|
316
|
+
// Skip the worktree/PR/checks/reviews sections entirely for triage.
|
|
317
|
+
return renderLines(lines, scrollOffset, height, width);
|
|
318
|
+
}
|
|
181
319
|
// ── Worktree ──────────────────────────────────────────────────────
|
|
182
320
|
lines.push(ruleLine);
|
|
183
321
|
if (worktree) {
|
|
@@ -468,6 +606,11 @@ export default function DetailPanel({ issue, scrollOffset, height, width, creati
|
|
|
468
606
|
// Action footer is rendered by the dashboard one row outside the panel,
|
|
469
607
|
// alongside the global command bar, so left- and right-pane key hints sit
|
|
470
608
|
// on the same row. The panel itself uses its full height for content.
|
|
609
|
+
return renderLines(lines, scrollOffset, height, width);
|
|
610
|
+
}
|
|
611
|
+
/** Scroll-clamp a built line list and render it into the panel box. Shared by
|
|
612
|
+
* the full detail view and the triage (discussion-only) view. */
|
|
613
|
+
function renderLines(lines, scrollOffset, height, width) {
|
|
471
614
|
const totalLines = lines.length;
|
|
472
615
|
const canScroll = totalLines > height;
|
|
473
616
|
const contentRows = canScroll ? height - 2 : height;
|
|
@@ -8,6 +8,14 @@ interface Props {
|
|
|
8
8
|
width: number;
|
|
9
9
|
/** Theme-adapted selection background (light/dark). Falls back to dark navy. */
|
|
10
10
|
selectionBg?: string;
|
|
11
|
+
/** Right-column variant (row structure — and click→row mapping — is identical):
|
|
12
|
+
* "default" — WT + CI status columns (Trees tab)
|
|
13
|
+
* "triage" — a colored due-date badge
|
|
14
|
+
* "issues" — a readiness glyph (ready / blocked by dependencies) */
|
|
15
|
+
variant?: "default" | "triage" | "issues";
|
|
16
|
+
/** Ticket ids whose worktree is currently being removed — shown with a
|
|
17
|
+
* distinct WT-column glyph so concurrent deletions are visible in the list. */
|
|
18
|
+
deletingIds?: Set<string>;
|
|
11
19
|
}
|
|
12
20
|
export type ListRow = {
|
|
13
21
|
kind: "spacer";
|
|
@@ -28,5 +36,5 @@ export type ListRow = {
|
|
|
28
36
|
depth: number;
|
|
29
37
|
};
|
|
30
38
|
export declare function buildIssueListRows(groups: ProjectGroup[], flatIssues: DashboardIssue[]): ListRow[];
|
|
31
|
-
export default function IssueList({ groups, flatIssues, selectedIndex, scrollOffset, height, width, selectionBg, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export default function IssueList({ groups, flatIssues, selectedIndex, scrollOffset, height, width, selectionBg, variant, deletingIds, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
32
40
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
+
import { formatDueDate } from "./due.js";
|
|
4
|
+
import { issueReadiness } from "../trackers/types.js";
|
|
3
5
|
function stateColor(type, name) {
|
|
4
6
|
const n = name?.toLowerCase();
|
|
5
7
|
if (n === "blocked")
|
|
@@ -85,11 +87,29 @@ export function buildIssueListRows(groups, flatIssues) {
|
|
|
85
87
|
// Glyphs are 1 char and rendered right-aligned within their column.
|
|
86
88
|
const LEFT_FIXED = 1 + 1 + 1 + 2 + 11; // 16 — left-aligned columns
|
|
87
89
|
const RIGHT_FIXED = 2 + 2 + 2; // 6 — WT + 2 spaces + CI
|
|
90
|
+
// Triage variant: a single right-aligned due-date column. Widest badge is
|
|
91
|
+
// "⚠ overdue 99d" (13 chars); pad/clamp everything to this so titles align.
|
|
92
|
+
const DUE_COL_WIDTH = 13;
|
|
93
|
+
// Issues variant: a single readiness glyph under a "RDY" header.
|
|
94
|
+
const READY_COL_WIDTH = 3;
|
|
88
95
|
const TITLE_GAP = 2; // minimum spacing between title and the right columns
|
|
89
|
-
|
|
96
|
+
function readinessGlyph(di) {
|
|
97
|
+
switch (issueReadiness(di.issue.blockedBy)) {
|
|
98
|
+
case "ready":
|
|
99
|
+
return { glyph: "✓", color: "green" };
|
|
100
|
+
case "blocked":
|
|
101
|
+
return { glyph: "⊘", color: "yellow" };
|
|
102
|
+
default:
|
|
103
|
+
return { glyph: "·", color: "gray" };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export default function IssueList({ groups, flatIssues, selectedIndex, scrollOffset, height, width, selectionBg = "#1e3a5f", variant = "default", deletingIds, }) {
|
|
107
|
+
const isTriage = variant === "triage";
|
|
108
|
+
const isIssues = variant === "issues";
|
|
109
|
+
const rightFixed = isTriage ? DUE_COL_WIDTH : isIssues ? READY_COL_WIDTH : RIGHT_FIXED;
|
|
90
110
|
const rows = buildIssueListRows(groups, flatIssues);
|
|
91
111
|
const visible = rows.slice(scrollOffset, scrollOffset + height);
|
|
92
|
-
const titleMaxWidth = Math.max(width - LEFT_FIXED - 1 /* leading space */ -
|
|
112
|
+
const titleMaxWidth = Math.max(width - LEFT_FIXED - 1 /* leading space */ - rightFixed - TITLE_GAP, 10);
|
|
93
113
|
return (_jsx(Box, { flexDirection: "column", width: width, height: height, children: _jsx(Box, { flexDirection: "column", height: height, children: visible.map((row, i) => {
|
|
94
114
|
if (row.kind === "spacer") {
|
|
95
115
|
return _jsx(Box, { height: 1 }, `sp-${i}`);
|
|
@@ -101,7 +121,7 @@ export default function IssueList({ groups, flatIssues, selectedIndex, scrollOff
|
|
|
101
121
|
// Label "WT CI" is 5 chars; the "W" lines up with the WT
|
|
102
122
|
// glyph at column (width - RIGHT_FIXED + 1).
|
|
103
123
|
const namePart = `${row.name} ${row.count}`;
|
|
104
|
-
const labelText = "WT CI";
|
|
124
|
+
const labelText = isTriage ? "DUE" : isIssues ? "RDY" : "WT CI";
|
|
105
125
|
const labelPad = row.isFirst
|
|
106
126
|
? Math.max(2, width - namePart.length - labelText.length)
|
|
107
127
|
: 0;
|
|
@@ -115,7 +135,8 @@ export default function IssueList({ groups, flatIssues, selectedIndex, scrollOff
|
|
|
115
135
|
const di = issue;
|
|
116
136
|
const sc = stateColor(di.issue.state.type, di.issue.state.name);
|
|
117
137
|
const prio = priorityMarker(di.issue.priority);
|
|
118
|
-
const
|
|
138
|
+
const isDeleting = deletingIds?.has(di.issue.identifier) ?? false;
|
|
139
|
+
const work = isDeleting ? { glyph: "⌫", color: "yellow" } : workIndicator(di.worktree);
|
|
119
140
|
const ci = ciIndicator(di.checks);
|
|
120
141
|
const nestPrefix = depth > 0 ? " ".repeat(depth - 1) + "└ " : "";
|
|
121
142
|
const adjustedTitleWidth = Math.max(titleMaxWidth - nestPrefix.length, 5);
|
|
@@ -123,9 +144,15 @@ export default function IssueList({ groups, flatIssues, selectedIndex, scrollOff
|
|
|
123
144
|
? di.issue.title.slice(0, adjustedTitleWidth - 1) + "…"
|
|
124
145
|
: di.issue.title;
|
|
125
146
|
const bg = selected ? selectionBg : undefined;
|
|
126
|
-
// Pad between title and the right columns so the
|
|
147
|
+
// Pad between title and the right columns so the markers stay
|
|
127
148
|
// pinned to the right edge regardless of title length.
|
|
128
|
-
const trailingPad = Math.max(0, width - LEFT_FIXED - 1 - nestPrefix.length - title.length -
|
|
129
|
-
|
|
149
|
+
const trailingPad = Math.max(0, width - LEFT_FIXED - 1 - nestPrefix.length - title.length - rightFixed);
|
|
150
|
+
// Triage variant: a single right-aligned due-date badge in place
|
|
151
|
+
// of the WT/CI columns.
|
|
152
|
+
const due = isTriage ? formatDueDate(di.issue.dueDate) : null;
|
|
153
|
+
const dueText = (due?.label ?? "").padStart(DUE_COL_WIDTH).slice(-DUE_COL_WIDTH);
|
|
154
|
+
// Issues variant: a single readiness glyph right-aligned under "RDY".
|
|
155
|
+
const ready = isIssues ? readinessGlyph(di) : null;
|
|
156
|
+
return (_jsxs(Box, { width: width, children: [_jsx(Text, { backgroundColor: bg, color: prio.color, children: prio.glyph }), _jsx(Text, { backgroundColor: bg, children: " " }), _jsx(Text, { backgroundColor: bg, color: sc, children: "\u25CF" }), _jsx(Text, { backgroundColor: bg, children: " " }), _jsxs(Text, { backgroundColor: bg, dimColor: true, children: [nestPrefix, di.issue.identifier.padEnd(10)] }), _jsxs(Text, { backgroundColor: bg, bold: selected, children: [" ", title] }), _jsx(Text, { backgroundColor: bg, children: " ".repeat(trailingPad) }), isTriage ? (_jsx(Text, { backgroundColor: bg, color: due?.color, bold: due?.urgent, children: dueText })) : isIssues ? (_jsx(Text, { backgroundColor: bg, color: ready?.color, children: ` ${ready?.glyph ?? " "}` })) : (_jsxs(_Fragment, { children: [_jsx(Text, { backgroundColor: bg, children: " " }), _jsx(Text, { backgroundColor: bg, color: work.color, children: work.glyph }), _jsx(Text, { backgroundColor: bg, children: " " }), _jsx(Text, { backgroundColor: bg, children: " " }), _jsx(Text, { backgroundColor: bg, color: ci.color, children: ci.glyph })] }))] }, di.issue.identifier));
|
|
130
157
|
}) }) }));
|
|
131
158
|
}
|
|
@@ -30,15 +30,22 @@ const LEGEND = [
|
|
|
30
30
|
{
|
|
31
31
|
title: "Tabs & keys",
|
|
32
32
|
rows: [
|
|
33
|
-
{ glyph: "1", color: "cyan", meaning: "
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
{ glyph: "1–4", color: "cyan", meaning: "Switch tab by number (Tab cycles)" },
|
|
34
|
+
{
|
|
35
|
+
glyph: "Triage",
|
|
36
|
+
color: "cyan",
|
|
37
|
+
meaning: "Incoming inbox — due dates + comments (Linear only)",
|
|
38
|
+
},
|
|
39
|
+
{ glyph: "Issues", color: "cyan", meaning: "Backlog / planning" },
|
|
40
|
+
{ glyph: "Trees", color: "cyan", meaning: "Worktrees in progress" },
|
|
41
|
+
{ glyph: "Reviews", color: "cyan", meaning: "PRs awaiting your review" },
|
|
37
42
|
{ glyph: "t", color: "cyan", meaning: "Switch / set up the issue tracker" },
|
|
38
43
|
{ glyph: "n", color: "cyan", meaning: "New issue (built-in tracker, Issues tab)" },
|
|
39
44
|
{ glyph: "e", color: "cyan", meaning: "Edit issue (built-in tracker, Issues tab)" },
|
|
40
45
|
{ glyph: "d", color: "red", meaning: "Delete issue (built-in) / remove worktree (Trees)" },
|
|
41
|
-
{ glyph: "w", color: "cyan", meaning: "Start work (creates a worktree
|
|
46
|
+
{ glyph: "w", color: "cyan", meaning: "Start work / send to tree (creates a worktree)" },
|
|
47
|
+
{ glyph: "a", color: "cyan", meaning: "Ask Claude about the issue + comments (Triage tab)" },
|
|
48
|
+
{ glyph: "s", color: "cyan", meaning: "Triage on-call schedule (Triage tab)" },
|
|
42
49
|
],
|
|
43
50
|
},
|
|
44
51
|
{
|
|
@@ -56,6 +63,14 @@ const LEGEND = [
|
|
|
56
63
|
{ glyph: "✗", color: "red", meaning: "CI column: a check is failing" },
|
|
57
64
|
{ glyph: "●", color: "yellow", meaning: "CI column: checks pending / running" },
|
|
58
65
|
{ glyph: "·", color: "gray", meaning: "CI column: no PR or no checks" },
|
|
66
|
+
{ glyph: "◷", color: "red", meaning: "DUE column (Triage): overdue / due today" },
|
|
67
|
+
{ glyph: "◷", color: "yellow", meaning: "DUE column (Triage): due within 2 days" },
|
|
68
|
+
{ glyph: "✓", color: "green", meaning: "RDY column (Issues): ready — no open blockers" },
|
|
69
|
+
{
|
|
70
|
+
glyph: "⊘",
|
|
71
|
+
color: "yellow",
|
|
72
|
+
meaning: "RDY column (Issues): blocked by an open dependency",
|
|
73
|
+
},
|
|
59
74
|
],
|
|
60
75
|
},
|
|
61
76
|
{
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TriageSchedule } from "./types.js";
|
|
2
|
+
type Seg = {
|
|
3
|
+
text: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
bold?: boolean;
|
|
6
|
+
dim?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/** Flatten the schedules into colored segment-lines. Exported for testing. */
|
|
9
|
+
export declare function buildScheduleLines(schedules: TriageSchedule[]): Seg[][];
|
|
10
|
+
export default function TriageScheduleOverlay({ schedules, scrollOffset, width, height, }: {
|
|
11
|
+
schedules: TriageSchedule[];
|
|
12
|
+
scrollOffset: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
function fmt(iso) {
|
|
4
|
+
const d = new Date(iso);
|
|
5
|
+
if (Number.isNaN(d.getTime()))
|
|
6
|
+
return iso;
|
|
7
|
+
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
8
|
+
}
|
|
9
|
+
/** Flatten the schedules into colored segment-lines. Exported for testing. */
|
|
10
|
+
export function buildScheduleLines(schedules) {
|
|
11
|
+
const lines = [];
|
|
12
|
+
if (schedules.length === 0) {
|
|
13
|
+
lines.push([{ text: "No triage on-call schedule found for your teams.", dim: true }]);
|
|
14
|
+
return lines;
|
|
15
|
+
}
|
|
16
|
+
schedules.forEach((sch, si) => {
|
|
17
|
+
if (si > 0)
|
|
18
|
+
lines.push([{ text: "" }]);
|
|
19
|
+
lines.push([
|
|
20
|
+
{ text: "≡ ", color: "cyan", bold: true },
|
|
21
|
+
{ text: sch.scheduleName, bold: true },
|
|
22
|
+
{ text: ` ${sch.teamName}`, dim: true },
|
|
23
|
+
]);
|
|
24
|
+
if (sch.currentName) {
|
|
25
|
+
lines.push([
|
|
26
|
+
{ text: " on call now: ", dim: true },
|
|
27
|
+
{ text: sch.currentName, color: sch.currentIsMe ? "cyan" : "green", bold: true },
|
|
28
|
+
...(sch.currentIsMe ? [{ text: " ← you", color: "cyan" }] : []),
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
for (const sh of sch.shifts) {
|
|
32
|
+
const range = `${fmt(sh.startsAt)} – ${fmt(sh.endsAt)}`.padEnd(18);
|
|
33
|
+
const segs = [
|
|
34
|
+
{ text: ` ${sh.isCurrent ? "●" : "·"} `, color: sh.isCurrent ? "green" : "gray" },
|
|
35
|
+
{ text: range, dim: !sh.isCurrent && !sh.isMe },
|
|
36
|
+
{
|
|
37
|
+
text: sh.name,
|
|
38
|
+
color: sh.isCurrent ? "green" : sh.isMe ? "cyan" : undefined,
|
|
39
|
+
bold: sh.isCurrent || sh.isMe,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
if (sh.isCurrent)
|
|
43
|
+
segs.push({ text: " now", color: "green", bold: true });
|
|
44
|
+
else if (sh.isMe)
|
|
45
|
+
segs.push({ text: " you", color: "cyan" });
|
|
46
|
+
lines.push(segs);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return lines;
|
|
50
|
+
}
|
|
51
|
+
export default function TriageScheduleOverlay({ schedules, scrollOffset, width, height, }) {
|
|
52
|
+
const all = buildScheduleLines(schedules);
|
|
53
|
+
// Title (1) + blank (1) leave the rest for the body. The footer/close hint is
|
|
54
|
+
// owned by the dashboard's global command-bar row, so the panel stays pure
|
|
55
|
+
// content and lines up with the left pane.
|
|
56
|
+
const bodyHeight = Math.max(1, height - 2);
|
|
57
|
+
const maxOffset = Math.max(0, all.length - bodyHeight);
|
|
58
|
+
const off = Math.min(scrollOffset, maxOffset);
|
|
59
|
+
const visible = all.slice(off, off + bodyHeight);
|
|
60
|
+
const clampSegs = (segs) => {
|
|
61
|
+
let remaining = width - 1;
|
|
62
|
+
const out = [];
|
|
63
|
+
for (const s of segs) {
|
|
64
|
+
if (remaining <= 0)
|
|
65
|
+
break;
|
|
66
|
+
if (s.text.length <= remaining) {
|
|
67
|
+
out.push(s);
|
|
68
|
+
remaining -= s.text.length;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
out.push({ ...s, text: s.text.slice(0, Math.max(0, remaining - 1)) + "…" });
|
|
72
|
+
remaining = 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
};
|
|
77
|
+
return (_jsxs(Box, { flexDirection: "column", width: width, height: height, paddingX: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "Triage on-call schedule" }), _jsx(Text, { children: " " }), visible.map((segs, i) => (_jsx(Box, { children: _jsx(Text, { children: clampSegs(segs).map((s, j) => (_jsx(Text, { color: s.color, bold: s.bold, dimColor: s.dim, children: s.text || " " }, j))) }) }, i))), off + bodyHeight < all.length ? _jsx(Text, { dimColor: true, children: "\u2193 more (press s to scroll)" }) : null] }));
|
|
78
|
+
}
|
|
@@ -4,6 +4,8 @@ export declare function loadDashboardData(repoRoot: string): Promise<{
|
|
|
4
4
|
flatIssues: DashboardIssue[];
|
|
5
5
|
treeGroups: ProjectGroup[];
|
|
6
6
|
flatTrees: DashboardIssue[];
|
|
7
|
+
triageGroups: ProjectGroup[];
|
|
8
|
+
flatTriage: DashboardIssue[];
|
|
7
9
|
}>;
|
|
8
10
|
export declare function loadReviewsData(repoRoot: string): Promise<{
|
|
9
11
|
flatReviews: EnrichedReviewPR[];
|
|
@@ -254,15 +254,37 @@ export async function loadDashboardData(repoRoot) {
|
|
|
254
254
|
function flatten(g) {
|
|
255
255
|
return g.flatMap((grp) => grp.statusGroups.flatMap((sg) => sg.issues.flatMap(flattenWithChildren)));
|
|
256
256
|
}
|
|
257
|
-
// ── Partition: Issues
|
|
258
|
-
//
|
|
257
|
+
// ── Partition: Triage / Issues (backlog) / Trees (work in progress).
|
|
258
|
+
// A tracker issue with no worktree is backlog — unless the active tracker
|
|
259
|
+
// has a triage inbox and the issue sits in it (state.type === "triage"), in
|
|
260
|
+
// which case it goes to the Triage tab instead. Once any issue gains a
|
|
259
261
|
// worktree it moves to the Trees tab. Children always have a worktree, so
|
|
260
262
|
// they only ever appear nested in Trees. Main-repo + orphaned worktrees
|
|
261
263
|
// belong to Trees (they're active checkouts, not backlog).
|
|
262
|
-
const
|
|
264
|
+
const triageEnabled = tracker.supportsTriage === true;
|
|
265
|
+
const isTriage = (di) => triageEnabled && !di.worktree && di.issue.state.type === "triage";
|
|
266
|
+
const triageIssues = enriched.filter(isTriage);
|
|
267
|
+
const backlogIssues = enriched.filter((di) => !di.worktree && !isTriage(di));
|
|
263
268
|
const treeIssues = enriched.filter((di) => di.worktree);
|
|
269
|
+
// Surface the most pressing triage items first: by due date ascending
|
|
270
|
+
// (overdue/soonest first), undated last. `dueDate` is `YYYY-MM-DD` so a
|
|
271
|
+
// plain string compare is chronological. buildProjectGroups preserves this
|
|
272
|
+
// order within each status group.
|
|
273
|
+
triageIssues.sort((a, b) => {
|
|
274
|
+
const da = a.issue.dueDate ?? null;
|
|
275
|
+
const db = b.issue.dueDate ?? null;
|
|
276
|
+
if (da && db)
|
|
277
|
+
return da < db ? -1 : da > db ? 1 : 0;
|
|
278
|
+
if (da)
|
|
279
|
+
return -1;
|
|
280
|
+
if (db)
|
|
281
|
+
return 1;
|
|
282
|
+
return 0;
|
|
283
|
+
});
|
|
264
284
|
const groups = buildProjectGroups(backlogIssues);
|
|
265
285
|
const flatIssues = flatten(groups);
|
|
286
|
+
const triageGroups = buildProjectGroups(triageIssues);
|
|
287
|
+
const flatTriage = flatten(triageGroups);
|
|
266
288
|
const treeGroups = buildProjectGroups(treeIssues);
|
|
267
289
|
const topLevelOrphans = orphans.filter((di) => !childTicketIds.has(di.issue.identifier));
|
|
268
290
|
if (topLevelOrphans.length > 0) {
|
|
@@ -286,7 +308,7 @@ export async function loadDashboardData(repoRoot) {
|
|
|
286
308
|
});
|
|
287
309
|
flatTrees.unshift(mainEntry);
|
|
288
310
|
}
|
|
289
|
-
return { groups, flatIssues, treeGroups, flatTrees };
|
|
311
|
+
return { groups, flatIssues, treeGroups, flatTrees, triageGroups, flatTriage };
|
|
290
312
|
}
|
|
291
313
|
/** Build the synthetic dashboard row for the main repo checkout — the
|
|
292
314
|
* non-worktree clone that the user typically commits master/main from.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Due-date formatting for the Triage tab. Turns Linear's `YYYY-MM-DD`
|
|
3
|
+
* `dueDate` string into a short, urgency-coded badge used by both the issue
|
|
4
|
+
* list (right column) and the detail panel.
|
|
5
|
+
*
|
|
6
|
+
* Urgency buckets (by whole calendar days from today, local time):
|
|
7
|
+
* - overdue (< 0) → red, "⚠ overdue Nd"
|
|
8
|
+
* - due today (0) → red, "⚠ due today"
|
|
9
|
+
* - soon (1–2 days) → yellow, "due in Nd"
|
|
10
|
+
* - later (≥ 3 days) → gray, "due Mon D"
|
|
11
|
+
*
|
|
12
|
+
* Returns null when there is no due date so callers can render nothing.
|
|
13
|
+
*/
|
|
14
|
+
export interface DueInfo {
|
|
15
|
+
/** Short badge text, e.g. "⚠ overdue 3d" or "due Jun 12". */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Ink color name keyed to urgency. */
|
|
18
|
+
color: "red" | "yellow" | "gray";
|
|
19
|
+
/** True for overdue/today — the cases worth a warning glyph. */
|
|
20
|
+
urgent: boolean;
|
|
21
|
+
/** Whole days until due (negative when overdue). */
|
|
22
|
+
days: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function formatDueDate(dueDate: string | null | undefined, now?: Date): DueInfo | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Whole-day difference between two dates, ignoring time-of-day. */
|
|
2
|
+
function dayDiff(from, to) {
|
|
3
|
+
const a = Date.UTC(from.getFullYear(), from.getMonth(), from.getDate());
|
|
4
|
+
const b = Date.UTC(to.getFullYear(), to.getMonth(), to.getDate());
|
|
5
|
+
return Math.round((b - a) / 86_400_000);
|
|
6
|
+
}
|
|
7
|
+
export function formatDueDate(dueDate, now = new Date()) {
|
|
8
|
+
if (!dueDate)
|
|
9
|
+
return null;
|
|
10
|
+
// Parse `YYYY-MM-DD` as a local date (not UTC) so "today" matches the user's
|
|
11
|
+
// wall clock. `new Date("2026-06-12")` would parse as UTC midnight; build the
|
|
12
|
+
// date from parts instead.
|
|
13
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(dueDate);
|
|
14
|
+
if (!m)
|
|
15
|
+
return null;
|
|
16
|
+
const due = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
|
|
17
|
+
if (Number.isNaN(due.getTime()))
|
|
18
|
+
return null;
|
|
19
|
+
const days = dayDiff(now, due);
|
|
20
|
+
const monthDay = due.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
21
|
+
if (days < 0) {
|
|
22
|
+
const n = Math.abs(days);
|
|
23
|
+
return { label: `⚠ overdue ${n}d`, color: "red", urgent: true, days };
|
|
24
|
+
}
|
|
25
|
+
if (days === 0) {
|
|
26
|
+
return { label: "⚠ due today", color: "red", urgent: true, days };
|
|
27
|
+
}
|
|
28
|
+
if (days <= 2) {
|
|
29
|
+
return { label: `due in ${days}d`, color: "yellow", urgent: false, days };
|
|
30
|
+
}
|
|
31
|
+
return { label: `due ${monthDay}`, color: "gray", urgent: false, days };
|
|
32
|
+
}
|