Skip to content

build: extract shared boilerplate via generator (trust boundary/lang/pre-flight/reviewer hint) #93

Description

@JFK

Problem

~2,300 tokens of boilerplate are duplicated near-verbatim across 8-9 command files: the Trust-boundary forbidden-action list, the Output-language policy, the pre-flight validation bash, and the reviewer language hint. Slash commands have no runtime include mechanism, so this is primarily a maintainability / sync-bug problem (the jq filter already needs a CI check to stay in sync), not a pure runtime-token win.

Approach

Author the shared blocks once as fragments and add a build/generate step that inlines them into each commands/*.md at author time. Runtime files stay self-contained (no extra Read per invocation); the duplication-induced sync bugs disappear.

Scope

  • Identify the canonical shared blocks: Trust-boundary clauses, Output-language policy, pre-flight checks, reviewer language hint (evidence: cross-file Explore review 2026-06-13).
  • Add fragments/ + a generator (script) that composes command files from a template + fragments.
  • Regenerate all command files; confirm byte-stable output vs hand-maintained versions (modulo the intended single-source change).
  • CI check that generated files are up to date (fail if a command file drifts from its fragments) — this can retire the bespoke jq-sync check.

Acceptance criteria

  • All 9 command files build from fragments; git diff after regenerate is empty on a clean tree.
  • Editing a shared fragment updates every consumer in one place.
  • Be explicit in the PR: runtime tokens are roughly unchanged; the win is maintainability + sync-bug elimination.

Depends on

#3, #4, #5, #6 (compress first, then extract the stabilized shared blocks). Architectural — lowest priority in the milestone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions