Skip to content

feat(docs): generated pages name their source and stay complete #4889

Done

Description

@dan-petty

Problem or Motivation

  • Only 2 of the 49 DocGenerator pages say that they are generated, so agents edit them by hand.
  • No map tells the brain which source module writes each page, so a stale generated citation cannot heal itself.
  • A removed command group leaves its docs/commands page behind.
  • docs/index.md links 3 of 7 reference pages and 0 command pages.
  • devops docs generate --format json writes docs/cli_schema.json into a tracked folder, and .gitignore does not ignore it.

Proposed Solution & Architectural Design

  1. Under each title, DocGenerator writes one line: "Generated by uv run devops docs generate from <source module>. Do not edit this file." When docs/DESIGN.md of feat(design): track the project design spec #4735 lands, it owns the form of this line.
  2. The generator exports a page-to-source map (generated_from) for the brain and for repair.
  3. write_all_docs deletes a docs/commands page that no command group writes.
  4. Generalize render_synced_readme (src/devops_cli/docs/generator.py) into one named marker-block function. It writes the README matrix and a new reference-pages block in docs/index.md. The quality-limits item (child 10 of feat(docs): track current content and brain-fed reference docs #4880) uses it again.
  5. --format json prints to stdout, or writes to --output-dir when given. It never writes into docs/.

This PR changes all 49 pages, so it lands as one PR. Before ready, the agent rebases on origin/main and runs uv run devops docs generate. Update the docs step of CONTRIBUTING.md and the docs row text of docs/SDLC.md.

Target Subsystem

SDLC, Git & PR Governance (src/devops_cli/docs/generator.py, docs/index.md).

Existing Tool Considered

The existing generator and its marker-block function. Cost: about 80 lines plus tests, about 60k tokens and 1.5 h to build.

Acceptance Criteria

  • Each of the 49 pages has the source line, and a test fails for a new output with no line.
  • A test removes a fake group and sees its page deleted.
  • docs/index.md links all 7 reference pages and docs/commands/, and a test fails when a generated page has no link.
  • uv run devops docs generate --format json writes no file under docs/.
  • The map names a source module for each of the 49 pages.

Dependencies

#4888.

Source: #4880

Alternatives check of 2026-11-27: rejected.
Rejected by ADR 0025. A newer fact can change an ADR.
Tool: cogapp (https://pypi.org/project/cogapp), MIT, last activity 2026-11-15, maintained.
Reason: Searches found only cogapp, a maintained cog code generator that syncs generated marker blocks and so covers the README matrix and index block part, but it exports no page-to-source map, deletes no orphan page and handles no JSON output; ADR 0025 rejects it.

Covers:

  • Syncs text between generated markers in existing files
  • One block per file, rerun is idempotent
  • Inline Python in the document supplies the body

Lacks:

  • No page-to-source map such as generated_from
  • No deletion of orphaned docs/commands pages
  • No JSON stdout or --output-dir output path
  • Runs Python from the documents, which ADR 0025 refuses

Proposed design

Problem statement

DocGenerator writes 49 pages, and only 2 say that they are generated. No map names the source module of each page, so a stale generated citation cannot heal itself. A removed command group leaves its docs/commands page behind, and docs/index.md does not link every reference page and command page. devops docs generate --format json writes docs/cli_schema.json into a tracked folder. The README matrix and the contributor docs edits are out of scope: main moved the matrix to docs/CLI_REFERENCE.md and already names the regenerate command.

Acceptance criteria

Requirement: Generated page source line

DocGenerator SHALL write a visible generated-by line under the H1 title of each page that generate_all_docs writes.

Scenario: Every generated page names its source module

  • WHEN A test runs generate_all_docs into a temporary docs tree.
  • THEN Each written page holds "Generated by uv run devops docs generate from <module>. Do not edit this file." under its H1, and its <module> equals the generated_from entry.

Requirement: Orphaned command page deletion

write_all_docs SHALL delete each file under docs/commands/ that holds the generated-by line and that no command group writes.

Scenario: A removed command group loses its generated page

  • WHEN A temporary docs tree holds a docs/commands/ page of a command group that the command tree no longer names, and that page holds the generated-by line.
  • THEN write_all_docs deletes that page and keeps each file under docs/commands/ that holds no generated-by line.

Requirement: Index block completeness

The generator SHALL write a named marker block in docs/index.md that links each reference page, the docs/commands/ directory and the page of each command group.

Scenario: A new page appears in the index block

  • WHEN A test writes a page set with a new reference page and a new command group into a temporary docs tree.
  • THEN The index block holds a link to each page and to docs/commands/, and the test fails when the block lacks a link that the page set needs.

Requirement: Page-to-source map

The generator SHALL export generated_from, a map from each page path to its source module path.

Scenario: Each page has one map entry

  • WHEN A test builds the map for the page set.
  • THEN The map holds one entry for each page that generate_all_docs writes, and each entry names a path under src/ that the checkout holds.

Requirement: JSON output outside docs

devops docs generate --format json SHALL write its JSON document to stdout and MUST write no file under docs/.

Scenario: The JSON run changes no file under docs

  • WHEN A test runs uv run devops docs generate --format json in a temporary copy of the repository that holds a docs directory.
  • THEN stdout parses as JSON and no file under docs/ changes.

Requirement: JSON output directory

devops docs generate --format json --output-dir <dir> SHALL write one JSON file under <dir> and MUST write no file under docs/.

Scenario: The given directory holds the JSON document

  • WHEN A test runs uv run devops docs generate --format json --output-dir <tmp>.
  • THEN One JSON file is under <tmp> and no file is under docs/.

Requirement: One marker-block function

The generator SHALL write the docs/index.md index block through one function sync_marker_block(text, marker, body).

Scenario: The index block goes through one function

  • WHEN A test replaces sync_marker_block with a spy and runs write_all_docs twice.
  • THEN The spy receives one call for the index block, and the second run changes no byte of docs/index.md.

Existing Tool Considered

cogapp (https://pypi.org/project/cogapp), verdict rejected: ADR 0025 rejects it. The alternatives check in the issue body gives what cogapp covers and lacks. The proposal adds one sync_marker_block function for the docs/index.md block. It adds the source line, generated_from map, orphan deletion and JSON output in src/devops_cli/docs/generator.py and src/devops_cli/commands/docs.py. The written cost of this code is about 80 lines plus tests, about 60k tokens and 1.5 h to build, keep and fix.

Key questions

  • What text and position does the generated-page source line take?: Write one visible line directly under the H1 title: "Generated by uv run devops docs generate from <source module>. Do not edit this file." The line stays outside the marker block. The issue text sets this form until feat(design): track the project design spec #4735 changes it. (best practice) [sources: src/devops_cli/docs/generator.py:1466, src/devops_cli/docs/generator.py:1508, docs/DESIGN.md]
    • Chosen: Visible line under the H1. A reader and an agent see it. One literal prefix lets the page-set test and the delete guard find it.
    • Rejected: HTML comment above the H1. The rendered page does not show it. The issue asks for a line that says the page is generated.
    • Rejected: Front-matter key. GitHub and the docs site do not show front matter. The brain reads page text.
  • Which source module does each page name, and where does the generator hold the map?: A module-level table in src/devops_cli/docs/generator.py maps each page path to the module whose data it renders. A command page names the module of its command group. A synced page names the module of its sync. The generator exports the table as generated_from, and generate_all_docs writes the source line from it. (best practice) [sources: src/devops_cli/docs/generator.py:1466, src/devops_cli/docs/generator.py:1508, CONTEXT.md]
    • Chosen: One module-level table. The map has one place, and a test reads it for each page.
    • Rejected: A field of each render function. A new page can omit its entry, and no one place names the source of each page.
  • Does write_all_docs delete a hand-written file under docs/commands/?: No. write_all_docs deletes only a file that holds the generated-by line and that no command group writes. A hand-written file under docs/commands/ stays. (best practice) [sources: src/devops_cli/docs/generator.py:1508, CONTEXT.md]
    • Chosen: Delete only a file that holds the generated-by line. The delete acts on generated output alone, and a hand-written page stays.
    • Rejected: Delete each file that the generator does not write. It removes a hand-written page and a file that another tool put there.
  • How does docs/index.md stay complete when the generator adds a page?: The generator writes a named marker block in docs/index.md. The block links each reference page that generate_all_docs writes, the docs/commands/ directory and the page of each command group. A test fails when the block lacks a link that the page set needs. (best practice) [sources: docs/index.md, src/devops_cli/docs/generator.py:1466]
    • Chosen: A marker block that the generator syncs. A new page needs no edit of the index, and the block is the same on each run.
    • Rejected: A hand-written list that a test checks. A new page fails the test until a person edits the index, which is the defect that the issue names.
  • Where does devops docs generate --format json write its document?: To stdout by default. With --output-dir <dir> it writes one JSON file under <dir>. It writes no file under docs/. (best practice) [sources: src/devops_cli/commands/docs.py, src/devops_cli/docs/generator.py:1508]
    • Chosen: stdout by default, a file only with --output-dir. No generated file enters the tracked docs folder, and a caller redirects the output where it wants it.
    • Rejected: Keep docs/cli_schema.json and add it to .gitignore. A file that git ignores is in no tree that the brain cites, and no check reads it.
  • Which function holds the marker-block logic after render_synced_readme is gone?: One function sync_marker_block(text, marker, body) in src/devops_cli/docs/generator.py. write_all_docs calls it for the docs/index.md index block. The quality-limits item can call it for its block. (best practice) [sources: src/devops_cli/docs/generator.py, docs/index.md]
    • Chosen: One function, called for the index block. One place holds the marker logic, and the index block needs no second write path.
    • Rejected: One function plus a block registry. A registry adds indirection for one block, and a third caller can pass its own marker and body.
    • Rejected: A second sync path for the index page. Two paths write the same kind of block, and a fix must change both.
  • What replaces the deleted render_synced_readme and the README matrix in the proposal?: No README matrix. Commit 0a14161 removed the matrix from README.md and moved it to docs/CLI_REFERENCE.md. tests/docs/test_docs_inventory.py:153 asserts that DocGenerator writes no block of README.md. CONTRIBUTING.md:193 and docs/SDLC.md:215 already name uv run devops docs generate. The proposal adds one sync_marker_block function for the docs/index.md block only. (best practice) [sources: tests/docs/test_docs_inventory.py:153, docs/CLI_REFERENCE.md, CONTRIBUTING.md:193, docs/SDLC.md:215]
    • Rejected: Keep the README matrix sync. Commit 0a14161 deleted render_synced_readme and the README matrix, and a test refuses a DocGenerator block in README.md.
    • Chosen: Sync only the docs/index.md block. It keeps the marker-block helper for the remaining generated block and does not restore a block that main removed.
    • Rejected: Add a second sync path for docs/index.md. Two paths would duplicate the marker logic and a fix would need both.
  • Do CONTRIBUTING.md and docs/SDLC.md still need the regeneration command?: No. CONTRIBUTING.md:193 and docs/SDLC.md:215 already name uv run devops docs generate. The proposal removes those edits. [sources: CONTRIBUTING.md:193, docs/SDLC.md:215]
  • Does the existing generated_from in src/devops_cli/citation.py conflict with the new generator map?: No. The new map is a module-level value in src/devops_cli/docs/generator.py. The citation module keeps its own generated_from. [sources: src/devops_cli/citation.py:63, src/devops_cli/docs/generator.py:1466]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4888

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/feature
    scope/docs
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/docs. The (docs) scope of the title gives the scope.
    • Priority: P2-Medium. It prevents agent errors on 49 pages but is not a blocking defect.
    • Value: Medium. It stops hand-edits of generated pages and keeps the doc set complete and linked.
    • Effort: Medium. The body estimates about 80 lines plus tests and 1.5 hours to build.
    • Related: chore(docs): mark the generated documents as generated #4888, which asks for a different change. Both mark generated docs, but the candidate also adds a source map, orphan deletion, index links, and JSON output fix that #4888 does not cover.
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. removed
    priority/p2-medium
    on Nov 12, 2026
  6. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Priority: P2-Medium. The change stops hand edits and stale pages, but it does not block users.
    • Value: Medium. Correct generated pages help users and agents trust the documentation.
    • Effort: Medium. The work adds about 80 lines and tests for five acceptance criteria.
    • Related: docs(adr): keep reference docs in git as cited brain sources #4884, which asks for a different change. Both items keep the generated reference pages correct and usable as brain sources, but #4884 records the decision and citation form while the candidate adds markers, a source map and link checks.
  7. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: rejected

    Reason: The searches found no general tool for the whole need: the item is about this repository's own DocGenerator (source line per page, page-to-source map, orphan deletion, index link checks, JSON output). The one open, maintained tool that covers a part of it is cogapp, whose marker-block generation writes generated blocks into documents, but ADR 0025 explicitly rejects cogapp for the generated blocks because it runs Python from the documents and the generator already writes marker blocks.

    Rejected by ADR 0025. A newer fact can change an ADR.

    Tool: cogapp (https://pypi.org/project/cogapp)

    • License: MIT
    • Last activity: 2025-09-21
    • Maintained: no

    Covers:

    • Writes generated content into existing document files, i.e. the marker-block pattern that the item wants generalized

    Lacks:

    • Per-page "Generated by ... from <source module>" attribution lines
    • An exported page-to-source map (generated_from)
    • Deleting docs/commands pages whose command group is gone
    • Linking all reference pages from docs/index.md
    • Keeping --format json output out of docs/
    • It generates by running Python embedded in the documents, which ADR 0025 rejects for this use

    Tools considered:

    Searches run:

    • markdown generated content marker block tool insert generated sections between markers, results: 5
    • docs generator page-to-source map delete orphaned generated files, results: 5
    • cogapp cog python inline generation in documentation marker blocks, results: 5
    • mkdocs plugin generate docs pages from source code delete stale pages, results: 5
    • cogapp, results: 5
    • docs-as-code tool marks generated files "do not edit" banner source module, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  8. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Owner question: When does the pull request merge? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  9. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  10. 8 remaining items

  11. added
    status/new
    and removed
    status/ready
    on Nov 28, 2026
  12. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  13. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  14. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  15. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  16. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 00:41 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/docssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions