@spunto/design-system 0.64.0 → 0.65.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/README.md CHANGED
@@ -332,7 +332,7 @@ review. Every surface that shows one:
332
332
  optional `actions`, and a dark surface for the app's own shell (the socket is the
333
333
  app's), or a sentence saying why there is none. No composer under it.
334
334
  - **`TaskDetails`** (`sidebar` | `sheet`) with **`TaskMachine`**, **`TaskBoot`**,
335
- `TaskSessionUsage`, `TaskPullRequest`, `TaskCommandLog` — the facts about a task, in
335
+ `TaskSessionUsage`, `TaskAppTileContent`, `TaskCommandLog` — the facts about a task, in
336
336
  one order, instead of two hand-kept copies.
337
337
  - **`NewTaskDialog`** — delegating: prompt, files, title, base branch, model, plus the app's own `fields` (`NewTaskCustomField`: label, hint, `defaultValue`, `required`, `render(value, onChange)`), read back in `value.fields`.
338
338
  - Vocabulary and helpers: `TaskStateBadge`, `taskStateConfig`, `useElapsed`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spunto/design-system",
3
- "version": "0.64.0",
3
+ "version": "0.65.0",
4
4
  "description": "Spunto's shared design system — green tokens (conservatory + sprout), color constants, and UI primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -85,7 +85,6 @@ export { TaskDiffPanel } from "./diff-panel"
85
85
  export type { TaskDiffPanelProps } from "./diff-panel"
86
86
  export { TaskTerminalPanel } from "./terminal-panel"
87
87
  export type { TaskTerminalPanelProps } from "./terminal-panel"
88
- export { TaskPullRequest } from "./pull-request"
89
88
  export { TaskSharedFiles, TaskSharedLinks } from "./shared"
90
89
  export { TaskAppTileContent, TaskAppTileItems } from "./app-tiles"
91
90
  export { TaskSessionUsage, formatCost, formatTokens } from "./session-usage"
@@ -121,8 +120,6 @@ export type {
121
120
  TaskPatchHunk,
122
121
  TaskPatchLine,
123
122
  TaskPendingAction,
124
- TaskPullRequestData,
125
- TaskPullRequests,
126
123
  TaskRepoDiff,
127
124
  TaskSharedData,
128
125
  TaskSharedFile,
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
- // Everything that is a *fact about* a task rather than a moment in it — branch, cost, the pull
4
- // request, what was shared in the conversation, the machine, the prompt, what ran — in one component with two shapes:
3
+ // Everything that is a *fact about* a task rather than a moment in it — branch, cost, what the
4
+ // org's apps draw (GitHub: the pull requests), what was shared in the conversation, the machine, the prompt, what ran — in one component with two shapes:
5
5
  //
6
6
  // - `sidebar`: the cockpit's right column, each block a fold, glanced at without pushing the
7
7
  // work off screen;
@@ -18,12 +18,11 @@ import { CheckIcon, ChevronRightIcon, CopyIcon, ExternalLinkIcon, GitBranchIcon,
18
18
 
19
19
  import { cn, formatRelativeTime } from "../../utils"
20
20
  import { TaskCommandLog } from "./command-log"
21
- import { TaskPullRequest } from "./pull-request"
22
21
  import { TaskSessionUsage } from "./session-usage"
23
22
  import { TaskSharedFiles, TaskSharedLinks } from "./shared"
24
23
  import { TaskAppTileContent } from "./app-tiles"
25
24
  import { isLiveTaskState, taskSpan } from "./task-state"
26
- import type { AttachmentUrl, TaskAppTile, TaskCommand, TaskItem, TaskPendingAction, TaskPullRequests, TaskSessionUsageData, TaskSharedData } from "./types"
25
+ import type { AttachmentUrl, TaskAppTile, TaskCommand, TaskItem, TaskPendingAction, TaskSessionUsageData, TaskSharedData } from "./types"
27
26
 
28
27
  /** Set by `TaskCockpitMobile` around its sheet, so Drop can close it. @internal */
29
28
  export const TaskDetailsSheetContext = createContext<{ close: () => void } | null>(null)
@@ -34,8 +33,6 @@ export interface TaskDetailsProps {
34
33
  variant?: "sidebar" | "sheet"
35
34
  /** What the session consumed. Absent → no Session block (nothing measured is not "free"). */
36
35
  usage?: TaskSessionUsageData | null
37
- /** What the forge says about the branch. Absent or `supported: false` → no block at all. */
38
- pullRequests?: TaskPullRequests | null
39
36
  /**
40
37
  * The links and files that circulated in the conversation (`GET .../shared`). Each list is its
41
38
  * own block, absent while empty. Files need `attachmentUrl` to be drawn.
@@ -155,7 +152,6 @@ export function TaskDetails({
155
152
  task,
156
153
  variant = "sidebar",
157
154
  usage,
158
- pullRequests,
159
155
  shared,
160
156
  appTiles,
161
157
  appTileSettingsHref,
@@ -257,14 +253,8 @@ export function TaskDetails({
257
253
  </Block>
258
254
  ))}
259
255
 
260
- {pullRequests?.supported && (
261
- <Block variant={variant} title="Pull request">
262
- <TaskPullRequest data={pullRequests} />
263
- </Block>
264
- )}
265
-
266
- {/* Right under the branch's own PR: what the org's apps make of the links the conversation
267
- shared — the other pull requests it talked about, with where each one stands. */}
256
+ {/* What the org's apps make of the links the conversation shared — GitHub: the pull requests
257
+ it talked about, with where each one stands. */}
268
258
  {appTiles?.filter((tile) => !tile.session).map((tile) => (
269
259
  <Block key={tile.appId} variant={variant} title={tile.title} hint={tile.appName === tile.title ? undefined : tile.appName}>
270
260
  <TaskAppTileContent tile={tile} />
@@ -216,27 +216,6 @@ export interface TaskFilePatch {
216
216
  hunks: TaskPatchHunk[]
217
217
  }
218
218
 
219
- // ── Pull request ─────────────────────────────────────────────────────────────────────────────
220
-
221
- /** A proposal at the forge for the task's branch — reported, never observed. */
222
- export interface TaskPullRequestData {
223
- /** Short reference, e.g. `#289` or `!42`. */
224
- label: string
225
- url: string
226
- title: string
227
- state: "draft" | "open" | "merged" | "closed"
228
- checks?: "pending" | "passing" | "failing" | null
229
- review?: "approved" | "changes-requested" | "pending" | null
230
- comments?: number | null
231
- updatedAt?: string | null
232
- }
233
-
234
- export interface TaskPullRequests {
235
- /** `false` → nothing connected can answer; the section is absent, not empty. */
236
- supported: boolean
237
- repos: { repo: string; pullRequest: TaskPullRequestData | null; error?: string | null }[]
238
- }
239
-
240
219
  // ── Shared in the conversation ──────────────────────────────────────────────────────────────
241
220
 
242
221
  /** A link written in the conversation (`GET .../tasks/{id}/shared`), deduplicated on its URL. */
@@ -1,179 +0,0 @@
1
- "use client"
2
-
3
- import type { ReactNode } from "react"
4
- import {
5
- CheckCircle2Icon,
6
- CircleDotIcon,
7
- CircleSlashIcon,
8
- ExternalLinkIcon,
9
- GitMergeIcon,
10
- GitPullRequestDraftIcon,
11
- GitPullRequestIcon,
12
- Loader2Icon,
13
- MessageSquareIcon,
14
- TriangleAlertIcon,
15
- XCircleIcon,
16
- } from "lucide-react"
17
-
18
- import { cn, formatRelativeTime } from "../../utils"
19
- import { Badge } from "../badge"
20
- import type { TaskPullRequestData, TaskPullRequests } from "./types"
21
-
22
- /**
23
- * What the forge says about the task's branch.
24
- *
25
- * The one thing on this screen the platform cannot read off the machine it started — a proposal
26
- * lives at the forge, with the discussion, the CI and the approvals around it. Everything else
27
- * here (the diff, the session, the machine) is observed; this is *reported*, by whichever app
28
- * implements `git.pullRequestForBranch`.
29
- *
30
- * So the whole block is conditional on the answer, not on a provider id: `supported: false` means
31
- * nothing connected can answer, and the section is **absent** rather than empty. That is the rule
32
- * RFC 0024 asks for — read `operations`, never `if (provider === "github")` — and it is why this
33
- * component names no forge anywhere in its markup.
34
- *
35
- * **It never moves the task.** A merged proposal does not mark the task `done`, and this
36
- * deliberately does not offer an Accept button of its own: accepting is the project's command,
37
- * run by the human who read the diff.
38
- */
39
-
40
- type PullRequest = TaskPullRequestData
41
-
42
- /**
43
- * Colours borrowed from the task states they mean the same thing as: merged is a `done`, closed
44
- * a `failed`, open the flame that says "a human is expected here". A draft is muted on purpose —
45
- * it is work someone has not yet asked to be looked at.
46
- */
47
- const STATE_STYLES: Record<PullRequest["state"], { label: string; className: string }> = {
48
- draft: { label: "Draft", className: "bg-muted text-muted-foreground border-border" },
49
- open: { label: "Open", className: "bg-primary/15 text-primary border-primary/30" },
50
- merged: { label: "Merged", className: "bg-green-500/15 text-green-700 dark:text-green-400 border-green-500/30" },
51
- closed: { label: "Closed", className: "bg-red-500/15 text-red-700 dark:text-red-400 border-red-500/30" },
52
- }
53
-
54
- function StateIcon({ state }: { state: PullRequest["state"] }) {
55
- if (state === "merged") return <GitMergeIcon className="h-3 w-3" />
56
- if (state === "closed") return <XCircleIcon className="h-3 w-3" />
57
- if (state === "draft") return <GitPullRequestDraftIcon className="h-3 w-3" />
58
- return <GitPullRequestIcon className="h-3 w-3" />
59
- }
60
-
61
- /** A verdict and its colour — the same three-way vocabulary for checks and for review. */
62
- function Signal({
63
- icon,
64
- label,
65
- tone,
66
- }: {
67
- icon: ReactNode
68
- label: string
69
- tone: "good" | "bad" | "waiting"
70
- }) {
71
- return (
72
- <span
73
- className={cn(
74
- "inline-flex items-center gap-1 text-[10px]",
75
- tone === "good" && "text-green-700 dark:text-green-400",
76
- tone === "bad" && "text-red-700 dark:text-red-400",
77
- tone === "waiting" && "text-muted-foreground",
78
- )}
79
- >
80
- {icon}
81
- {label}
82
- </span>
83
- )
84
- }
85
-
86
- function Checks({ checks = null }: { checks?: PullRequest["checks"] }) {
87
- // Null is not "passing": a repository with no CI has not passed anything, and drawing a green
88
- // tick for it would be the panel's one outright lie.
89
- if (checks === null) return null
90
- if (checks === "passing") return <Signal icon={<CheckCircle2Icon className="h-3 w-3" />} label="Checks passing" tone="good" />
91
- if (checks === "failing") return <Signal icon={<TriangleAlertIcon className="h-3 w-3" />} label="Checks failing" tone="bad" />
92
- return <Signal icon={<Loader2Icon className="h-3 w-3 animate-spin" />} label="Checks running" tone="waiting" />
93
- }
94
-
95
- function Review({ review = null }: { review?: PullRequest["review"] }) {
96
- if (review === null) return null
97
- if (review === "approved") return <Signal icon={<CheckCircle2Icon className="h-3 w-3" />} label="Approved" tone="good" />
98
- if (review === "changes-requested")
99
- return <Signal icon={<CircleSlashIcon className="h-3 w-3" />} label="Changes requested" tone="bad" />
100
- return <Signal icon={<CircleDotIcon className="h-3 w-3" />} label="Review requested" tone="waiting" />
101
- }
102
-
103
- function PullRequestCard({ repo, pr, showRepo }: { repo: string; pr: PullRequest; showRepo: boolean }) {
104
- const style = STATE_STYLES[pr.state] ?? STATE_STYLES.open
105
- return (
106
- <a
107
- href={pr.url}
108
- target="_blank"
109
- rel="noreferrer"
110
- className="group block rounded-md border border-border/60 bg-background/60 px-2.5 py-2 transition-colors hover:border-border hover:bg-muted/40"
111
- >
112
- <div className="flex items-center gap-1.5">
113
- <Badge variant="outline" className={cn("h-5 shrink-0 gap-1 px-1.5 text-[10px]", style.className)}>
114
- <StateIcon state={pr.state} />
115
- {style.label}
116
- </Badge>
117
- <span className="shrink-0 font-mono text-[11px] text-muted-foreground">{pr.label}</span>
118
- <ExternalLinkIcon className="ml-auto h-3 w-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100" />
119
- </div>
120
- {/* The title is the proposal's own, not the task's: an agent that renamed its work on the
121
- way out is telling the reviewer something, and echoing the task title would hide it. */}
122
- <p className="mt-1.5 line-clamp-2 text-xs leading-snug">{pr.title}</p>
123
- {showRepo && <p className="mt-1 truncate font-mono text-[10px] text-muted-foreground">{repo}</p>}
124
- {(pr.checks || pr.review || pr.comments) && (
125
- <div className="mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1">
126
- <Checks checks={pr.checks} />
127
- <Review review={pr.review} />
128
- {!!pr.comments && (
129
- <Signal icon={<MessageSquareIcon className="h-3 w-3" />} label={String(pr.comments)} tone="waiting" />
130
- )}
131
- </div>
132
- )}
133
- {pr.updatedAt && (
134
- <p className="mt-1.5 text-[10px] text-muted-foreground">Updated {formatRelativeTime(pr.updatedAt)}</p>
135
- )}
136
- </a>
137
- )
138
- }
139
-
140
- /**
141
- * The proposals open for the task's branch, one card per repository that has one. Render it only
142
- * when `data.supported` — the cockpit's details panel does exactly that.
143
- */
144
- export function TaskPullRequest({ data }: { data: TaskPullRequests }) {
145
- const withProposal = data.repos.filter((r) => r.pullRequest)
146
- const failed = data.repos.filter((r) => r.error)
147
-
148
- if (withProposal.length === 0) {
149
- return (
150
- <p className="text-[11px] leading-relaxed text-muted-foreground">
151
- {failed.length > 0
152
- ? failed.map((r) => r.error).join(" · ")
153
- : // Said plainly, because it is the normal state of a task that has not pushed yet —
154
- // not a failure, and not something the reader has to do anything about.
155
- "No pull request for this branch yet."}
156
- </p>
157
- )
158
- }
159
-
160
- return (
161
- <div className="space-y-1.5">
162
- {withProposal.map((row) => (
163
- <PullRequestCard
164
- key={row.repo}
165
- repo={row.repo}
166
- pr={row.pullRequest!}
167
- // Named only when there is more than one — on the single-repository project that most
168
- // are, the repo name is the project's name repeated under every card.
169
- showRepo={data.repos.length > 1}
170
- />
171
- ))}
172
- {failed.map((row) => (
173
- <p key={row.repo} className="text-[10px] text-muted-foreground">
174
- {row.repo}: {row.error}
175
- </p>
176
- ))}
177
- </div>
178
- )
179
- }