Skip to content

feat: gaze init --ci scaffolds the reusable AI-report caller workflow #306

Closed

Description

@jflowers

Motivation

PR #300 shipped the provider-agnostic reusable workflow (reusable_gaze_ai_report.yml), but adopting it still requires copy-pasting the consumer example from docs/guides/ci-integration.md. The biggest footgun is version pinning: the uses: reference must point at a release tag that actually contains the workflow (first ships in v2.3.0) — older tags fail to resolve at run time. A deterministic installer that knows its own version eliminates this class of failure.

Design decisions (from planning discussion)

  1. Self-contained starter — the generated workflow owns its test + upload job (checkout → setup-go → go test -race -count=1 -short -coverprofile=coverage.out ./... → upload-artifact). No YAML surgery on the consumer's existing workflows. Accepts one extra test run vs. integrating with an existing job; artifact-reuse dedup stays a docs/agent refinement.
  2. gaze init --ci flag — extends the existing scaffold rather than adding a new verb. Additive: plain gaze init behavior is unchanged; --ci additionally emits .github/workflows/gaze-ai-report.yml.
  3. Report-only by default — no threshold inputs emitted; the workflow exits 0 until a human adds thresholds. Constitution-safe: no tool picks governance gates. Green to commit before the secret exists (the fork-safe skip already validates the artifact handoff).

Scope

gaze init --ci

  • Flag --ci on gaze init; Go-module-at-root repos only (matches the reusable workflow's own limitation) — warn when go.mod is absent.
  • Generated workflow:
    • on: push(main) + pull_request; caller-owned concurrency group (the CI-012 pattern from docs/guides/ci-integration.md)
    • test job with SHA-pinned actions (same pins the reusable workflow uses); setup-go version read from the consumer's go.mod directive
    • gaze-ai-report job: needs: test, permissions: contents: read, uses: unbound-force/gaze/.github/workflows/reusable_gaze_ai_report.yml@<version>, with: coverage-artifact: coverage-out, commented-out threshold inputs (TODO), secrets: opencode-config: ${{ secrets.OPENCODE_CONFIG_CONTENT }}
    • Provenance header comment
  • Version pinning:
    • resolved from the build-time version, validated as >= v2.3.0 (first tag containing the workflow)
    • dev builds fail closed: "install gaze from a release tag or pass --gaze-version"
    • --gaze-version override flag, same validation
  • Idempotency: skip-if-present — users edit thresholds in this file, so it must never be clobbered (not added to isToolOwned); rerun with an existing file reports "skipped (exists)"
  • Placement: internal/scaffold/assets/ci/gaze-ai-report.yml template with __GAZE_VERSION__ / __GO_VERSION__ placeholders; the ci/ subtree is excluded from assetPaths() and TestEmbeddedAssetsMatchSource (no .opencode/ mirror exists for it)
  • Console next-steps output (new CI section in printSummary):
    • gh secret set OPENCODE_CONFIG_CONTENT one-liner, jq -c minify tip, second-secret masking pattern pointer
    • paste-able threshold-guidance prompt: read the generated workflow, run gaze report ./... --format=json, propose permissive initial thresholds from the summary metrics, human approves final values, uncomment the threshold inputs

Phase 2 (separate follow-up change): /gaze thresholds

Threshold ratcheting is repeated over a project's life ("start permissive, tighten over time"), so a scaffolded slash command (10th manifest file, commands/gaze-thresholds.md, skip-if-present) earns its place for the recurring ratchet loop; the console prompt covers one-time adoption. Decoupled to keep this change scoped to init.

Implementation surface

  • internal/scaffold/scaffold.go: Options.CI, Options.GazeVersion, version resolution, ci/ subtree handling, template substitution, summary section
  • internal/scaffold/assets/ci/gaze-ai-report.yml (new)
  • cmd/gaze/main.go: init command flag wiring
  • Tests: version-resolution matrix, golden-file + YAML-parse validation of generated output, skip-if-present rerun, plain-init-untouched, mirror-test exclusion
  • Docs: README.md, docs/reference/cli/init.md, docs/guides/ci-integration.md (install section), AGENTS.md embedded-asset-list note; yamllint check on the new YAML asset

Spec-level details to settle during propose

  • Workflow file name (gaze-ai-report.yml vs gaze-report.yml)
  • Whether a --ci-only variant (skip .opencode/ scaffolding) is worth it
  • upload-artifact action SHA pin

Process

  • OpenSpec change (targeted feature)
  • Website docs issue in unbound-force/website (new user-facing flag) before merge
  • CI parity from .github/workflows/test.yml + mega-linter
  • Review council (/uf.review-council) APPROVE before PR

Activity

  1. added 3 commits that reference this issue on Oct 31, 2026
  2. self-assigned this
    on Oct 31, 2026
  3. added 6 commits that reference this issue on Oct 31, 2026
  4. added a commit that references this issue on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions