Skip to content

ci: add GitHub Actions for CI and Fly.io deployment#7

Merged
zbigniewsobiecki merged 1 commit intomainfrom
ci/github-actions-deploy
Jan 1, 2026
Merged

ci: add GitHub Actions for CI and Fly.io deployment#7
zbigniewsobiecki merged 1 commit intomainfrom
ci/github-actions-deploy

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

Adds GitHub Actions workflows for continuous integration and automatic deployment to Fly.io.

Changes

  • ci.yml: Runs lint, typecheck, and tests on PRs and push to main/dev
    • Includes commitlint validation for PR commits
  • deploy.yml: Deploys both apps to Fly.io on push to main
    • cascade-webhooks (main webhook processor)
    • cascade-router (lightweight event router)
    • Both deploy in parallel for speed
  • Dockerfile: Added sudo for agent tooling

Required Setup

Add FLY_API_TOKEN secret to the repository:

  1. Generate: fly tokens create deploy -x 999999h
  2. Add to GitHub: Settings > Secrets > Actions > New repository secret

🤖 Generated with Claude Code

- Add ci.yml: runs lint, typecheck, and tests on PRs and push to main/dev
- Add deploy.yml: deploys both webhook and router apps to Fly.io on push to main
- Add commitlint validation for PR commits
- Add sudo to Dockerfile for agent tooling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 1b09887 into main Jan 1, 2026
2 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the ci/github-actions-deploy branch January 1, 2026 19:18
zbigniewsobiecki added a commit that referenced this pull request Apr 15, 2026
…ES contract

Plan 001/2 (context-rework). See parent spec at
docs/specs/001-pr-review-correctness.md and the plan at
docs/plans/001-pr-review-correctness/2-context-rework.md.done.

Also bundles in-flight web-wizard work that was sitting in the working
tree (provider-switch credential cleanup); see "Bundled" section below.

## Plan 001/2 — context-rework

The review agent's pre-fetched PR context shape is reshaped from "echo
full file contents up to a 25k-token cap" to "compact per-file diffs +
explicit list of what was omitted." This scales with PR size rather
than repo size, mitigates LLM context rot, and ensures the agent is
aware of (rather than blind to) anything it didn't get.

What this commit changes:

- `src/config/reviewConfig.ts`: `REVIEW_FILE_CONTENT_TOKEN_LIMIT`
  (25_000) replaced by `REVIEW_DIFF_CONTEXT_TOKEN_LIMIT` (200_000).
  Diffs are denser than full files, so a much larger budget fits the
  median PR comfortably while staying well under the model's window.

- `src/agents/shared/prFormatting.ts`: removed the filesystem-reading
  `readPRFileContents` and its `PRFileContents` type. Added new types
  `SkippedFile` and `PRDiffContext`, and four pure functions:
    - `extractPRDiffs(prDiff)` — produces a `PRDiffContext` from
      GitHub's PR-files response. Skip rules in order: `deleted` →
      `no-patch` → `patch-too-large` (per-file cap = 10% of total
      budget) → `over-budget`. No filesystem reads.
    - `formatPRDiffContext(ctx)` — renders the included diffs as one
      back-to-back text block with `### <filename> (<status>, +N -M)`
      per-file headers.
    - `formatSkippedFilesInjection(skipped, prNumber)` — renders the
      skipped list as a SELF-DOCUMENTING block: filenames + reasons
      plus the fetch guidance (`gh pr diff <N> -- <path>`, `Read`,
      `Grep`). Inlining the guidance means agents that don't yet have
      explicit prompt updates still see how to use the data.
    - `countSkipsByReason(skipped)` — group-by for the log entry.

- `src/agents/definitions/contextSteps.ts`: `fetchPRContextStep`
  rewritten. Instead of a per-file `ReadFile` injection loop, it now
  pushes one `GetPRDiffContext` injection plus, conditionally, one
  `SkippedFiles` injection. New log entry `PR context prepared` with
  `included`, `skipped`, and `skipReasons` fields (replaces the
  previous `File contents loaded`).

- `src/agents/definitions/review.yaml`: prompt expanded to describe
  the compact-diff context shape and explicitly name the `SKIPPED
  FILES` injection, with the same fetch guidance the injection
  itself carries. (AC #7 specifically required the YAML mention.)

- Cross-agent impact: `fetchPRContextStep` is registered as
  `prContext` in the strategy registry and is consumed by 5 agents
  (`review`, `respond-to-ci`, `respond-to-pr-comment`,
  `respond-to-review`, `resolve-conflicts`). All 5 receive the new
  context shape. Because the SKIPPED FILES injection is
  self-documenting, no prompt edits are needed in the other 4 YAMLs.

Tests: 49 new tests (28 prFormatting, 21 contextSteps incl 4 new on
fetchPRContextStep, 4 review.yaml prompt-contract, 17 reviewConfig,
plus updated agent-profiles tests). 7533/7533 unit tests pass; lint,
typecheck, and build all clean.

Docs: CLAUDE.md gains a "Review Agent — Context Shape" subsection
under "Debugging Production Sessions". CHANGELOG.md gains an
Unreleased "Changed" entry. docs/architecture/03-trigger-system.md
table row for `prContext` updated.

## Bundled — web pm-wizard provider-switch cleanup

Pre-existing in-flight work in the working tree (Linear/PM-wizard
related). When a user edits an existing project's PM integration and
switches provider mid-edit (e.g. Trello → Linear), the save flow now:

- Snapshots the originally-loaded provider as `previousProvider` at
  `INIT_EDIT` time (`pm-wizard-state.ts`).
- Preserves `isEditing` + `previousProvider` across `SET_PROVIDER`
  actions so the switch doesn't lose edit-mode context.
- On save (`pm-wizard-hooks.ts`), if `previousProvider !== provider`,
  deletes the old provider's project credentials before persisting
  the new ones. Uses `getCredentialRoles` from
  `src/config/integrationRoles.ts` to enumerate which env-var keys
  to clear.

`web/tsconfig.json` adds `../src/config/**/*` to its `include` list
so the web workspace can typecheck the shared `getCredentialRoles`
import.

Tests: `tests/unit/web/pm-wizard-state.test.ts` extended with
`previousProvider`-snapshot coverage (initial state default, INIT_EDIT
snapshot, SET_PROVIDER preserves it in edit mode) — included in the
7533 unit-test count above.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zbigniewsobiecki added a commit that referenced this pull request Apr 25, 2026
…tructured envelope, --comment alias) (#1190)

* docs(014): spec + plans for cascade-tools agent ergonomics

Adds docs/specs/014-cascade-tools-agent-ergonomics.md plus two plans
covering shared-infra and create-pr-review adoption. Prompted by prod
run 5d993b04-6e05-4ae1-b7de-8c274cf3496b.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(plan-014): lock plan 1 (shared-infra)

* feat(cascade-tools): plan 014/1 shared-infra — truthful prompts + envelope

Ships the root-cause fix for prod run 5d993b04-6e05-4ae1-b7de-8c274cf3496b
plus the shared infrastructure every future gadget inherits:

- System-prompt renderer (src/backends/shared/nativeToolPrompts.ts) stops
  stripping trailing 's' from array param names and claiming '<string>
  (repeatable)' for every array. Array-of-object params now render as
  `--<flag> '<json>'` with aliases appended via `|` and a one-line runnable
  example from the tool definition.
- Factory (src/gadgets/shared/cliCommandFactory.ts) gains oclif flag aliases,
  JSON parsing for array-of-object flags, file-input JSON parsing, `examples`
  wired into oclif `--help`, and Levenshtein-based 'did you mean' suggestions
  for mistyped flags (via fastest-levenshtein).
- New shared error envelope (src/gadgets/shared/errorEnvelope.ts) — every
  CLI failure emits `{"success":false,"error":{type,flag?,message,got?,
  expected?,hint?,example?}}` on stdout plus a one-line prose summary on
  stderr. All prior `this.error()` / flat `{success:false,error:"<string>"}`
  call sites migrated.
- Contracts widened: ParameterDefinition gains `cliAliases`, FileInput-
  Alternative gains `parseAs`, ToolManifest parameters carry `items`,
  `aliases`, `example`.
- Manifest generator threads the new fields through.
- bin/cascade-tools.js wraps `run()` to swallow oclif ExitError cleanly so
  the envelope isn't obscured by Node's default stack dump.

Plan-1 ACs #1#17 all delivered. 8438/8438 unit tests passing.

Test surface delta: 57 new unit tests across errorEnvelope.test.ts,
shared-nativeToolPrompts.test.ts, and factories.test.ts. Seven legacy
assertions encoding the pre-014 error surface updated in cli/cli-command-
factory, cli/file-input-flags, cli/scm/create-pr-sidecar, cli/scm/create-
pr-review-sidecar, backends/claude-code.

Plan 2 adopts the pattern on createPRReviewDef — zero shared-file edits —
proving the declarative-metadata invariant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(plan-014): lock plan 2 (createprreview-adopt)

* feat(cascade-tools): plan 014/2 createprreview-adopt + spec done

Applies the spec-014 declarative-metadata pattern to createPRReviewDef:

- --comment alias for --comments (the exact muscle-memory mistake from
  prod run 5d993b04-6e05-4ae1-b7de-8c274cf3496b).
- --comments-file <path> (and - for stdin) JSON-parsed escape hatch for
  long payloads that don't survive shell quoting.
- Two declarative fields on createPRReviewDef.parameters.comments.cliAliases
  + createPRReviewDef.cli.fileInputAlternatives. Zero edits to shared
  infrastructure (cliCommandFactory, manifestGenerator, nativeToolPrompts,
  errorEnvelope) — proves spec 014's single-entrypoint invariant.

Per-plan ACs #1, #2, #3, #5, #6, #7, #8, #9, #11, #12 auto-verified
(unit tests + build + lint + typecheck). AC #4 (binary-level smoke)
tagged [manual] because vitest fork-pool workers fail to capture
stdout/stderr from spawned binaries that do top-level await import();
the six scenarios were verified manually against the built binary and
the trace is recorded in the plan. AC #10 n/a — integration test path
abandoned for the same reason.

All plans done. Spec 014 marked .done (docs/specs/014-*.md → .done).
CHANGELOG Unreleased updated with a per-plan entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant