@clipboard-health/groundcrew 4.0.0 → 4.0.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.
@@ -1,223 +0,0 @@
1
- import { type Blocker, type RawLinearIssue } from "../lib/boardSource.ts";
2
- import { type ResolvedConfig } from "../lib/config.ts";
3
- import { type RunState } from "../lib/runState.ts";
4
- import { type UsageByModel } from "../lib/usage.ts";
5
- import { type WorkspaceAccessHint, type WorkspaceProbe } from "../lib/workspaces.ts";
6
- import { type WorktreeDirtiness, type WorktreeEntry } from "../lib/worktrees.ts";
7
- import { type TicketCheck } from "./ticketCheck.ts";
8
- export type TicketDoctorVerdict = {
9
- kind: "pr-open";
10
- number: number;
11
- url: string;
12
- } | {
13
- kind: "pr-merged";
14
- number: number;
15
- url: string;
16
- } | {
17
- kind: "interrupted";
18
- reason: string;
19
- nextStep: string;
20
- } | {
21
- kind: "failed-launch";
22
- reason: string;
23
- nextStep: string;
24
- } | {
25
- kind: "in-flight";
26
- reason: string;
27
- } | {
28
- kind: "recoverable";
29
- reason: string;
30
- nextStep: string;
31
- } | {
32
- kind: "would-dispatch";
33
- } | {
34
- kind: "ineligible";
35
- reason: string;
36
- } | {
37
- kind: "unresolvable";
38
- reason: string;
39
- } | {
40
- kind: "lost";
41
- reason: string;
42
- };
43
- export type LinearStatusProbe = {
44
- kind: "terminal";
45
- stateName: string;
46
- } | {
47
- kind: "non-terminal";
48
- stateName: string;
49
- } | {
50
- kind: "skipped";
51
- } | {
52
- kind: "unresolvable";
53
- reason: string;
54
- };
55
- export type WorktreeProbe = {
56
- kind: "present-clean";
57
- } | {
58
- kind: "present-dirty";
59
- modified: number;
60
- untracked: number;
61
- } | {
62
- kind: "present-unknown-dirtiness";
63
- reason: string;
64
- } | {
65
- kind: "absent";
66
- };
67
- export type LocalBranchProbe = {
68
- kind: "present";
69
- ahead: number;
70
- behind: number;
71
- defaultBranch?: string;
72
- } | {
73
- kind: "absent";
74
- } | {
75
- kind: "unknown";
76
- reason: string;
77
- };
78
- export type RemoteBranchProbe = {
79
- kind: "present";
80
- } | {
81
- kind: "absent";
82
- } | {
83
- kind: "unknown";
84
- reason: string;
85
- };
86
- export type PullRequestProbe = {
87
- kind: "open";
88
- number: number;
89
- url: string;
90
- } | {
91
- kind: "merged";
92
- number: number;
93
- url: string;
94
- } | {
95
- kind: "absent";
96
- } | {
97
- kind: "gh-missing";
98
- } | {
99
- kind: "unknown";
100
- reason: string;
101
- };
102
- export interface DecideVerdictInput {
103
- linear: LinearStatusProbe;
104
- worktree: WorktreeProbe;
105
- localBranch: LocalBranchProbe;
106
- remoteBranch: RemoteBranchProbe;
107
- pullRequest: PullRequestProbe;
108
- branch: string;
109
- worktreeDir: string | undefined;
110
- workspaceName: string | undefined;
111
- runState: RunState | undefined;
112
- }
113
- /**
114
- * Returns a post-dispatch verdict if the probe bundle matches one of the
115
- * "ticket has moved past dispatch" cases. Returns `undefined` otherwise,
116
- * signalling that the caller should fall through to the pre-dispatch path.
117
- *
118
- * Precedence: PR verdicts always win. Failed launches report before ordinary
119
- * local recovery. Interrupted runs report concrete recoverable git work first
120
- * when it exists, then fall back to `interrupted`. Ordinary post-dispatch cases
121
- * report in-flight before recoverable. Inside `recoverable`, dirty worktree
122
- * beats clean-with-un-pushed-local beats remote-only beats stranded local.
123
- */
124
- export declare function decidePostDispatchVerdict(input: DecideVerdictInput): TicketDoctorVerdict | undefined;
125
- export interface TicketDoctorDependencies {
126
- config: ResolvedConfig;
127
- ticket: string;
128
- /**
129
- * Injected to keep `ticketDoctor` pure and easy to unit-test. `undefined`
130
- * means the caller passed `--no-linear` — the Linear-backed pre-dispatch
131
- * checks (status, label, repo, eligibility) are all skipped.
132
- */
133
- fetchRawIssue: ((input: {
134
- ticket: string;
135
- }) => Promise<RawLinearIssue>) | undefined;
136
- fetchBlockersFor: (input: {
137
- ticket: string;
138
- uuid: string;
139
- }) => Promise<readonly Blocker[]>;
140
- fetchUsage: () => Promise<UsageByModel>;
141
- countInProgress: () => Promise<number>;
142
- findWorktree: (ticket: string) => WorktreeEntry | undefined;
143
- probeWorkspaces: () => Promise<WorkspaceProbe>;
144
- workspaceAccessHint: (name: string) => Promise<WorkspaceAccessHint | undefined>;
145
- probeWorkingTree: (input: {
146
- worktreeDir: string;
147
- }) => Promise<WorktreeDirtiness>;
148
- /**
149
- * Resolves the default branch for `repoDir` (e.g. "master" vs "main") from
150
- * the local clone's `refs/remotes/<remote>/HEAD`, falling back to
151
- * `config.git.defaultBranch`. Injected so probeLocalBranchSection can pass a
152
- * per-repo branch into `probeLocalBranch` without each probe needing to
153
- * shell out to git itself.
154
- */
155
- resolveDefaultBranch: (input: {
156
- repoDir: string;
157
- }) => Promise<string>;
158
- probeLocalBranch: (input: {
159
- repoDir: string;
160
- branch: string;
161
- remote: string;
162
- defaultBranch: string;
163
- }) => Promise<LocalBranchProbe>;
164
- probeRemoteBranch: (input: {
165
- repoDir: string;
166
- branch: string;
167
- remote: string;
168
- doFetch: boolean;
169
- }) => Promise<RemoteBranchProbe>;
170
- probePullRequest: (input: {
171
- repoDir: string;
172
- branch: string;
173
- }) => Promise<PullRequestProbe>;
174
- readRunState: (ticket: string) => RunState | undefined;
175
- doFetch: boolean;
176
- }
177
- export interface TicketDoctorResult {
178
- ticket: string;
179
- title?: string;
180
- resolution: TicketCheck[];
181
- eligibility: TicketCheck[];
182
- runState: TicketCheck[];
183
- worktree: TicketCheck[];
184
- workspace: TicketCheck[];
185
- localBranch: TicketCheck[];
186
- remoteBranch: TicketCheck[];
187
- pullRequest: TicketCheck[];
188
- skipReasons: {
189
- resolution: string;
190
- eligibility: string;
191
- worktree: string;
192
- runState: string;
193
- workspace: string;
194
- localBranch: string;
195
- remoteBranch: string;
196
- pullRequest: string;
197
- };
198
- verdict: TicketDoctorVerdict;
199
- }
200
- /**
201
- * Pure-with-async orchestrator that gathers all sections plus the verdict.
202
- * All I/O happens via injected probes — the function itself does no
203
- * filesystem, network, or stdout work.
204
- */
205
- export declare function ticketDoctor(dependencies: TicketDoctorDependencies): Promise<TicketDoctorResult>;
206
- interface TicketDoctorArguments {
207
- ticket: string;
208
- doLinear: boolean;
209
- doFetch: boolean;
210
- }
211
- /**
212
- * Parses optional `--no-linear` and `--no-fetch` flags that follow
213
- * `crew doctor --ticket <id>`. The ticket id is consumed by `cli.ts` before
214
- * this point.
215
- */
216
- export declare function parseTicketDoctorFlags(argv: string[]): {
217
- doLinear: boolean;
218
- doFetch: boolean;
219
- };
220
- export declare function renderTicketDoctorResult(result: TicketDoctorResult): string[];
221
- export declare function runTicketDoctor(parsed: TicketDoctorArguments): Promise<boolean>;
222
- export {};
223
- //# sourceMappingURL=ticketDoctor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ticketDoctor.d.ts","sourceRoot":"","sources":["../../src/commands/ticketDoctor.ts"],"names":[],"mappings":"AAoBA,OAAO,EAOL,KAAK,OAAO,EAEZ,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEpF,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAc,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAa,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAO5F,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAW3F,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CA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