Skip to main content

Scaffold DIARY documentation structure with MkDocs and Backstage support

Project description

diary-docs — DIARY Documentation Scaffolder

A CLI tool that scaffolds a DIARY documentation structure with MkDocs and Backstage support, indexes your codebase for knowledge retrieval, and keeps docs in sync with code changes.

Installation

pip install diary-docs

For development:

pip install -e .

Commands

diary-docs init

Initialize a new DIARY documentation project in the current directory.

diary-docs init

The tool prompts for a project name, then creates:

docs/
├── index.md
├── objectives.md
├── structure/
│   └── index.md
├── techdocs/
│   ├── index.md
│   ├── architecture.md
│   ├── api-contracts.md
│   ├── deployment.md
│   ├── adr.md
│   └── development-guide.md
├── product/
│   ├── index.md
│   ├── user-guide.md
│   └── modules.md
├── ops-governance/
│   ├── index.md
│   ├── runbooks.md
│   └── security.md
└── knowledge-base/
    ├── index.md
    ├── faq.md
    └── troubleshooting.md
mkdocs.yml
catalog-info.yaml

It also generates an AI agent skill file for content generation.

Options:

Flag Description
-f, --force Overwrite existing files
--help Show help for this command

If files already exist, they are skipped (unless --force is used).


diary-docs index

Index the workspace codebase for knowledge retrieval. Extracts symbols, files, and relationships into a SQLite database.

diary-docs index

Options:

Flag Description
-r, --report Generate a documentation coverage report after indexing
--db-path PATH Custom database path (default: docs/.index/knowledge.db)
--help Show help for this command

The index powers the diary-docs generate-content skill, allowing AI agents to query the codebase structure without manually scanning files.


diary-docs sync

Synchronize documentation with detected code changes. Compares the current workspace against git history to find outdated AIMB (AI-Managed) blocks in markdown files.

# Preview changes without applying
diary-docs sync --dry-run

# Apply all detected changes
diary-docs sync --force

Options:

Flag Description
-n, --dry-run Preview changes as JSON without applying
-b, --branch NAME Override branch detection
-f, --force Skip conflict warnings
-o, --output FILE Write JSON report to file
--help Show help for this command

Dry-run output is a JSON SyncReport showing code changes, affected docs, confidence scores, and any conflicts.


Global Options

Flag Description
--version Show version
--help Show top-level help

AI Agent Skills

diary-docs init generates two slash commands for AI coding agents (Claude Code, OpenCode). The skill files are placed in .claude/commands/ or .opencode/commands/ (you choose during init).

/diary-generate-content

Analyzes the workspace codebase via the pre-built index and generates enterprise-grade documentation content for every DIARY file.

# In Claude Code or OpenCode:
/diary-generate-content

The skill follows a multi-step workflow:

  1. Reads existing docs structure
  2. Queries the knowledge index (docs/.index/knowledge.db)
  3. Asks clarifying questions for missing context
  4. Generates content with Mermaid diagrams, tables, and use cases
  5. Writes all docs/ files with AIMB (AI-Managed Block) wrappers

Output covers: architecture overview, API contracts, deployment flow, ADR log, user guide, runbooks, security compliance, FAQ, and troubleshooting.


/diary-sync

Synchronizes documentation with detected code changes. Compares the current git state against history to find outdated AIMB blocks.

# In Claude Code or OpenCode:
/diary-sync

The skill follows a structured workflow:

  1. Verifies git state and runs diary-docs sync --dry-run
  2. Parses the SyncReport JSON for changes and conflicts
  3. Processes each high-confidence change by updating relevant AIMB blocks
  4. Flags conflicts for manual review (never auto-resolves)
  5. Finalizes with diary-docs sync --force
  6. Prints a summary of all processed files

Prerequisites: All code changes must be committed to git before running /diary-sync.


What It Generates

File/Folder Description
docs/ Main documentation folder
docs/index.md Root documentation index
docs/objectives.md Project objectives and goals
docs/structure/index.md Writing guidelines and conventions
docs/techdocs/ Technical documentation section
docs/techdocs/architecture.md System architecture overview
docs/techdocs/api-contracts.md API endpoint specifications
docs/techdocs/deployment.md Deployment flow and environments
docs/techdocs/adr.md Architecture Decision Records
docs/techdocs/development-guide.md Local development setup guide
docs/product/ Product documentation section
docs/product/user-guide.md End-user guide with use cases
docs/product/modules.md Module/component reference
docs/ops-governance/ Operations & governance section
docs/ops-governance/runbooks.md Operational runbooks
docs/ops-governance/security.md Security compliance docs
docs/knowledge-base/ Knowledge base section
docs/knowledge-base/faq.md Frequently asked questions
docs/knowledge-base/troubleshooting.md Troubleshooting guide
mkdocs.yml MkDocs configuration with TechDocs Core plugin
catalog-info.yaml Backstage component registration file

Development

pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diary_docs-0.1.0.tar.gz (67.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diary_docs-0.1.0-py3-none-any.whl (52.9 kB view details)

Uploaded Python 3

File details

Details for the file diary_docs-0.1.0.tar.gz.

File metadata

  • Download URL: diary_docs-0.1.0.tar.gz
  • Upload date:
  • Size: 67.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for diary_docs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a044d9d1db8704fd98707c441607943d35e254e77b84316f8e2bd5becc3fc4a6
MD5 daf5eb1cd525a4ddd78eab5d77addea8
BLAKE2b-256 76096a7249a428065760693d879f6f7bee0a7864c38708bd1561d11137ad7c81

See more details on using hashes here.

File details

Details for the file diary_docs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: diary_docs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 52.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for diary_docs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 684ed924f98c158487109ee6ac2cb6564069397617ec9ef39b7f23697ce8ad54
MD5 962347b7af84eb466a647c902a046ac0
BLAKE2b-256 b99b036bee1bfaa6149234347eacd38a400f3c2285c4c3b20ff8bb79ecaeed93

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page