# dev-workflow.yml — per-repo config for the dev-workflow framework.
# Copy this to your target repo root as `dev-workflow.yml` and edit the
# values. Validate it with:  uv run dev-workflow/validate.py dev-workflow.yml
#
# Boundary rule 1: this config can only TIGHTEN the framework defaults, never
# loosen them. The baseline guardrails (never push the base/prod branch, no
# force-push, never read secrets, never edit the framework, deploy only via
# CI) are framework-side constants — nothing here can switch them off.

# The repository and its branch model.
repo:
  url: https://github.com/your-org/your-repo   # remote URL (informational)
  base_branch: dev                             # the integration trunk; feature PRs land here
  prod_branch: main                            # the prod mirror; only a dev->main PR deploys
  branch_prefix: feature                        # auto-numbered work branches: feature-1, feature-2, ...

# The issue tracker — the adapter seam. See tracker-adapters.md for the verbs.
tracker:
  provider: linear                # linear is the only implementation today
  team: Acme                      # the tracker team/workspace name
  ticket_prefix: ABC              # ticket keys look like ABC-123
  roles:                          # map framework roles -> your board's own label/state names
    queue:   { label: agent, states: [Todo, In Progress] }   # the loop picks up work here
    blocked: { label: agent-blocked }                        # set when a ticket needs a human ANSWER
    exclude: { labels: [manual, gated, decision] }           # never auto-worked
    done:    { state: Done }                                  # set when the PR merges
    # Optional roles below. Omit them and everything still validates.
    flagged:     { label: flagged }      # the weekly "clear these" checklist marker (Epic C)
    dep_blocked: { label: dep-blocked }  # inert-but-ready: waiting on a BLOCKER TICKET, distinct
                                         # from `blocked` (which means waiting on a human answer) (Epic D)

# The chat channel the agent reports to and asks questions in. Credentials
# come from the environment (agent.env) — never put tokens in this file.
chat:
  provider: telegram

# How to test, lint, and (optionally) install dependencies. `{pkgs}` is
# substituted with the changed packages for a narrow run.
quality:
  test: "scripts/test.sh {pkgs}"
  lint: "ruff check ."
  bootstrap: "uv sync"           # optional: run once to install deps before testing

# Versioning + changelog generation for the release step.
version:
  file: VERSION
  scheme: conservative-patch     # bump the patch segment for feature batches
  changelog: "scripts/changelog.sh"

# How a merge to prod actually deploys, and where to announce it.
deploy:
  trigger: push-main-gha         # a push to prod_branch runs the GitHub Actions deploy
  announce: telegram

# The generated board snapshot the standup skill reads. The framework board tool
# (dw-board.py) reads team + gates + prune policy from here; the LINEAR_API_KEY it
# needs comes from the ENVIRONMENT only (never put creds in this file).
board:
  snapshot: "scripts/linear-snapshot.sh"   # a command; repos may point this at `dw-board snapshot`
  views: ".local/board"                     # where dw-board renders its throwaway markdown views
                                            # (also the default home of import.json for `dw-board import`)
  gates: [publifai, launch, migrate]        # ordered gate-label precedence — one <gate>.md view each.
                                            # A flat label list (NO filter DSL). Omit for no gate views.
  prune:                                    # dw-board prune policy. Omit the whole block for defaults.
    allow_delete: false                     # DEFAULT: report only, never mutates. true => may trash
                                            # (and even then only with --yes at run time)
    threshold_days: 7                       # Done/Canceled issues closed longer ago than this are candidates

# Extra protected paths + the per-PR diff budget. off_limits ADDS to the
# framework baseline (.env*, *.key, *.pem, credentials.json, .claude/settings*,
# .github/workflows/**) — it never shrinks it. The budget is tighten-only:
# max_lines <= 400, max_files <= 15.
guardrails:
  off_limits:
    - "infra/**"
    - "migrations/**"
  diff_budget:
    max_lines: 400
    max_files: 15

# Build settings for each autonomous pass. cap_per_pass is tighten-only (<= 2).
build:
  model: sonnet                  # model id the loop pins each headless pass to
  cap_per_pass: 2                # max tickets built per loop pass

# When the autonomous loop is allowed to run.
schedule:
  window: "09:00-20:00"          # HH:MM-HH:MM local working window
  tz: America/New_York           # IANA timezone name
  every: 30m                     # cadence between passes

# Optional: enables cleanup's blog-proposal step. When set, cleanup MAY offer to
# turn a sharp, non-obvious session learning into one local draft — it never
# auto-writes and never publishes. Omit this whole section to disable the offer.
# blog:
#   skill: blog-from-session            # repo-local skill to invoke (falls back to the bundled one)
#   posts_dir: docs/blog                # where the bundled skill writes drafts
#   publish: "scripts/blog-publish.sh"  # optional publish command; NEVER run unprompted. Omit for none

# Optional: a command run before each loop pass (e.g. refresh the board).
# hooks:
#   pre_pass: "scripts/linear-snapshot.sh"

# Optional: where the loop keeps its per-repo state. Defaults to .agent-loop.
# runtime:
#   state_dir: ".agent-loop"
