sequant 2.6.2 → 2.8.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.
Files changed (62) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +13 -1
  4. package/dist/bin/cli.d.ts +1 -1
  5. package/dist/bin/cli.js +11 -1
  6. package/dist/bin/preflight.d.ts +21 -0
  7. package/dist/bin/preflight.js +45 -0
  8. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +1 -1
  9. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/force-push.md +34 -0
  10. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +24 -7
  11. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +29 -0
  12. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +100 -2
  13. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +24 -0
  14. package/dist/marketplace/external_plugins/sequant/skills/qa/references/anti-pattern-detection.md +285 -0
  15. package/dist/marketplace/external_plugins/sequant/skills/qa/references/call-site-review.md +202 -0
  16. package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +287 -0
  17. package/dist/marketplace/external_plugins/sequant/skills/qa/references/test-quality-checklist.md +272 -0
  18. package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +40 -0
  19. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +95 -11
  20. package/dist/marketplace/external_plugins/sequant/skills/references/shared/framework-gotchas.md +186 -0
  21. package/dist/marketplace/external_plugins/sequant/skills/release/SKILL.md +661 -0
  22. package/dist/marketplace/external_plugins/sequant/skills/test/references/browser-testing-patterns.md +423 -0
  23. package/dist/marketplace/external_plugins/sequant/skills/upstream/SKILL.md +419 -0
  24. package/dist/src/commands/sync.d.ts +1 -0
  25. package/dist/src/commands/sync.js +56 -1
  26. package/dist/src/commands/update.js +7 -0
  27. package/dist/src/lib/errors.d.ts +85 -0
  28. package/dist/src/lib/errors.js +111 -0
  29. package/dist/src/lib/version-check.d.ts +19 -0
  30. package/dist/src/lib/version-check.js +44 -0
  31. package/dist/src/lib/workflow/batch-executor.js +61 -6
  32. package/dist/src/lib/workflow/drivers/agent-driver.d.ts +17 -0
  33. package/dist/src/lib/workflow/drivers/claude-code.d.ts +22 -0
  34. package/dist/src/lib/workflow/drivers/claude-code.js +111 -7
  35. package/dist/src/lib/workflow/log-writer.d.ts +1 -1
  36. package/dist/src/lib/workflow/phase-executor.d.ts +18 -0
  37. package/dist/src/lib/workflow/phase-executor.js +76 -14
  38. package/dist/src/lib/workflow/run-log-schema.d.ts +3 -0
  39. package/dist/src/lib/workflow/run-log-schema.js +7 -0
  40. package/dist/src/lib/workflow/state-manager.d.ts +1 -0
  41. package/dist/src/lib/workflow/state-manager.js +6 -0
  42. package/dist/src/lib/workflow/state-schema.d.ts +3 -0
  43. package/dist/src/lib/workflow/state-schema.js +7 -0
  44. package/dist/src/lib/workflow/types.d.ts +17 -0
  45. package/dist/src/ui/tui/theme.d.ts +18 -4
  46. package/dist/src/ui/tui/theme.js +18 -4
  47. package/package.json +4 -3
  48. package/templates/skills/_shared/references/force-push.md +34 -0
  49. package/templates/skills/assess/SKILL.md +24 -7
  50. package/templates/skills/exec/SKILL.md +29 -0
  51. package/templates/skills/loop/SKILL.md +100 -2
  52. package/templates/skills/qa/SKILL.md +24 -0
  53. package/templates/skills/qa/references/anti-pattern-detection.md +285 -0
  54. package/templates/skills/qa/references/call-site-review.md +202 -0
  55. package/templates/skills/qa/references/quality-gates.md +287 -0
  56. package/templates/skills/qa/references/test-quality-checklist.md +272 -0
  57. package/templates/skills/qa/references/testing-requirements.md +40 -0
  58. package/templates/skills/qa/scripts/quality-checks.sh +95 -11
  59. package/templates/skills/references/shared/framework-gotchas.md +186 -0
  60. package/templates/skills/release/SKILL.md +661 -0
  61. package/templates/skills/test/references/browser-testing-patterns.md +423 -0
  62. package/templates/skills/upstream/SKILL.md +419 -0
@@ -0,0 +1,419 @@
1
+ ---
2
+ name: upstream
3
+ description: "Monitor Claude Code releases, assess compatibility with sequant, and create issues for breaking changes and deprecations. Opportunities are noted in assessment reports for human triage."
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Read
10
+ - Write
11
+ - Glob
12
+ - Grep
13
+ - Bash(gh *)
14
+ - Bash(git *)
15
+ - Bash(jq *)
16
+ - Bash(base64 *)
17
+ - Bash(npx tsx *)
18
+ ---
19
+
20
+ <!-- sequant:local-override -->
21
+ > **Local overrides (read this first).** Before following any instruction below, check whether `.claude/.local/skills/upstream/overrides.md` exists. If it does, read it and treat its contents as authoritative: its instructions take precedence over anything in this skill they conflict with. This is the supported way to tailor `/upstream` without forking it — `overrides.md` lives under `.claude/.local/`, which `sequant update` and `sync` never overwrite.
22
+
23
+ # Upstream: Claude Code Release Tracking
24
+
25
+ You are the "Upstream Assessment Agent" for the sequant repository.
26
+
27
+ ## Purpose
28
+
29
+ When invoked as `/upstream`, your job is to:
30
+
31
+ 1. Fetch Claude Code release information from the public GitHub repo
32
+ 2. Analyze changes against sequant's current capabilities baseline
33
+ 3. Detect relevant changes using keyword matching and regex patterns
34
+ 4. Skip out-of-scope changes (configured in baseline.json `outOfScope`)
35
+ 5. Generate a structured compatibility assessment report with Actionable and Informational sections
36
+ 6. Auto-create GitHub issues for breaking changes, deprecations, new tools, and hook changes
37
+ 7. List opportunities in the assessment report for human triage (no individual issues created)
38
+
39
+ ## Invocation
40
+
41
+ ```bash
42
+ # Analyze latest release
43
+ /upstream
44
+
45
+ # Analyze specific version
46
+ /upstream v2.1.29
47
+
48
+ # Analyze all releases since version
49
+ /upstream --since v2.1.25
50
+
51
+ # Dry-run mode (no issues created)
52
+ /upstream --dry-run
53
+
54
+ # Help
55
+ /upstream --help
56
+ ```
57
+
58
+ ## Assessment Process
59
+
60
+ ### 1. Parse Arguments
61
+
62
+ Parse the command arguments to determine:
63
+
64
+ - **Target version**: Specific version (e.g., `v2.1.29`) or `latest`
65
+ - **Since version**: If `--since` flag provided, assess all versions since that release
66
+ - **Dry-run mode**: If `--dry-run` flag, generate report but skip issue creation
67
+ - **Help**: If `--help` flag, show usage instructions
68
+
69
+ ### 2. Fetch Release Data
70
+
71
+ Fetch release information from the public Claude Code repository:
72
+
73
+ ```bash
74
+ # Get latest release
75
+ gh release view --repo anthropics/claude-code --json tagName,name,body,publishedAt
76
+
77
+ # Get specific version
78
+ gh release view v2.1.29 --repo anthropics/claude-code --json tagName,name,body,publishedAt
79
+
80
+ # List releases for --since support
81
+ gh release list --repo anthropics/claude-code --limit 50 --json tagName,publishedAt
82
+ ```
83
+
84
+ ### 3. Load Baseline
85
+
86
+ Load the sequant capabilities baseline from `.sequant/upstream/baseline.json`:
87
+
88
+ ```json
89
+ {
90
+ "lastAssessedVersion": "v2.1.25",
91
+ "tools": {
92
+ "core": ["Task", "Bash", "Read", "Write", "Edit", "Glob", "Grep"],
93
+ "optional": ["WebFetch", "WebSearch", "NotebookEdit"]
94
+ },
95
+ "hooks": {
96
+ "used": ["PreToolUse"],
97
+ "files": ["src/hooks/pre-tool-hook.ts"]
98
+ },
99
+ "mcpServers": {
100
+ "required": [],
101
+ "optional": ["chrome-devtools", "context7", "sequential-thinking"]
102
+ },
103
+ "keywords": [
104
+ "Task", "Bash", "hook", "PreToolUse", "PostToolUse",
105
+ "MCP", "permission", "allow", "deny", "tool",
106
+ "background", "parallel", "agent", "subagent",
107
+ "settings", "config", "plugin"
108
+ ],
109
+ "dependencyMap": {
110
+ "permission": ["src/hooks/pre-tool-hook.ts", ".claude/settings.json"],
111
+ "hook": ["src/hooks/pre-tool-hook.ts"],
112
+ "Task": [".claude/skills/**/*.md", "src/lib/workflow/*.ts"],
113
+ "MCP": ["docs/mcp-integrations.md", ".claude/settings.json"]
114
+ },
115
+ "outOfScope": [
116
+ "PDF/document processing - users work with code and GitHub issues",
117
+ "Slack/OAuth integrations - workflow is GitHub-centric",
118
+ "Notebook editing - not a data science tool",
119
+ "IDE-specific features (VSCode, JetBrains) - sequant is CLI/terminal focused",
120
+ "Windows-specific fixes - sequant targets macOS/Linux"
121
+ ]
122
+ }
123
+ ```
124
+
125
+ ### 4. Analyze Changes
126
+
127
+ For each release, analyze the changelog/release body:
128
+
129
+ **Step 1: Extract Changes**
130
+
131
+ Parse the release body to extract individual change items. Common formats:
132
+ - Bullet points: `- Added new feature X`
133
+ - "What's changed" sections
134
+ - BREAKING CHANGE markers
135
+
136
+ **Step 2: Relevance Detection**
137
+
138
+ For each change, check if it's relevant to sequant:
139
+
140
+ ```typescript
141
+ // Keyword matching
142
+ const isRelevant = baseline.keywords.some(kw =>
143
+ change.toLowerCase().includes(kw.toLowerCase())
144
+ );
145
+
146
+ // Pattern matching
147
+ const patterns = {
148
+ newTool: /added.*tool|new.*tool|introducing/i,
149
+ deprecation: /deprecat|remov|no longer support/i,
150
+ breaking: /breaking|incompatible|must update/i,
151
+ hook: /hook|PreToolUse|PostToolUse/i,
152
+ permission: /permission|allow|deny|ask/i,
153
+ };
154
+ ```
155
+
156
+ **Step 3: Categorize**
157
+
158
+ Categorize each relevant change:
159
+
160
+ | Category | Detection Pattern | Issue Labels |
161
+ |----------|------------------|--------------|
162
+ | `breaking` | Breaking, incompatible, must update | `upstream`, `bug`, `priority:high` |
163
+ | `deprecation` | Deprecated, removed, no longer supported | `upstream`, `bug` |
164
+ | `new-tool` | Added tool, new tool, introducing | `upstream`, `enhancement` |
165
+ | `hook-change` | Hook, PreToolUse, PostToolUse | `upstream`, `enhancement` |
166
+ | `opportunity` | Keywords match but not above categories | (no issue — noted in assessment for human triage) |
167
+ | `no-action` | Doesn't match patterns or keywords | (no issue) |
168
+
169
+ **Step 4: Impact Mapping**
170
+
171
+ For relevant changes, map to affected sequant files using `dependencyMap`:
172
+
173
+ ```typescript
174
+ const impactFiles = baseline.dependencyMap[matchedKeyword] || [];
175
+ ```
176
+
177
+ ### 5. Check for Duplicates
178
+
179
+ Before creating issues, check for existing upstream issues:
180
+
181
+ ```bash
182
+ # Search for similar issues
183
+ gh issue list --label upstream --search "<finding-title>" --json number,title
184
+ ```
185
+
186
+ If a similar issue exists:
187
+ - Add a comment linking to the new assessment
188
+ - Skip creating a duplicate
189
+
190
+ ### 6. Generate Outputs
191
+
192
+ **Output 1: Assessment Report (GitHub Issue)**
193
+
194
+ Create a summary issue with the full assessment:
195
+
196
+ ```markdown
197
+ ## Upstream: Claude Code <version> Assessment
198
+
199
+ **Release:** [<version>](https://github.com/anthropics/claude-code/releases/tag/<version>)
200
+ **Released:** <date>
201
+ **Assessed:** <today>
202
+
203
+ ### Summary
204
+
205
+ | Category | Count | Action Required |
206
+ |----------|-------|-----------------|
207
+ | Breaking Changes | N | [status] |
208
+ | New Tools | N | [status] |
209
+ | Deprecations | N | [status] |
210
+ | Opportunities | N | [status] |
211
+
212
+ ### Actionable
213
+
214
+ *Breaking changes, deprecations, and other items that affect sequant.*
215
+
216
+ [list of breaking, deprecation, new-tool, hook-change findings]
217
+
218
+ ### Informational
219
+
220
+ *Opportunities noted for human triage. No individual issues auto-created.*
221
+
222
+ [list of opportunity findings]
223
+
224
+ ### No Action Required
225
+
226
+ [list of irrelevant changes]
227
+
228
+ ---
229
+
230
+ *Generated by /upstream skill*
231
+ ```
232
+
233
+ **Output 2: Individual Issues (Actionable Findings)**
234
+
235
+ For each actionable finding (breaking, deprecation, new-tool, hook-change), create an issue.
236
+ **Note:** Opportunities do NOT get individual issues — they are listed in the assessment report's Informational section for human triage.
237
+
238
+ ```markdown
239
+ ## feat: Leverage <feature> from Claude Code <version>
240
+
241
+ **Upstream:** Claude Code <version>
242
+ **Category:** <category>
243
+ **Assessment:** #<assessment-issue>
244
+
245
+ ### Context
246
+
247
+ <description from release notes>
248
+
249
+ ### Opportunity
250
+
251
+ <how sequant could use this>
252
+
253
+ ### Proposed Implementation
254
+
255
+ [To be determined during /spec phase]
256
+
257
+ ### Acceptance Criteria
258
+
259
+ - [ ] AC-1: [To be defined]
260
+
261
+ ---
262
+
263
+ *Auto-created by /upstream assessment #<N>*
264
+ ```
265
+
266
+ Labels: `upstream`, `needs-triage`, `enhancement`
267
+
268
+ **Output 3: Local Report**
269
+
270
+ Save to `.sequant/upstream/<version>.md`:
271
+
272
+ ```markdown
273
+ # Claude Code <version> Assessment
274
+
275
+ Assessed: <date>
276
+ Previous: <last-assessed-version>
277
+
278
+ ## Summary
279
+
280
+ [same as GitHub issue]
281
+
282
+ ## Raw Findings
283
+
284
+ [detailed analysis data]
285
+ ```
286
+
287
+ **Output 4: Update Baseline**
288
+
289
+ Update `.sequant/upstream/baseline.json`:
290
+ - Set `lastAssessedVersion` to the assessed version
291
+
292
+ ### 7. Multi-Version Batching
293
+
294
+ When `--since <version>` is used:
295
+
296
+ 1. List all releases after the specified version
297
+ 2. Assess each version individually
298
+ 3. Create a batched summary issue linking all individual assessments
299
+ 4. Update baseline to latest assessed version
300
+
301
+ ## Dry-Run Mode
302
+
303
+ When `--dry-run` is specified:
304
+
305
+ 1. Perform full analysis
306
+ 2. Generate local report
307
+ 3. Output what issues WOULD be created (titles, labels)
308
+ 4. Skip actual GitHub issue creation
309
+ 5. Skip baseline update
310
+
311
+ ## Error Handling
312
+
313
+ - **No releases found**: Exit with clear message
314
+ - **Baseline missing**: Create default baseline, warn user
315
+ - **GitHub API errors**: Retry with backoff, then fail gracefully
316
+ - **Already assessed**: Skip with message (idempotent)
317
+
318
+ ## Output Verification
319
+
320
+ **Before completing, verify:**
321
+
322
+ - [ ] Release data successfully fetched
323
+ - [ ] Baseline loaded (or created with defaults)
324
+ - [ ] Each change categorized
325
+ - [ ] Duplicates checked before issue creation
326
+ - [ ] Assessment report created (or dry-run output shown)
327
+ - [ ] Individual issues created for actionable findings (not opportunities)
328
+ - [ ] Local report saved
329
+ - [ ] Baseline updated with new version
330
+
331
+ ## Examples
332
+
333
+ ### Example 1: Assess Latest Release
334
+
335
+ ```
336
+ /upstream
337
+
338
+ Fetching latest Claude Code release...
339
+ Release: v2.1.29 (2025-01-31)
340
+
341
+ Loading baseline from .sequant/upstream/baseline.json...
342
+ Last assessed: v2.1.27
343
+
344
+ Analyzing 12 changes from release notes...
345
+ - 3 relevant changes detected
346
+ - 9 no-action changes
347
+
348
+ Findings:
349
+ 1. [opportunity] New --background flag on Task tool
350
+ Matched keywords: Task, background
351
+ Impact files: .claude/skills/**/*.md
352
+
353
+ 2. [hook-change] Permissions now respect content-level ask
354
+ Matched keywords: permission
355
+ Impact files: src/hooks/pre-tool-hook.ts
356
+
357
+ 3. [deprecation] oldHookName deprecated
358
+ Matched pattern: deprecat
359
+ Impact files: src/hooks/pre-tool-hook.ts
360
+
361
+ Creating assessment issue...
362
+ Created: #250 - Upstream: Claude Code v2.1.29 Assessment
363
+
364
+ Creating individual issues...
365
+ Created: #251 - feat: Leverage new --background flag from Claude Code v2.1.29
366
+ Created: #252 - chore: Update to new hook name (deprecation from v2.1.29)
367
+
368
+ Saving local report to .sequant/upstream/v2.1.29.md...
369
+ Updating baseline lastAssessedVersion to v2.1.29...
370
+
371
+ Done! Assessment complete.
372
+ ```
373
+
374
+ ### Example 2: Dry Run
375
+
376
+ ```
377
+ /upstream --dry-run
378
+
379
+ [DRY RUN MODE - No issues will be created]
380
+
381
+ Fetching latest Claude Code release...
382
+ Release: v2.1.29 (2025-01-31)
383
+
384
+ ...analysis...
385
+
386
+ Would create issues:
387
+ 1. Assessment: Upstream: Claude Code v2.1.29 Assessment
388
+ 2. Finding: feat: Leverage new --background flag from Claude Code v2.1.29
389
+ 3. Finding: chore: Update to new hook name (deprecation from v2.1.29)
390
+
391
+ Local report saved: .sequant/upstream/v2.1.29.md
392
+ Baseline NOT updated (dry-run mode)
393
+ ```
394
+
395
+ ### Example 3: Already Assessed
396
+
397
+ ```
398
+ /upstream
399
+
400
+ Fetching latest Claude Code release...
401
+ Release: v2.1.29 (2025-01-31)
402
+
403
+ Already assessed: .sequant/upstream/v2.1.29.md exists
404
+ Use --force to re-assess.
405
+
406
+ No action taken.
407
+ ```
408
+
409
+ ## Notes
410
+
411
+ - This is an internal tool for sequant maintainers
412
+ - All created issues get `needs-triage` label for human review
413
+ - The skill is read-only for Claude Code repo (no PRs or edits)
414
+ - Baseline file should be committed to version control
415
+ - Local reports in `.sequant/upstream/` should be committed
416
+
417
+ ---
418
+
419
+ *This skill monitors the upstream Claude Code project to help sequant stay current with new features and breaking changes.*
@@ -7,6 +7,7 @@
7
7
  interface SyncOptions {
8
8
  force?: boolean;
9
9
  quiet?: boolean;
10
+ dryRun?: boolean;
10
11
  }
11
12
  /**
12
13
  * Get the version of skills currently installed
@@ -181,7 +181,7 @@ async function updateSkillsVersion() {
181
181
  await writeFile(SKILLS_VERSION_PATH, getPackageVersion());
182
182
  }
183
183
  export async function syncCommand(options = {}) {
184
- const { force = false, quiet = false } = options;
184
+ const { force = false, quiet = false, dryRun = false } = options;
185
185
  if (!quiet) {
186
186
  console.log(chalk.blue("\nSyncing templates...\n"));
187
187
  console.log(chalk.yellow("Note: For seamless auto-updates, install sequant as a Claude Code plugin:\n" +
@@ -231,6 +231,61 @@ export async function syncCommand(options = {}) {
231
231
  process.exitCode = 1;
232
232
  return;
233
233
  }
234
+ // Preview path: report exactly what the apply would write, then stop without
235
+ // mutating (#722). This branch is only reached when `force` is set or the
236
+ // version marker mismatches — i.e. the path that runs `copyTemplates(force:
237
+ // true)` and rewrites the whole tree. (A matching-version, non-force dry-run
238
+ // already returned at the report-only short-circuit above, which never
239
+ // mutates.) `copyTemplates` does NOT protect in-place customizations the way
240
+ // `update` does — the force copy overwrites them — so the preview counts
241
+ // `local-override` files alongside `new`/`modified`. Reporting only
242
+ // new+modified would under-report the write-set, the exact divergence #722
243
+ // is about.
244
+ if (dryRun) {
245
+ const changes = await computeTemplateChanges(manifest.stack, tokens);
246
+ const newFiles = changes.filter((c) => c.status === "new");
247
+ const modifiedFiles = changes.filter((c) => c.status === "modified");
248
+ const localOverrides = changes.filter((c) => c.status === "local-override");
249
+ const toWrite = [...newFiles, ...modifiedFiles, ...localOverrides];
250
+ if (!quiet) {
251
+ console.log(chalk.bold("Summary (dry-run):"));
252
+ console.log(chalk.green(` New files: ${newFiles.length}`));
253
+ console.log(chalk.yellow(` Modified: ${modifiedFiles.length}`));
254
+ console.log(chalk.blue(` Local overrides (overwritten by sync): ${localOverrides.length}`));
255
+ if (modifiedFiles.length > 0) {
256
+ console.log(chalk.bold("\nModified files:"));
257
+ for (const file of modifiedFiles) {
258
+ console.log(chalk.yellow(` ${file.path}`));
259
+ }
260
+ }
261
+ if (newFiles.length > 0) {
262
+ console.log(chalk.bold("\nNew files:"));
263
+ for (const file of newFiles) {
264
+ console.log(chalk.green(` ${file.path}`));
265
+ }
266
+ }
267
+ if (localOverrides.length > 0) {
268
+ console.log(chalk.bold("\nLocal overrides (will be overwritten by sync):"));
269
+ for (const file of localOverrides) {
270
+ console.log(chalk.blue(` ${file.path}`));
271
+ }
272
+ }
273
+ if (toWrite.length === 0) {
274
+ console.log(chalk.green("\n✔ Skills are already up to date!"));
275
+ }
276
+ else {
277
+ console.log(chalk.gray("\n(dry-run mode - no changes made)"));
278
+ }
279
+ }
280
+ // Non-zero exit when work is pending so the documented preview surface can
281
+ // gate CI/automation (the #709 intent): a dry-run reporting nothing must
282
+ // mean nothing to do. The matching-version short-circuit signals drift the
283
+ // same way.
284
+ if (toWrite.length > 0) {
285
+ process.exitCode = 1;
286
+ }
287
+ return;
288
+ }
234
289
  // Copy templates with force to overwrite existing files
235
290
  const copyOptions = {
236
291
  force: true, // Always overwrite when syncing
@@ -167,6 +167,13 @@ export async function updateCommand(options) {
167
167
  }
168
168
  if (options.dryRun) {
169
169
  console.log(chalk.gray("\n(dry-run mode - no changes made)"));
170
+ // Non-zero exit when work is pending so a CI/automation job can gate on the
171
+ // preview, matching `sync --dry-run` (#724 / #709 intent): a dry-run that
172
+ // reports nothing must mean nothing to do. The no-op case short-circuits at
173
+ // the "Everything is up to date!" return above, so it correctly stays 0.
174
+ if (applySet.length > 0) {
175
+ process.exitCode = 1;
176
+ }
170
177
  return;
171
178
  }
172
179
  // Confirm update. --yes and --force both auto-confirm; otherwise we need a
@@ -86,6 +86,91 @@ export declare class SubprocessError extends SequantError {
86
86
  readonly metadata: SubprocessErrorMetadata;
87
87
  constructor(message: string, metadata?: SubprocessErrorMetadata, cause?: Error);
88
88
  }
89
+ /**
90
+ * Metadata carried by {@link RateLimitError} / {@link BillingError}.
91
+ *
92
+ * Fields mirror the structured signals the Claude Agent SDK emits via
93
+ * `rate_limit_event` (`SDKRateLimitInfo`). The `canUserPurchaseCredits` /
94
+ * `hasChargeableSavedPaymentMethod` fields arrived in SDK 0.3.181 and are
95
+ * optional so older streams (or absent fields) degrade gracefully.
96
+ */
97
+ export interface RateLimitMetadata {
98
+ [key: string]: unknown;
99
+ /** Unix timestamp (seconds or ms) at which the limit resets. */
100
+ resetsAt?: number;
101
+ /** Which limit window was hit (five_hour, seven_day, overage, …). */
102
+ rateLimitType?: string;
103
+ /** Why overage/billing was disabled (e.g. `out_of_credits`). */
104
+ overageDisabledReason?: string;
105
+ /** SDK error code; `credits_required` indicates a billing failure. */
106
+ errorCode?: string;
107
+ /** Whether the user can self-serve purchase credits (≥0.3.181). */
108
+ canUserPurchaseCredits?: boolean;
109
+ /** Whether a chargeable payment method is on file (≥0.3.181). */
110
+ hasChargeableSavedPaymentMethod?: boolean;
111
+ }
112
+ /**
113
+ * Transient rate-limit error (HTTP 429-style throttle, overloaded API).
114
+ *
115
+ * Retryable: waiting and re-running can succeed once the limit window resets.
116
+ */
117
+ export declare class RateLimitError extends SequantError {
118
+ readonly metadata: RateLimitMetadata;
119
+ constructor(message: string, metadata?: RateLimitMetadata, cause?: Error);
120
+ }
121
+ /**
122
+ * Billing / out-of-credits error.
123
+ *
124
+ * NOT retryable: a no-MCP retry (or any retry) cannot refill credits, so the
125
+ * executor must surface the real cause instead of looping. Drives the #592
126
+ * fallback-noise skip in phase-executor.
127
+ */
128
+ export declare class BillingError extends SequantError {
129
+ readonly metadata: RateLimitMetadata;
130
+ constructor(message: string, metadata?: RateLimitMetadata, cause?: Error);
131
+ }
132
+ /**
133
+ * Structural subset of the SDK's `SDKRateLimitInfo` consumed when building a
134
+ * rate-limit error. Declared here (not imported from the SDK) so `errors.ts`
135
+ * stays SDK-free — only the driver owns the `@anthropic-ai/claude-agent-sdk`
136
+ * import.
137
+ */
138
+ export interface RateLimitInfoLike {
139
+ status?: string;
140
+ resetsAt?: number;
141
+ rateLimitType?: string;
142
+ overageDisabledReason?: string;
143
+ errorCode?: string;
144
+ canUserPurchaseCredits?: boolean;
145
+ hasChargeableSavedPaymentMethod?: boolean;
146
+ }
147
+ /**
148
+ * True when the rate-limit info represents a billing/credits failure (which a
149
+ * retry cannot fix), rather than a transient throttle.
150
+ */
151
+ export declare function isBillingFailure(info: RateLimitInfoLike): boolean;
152
+ /**
153
+ * True when the rate-limit info represents an actual failure (rejection or
154
+ * billing), as opposed to an informational `allowed` / `allowed_warning`
155
+ * event. The driver uses this to avoid mis-attributing a stale warning event
156
+ * to an unrelated phase failure.
157
+ */
158
+ export declare function isRateLimitFailureInfo(info: RateLimitInfoLike): boolean;
159
+ /**
160
+ * Build a user-facing message from rate-limit info, naming the real cause:
161
+ * - billing/credits → "Out of credits" (enriched with purchasable vs hard
162
+ * limit when the ≥0.3.181 `canUserPurchaseCredits` field is present)
163
+ * - transient throttle → "Rate limited — resets at HH:MM" (date-qualified as
164
+ * "MM-DD HH:MM" when the reset is not today; reset time omitted entirely when
165
+ * `resetsAt` is absent)
166
+ */
167
+ export declare function formatRateLimitMessage(info: RateLimitInfoLike): string;
168
+ /**
169
+ * Construct the appropriate typed error from structured rate-limit info.
170
+ * Billing/credits failures become a non-retryable {@link BillingError};
171
+ * transient throttles become a retryable {@link RateLimitError}.
172
+ */
173
+ export declare function createRateLimitError(info: RateLimitInfoLike): RateLimitError | BillingError;
89
174
  /**
90
175
  * Map of error type names to their constructors.
91
176
  * Used for deserialization from logs.