zudo-slack-notify

Type to search...

to open search from anywhere

Development

Repository layout, test tiers, CI and deploy workflows, and the pre-push suite.

Layout

app/                 Worker API + CLI (Worker: zudo-slack-notify-app)
  src/               index.ts (handler), notification.ts (validation and rendering)
  cli/notify.ts      CLI sender
  tests/             unit, CLI, and workerd tests
  examples/          sample payloads
  slack-app-manifest.json
  wrangler.toml
doc/                 zudo-doc site (Worker: zudo-slack-notify)
skills/notify-slack/ Claude Code skill
scripts/             push-worker-secrets.mjs, smoke.sh, run-b4push.sh

The repository is a pnpm workspace (pnpm 11, Node 24) with two members, app and doc.

Local Worker

Copy app/.dev.vars.example to app/.dev.vars, replace the placeholders, and run:

pnpm --filter zudo-slack-notify-app dev

Point a sender at it with ZUDO_SLACK_NOTIFY_URL=http://127.0.0.1:8787/v1/notify. Never commit .dev.vars.

Test tiers

TierCommandWhat it covers
Ops scriptspnpm test:opsVitest for the root scripts/: push-worker-secrets.mjs and smoke.sh, with fakes. No real network or wrangler.
App unit and CLIpnpm --filter zudo-slack-notify-app testValidation, rendering, handler and CLI behavior against an injected fake Slack.
workerdpnpm --filter zudo-slack-notify-app test:workerdThe Worker in the real Workers runtime, including native fetch handling. Not part of root pnpm test; run it on its own.
Post-deploy smokebash scripts/smoke.sh app or docThe deployed origins, run by the deploy workflows after each deploy.

Root pnpm test is pnpm test:ops followed by every member's test script, so it covers the first two rows. The suites supply their own fakes and never need real credentials or channel IDs.

Smoke tests

scripts/smoke.sh takes one mode, app or doc, and needs curl and jq.

  • app: GET /healthz must return the Worker's { ok: true, service: "zudo-slack-notify" }. An unauthenticated POST /v1/notify must return 401; before Slack is wired a 503 server_misconfigured is also tolerated. Any 2xx fails. See Smoke test variables.

  • doc: GET / must return 200 with the zudo-slack-notify site marker, and an unknown path must return 404.

Right after a first deploy a custom domain can take a moment to answer, so the script retries until the first real answer (the Worker's own JSON envelope for app, a 200 for doc), then tolerates nothing. Environment variables:

VariableDefaultMeaning
APP_BASE_URLnoneRequired for app: bare API origin, for example https://notify.example.com
DOC_BASE_URLnoneRequired for doc: bare docs origin
SLACK_WIREDemptytrue once Slack is wired: only 401 passes on POST /v1/notify
SMOKE_RETRY_WINDOW_SECONDS120How long to wait for the first real answer
SMOKE_RETRY_INTERVAL_SECONDS5Pause between attempts

There are no built-in origin defaults: a missing or empty origin for the mode being run exits non-zero with a clear message. In CI the deploy workflows pass APP_BASE_URL and DOC_BASE_URL from repository variables of the same names.

The ops script scripts/push-worker-secrets.mjs reads its env file from --env-file <path> or the ZUDO_SLACK_NOTIFY_WORKER_ENV environment variable; see Secrets and rotation.

Pre-push suite

pnpm b4push

Runs scripts/run-b4push.sh in eight steps: frozen install, Prettier check, markdown format check, typecheck, pnpm test, the app workerd suite, build, and the doc link check. The heavy steps go through the machine-wide queue when it is present. It collects failures so one run reports every broken step.

Formatting

  • pnpm format and pnpm format:check run Prettier.

  • pnpm format:md and pnpm format:md:check run @takazudo/mdx-formatter over every .md and .mdx file, including these pages.

CI and deploy workflows

All workflows share the composite action .github/actions/setup (pnpm from the packageManager field, Node from .node-version, and pnpm install --frozen-lockfile).

WorkflowTriggerJobs
ci.ymlpull requests, and pushes to any branch except mainformat (Prettier and markdown), typecheck, test-app (unit then workerd), test-ops, build-app, build-doc (build and check links)
actionlint.ymlpull requests and pushes that touch .github/workflows/** or .github/actions/**actionlint (pinned, checksum-verified release)
deploy-app.ymlpush to main touching app/**, root package or workspace files, or the setup action; manual dispatchgate, test (typecheck, unit, workerd), deploy (wrangler deploy in app/), smoke (scripts/smoke.sh app with APP_BASE_URL and SLACK_WIRED from repo variables)
deploy-doc.ymlpush to main touching doc/**, root package or workspace files, or the setup action; manual dispatchgate, deploy (doc build, check:links, wrangler deploy in doc/), smoke (scripts/smoke.sh doc with DOC_BASE_URL from a repo variable)

Each deploy workflow starts with a gate job that skips the rest, cleanly and green, when the ref is not main or when the CLOUDFLARE_API_TOKEN or CLOUDFLARE_ACCOUNT_ID repository secret is absent, so forks and unconfigured clones stay green. Cloudflare credentials are scoped to the single deploy step. Deploy runs never overlap (a concurrency group per workflow, without cancellation).

Editing these docs

pnpm --filter zudo-slack-notify-doc dev     # dev server
pnpm --filter zudo-slack-notify-doc build   # static export
pnpm --filter zudo-slack-notify-doc check:links

check:links fails on any broken internal link. Sidebar order comes from sidebar_position in each page's frontmatter, and each top-level folder's index.mdx names its category.

Revision History

CreatedUpdated