Skip to content

feat: commit-convention-aware docs-sync commits - #1

Merged
heysanil merged 6 commits into
mainfrom
feat/commit-convention-aware-sync
Jul 14, 2026
Merged

heysanil merged 6 commits into
mainfrom
feat/commit-convention-aware-sync

Conversation

@heysanil

Copy link
Copy Markdown
Member

What & why

The docs-sync commit's subject (docs: sync documentation with code changes) and PR title
were hardcoded strings, and the commit body had no line-length discipline. In repos that lint
their commit history (commitlint, gitlint, cocogitto, …) this can fail the calling repo's own commit
lint — e.g. @commitlint/config-conventional enforces body-max-line-length: 100 at error level,
and a repo whose type-enum omits docs or requires a scope rejects the hardcoded subject.

This makes the sync commit/PR detect the calling repo's commit convention and shape its subject +
body to match
, with a tunable fallback body line width.

Design

Hybrid ownership — the shell keeps every safety guarantee; the auditor only shapes prose:

Concern Owner Guarantee
[skip docs-sentinel] loop-breaker shell Always appended, relocated from the subject to a footer trailer so it never trips a header-length/subject rule. The gate greps the whole message, so a footer marker is behaviorally identical for the loop guard.
Commit subject agent proposes, shell validates Auditor emits a Subject: line; shell uses it only if non-empty and ≤100 chars, else falls back to the static subject.
Body prose + wrap agent (best-effort) Prompt-directed; no mechanical shell reflow (would corrupt markdown/code/URLs).

Precedence for the wrap width: detected repo body-max-line-length > the commit-body-line-length
fallback (default 100)
. So linted repos get their real value; unlinted repos get sane plain-text
hygiene.

Changes

  • engine/compose-message.sh — peel/validate an optional Subject: line off the auditor
    summary; emit it as the commit subject + new pr_title step output; move the skip marker to a
    footer trailer.
  • engine/prompt-skeleton.md — new "Matching the repo's commit convention" section
    (glob-cheap detection of commitlint / commit templates / commitizen-cocogitto-gitlint) + the
    Subject: output contract.
  • .github/workflows/audit.yml — new commit-body-line-length input (default 100), validated
    as a positive integer and substituted into the prompt in both audit jobs; sync-PR title: now
    uses steps.compose.outputs.pr_title.
  • README.md / AGENT_SETUP.md — document the input + behavior.
  • Design spec + implementation plan under docs/superpowers/.

Testing

Local run of the three CI gates — all clean:

  • shellcheck engine/*.sh
  • bats tests — 24/24 (new cases: subject extraction, footer-marker placement, pr_title output,
    empty/over-long subject fallback)
  • actionlint

Plus an end-to-end run of compose-message.sh with a Subject: line, and a simulation of the
workflow's prompt substitution + input validation.

Integration caveat: the subject-detection path runs the real Claude Code CLI in CI, so it can
only be fully exercised on a live PR — the local suite covers the shell contract, not the model's
output.

heysanil added 6 commits July 12, 2026 11:54
Design for detecting the calling repo's commit convention (commitlint,
commit templates, commitizen/cocogitto/gitlint) and shaping the sync
commit subject + body to match, with a tunable fallback body line width.
compose-message.sh now peels an optional 'Subject:' line off the auditor
summary, validates it (single line, <=100 chars, static fallback), and
emits it as the commit subject and a new pr_title output. The skip marker
moves from the subject to a footer trailer so it never trips a commit rule.
The auditor now scans for commitlint/commit-template/commitizen configs
and shapes its Subject line and body wrap to match, falling back to the
injected {{COMMIT_BODY_LINE_LENGTH}} width when no convention is found.
New workflow input (default 100) is validated and substituted into the
auditor prompt in both audit jobs; the rolling docs-sync PR title now
uses the auditor's proposed subject (steps.compose.outputs.pr_title).
@heysanil
heysanil merged commit 4def3ca into main Jul 14, 2026
3 checks passed
@heysanil
heysanil deleted the feat/commit-convention-aware-sync branch July 14, 2026 06:41
heysanil added a commit that referenced this pull request Jul 14, 2026
Detect the calling repo's commit convention (commitlint / commit templates /
commitizen-cocogitto-gitlint) and shape the sync commit's subject + body to match.

- compose-message.sh: peel/validate an optional Subject: line from the auditor summary,
  emit it as the commit subject + new pr_title output; move [skip docs-sentinel] to a footer trailer.
- prompt-skeleton.md: convention-detection section + Subject: output contract.
- audit.yml: new commit-body-line-length input (default 100), validated + substituted into the
  prompt in both audit jobs; sync-PR title now uses the auditor's proposed subject.
- README / AGENT_SETUP: document the input and behavior.
- docs/superpowers: design spec + implementation plan.
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