Skip to content

docs: Restructure ARCHITECTURE.md into modular documentation #109

@inureyes

Description

@inureyes

Problem / Background

The current ARCHITECTURE.md file has grown to 4,340 lines, making it difficult to maintain and navigate. The document also contains content that should not be in an architecture document:

Issues Identified

  1. Excessive Length: 4,340 lines is too large for a single documentation file
  2. Historical Entries: Contains date-based entries (e.g., "Added 2025-12-17", "Implemented 2025-10-29") that belong in CHANGELOG
  3. Issue/PR References: Contains references like "Issue refactor: Split oversized modules to improve maintainability #33", "Issue feat: Implement real-time streaming output with interactive multi-node UI #68", "PR feat: Add --batch option for single Ctrl+C termination (pdsh -b compatibility) #102" that are changelog content
  4. Version References: Contains version numbers like "v0.9.0", "v1.2.0+" that are changelog content
  5. Development Timeline Section: Contains a full development timeline (lines 2896-2935) that belongs in CHANGELOG
  6. Code Structure Evolution Section: Contains historical refactoring details (lines 56-81) that are changelog content

Proposed Solution

Phase 1: Extract Component Documentation

Create a docs/architecture/ directory and extract detailed component documentation into separate files:

File Content Source Sections
cli-interface.md CLI Interface, pdsh compatibility, hostlist expressions, mode detection Section 1, 1.5
configuration.md Configuration Management, types, loader, resolver, XDG support Section 2
executor.md Parallel Executor, concurrency, signal handling, fail-fast, stream management Section 3, 4.0.2
ssh-client.md SSH Client, connection, authentication, command execution, streaming Section 4, 4.0.1, 4.1
tui.md Terminal User Interface, views, event handling, progress parsing Section 4.0.3, TUI Architecture section
interactive-mode.md Interactive Mode and PTY Implementation Interactive Mode Architecture, PTY Implementation Design
ssh-config-parser.md SSH Configuration File Parser, Include/Match directives, options, caching Section 6, 7, SSH Configuration Parser section
ssh-jump-hosts.md SSH Jump Host Support, chain management, authentication SSH Jump Host Support section
ssh-port-forwarding.md Port Forwarding (local, remote, dynamic/SOCKS) SSH Port Forwarding section
exit-code-strategy.md Exit Code Strategy Architecture Exit Code Strategy Architecture section

Phase 2: Clean Up Main ARCHITECTURE.md

The main ARCHITECTURE.md should be slimmed down to contain only:

1. Overview (~50 lines)
   - Project description
   - Core capabilities

2. System Architecture (~100 lines)
   - ASCII diagram
   - High-level component interactions

3. Component Summary (~150 lines)
   - Brief descriptions with links to detailed docs
   - One paragraph per component

4. Data Flow (~50 lines)
   - Command execution flow
   - Error handling strategy

5. Security Model (~50 lines)
   - Current implementation summary
   - Link to detailed security docs

6. Dependencies and Licensing (~50 lines)
   - Core dependencies
   - License compatibility

7. Appendix (~50 lines)
   - Configuration schema
   - Error codes
   - Performance tuning

Target: ~500 lines (down from 4,340)

Phase 3: Content Cleanup

Remove all non-architectural content from extracted documentation:

Acceptance Criteria

  • Create docs/architecture/ directory structure
  • Extract 10 component documentation files as listed above
  • Reduce main ARCHITECTURE.md to ~500 lines (target)
  • Remove all date-based, issue/PR, and version references from all docs
  • Remove Development Timeline and Code Structure Evolution sections
  • Add navigation links between main doc and component docs
  • Ensure all code examples and diagrams are preserved
  • Verify no broken internal links
  • Update README.md if it references ARCHITECTURE.md sections

Technical Considerations

File Structure

docs/
└── architecture/
    ├── README.md           # Index of all architecture docs
    ├── cli-interface.md
    ├── configuration.md
    ├── executor.md
    ├── ssh-client.md
    ├── tui.md
    ├── interactive-mode.md
    ├── ssh-config-parser.md
    ├── ssh-jump-hosts.md
    ├── ssh-port-forwarding.md
    └── exit-code-strategy.md

Link Format

Each extracted document should include:

  • Header with navigation back to main ARCHITECTURE.md
  • Footer with related documents
  • Cross-references using relative links

Content Preservation

  • All ASCII diagrams must be preserved exactly
  • All code examples must remain functional
  • All implementation details must be kept (just moved)
  • Only remove historical/changelog content, not technical content

Benefits

  1. Easier Navigation: Find specific topics quickly
  2. Better Maintainability: Update component docs independently
  3. Faster Loading: Smaller files load faster in editors/viewers
  4. Clear Separation: Architecture vs changelog content
  5. Better Discoverability: Topic-based organization
  6. Reduced Merge Conflicts: Changes isolated to specific files

Additional Context

The ARCHITECTURE.md file contains valuable technical content that should be preserved. This issue is about reorganization and cleanup, not content reduction. All technical details, diagrams, and implementation notes should be maintained in the new structure.

Current line counts of major sections:

  • CLI Interface + pdsh: ~350 lines
  • Configuration: ~120 lines
  • Executor + Streaming: ~500 lines
  • SSH Client + Auth: ~300 lines
  • TUI: ~600 lines
  • Interactive Mode + PTY: ~400 lines
  • SSH Config Parser: ~350 lines
  • Jump Hosts: ~400 lines
  • Port Forwarding: ~250 lines
  • Exit Code Strategy: ~200 lines
  • Timeline + Evolution (to remove): ~100 lines

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumMedium priority issuestatus:reviewUnder reviewtype:docsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions