diff --git a/.prettierignore b/.prettierignore
index 9516d68..050f3d2 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,7 +1 @@
-node_modules
-target
-.git
-out
-dist
-*.lock
-
+doc/templates/**
diff --git a/doc/actors/systems.md b/doc/actors/systems.md
index 86977db..65fd7dc 100644
--- a/doc/actors/systems.md
+++ b/doc/actors/systems.md
@@ -11,6 +11,10 @@ An automated Continuous Integration system that runs Docgraph checks.
- Run automated tests.
- Verify relationship rules.
+### Participates in
+
+- [UC_CLI_ANALYSIS (CLI Traceability Analysis)](../usecases/cli-analysis.md#UC_CLI_ANALYSIS)
+
## AI Agent
@@ -21,3 +25,7 @@ An AI agent that consumes the document graph to build knowledge and assist users
- Assist in documentation writing.
- Verify rule compliance.
+
+### Participates in
+
+- [UC_AI_ASSISTANCE (AI-Assisted Documentation)](../usecases/ai-assistance.md#UC_AI_ASSISTANCE)
diff --git a/doc/actors/users.md b/doc/actors/users.md
index 1847266..5249e50 100644
--- a/doc/actors/users.md
+++ b/doc/actors/users.md
@@ -11,6 +11,10 @@ A human user who interacts with the Docgraph CLI or VS Code extension.
- Read documentation.
- Browse the graph.
+### Participates in
+
+- [UC_CLI_ANALYSIS (CLI Traceability Analysis)](../usecases/cli-analysis.md#UC_CLI_ANALYSIS)
+
## Developer
@@ -21,3 +25,15 @@ A software developer who writes code and specifications, and runs Docgraph local
- Write specifications.
- Maintain relationships.
+
+### Participates in
+
+- [UC_WRITE (Write Specifications)](../usecases/writing-specification.md#UC_WRITE)
+- [UC_CLI_ANALYSIS (CLI Traceability Analysis)](../usecases/cli-analysis.md#UC_CLI_ANALYSIS)
+- [UC_INSTALL_MANUAL (Install Manual Setup)](../usecases/setup.md#UC_INSTALL_MANUAL)
+- [UC_INSTALL_BINARY (Install via Binary Script)](../usecases/setup.md#UC_INSTALL_BINARY)
+- [UC_CLAUDE_INSTALL (Install Claude Plugin)](../usecases/setup.md#UC_CLAUDE_INSTALL)
+- [UC_VSCODE_INSTALL (Install VS Code Extension)](../usecases/setup.md#UC_VSCODE_INSTALL)
+- [UC_ZED_INSTALL (Install Zed Extension)](../usecases/setup.md#UC_ZED_INSTALL)
+- [UC_PREK_SETUP (Set Up Development Hooks)](../usecases/setup.md#UC_PREK_SETUP)
+- [UC_EDITOR_LSP (Editor Support via LSP)](../usecases/lsp-editing.md#UC_EDITOR_LSP)
diff --git a/doc/architecture/design/cicd.md b/doc/architecture/design/cicd.md
index 91e3e34..bcfc8a7 100644
--- a/doc/architecture/design/cicd.md
+++ b/doc/architecture/design/cicd.md
@@ -18,10 +18,6 @@ validated, tested, and released.
- [ADR_CI_ENV_PARITY (CI Environment Parity)](../../decisions/ci-env-parity.md#ADR_CI_ENV_PARITY) To minimize
environmental discrepancies.
-### Realized by
-
-- [MOD_CICD (CI/CD Pipelines)](../view/module.md#MOD_CICD)
-
Triggered when PR is merged to `main`.
- **Publish**: (Planned) Publish binary or crate to registry.
diff --git a/doc/architecture/design/dependency-rule.md b/doc/architecture/design/dependency-rule.md
index 7e3b0a6..5a7eafe 100644
--- a/doc/architecture/design/dependency-rule.md
+++ b/doc/architecture/design/dependency-rule.md
@@ -1,23 +1,20 @@
+# The Dependency Rule
+
## The Dependency Rule
-Dependencies must point inwards, towards high-level policies.
-
-**Direction:**
-
-- **Outer Layers** (Infrastructure, adapters) depend on **Inner Layers** (Use Cases, Entities).
-- **Inner Layers** MUST NOT depend on **Outer Layers**.
+Source code dependencies must point only inward, toward higher-level policies.
-**Core Layer Independence:**
+**Rules:**
-The `src/core/` module contains only domain types and business logic. It has NO references to CLI or LSP types.
+1. Nothing in an inner circle (Core) can know anything at all about something in an outer circle (Handlers, UI).
+2. The name of something declared in an outer circle must not be mentioned by the code in the an inner circle.
-**Handler Layer Dependency:**
+### Decided by
-CLI and LSP handlers import from Core, but Core never imports from handlers.
+- [ADR_LAYERED_ARCH (Layered Architecture)](../../decisions/layered-architecture.md#ADR_LAYERED_ARCH)
-### Decided by
+### Reflected in (Optional)
-- [ADR_LAYERED_ARCH (Layered Architecture)](../../decisions/layered-architecture.md#ADR_LAYERED_ARCH) To enforce
- directional dependency.
+- [NFR_EXT (Modular Design)](../../requirements/non-functional/extensibility.md#NFR_EXT)
diff --git a/doc/architecture/design/development-norm.md b/doc/architecture/design/development-norm.md
index 39df1d9..f61ca73 100644
--- a/doc/architecture/design/development-norm.md
+++ b/doc/architecture/design/development-norm.md
@@ -30,10 +30,6 @@ Defined in [.devcontainer/devcontainer.json](../../../.devcontainer/devcontainer
- [ADR_CI_ENV_PARITY (CI Environment Parity)](../../decisions/ci-env-parity.md#ADR_CI_ENV_PARITY) To ensure consistent
development experience.
-### Realized by
-
-- [MOD_DEV_CONTAINER (Dev Container)](../view/module.md#MOD_DEV_CONTAINER)
-
---
@@ -56,10 +52,6 @@ generation and versioning.
- **test**: Adding missing tests or correcting existing tests
- **chore**: Changes to the build process or auxiliary tools and libraries
-### Realized by
-
-- [MOD_CICD (CI/CD Pipelines)](../view/module.md#MOD_CICD)
-
---
@@ -75,7 +67,3 @@ Given a version number **MAJOR.MINOR.PATCH**, increment the:
1. **MAJOR** version when you make incompatible API changes.
2. **MINOR** version when you add functionality in a backwards compatible manner.
3. **PATCH** version when you make backwards compatible bug fixes.
-
-### Realized by
-
-- [MOD_CICD (CI/CD Pipelines)](../view/module.md#MOD_CICD)
diff --git a/doc/architecture/design/error-handling.md b/doc/architecture/design/error-handling.md
index a54cbd6..5189f07 100644
--- a/doc/architecture/design/error-handling.md
+++ b/doc/architecture/design/error-handling.md
@@ -78,7 +78,3 @@ Errors automatically convert across boundaries:
- [ADR_ERROR_HANDLING (Error Handling Strategy: thiserror for Core, anyhow for Binaries)](../../decisions/error-handling.md#ADR_ERROR_HANDLING)
To unify error reporting.
-
-### Realized by
-
-- [MOD_CORE_ERRORS (Error Definitions)](../view/module.md#MOD_CORE_ERRORS)
diff --git a/doc/architecture/design/testing.md b/doc/architecture/design/testing.md
index a428b30..339bc4e 100644
--- a/doc/architecture/design/testing.md
+++ b/doc/architecture/design/testing.md
@@ -12,10 +12,6 @@ We employ a pyramid testing strategy to ensure reliability and velocity.
2. **Integration Tests (Middle)**: Verify component interactions.
3. **E2E Tests (Top)**: Verify full system behavior via LSP.
-### Realized by
-
-- [MOD_TEST_INFRA (Test Infrastructure)](../view/module.md#MOD_TEST_INFRA)
-
---
@@ -30,11 +26,6 @@ Unit tests should cover all public functions and complex private logic.
- **Speed**: Tests must run per commit.
- **Coverage**: Aim for high branch coverage in core logic.
-### Realized by
-
-- [MOD_CORE_RULES (Validation Rules)](../view/module.md#MOD_CORE_RULES)
-- [MOD_CORE_GRAPH (Graph Logic)](../view/module.md#MOD_CORE_GRAPH)
-
---
@@ -53,11 +44,6 @@ E2E tests verify the system from the user's perspective (LSP client).
- Rust standard test framework with a mock LSP client.
-### Realized by
-
-- [MOD_LSP_SERVER (LSP Server)](../view/module.md#MOD_LSP_SERVER)
-- [MOD_TEST_INFRA (Test Infrastructure)](../view/module.md#MOD_TEST_INFRA)
-
---
@@ -66,8 +52,6 @@ E2E tests verify the system from the user's perspective (LSP client).
We use `cargo-llvm-cov` to measure test effectiveness.
-**Realized by**: [MOD_LSP (LSP Library)](../../architecture/view/module.md#MOD_LSP)
-
**Running Coverage Locally:**
1. Install: `cargo install cargo-llvm-cov`
diff --git a/doc/architecture/design/thin-handlers.md b/doc/architecture/design/thin-handlers.md
index 7f87bc1..ee54903 100644
--- a/doc/architecture/design/thin-handlers.md
+++ b/doc/architecture/design/thin-handlers.md
@@ -22,7 +22,3 @@ Request handlers should be "thin," delegating business logic to core modules.
- [ADR_THIN_HANDLERS (Thin Handlers)](../../decisions/thin-handlers.md#ADR_THIN_HANDLERS) To maintain separation of
concerns.
-
-### Realized by
-
-- [MOD_LSP_HANDLERS (LSP Handlers)](../view/module.md#MOD_LSP_HANDLERS)
diff --git a/doc/architecture/view/module.md b/doc/architecture/view/module.md
index ac2393f..8545535 100644
--- a/doc/architecture/view/module.md
+++ b/doc/architecture/view/module.md
@@ -41,45 +41,103 @@ The `core` module contains the fundamental logic for analyzing documentation gra
- **`parse`**: Responsible for extracting `{document}` blocks and HTML anchors from Markdown files.
- **`collect`**: Orchestrates the scanning of directories and aggregation of nodes.
+### Realizes
+
+- [FR_CORE_VALID_REF (Valid References)](../../requirements/functional/core.md#FR_CORE_VALID_REF)
+- [FR_CORE_UNIQUE (Unique Node IDs)](../../requirements/functional/core.md#FR_CORE_UNIQUE)
+- [FR_CORE_AUDIT (Audit Logging)](../../requirements/functional/core.md#FR_CORE_AUDIT)
+- [FR_CORE_AUTH (Authentication)](../../requirements/functional/core.md#FR_CORE_AUTH)
+- [FR_CORE_TEMPLATE_VALIDATION (Template Validation)](../../requirements/functional/core.md#FR_CORE_TEMPLATE_VALIDATION)
+- [FR_CORE_CONFIGURATION (Configuration)](../../requirements/functional/core.md#FR_CORE_CONFIGURATION)
+- [NFR_AVAILABILITY (System Availability)](../../requirements/non-functional/performance.md#NFR_AVAILABILITY)
+- [IF_CONFIG (docgraph.toml Configuration)](../../requirements/interfaces/interfaces.md#IF_CONFIG)
+
### Validation Rules
- **`lint`**: Implements the validation engine and individual rules (DG001-DG006).
+### Realizes
+
+- [FR_CORE_TEMPLATE_VALIDATION (Template Validation)](../../requirements/functional/core.md#FR_CORE_TEMPLATE_VALIDATION)
+
### Graph Logic
- **`graph`**: Manages the construction and traversal of the dependency graph.
+### Realizes
+
+- [FR_CORE_VALID_REF (Valid References)](../../requirements/functional/core.md#FR_CORE_VALID_REF)
+- [FR_CORE_UNIQUE (Unique Node IDs)](../../requirements/functional/core.md#FR_CORE_UNIQUE)
+
### Error Definitions
- **`error`**: Defines the unified error types and handling strategies.
+### Realizes
+
+- [CC_ERROR_HANDLING (Error Handling Strategy)](../design/error-handling.md#CC_ERROR_HANDLING)
+
### CLI Application
The `cli` module handles user interaction via the terminal.
-- **`handlers`**: Contains the logic for each CLI command (`check`, `list`, `describe`, `graph`, `trace`, `rule`).
+- **`handlers`**: Contains the logic for each CLI command (`check`, `describe`, `graph`, `rule`).
- **`output`**: Manages the formatting of results (Text, JSON).
+### Realizes
+
+- [FR_CLI_LINT (Lint Command)](../../requirements/functional/cli.md#FR_CLI_LINT)
+- [FR_CLI_GRAPH (Graph Command)](../../requirements/functional/cli.md#FR_CLI_GRAPH)
+- [FR_CLI_LIST (List Capability)](../../requirements/functional/cli.md#FR_CLI_LIST)
+- [FR_CLI_TRACE (Trace Capability)](../../requirements/functional/cli.md#FR_CLI_TRACE)
+- [FR_CLI_DESCRIBE (Describe Command)](../../requirements/functional/cli.md#FR_CLI_DESCRIBE)
+- [FR_CLI_TYPE (Type Command)](../../requirements/functional/cli.md#FR_CLI_TYPE)
+- [FR_CLI_VERSION (Version Command)](../../requirements/functional/cli.md#FR_CLI_VERSION)
+- [FR_CLI_HELP (Help Command)](../../requirements/functional/cli.md#FR_CLI_HELP)
+- [FR_CLI_QUERY (Query Command)](../../requirements/functional/cli.md#FR_CLI_QUERY)
+- [FR_INSTALL_MANUAL (Manual Installation)](../../requirements/functional/installation.md#FR_INSTALL_MANUAL)
+- [FR_INSTALL_BINARY (Binary Installation Support)](../../requirements/functional/installation.md#FR_INSTALL_BINARY)
+- [FR_INSTALL_PREK (Pre-commit Hook Support)](../../requirements/functional/installation.md#FR_INSTALL_PREK)
+- [IF_CLI (Command Line Interface)](../../requirements/interfaces/interfaces.md#IF_CLI)
+
### LSP Library
The `lsp` module provides the Language Server Protocol implementation.
+### Realizes
+
+- [FR_LSP_GOTO (Go to Definition)](../../requirements/functional/lsp.md#FR_LSP_GOTO)
+- [FR_LSP_HOVER (Hover Information)](../../requirements/functional/lsp.md#FR_LSP_HOVER)
+- [FR_LSP_COMP (Auto-completion)](../../requirements/functional/lsp.md#FR_LSP_COMP)
+- [FR_LSP_REFS (Find References)](../../requirements/functional/lsp.md#FR_LSP_REFS)
+- [FR_LSP_RENAME (Symbol Rename)](../../requirements/functional/lsp.md#FR_LSP_RENAME)
+- [FR_LSP_HIERARCHY (Call Hierarchy)](../../requirements/functional/lsp.md#FR_LSP_HIERARCHY)
+- [FR_LSP_DOC_SYMBOL (Document Symbol)](../../requirements/functional/lsp.md#FR_LSP_DOC_SYMBOL)
+- [FR_LSP_WS_SYMBOL (Workspace Symbol)](../../requirements/functional/lsp.md#FR_LSP_WS_SYMBOL)
+- [FR_LSP_SUPPORT (LSP Server)](../../requirements/functional/lsp.md#FR_LSP_SUPPORT)
+- [NFR_LATENCY (System Latency)](../../requirements/non-functional/performance.md#NFR_LATENCY)
+- [CC_COVERAGE (3. Code Coverage Standards)](../design/testing.md#CC_COVERAGE)
+
### LSP Server
- **`server`**: Implements the main event loop and lifecycle management.
+### Realizes
+
+- [FR_LSP_SUPPORT (LSP Server)](../../requirements/functional/lsp.md#FR_LSP_SUPPORT)
+
### LSP Handlers
@@ -87,6 +145,10 @@ The `lsp` module provides the Language Server Protocol implementation.
- **`handlers`**: Implements LSP capabilities such as `textDocument/definition`, `textDocument/references`, and
`textDocument/hover`.
+### Realizes
+
+- [CC_THIN_HANDLERS (Thin Handlers Pattern)](../design/thin-handlers.md#CC_THIN_HANDLERS)
+
### VS Code Extension
@@ -96,6 +158,15 @@ The `vsix` module is a TypeScript-based project that acts as the LSP client.
- **`src/extension.ts`**: Manages the lifecycle of the `docgraph` language server and registers editor-specific
commands.
+### Realizes
+
+- [FR_VSC_LSP_CLIENT (LSP Client Integration)](../../requirements/functional/vscode.md#FR_VSC_LSP_CLIENT)
+- [FR_VSC_BINARY_PATH (Binary Path Configuration)](../../requirements/functional/vscode.md#FR_VSC_BINARY_PATH)
+- [FR_VSC_MARKDOWN_ACTIVATION (Markdown Activation)](../../requirements/functional/vscode.md#FR_VSC_MARKDOWN_ACTIVATION)
+- [FR_VSC_SERVER_LIFECYCLE (Server Lifecycle Commands)](../../requirements/functional/vscode.md#FR_VSC_SERVER_LIFECYCLE)
+- [NFR_VSCODE_PORTABILITY (Cross-platform Portability)](../../requirements/non-functional/vscode.md#NFR_VSCODE_PORTABILITY)
+- [NFR_VSCODE_PACKAGING (Lightweight Packaging)](../../requirements/non-functional/vscode.md#NFR_VSCODE_PACKAGING)
+
### Zed Editor Extension
@@ -105,6 +176,11 @@ The `zed-extension` is a WASM-based extension for the Zed editor.
- **`zed-extension/src/lib.rs`**: Implements the `zed::Extension` trait and the `language_server_command` to bridge Zed
and the `docgraph` binary.
+### Realizes
+
+- [FR_INSTALL_EXT_ZED (Zed Editor Extension)](../../requirements/functional/installation.md#FR_INSTALL_EXT_ZED)
+- [IF_ZED_UI (Zed UI)](../../requirements/interfaces/interfaces.md#IF_ZED_UI)
+
### CI/CD Pipelines
@@ -115,6 +191,14 @@ The `.github` directory contains the CI/CD pipeline configuration.
- **`.github/workflows/codeql.yml`**: Static application security testing.
- **`.github/dependabot.yml`**: Automated dependency updates.
+### Realizes
+
+- [FR_DEV_CI (Automated Validation)](../../requirements/functional/development.md#FR_DEV_CI)
+- [FR_DEV_STANDARDS (Development Standards)](../../requirements/functional/development.md#FR_DEV_STANDARDS)
+- [CC_CICD (CI/CD Pipeline)](../design/cicd.md#CC_CICD)
+- [CC_CONVENTIONAL_COMMITS (Commit Messages)](../design/development-norm.md#CC_CONVENTIONAL_COMMITS)
+- [CC_SEMANTIC_VERSIONING (Versioning)](../design/development-norm.md#CC_SEMANTIC_VERSIONING)
+
### Claude Code Plugin
@@ -124,6 +208,12 @@ The `docgraph-plugin` provides a Model Context Protocol (MCP) server for Claude
- **`skills/docgraph`**: Defines the tools and resources available to the AI agent.
- **`.claude-plugin`**: Contains the plugin manifest and capability definitions.
+### Realizes
+
+
+
+- [IF_CLAUDE_CODE (Interface: Claude Code Plugin)](../../requirements/interfaces/interfaces.md#IF_CLAUDE_CODE)
+
### Dev Container
@@ -134,6 +224,10 @@ The `.devcontainer` directory contains the development environment configuration
- **`postCreateCommand`**: Installs additional tools (docgraph, Claude Code).
- **Extensions**: Pre-configured VS Code extensions for Rust, TOML, debugging, and AI assistance.
+### Realizes
+
+- [CC_DEV_ENV (Development Environment)](../design/development-norm.md#CC_DEV_ENV)
+
### Test Infrastructure
@@ -142,3 +236,7 @@ The `tests` directory and test utilities.
- **`tests/`**: Integration and E2E tests.
- **`src/test_utils`**: Helper functions and mocks for testing.
+
+### Realizes
+
+- [CC_TESTING_STRATEGY (Testing Strategy)](../design/testing.md#CC_TESTING_STRATEGY)
diff --git a/doc/constraints/development.md b/doc/constraints/development.md
index 0cc48b4..95b9b50 100644
--- a/doc/constraints/development.md
+++ b/doc/constraints/development.md
@@ -1,15 +1,9 @@
-# Development Constraints
-
## High Performance
The system must satisfy strict performance requirements to support large codebases.
-### Satisfied by
-
-- [NFR_PERF (High Performance)](../requirements/non-functional/performance.md#NFR_PERF) {To support large codebases}
-
## Open Source Software (OSS)
@@ -17,10 +11,6 @@ The system must satisfy strict performance requirements to support large codebas
This project is Open Source Software. To facilitate community contribution and ensure long-term sustainability, we MUST
adhere to de-facto industry standards for development workflows and project structure.
-### Realized by
-
-- [FR_DEV_STANDARDS (Development Standards)](../requirements/functional/development.md#FR_DEV_STANDARDS)
-
## Solo Development
@@ -28,17 +18,8 @@ adhere to de-facto industry standards for development workflows and project stru
This project is developed by a single individual. To maintain quality and velocity with limited resources, automation is
mandatory.
-### Realized by
-
-- [FR_DEV_CI (Automated Validation)](../requirements/functional/development.md#FR_DEV_CI)
-- [FR_DEV_STANDARDS (Development Standards)](../requirements/functional/development.md#FR_DEV_STANDARDS)
-
## Extensibility
The system architecture must support easy extension of core capabilities.
-
-### Satisfied by
-
-- [NFR_EXT (Modular Design)](../requirements/non-functional/extensibility.md#NFR_EXT) {To allow future enhancements}
diff --git a/doc/constraints/quality.md b/doc/constraints/quality.md
index 0139e38..737cb20 100644
--- a/doc/constraints/quality.md
+++ b/doc/constraints/quality.md
@@ -1,5 +1,3 @@
-# Quality Constraints
-
## Quality
@@ -10,8 +8,3 @@ The system must maintain high quality standards across testing and security to e
- Core business logic: 85%+ coverage
- Overall codebase: 70%+ coverage
-
-### Satisfied by
-
-- [NFR_TEST (Comprehensive Testing)](../requirements/non-functional/test-quality.md#NFR_TEST) {To ensure reliability}
-- [NFR_SECURITY (Security Testing)](../requirements/non-functional/security.md#NFR_SECURITY) {To ensure security}
diff --git a/doc/decisions/error-handling.md b/doc/decisions/error-handling.md
index 377a72e..3bd98a3 100644
--- a/doc/decisions/error-handling.md
+++ b/doc/decisions/error-handling.md
@@ -90,7 +90,19 @@ fn to_jsonrpc_error(err: anyhow::Error) -> jsonrpc::Error {
We selected this hybrid approach to balance type safety in the core library with development velocity and error context
in the application layers.
-### 1. Core Library: thiserror (Typed Errors)
+The `docgraph` project has a layered architecture with:
+
+- **Core library** (`src/core/`, `src/lib.rs`) - Reusable logic exposed to other crates
+- **CLI binary** (`src/main.rs`, `src/cli/`) - Command-line interface
+- **LSP server** (`src/lsp/`) - Language Server Protocol implementation
+
+We need a consistent error handling strategy that:
+
+1. Provides typed errors for library APIs
+2. Offers rich context for end-user error messages
+3. Converts errors appropriately at layer boundaries
+
+**1. Core Library: thiserror (Typed Errors)**
**Why**: The core library is called by other crates (CLI, LSP), so errors should be **typed** for programmatic handling.
@@ -125,7 +137,7 @@ pub enum Error {
pub type Result = std::result::Result;
```
-#### 2. CLI Binary: anyhow (Contextual Reporting)
+**2. CLI Binary: anyhow (Contextual Reporting)**
**Why**: CLI is the final consumer - errors are displayed to users and then the program exits. We need **rich context**
more than type safety.
@@ -155,7 +167,7 @@ fn main() -> anyhow::Result<()> {
Core's `Error` automatically converts to `anyhow::Error` via `?` operator.
-#### 3. LSP Server: anyhow + JSON-RPC Conversion
+**3. LSP Server: anyhow + JSON-RPC Conversion**
**Why**: LSP handles requests asynchronously and needs to convert errors to JSON-RPC error responses.
@@ -190,20 +202,8 @@ async fn handle_hover(...) -> Result