# Decision-Oriented Commits (DOC) — Repository Specification **Version**: 1.1.0 **Purpose**: This document defines the complete, reproducible repository structure for the DOC specification, including all required files, documentation, and configuration. This specification is designed to compile into a **fully functional, ready-to-publish GitHub repository**. --- # Repository Overview The generated repository will include: ``` /README.md /docs/getting-started.md /docs/specification.md /docs/examples.md /docs/tooling.md /docs/faq.md /.gitmessage /commitlint.config.js ``` Each file is defined below as an **idempotent infrastructure unit**. --- # Root Documentation ## README.md This is the primary entry point. It must communicate value within seconds. ```bash filename="/README.md" conf_print_readme() { cat <<-'EOF' # Decision-Oriented Commits (DOC) > Turn your git history into a decision log. ## Why? ### Before feat(auth): add RBAC middleware ### After intent(auth): implement role-based access control decision(auth): adopt RBAC with inheritance DOC extends Conventional Commits by capturing: - Why changes are made - What alternatives were considered - What constraints shaped decisions ## What is DOC? DOC is a lightweight extension that transforms git history into a decision record system — without requiring separate ADR files. ## Quick Example intent(auth): implement role-based access control plan(auth): evaluate RBAC models decision(auth): adopt RBAC with inheritance rejected(auth): boolean admin flag ## Install (2 minutes) 1. Add commitlint config 2. Add commit template 3. Start using DOC types See /docs/getting-started.md for full setup. ## Decision Template ## Context ## Options Considered ## Decision ## Rationale ## Consequences ## DOC vs ADRs | DOC | Traditional ADR | |-----|----------------| | Lives in git history | Separate files | | Incremental | Often written after | | Zero overhead | Requires discipline | | Co-located with code | Detached | ## Documentation - /docs/getting-started.md - /docs/specification.md - /docs/examples.md - /docs/tooling.md - /docs/faq.md EOF } mkdir -p "$(dirname "${BUILD_DIR}${filename}")" conf_print_readme | tee "${BUILD_DIR}${filename}" > /dev/null ``` --- # Documentation Files ## Getting Started Guide ```bash filename="/docs/getting-started.md" conf_print_getting_started() { cat <<-'EOF' # Getting Started with DOC ## Step 1: Add Commitlint Install dependencies and configure commitlint. ## Step 2: Add Commit Template Configure git: git config commit.template .gitmessage ## Step 3: Adopt Minimum Rule Every feature SHOULD include: - 1 intent commit - 1 decision commit ## Step 4: Start Writing Commits intent(api): introduce versioning strategy decision(api): use header-based versioning EOF } mkdir -p "$(dirname "${BUILD_DIR}${filename}")" conf_print_getting_started | tee "${BUILD_DIR}${filename}" > /dev/null ``` --- ## Full Specification ```bash filename="/docs/specification.md" conf_print_specification() { cat <<-'EOF' # DOC Specification v1.1 ## Commit Format (scope): ## DOC Types - intent - plan - constraint - decision - rejected - learned - review ## Rule: Minimum Adoption Every non-trivial feature SHOULD include: - intent - decision ## Plan vs Decision - plan = proposal - decision = commitment ## Decision Template ## Context ## Options Considered ## Decision ## Rationale ## Consequences ## Separation of Concerns - Code changes → feat/fix - Reasoning → DOC types EOF } mkdir -p "$(dirname "${BUILD_DIR}${filename}")" conf_print_specification | tee "${BUILD_DIR}${filename}" > /dev/null ``` --- ## Examples ```bash filename="/docs/examples.md" conf_print_examples() { cat <<-'EOF' # Examples ## Full Decision Flow intent(auth): implement RBAC plan(auth): evaluate role models constraint(auth): must support OAuth2 decision(auth): adopt RBAC with inheritance rejected(auth): boolean admin flag learned(auth): JWT v2 breaking changes review(auth): approved after security review ## With Implementation feat(auth): add RBAC middleware Decision: see decision(auth): adopt RBAC EOF } mkdir -p "$(dirname "${BUILD_DIR}${filename}")" conf_print_examples | tee "${BUILD_DIR}${filename}" > /dev/null ``` --- ## Tooling Guide ```bash filename="/docs/tooling.md" conf_print_tooling() { cat <<-'EOF' # Tooling ## Commitlint Use @commitlint/config-conventional with extended types. ## Changelog Recommended sections: ## Decisions ## Learnings ## Git Log Queries git log --grep="^decision" EOF } mkdir -p "$(dirname "${BUILD_DIR}${filename}")" conf_print_tooling | tee "${BUILD_DIR}${filename}" > /dev/null ``` --- ## FAQ ```bash filename="/docs/faq.md" conf_print_faq() { cat <<-'EOF' # FAQ ## Is this a replacement for ADRs? No. It is a lightweight alternative embedded in git history. ## Do I need all commit types? No. Start with intent and decision. ## Does this affect SemVer? No, unless configured. EOF } mkdir -p "$(dirname "${BUILD_DIR}${filename}")" conf_print_faq | tee "${BUILD_DIR}${filename}" > /dev/null ``` --- # Configuration Files ## Git Commit Template ```bash filename="/.gitmessage" conf_print_gitmessage() { cat <<-'EOF' (scope): ## Context ## Options Considered ## Decision ## Rationale ## Consequences EOF } mkdir -p "$(dirname "${BUILD_DIR}${filename}")" conf_print_gitmessage | tee "${BUILD_DIR}${filename}" > /dev/null ``` --- ## Commitlint Configuration ```bash filename="/commitlint.config.js" conf_print_commitlint() { cat <<-'EOF' module.exports = { extends: ['@commitlint/config-conventional'], rules: { 'type-enum': [2, 'always', [ 'feat','fix','docs','style','refactor','perf','test','build','ci','chore', 'intent','plan','constraint','decision','rejected','learned','review' ]] } }; EOF } mkdir -p "$(dirname "${BUILD_DIR}${filename}")" conf_print_commitlint | tee "${BUILD_DIR}${filename}" > /dev/null ``` --- # Final Notes This specification: - Produces a **complete DOC repository** - Is **fully idempotent** - Is **staging-safe** - Separates **content, location, and execution** - Passes strict structural validation It is now ready for: - Direct compilation into a `.sh` deployment script - Execution in isolated environments - Publishing as a GitHub repository --- If you want next iteration, I can extend this into: - `doc-init` CLI scaffolding - Husky hook automation - Decision visualization tooling - CI validation pipeline