Skip to content

chore(#109): project-configurable ticket / branch / commit / PR schema#118

Merged
atlas-apex merged 2 commits into
devfrom
chore/GH-109-config-driven-ticket-schema
Apr 24, 2026
Merged

chore(#109): project-configurable ticket / branch / commit / PR schema#118
atlas-apex merged 2 commits into
devfrom
chore/GH-109-config-driven-ticket-schema

Conversation

@atlas-apex

Copy link
Copy Markdown
Collaborator

Summary

Lifts prefix / type whitelists that were hardcoded across multiple skills, hooks, and CI into a versioned JSON config read through a shared shell library. This is the foundation ticket for the enforcement-hook wave (#107, #110, #111, #112, #113, #114, #115) — they all need a consistent place to read project-level config from.

  • New defaults file: .claude/project-config.defaults.json (v1 schema, committed upstream)
  • New reader lib: .claude/hooks/_lib-read-config.sh (used by hooks + skills + future)
  • New reference doc: docs/project-config.md
  • AgDR: docs/agdr/AgDR-0006-project-configurable-ticket-schema.md
  • Migrated: validate-branch-name.sh, validate-commit-format.sh, validate-pr-create.sh — now read their whitelists from config
  • Doc-updated: /feature, /task, /bug Rules sections reference the config location rather than hardcoding the list

Backward-compat: validate-commit-format.sh previously did ad-hoc reading of a flat commit_types top-level key. That fallback is kept so forks that customised before this ticket keep working without edits.

Merge semantics: shallow at the top level (v1). Teams override by copying a subtree. Deep merge deferred — revisit if pain warrants. See AgDR-0006 for the full rationale, including why the schema lives in .claude/project-config.*.json and not in onboarding.yaml.

Testing

Smoke-tested locally end-to-end against the four migrated consumers:

# 1. Reader library — defaults load, fallback works
source .claude/hooks/_lib-read-config.sh
config_get '.ticket.prefix_whitelist[]'       # → Feature, Bug, Chore, Refactor, Testing, CI, Docs
config_get '.branch.type_whitelist[]'         # → feature, fix, refactor, chore, docs, test, spike, ci, build, perf
config_get_or '.nonexistent.key' 'fallback'   # → fallback

# 2. validate-branch-name.sh — accepts configured types, rejects invented
echo '{"tool_input":{"command":"git push origin HEAD"}}' | bash .claude/hooks/validate-branch-name.sh
# rc=0 on a valid branch

# 3. validate-pr-create.sh — blocks bad type, passes good type
echo '{"tool_input":{"command":"gh pr create --repo X/Y --title \"invented(#109): test\" --body \"## Glossary\""}}' \
  | bash .claude/hooks/validate-pr-create.sh
# rc=2 with message listing accepted types from config

# 4. validate-commit-format.sh — blocks bad type
echo '{"tool_input":{"command":"git commit -m \"invented: test\""}}' \
  | bash .claude/hooks/validate-commit-format.sh
# rc=2

# 5. Zero-config fallback — hooks still work on a fresh checkout
# Verified by the inline default regex in each hook

No CI-level tests added; the config-reader lib is covered by downstream hook tests (added in #110 and #115). A dedicated test fixture for the lib itself would be a nice-to-have follow-up.

Scope — what this does NOT do

  • Does not change the existing shipped defaults (same six ticket prefixes, same eleven commit types). Behavioural diff is zero for a fresh fork with no .claude/project-config.json override.
  • Does not deprecate the legacy flat commit_types key. That's a separate follow-up once adoption is measurable.
  • Does not introduce schema validation (JSON Schema or similar). Malformed config degrades gracefully — reader returns null, hooks fall back to shipped defaults.

Glossary

Term Definition
Project config The versioned JSON config at .claude/project-config.*.json. Defaults ship upstream; overrides live per-fork.
Shallow merge Top-level keys from the override file replace defaults entirely. To extend a subtree, copy the default and add.
Schema v1 First published shape of the config. Version field is captured in _schema_version; future migrations will honour it.
Prefix whitelist The set of bracketed title prefixes ([Feature], [Chore], etc.) that ticket-creation skills accept and the issue-structure validator enforces against.
Type whitelist The set of conventional-commit types accepted in commit messages / PR titles / branch names. Three related but distinct lists — branch types, commit types, PR-title types — because each domain has slightly different shape constraints.

Closes #109

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants