SLOPSHOPPER

deploy-watch

Watch GitHub Actions runs for the commit you pushed or merged; /ci pane and a toast when they finish

paneguardcommandtoastprocesstimer
v0.4.1MITupdated 2026-10-19blackironj/claude-mods/deploy-watch
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · deploy-watch
│ ┃ CI ✕ › fix the failing auth test and add an audit log call │ ┃ @ a1b2c3d │ ┃ waiting for runs ⏺ Read(src/auth.ts) │ ⎿ Read 6 lines │ ⏺ Update(src/auth.ts) │ ⎿ Added 2 lines, removed 1 line │ ⏺ Bash(bun test) │ ⎿ 3 pass, 1 fail │ │ ● Done. refresh now rejects expired claims and logs an audit event. │ │ ✻ Worked for 42s · done 4:20 PM │ │ › /ci │ ⎿ deploy-watch: CI pane opened. │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · CI
@ a1b2c3d waiting for runs
README

claude-mods

Six Claude Code mods that guard risky actions and cut down on babysitting: confirm production changes, keep secrets out of the model's context, start branches from the right base, hold Claude to "just look" when you ask for it, tell you when CI finishes, and let you approve a command auto mode blocked with one button.

They started as one person's setup and stay opinionated, but every personal value is a plugin option with a sensible default.

[!WARNING] Mods run inside Claude Code with your permissions and are not sandboxed. These guards parse shell commands heuristically: they catch the common forms Claude writes, not every way a command can be spelled. Treat them as a safety net for mistakes, not a security boundary. Read the source before installing.

Mods

ModWhat it does
prod-guardHolds mutating kubectl/helm commands against production contexts and aws iam writes until you confirm the exact command; a confirmed call skips the auto-mode classifier, and one the classifier blocks anyway goes into your prompt box as ! …. Refuses mutating kubectl without an explicit --context. Judges the command inside aws-vault exec <profile> -- … by the same rules, and puts aws-vault login or a bare aws-vault exec <profile> (an interactive shell) in your prompt box as ! … instead of running it (left out when the box holds a draft, so the draft is kept).
secret-guardBlocks Bash and Read access to .env files (not .env.example) and to ~/.claude.json. Masks JWTs, AWS/GitHub/Slack/Anthropic/OpenAI/Google keys and private key blocks in Bash and Read output before Claude sees them.
branch-baseRewrites git checkout -b, git switch -c and git worktree add with no start point to start from origin/<base> after a fetch, and adds --base <base> to gh pr create. When a repo has no such branch, asks you which base to use (remembered per repo until reload).
read-only-lockAfter a look-only prompt ("just investigate", "plan first, don't change anything", or Korean equivalents such as "확인만 해"), blocks file edits and mutating commands and shows a one-line band with an Unlock button. "go ahead", "apply it" or the button unlocks.
deploy-watchAfter git push or gh pr create, polls GitHub Actions for that commit every 30 s; after gh pr merge, for the merge commit GitHub made on the base branch, where deploy workflows run (an auto-merge is followed until it lands); after gh workflow run, for the dispatched workflow. Raises a toast and a notification when the runs finish and sends the result to Claude as a message that starts a turn (a push that started no runs is only noted, without starting one), so Claude reports it and picks up work that was waiting on CI without watching CI itself. /ci opens a pane with the runs.
approve-blockedWhen the auto-mode classifier blocks a Bash command, asks you Run or Don't run in a dialog instead of leaving Claude to tell you to run it with !. Run runs the call again past the classifier (a permissions.deny rule still stands); if the classifier blocks it again, the command goes into your prompt box as ! … so Enter runs it. Don't run tells Claude not to hand the command to you. A call prod-guard already had you confirm is not asked about twice.

Install

Requires Claude Code v2.1.287 or later (mods are on by default). At the prompt of a terminal session:

/plugin install prod-guard --marketplace blackironj/claude-mods

Answer y to add the marketplace, then pick a scope (user scope loads it in every session). Repeat for each mod you want: secret-guard, branch-base, read-only-lock, deploy-watch, approve-blocked.

From a shell:

claude plugin install prod-guard --marketplace blackironj/claude-mods

Disable or uninstall any mod from the Installed tab in /plugin.

Options

Set them on the install screen, or change them later in /config.

ModOptionDefaultMeaning
prod-guardprodContextsprodComma-separated kube contexts whose mutations need confirmation (also matched against helm --kube-context).
prod-guardrequireContexttrueRefuse mutating kubectl commands without --context.
branch-basebaseBranchdevRemote branch new branches start from and PRs target.

Requirements and limits

  • deploy-watch needs the GitHub CLI signed in; branch-base needs git.
  • Panes, bands and toasts draw in the terminal and the Desktop app's Code tab. Under claude -p and the VS Code chat panel the guards still run but nothing is drawn.
  • read-only-lock decides from keywords, so it can lock or stay unlocked when you didn't mean it to; the band shows when it is on.
  • secret-guard also blocks commands that create a .env (for example cp .env.example .env); run those yourself. Masking covers the token shapes listed above, not arbitrary passwords.
  • branch-base does not affect worktrees Claude Code creates on its own (EnterWorktree).
  • approve-blocked turns every auto-mode block of a Bash command into a question for you, so pressing Run overrides the classifier for that one call: read the command first. Other tools the classifier blocks are left as they are.
  • prod-guard lets a call you confirmed run even where a permission rule or the auto-mode classifier would stop it, and its aws-vault handoff puts a command Claude wrote into your prompt box: a ! command runs in your shell with no permission check, so read it before pressing Enter.
  • prod-guard lets aws-vault exec <profile> -- … run in Claude's shell, which has no terminal for prompts. When the session needs an MFA code or a key-store passphrase, the command fails; run one aws-vault command yourself with ! to refresh the session.

Development

Each mod is a plugin folder (.claude-plugin/plugin.json, hooks/hooks.json, a TypeScript hooks module, tests). There is no build step: Claude Code loads the .ts/.tsx sources directly. See CLAUDE.md for the layout, checks and conventions.

claude plugin validate prod-guard   # what the module hooks and calls, and anything the engine would refuse
claude plugin test prod-guard       # runs prod-guard/tests/*.test.ts against the engine
claude --plugin-dir ./prod-guard    # a session with your working copy loaded and hot-reloaded

License

MIT

Source 4 files
hooks/register.tsx 213 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import type { Run, Watch } from '../types'
5import { mark, newSince, summarize, trigger } from './runs'
6import type { Trigger } from './runs'
7
8const PANE = 'ci'
9const POLL_MS = 30_000
10const GIVE_UP_MS = 10 * 60_000
11const MERGE_GIVE_UP_MS = 60 * 60_000
12const RUN_FIELDS = 'name,status,conclusion,url,createdAt'
13
14const watch = atom({ plugin: 'deploy-watch', key: 'watch' } as const, null as Watch | null)
15
16type PrView = { state: string; baseRefName: string; mergeCommit: { oid: string } | null }
17
18function repoArgs(repo: string | undefined): string[] {
19  return repo === undefined ? [] : ['-R', repo]
20}
21
22/** What the toast and the pane name: the workflow, the PR still to merge, or the branch. */
23function label(w: Watch): string {
24  if (w.workflow !== undefined) return w.branch === '' ? w.workflow : `${w.workflow} on ${w.branch}`
25  if (w.sha === '' && w.pr !== undefined) return `PR ${w.pr}`
26  return w.branch
27}
28
29function noteFor(w: Watch): string {
30  const target =
31    w.workflow !== undefined ? `the next ${label(w)} run`
32    : w.sha === '' ? `${label(w)}'s merge commit once it merges`
33    : `${w.branch}@${w.sha.slice(0, 7)}`
34  return (
35    `deploy-watch is now tracking GitHub Actions for ${target}. When the runs finish it notifies the user ` +
36    '(toast and system notification) and sends you the result as a new message that starts a turn. Do not watch ' +
37    'or poll this CI yourself (no `gh run watch`, no sleep loops). If your next step depends on this CI, say so to ' +
38    'the user and end your turn; continue when the result arrives. The user can open the /ci pane.'
39  )
40}
41
42async function absDir($: EngineInterface, dir: string): Promise<string> {
43  if (dir.startsWith('/')) return dir
44  const cwd = await $.session.cwd()
45  return dir === '' ? cwd : `${cwd}/${dir}`
46}
47
48async function headOf($: EngineInterface, cwd: string): Promise<{ sha: string; branch: string } | undefined> {
49  const head = await $.process.run(['git', 'rev-parse', 'HEAD', '--abbrev-ref', 'HEAD'], { cwd })
50  if (head.exitCode !== 0) return undefined
51  const [sha = '', branch = ''] = head.stdout.trim().split('\n')
52  return { sha, branch }
53}
54
55async function viewPr($: EngineInterface, dir: string, repo: string | undefined, pr: string): Promise<PrView | undefined> {
56  const out = await $.process.run(['gh', 'pr', 'view', pr, ...repoArgs(repo), '--json', 'state,baseRefName,mergeCommit'], { cwd: dir })
57  return out.exitCode === 0 ? (JSON.parse(out.stdout) as PrView) : undefined
58}
59
60/**
61 * The watch a trigger starts. A merge is watched on the commit GitHub made on
62 * the base branch, not the local HEAD, since that is where deploy workflows run;
63 * `branchBefore` names the PR when `gh pr merge` was given none.
64 */
65async function watchFor($: EngineInterface, t: Trigger, branchBefore: string | undefined): Promise<Watch | undefined> {
66  const dir = await absDir($, t.dir)
67  const now = await $.clock.now()
68  const base = { dir, ...(t.repo === undefined ? {} : { repo: t.repo }), startedAt: now, runs: [], isDone: false }
69
70  if (t.kind === 'push' || t.kind === 'pr-create') {
71    const head = await headOf($, dir)
72    return head === undefined ? undefined : { ...base, ...head, since: now }
73  }
74  if (t.kind === 'workflow-run') return { ...base, branch: t.ref ?? '', sha: '', workflow: t.workflow, since: now }
75
76  const pr = t.pr ?? branchBefore
77  if (pr === undefined) return undefined
78  const view = await viewPr($, dir, t.repo, pr)
79  if (view?.state === 'MERGED' && view.mergeCommit !== null) return { ...base, branch: view.baseRefName, sha: view.mergeCommit.oid }
80  return { ...base, branch: view?.baseRefName ?? '', sha: '', pr }
81}
82
83/**
84 * Tells the person (toast, system notification) and the model: by default a
85 * prompt that starts a turn once the session is idle; with `wake: false` a row
86 * it reads next turn, for results nothing is waiting on.
87 */
88async function announce($: EngineInterface, text: string, { wake = true } = {}) {
89  $.ui.toast(text, { timeoutMs: 15_000 })
90  await $.ui.notify(text, { title: 'CI' })
91  if (!wake) {
92    await $.session.append({
93      message: { type: 'user', content: [{ type: 'text', text: `deploy-watch: ${text}. The user has already been notified.` }] },
94    })
95    return
96  }
97  await $.prompt.submit({
98    text:
99      `deploy-watch: ${text}. Tell the user this result in one line, then continue any work that was waiting on ` +
100      'this CI; if a run failed, look at why before going on.',
101  })
102}
103
104/**
105 * Marks `w` done with `patch`. True only for the call that did, so two polls
106 * that overlap (the timer and /ci) announce the result once.
107 */
108async function finish($: EngineInterface, w: Watch, patch: Partial<Watch>): Promise<boolean> {
109  let isFirst = false
110  await update($, watch, cur => {
111    isFirst = cur !== null && cur.startedAt === w.startedAt && !cur.isDone
112    return cur !== null && isFirst ? { ...cur, ...patch, isDone: true } : cur
113  })
114  return isFirst
115}
116
117/** A PR not merged yet: switch to its merge commit once merged, stop when closed or after an hour. */
118async function pollMerge($: EngineInterface, w: Watch, pr: string, now: number) {
119  const view = await viewPr($, w.dir, w.repo, pr)
120  if (view === undefined) return
121  if (view.state === 'MERGED' && view.mergeCommit !== null) {
122    const sha = view.mergeCommit.oid
123    await update($, watch, cur => (cur?.startedAt === w.startedAt ? { ...cur, sha, branch: view.baseRefName, startedAt: now } : cur))
124    return
125  }
126  if (view.state !== 'CLOSED' && now - w.startedAt <= MERGE_GIVE_UP_MS) return
127  if (!(await finish($, w, {}))) return
128  await announce($, view.state === 'CLOSED' ? `PR ${pr} was closed without merging` : `PR ${pr} did not merge within 60 min`)
129}
130
131async function poll($: EngineInterface) {
132  const w = await read($, watch)
133  if (w === null || w.isDone) return
134  const now = await $.clock.now()
135  if (w.sha === '' && w.pr !== undefined) return pollMerge($, w, w.pr, now)
136
137  const listed = await $.process.run(
138    w.workflow !== undefined
139      ? ['gh', 'run', 'list', '--workflow', w.workflow, ...(w.branch === '' ? [] : ['--branch', w.branch]), ...repoArgs(w.repo), '--json', RUN_FIELDS, '--limit', '5']
140      : ['gh', 'run', 'list', '--commit', w.sha, ...repoArgs(w.repo), '--json', RUN_FIELDS, '--limit', '20'],
141    { cwd: w.dir },
142  )
143  if (listed.exitCode !== 0) return
144  const runs = newSince(JSON.parse(listed.stdout) as Run[], w.since)
145  const summary = summarize(runs)
146  const isStale = runs.length === 0 && now - w.startedAt > GIVE_UP_MS
147
148  if (!summary.isDone && !isStale) {
149    await update($, watch, cur => (cur?.startedAt === w.startedAt && !cur.isDone ? { ...cur, runs } : cur))
150    return
151  }
152  if (!(await finish($, w, { runs }))) return
153  if (isStale) await announce($, `No CI runs appeared for ${label(w)} in 10 min`, { wake: false })
154  else await announce($, `${summary.text} · ${label(w)}`)
155}
156
157async function branchIn($: EngineInterface, dir: string): Promise<string | undefined> {
158  return (await headOf($, await absDir($, dir)))?.branch
159}
160
161export const register: Register = on => {
162  on('session.start', async ($, e, next) => {
163    await $.command.register({ name: PANE, description: 'Show GitHub Actions runs for the watched commit (starts watching HEAD if nothing is)' })
164    $.clock.every(POLL_MS, () => void poll($))
165    return next(e)
166  })
167
168  on('command.run', { command: PANE }, async $ => {
169    const w = await read($, watch)
170    if (w === null || w.isDone) {
171      const fresh = await watchFor($, { kind: 'push', dir: '' }, undefined)
172      if (fresh !== undefined) await update($, watch, () => fresh)
173    }
174    await $.ui.open({ id: PANE, title: 'CI' })
175    void poll($)
176    return { text: 'CI pane opened.' }
177  }).catch($ => ({ text: `${$.plugin.name}: could not open the CI pane.` }))
178
179  on('tool.call', { tool: 'Bash' }, async ($, e, next) => {
180    const t = trigger(e.command)
181    const before = t?.kind === 'pr-merge' && t.pr === undefined ? await branchIn($, t.dir) : undefined
182    const ran = await next(e)
183    if (t === undefined || ran.deny !== undefined || ran.isError === true) return ran
184
185    const w = await watchFor($, t, before)
186    if (w === undefined) return ran
187    await update($, watch, () => w)
188    return { ...ran, context: [...(ran.context ?? []), noteFor(w)] }
189  }).catch(($, e, next) => next(e)) // a watch that fails to start must not fail the command
190
191  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
192    const { Box, Text } = $.ui.resolve(e)
193    const w = await read($, watch)
194    if (w === null) return <Text dimColor>Nothing watched yet. Push a branch, or run /ci in a repo.</Text>
195
196    const summary = w.sha === '' && w.pr !== undefined ? { text: 'waiting for the PR to merge' } : summarize(w.runs)
197    return (
198      <Box flexDirection="column">
199        <Text weight="bold">
200          {label(w)}
201          {w.sha === '' ? '' : ` @ ${w.sha.slice(0, 7)}`}
202        </Text>
203        <Text dimColor>{summary.text}</Text>
204        {w.runs.map(run => (
205          <Text color={mark(run) === '✗' ? 'red' : mark(run) === '✓' ? 'green' : undefined}>
206            {mark(run)} {run.name}
207          </Text>
208        ))}
209      </Box>
210    )
211  })
212}
213
hooks/runs.ts 73 lines
1import type { Run } from '../types'
2import { option, positionals, program, segments } from './shell'
3
4/**
5 * A CI-triggering command: where it ran (`git -C`, an earlier `cd`, or '' for
6 * the session's directory), its `-R/--repo`, and what to watch afterwards.
7 */
8export type Trigger =
9  | { kind: 'push'; dir: string; repo?: string }
10  | { kind: 'pr-create'; dir: string; repo?: string }
11  /** `pr` is the number, URL or branch given; absent means the current branch's PR. */
12  | { kind: 'pr-merge'; dir: string; repo?: string; pr?: string }
13  | { kind: 'workflow-run'; dir: string; repo?: string; workflow: string; ref?: string }
14
15const PR_MERGE_VALUED = ['-b', '--body', '-F', '--body-file', '-t', '--subject', '-A', '--author-email', '--match-head-commit', '-R', '--repo']
16const WORKFLOW_RUN_VALUED = ['-r', '--ref', '-f', '--raw-field', '-F', '--field', '-R', '--repo']
17
18/** The first CI-triggering command in `command`, or undefined when it triggers no CI. */
19export function trigger(command: string): Trigger | undefined {
20  let cdDir = ''
21  for (const seg of segments(command)) {
22    const ws = program(seg.words)
23    if (ws[0] === 'cd' && ws[1] !== undefined) cdDir = ws[1]
24    if (ws[0] === 'git' && ws.includes('push')) return { kind: 'push', dir: option(ws, '-C') ?? cdDir }
25    if (ws[0] !== 'gh') continue
26
27    const repo = option(ws, '-R', '--repo')
28    const at = (t: Trigger): Trigger => (repo === undefined ? t : { ...t, repo })
29    if (ws[1] === 'pr' && ws[2] === 'create') return at({ kind: 'pr-create', dir: cdDir })
30    if (ws[1] === 'pr' && ws[2] === 'merge') {
31      const pr = positionals(ws, 3, PR_MERGE_VALUED)[0]
32      return at(pr === undefined ? { kind: 'pr-merge', dir: cdDir } : { kind: 'pr-merge', dir: cdDir, pr })
33    }
34    if (ws[1] === 'workflow' && ws[2] === 'run') {
35      const workflow = positionals(ws, 3, WORKFLOW_RUN_VALUED)[0]
36      if (workflow === undefined) return undefined
37      const ref = option(ws, '-r', '--ref')
38      return at(ref === undefined ? { kind: 'workflow-run', dir: cdDir, workflow } : { kind: 'workflow-run', dir: cdDir, workflow, ref })
39    }
40  }
41  return undefined
42}
43
44/** How far before a watch starts a run may be created and still belong to it (GitHub clock skew, push latency). */
45export const SKEW_MS = 2 * 60_000
46
47/**
48 * The runs created after `since` (less `SKEW_MS`): a commit can already carry
49 * runs from an earlier push or PR, which must not finish this watch early.
50 * Runs without `createdAt` (state from an older version) are kept.
51 */
52export function newSince(runs: readonly Run[], since: number | undefined): Run[] {
53  if (since === undefined) return [...runs]
54  return runs.filter(r => r.createdAt === undefined || Date.parse(r.createdAt) >= since - SKEW_MS)
55}
56
57export type Summary = { isDone: boolean; text: string }
58
59export function summarize(runs: readonly Run[]): Summary {
60  if (runs.length === 0) return { isDone: false, text: 'waiting for runs' }
61  const running = runs.filter(r => r.status !== 'completed')
62  if (running.length > 0) return { isDone: false, text: `${running.length}/${runs.length} running` }
63  const failed = runs.filter(r => !['success', 'skipped', 'neutral'].includes(r.conclusion))
64  return failed.length === 0
65    ? { isDone: true, text: `CI passed (${runs.length} runs)` }
66    : { isDone: true, text: `CI failed: ${failed.map(r => `${r.name} (${r.conclusion})`).join(', ')}` }
67}
68
69export function mark(run: Run): string {
70  if (run.status !== 'completed') return '…'
71  return ['success', 'skipped', 'neutral'].includes(run.conclusion) ? '✓' : '✗'
72}
73
hooks/shell.ts 144 lines
1// Minimal shell splitting for guards: good enough to find simple commands
2// in a Bash tool call, not a full shell parser. Quotes are respected;
3// substitutions ($(...), backticks) are not expanded.
4
5export type Segment = {
6  /** The segment's source text, trimmed. */
7  text: string
8  /** Offset of `text` in the full command. */
9  start: number
10  /** Words with quotes removed. */
11  words: string[]
12}
13
14/** Splits a command line at unquoted `&&`, `||`, `;`, `|`, `&` and newlines. */
15export function segments(command: string): Segment[] {
16  const out: Segment[] = []
17  let segStart = 0
18  let quote: '"' | "'" | null = null
19
20  const push = (end: number) => {
21    const raw = command.slice(segStart, end)
22    const lead = raw.length - raw.trimStart().length
23    const text = raw.trim()
24    if (text !== '') out.push({ text, start: segStart + lead, words: words(text) })
25  }
26
27  for (let i = 0; i < command.length; i++) {
28    const c = command.charAt(i)
29    if (quote !== null) {
30      if (c === '\\' && quote === '"') i++
31      else if (c === quote) quote = null
32      continue
33    }
34    if (c === '\\') {
35      i++
36      continue
37    }
38    if (c === '"' || c === "'") {
39      quote = c
40      continue
41    }
42    const two = command.slice(i, i + 2)
43    if (two === '&&' || two === '||') {
44      push(i)
45      segStart = i + 2
46      i++
47    } else if (c === '&' && /[<>]/.test(command.charAt(i - 1) + command.charAt(i + 1))) {
48      // fd duplication or `&>`, not a separator
49      continue
50    } else if (c === ';' || c === '|' || c === '&' || c === '\n') {
51      push(i)
52      segStart = i + 1
53    }
54  }
55  push(command.length)
56  return out
57}
58
59/** Splits one simple command into words, removing quotes. */
60export function words(text: string): string[] {
61  const out: string[] = []
62  let cur = ''
63  let has = false
64  let quote: '"' | "'" | null = null
65
66  for (let i = 0; i < text.length; i++) {
67    const c = text.charAt(i)
68    if (quote !== null) {
69      if (c === quote) quote = null
70      else if (c === '\\' && quote === '"' && i + 1 < text.length) cur += text.charAt(++i)
71      else cur += c
72      continue
73    }
74    if (c === '"' || c === "'") {
75      quote = c
76      has = true
77    } else if (c === '\\' && i + 1 < text.length) {
78      cur += text.charAt(++i)
79      has = true
80    } else if (/\s/.test(c)) {
81      if (has) out.push(cur)
82      cur = ''
83      has = false
84    } else {
85      cur += c
86      has = true
87    }
88  }
89  if (has) out.push(cur)
90  return out
91}
92
93const WRAPPERS = new Set(['sudo', 'env', 'time', 'command', 'exec'])
94
95/** Drops leading `VAR=value` assignments and `sudo`/`env`/`time` wrappers. */
96export function program(ws: string[]): string[] {
97  const i = ws.findIndex(w => !/^[A-Za-z_][A-Za-z0-9_]*=/.test(w) && !WRAPPERS.has(w))
98  return i === -1 ? [] : ws.slice(i)
99}
100
101/**
102 * The value of a long or short option in `ws`, written `--name=value` or
103 * `--name value`; undefined when absent.
104 */
105export function option(ws: string[], ...names: string[]): string | undefined {
106  for (const [i, w] of ws.entries()) {
107    for (const name of names) {
108      if (w === name) return ws[i + 1]
109      if (name.startsWith('--') && w.startsWith(name + '=')) return w.slice(name.length + 1)
110    }
111  }
112  return undefined
113}
114
115/**
116 * Positional words after `from`, skipping flags and redirections; flags in
117 * `valued` consume the next word unless written `--flag=value`.
118 */
119export function positionals(ws: string[], from: number, valued: readonly string[]): string[] {
120  const out: string[] = []
121  let skip = false
122  for (const [i, w] of ws.entries()) {
123    if (i < from) continue
124    if (skip) {
125      skip = false
126      continue
127    }
128    if (w === '--') {
129      out.push(...ws.slice(i + 1))
130      break
131    }
132    if (/^\d*(>>?|<|&>)/.test(w)) {
133      skip = /^\d*(>>?|<|&>)$/.test(w)
134      continue
135    }
136    if (w.startsWith('-') && w !== '-') {
137      skip = !w.includes('=') && valued.includes(w)
138      continue
139    }
140    out.push(w)
141  }
142  return out
143}
144
types/index.d.ts 27 lines
1/** One `gh run list` row; `createdAt` is absent in state kept by 0.2.0 and earlier. */
2export type Run = { name: string; status: string; conclusion: string; url: string; createdAt?: string }
3
4export type Watch = {
5  dir: string
6  /** `-R/--repo` of the triggering command, passed on to every `gh` call. */
7  repo?: string
8  branch: string
9  /** The watched commit; '' while waiting for `pr` to merge or for a dispatched `workflow`'s run. */
10  sha: string
11  /** A PR whose merge commit becomes `sha` once it merges (`gh pr merge --auto`). */
12  pr?: string
13  /** A dispatched workflow, watched by name instead of by commit. */
14  workflow?: string
15  startedAt: number
16  /** Runs created before this (less a skew) belong to an earlier trigger; absent for a fresh merge commit. */
17  since?: number
18  runs: Run[]
19  isDone: boolean
20}
21
22declare module 'claude-code' {
23  interface PluginState {
24    'deploy-watch': { watch: Watch | null }
25  }
26}
27