Skip to content

CALM Widgets - Simplified Handlebars Template Library for Architecture Documentation #1416

@rocketstack-matt

Description

@rocketstack-matt

Feature Proposal

Target Project:

CALM Monorepo - New calm-widgets project to be integrated into the existing monorepo structure and used by the CLI

Description of Feature:

The CALM CLI already provides a Handlebars integration. Whilst the existing implementation is extremely powerful and allows for multiple complex target output formats such as Docusaurus websites and Infrastructure as Code manifests, it is overly complex for architects wanting to embed elements of their CALM architecture into markdown documents.

This proposal addresses the need for a more streamlined and accessible way to generate documentation from CALM architecture files.

Desired Capabilities:

  • Simplified Template Syntax: Intuitive property access using {{ architecture.metadata.name }} instead of complex helper functions
  • Bracket Notation Support: Easy node access with {{ architecture.nodes['api-gateway'].description }}
  • Schema-Based Controls: Automatic fetching and parsing of control requirement schemas from URLs
  • Array Indexing: Support for accessing array elements with {{ architecture.nodes['api-gateway'].controls.cbom.requirements[0] }}
  • Intelligent Table Generation: Automatic table formatting for nodes, controls, metadata, and individual control requirements
  • CLI Integration: Seamless integration with CALM CLI for template processing

User Stories:

  • As a solution architect, I want to generate beautiful documentation from my CALM architecture files so that I can share readable architecture descriptions with stakeholders
  • As a developer, I want to use simple, intuitive template syntax so that I can quickly create custom documentation templates without learning complex Handlebars helpers
  • As a technical writer, I want to access specific architecture components by their unique IDs so that I can create focused documentation for individual services or systems
  • As a DevOps engineer, I want to integrate CALM documentation generation into my CI/CD pipeline so that architecture documentation stays up-to-date automatically

Current Limitations:

Currently, the CALM ecosystem lacks:

  • Simple, intuitive template syntax - current approaches require deep Handlebars knowledge
  • Support for schema-based control requirement documentation
  • Easy access to specific architecture components by their unique IDs
  • Built-in widgets for common documentation patterns (tables, lists, metadata display)

Proposed Implementation:

We propose to implement this feature with the following technical approach:

Technical Architecture:

  • Project Structure: Create a standalone calm-widgets project within the monorepo
  • Template Engine: Extend Handlebars with custom helpers and preprocessing capabilities
  • CLI Integration: Integrate directly with the existing CALM CLI template command

Proposed API Design:

// CLI Integration
calm template --input ./architecture.json --template my-template.md --output ./docs

// Template Syntax Examples
{{ architecture.metadata.name }}
{{ table architecture.nodes filter='node-type:service' }}
{{ architecture.nodes['api-gateway'].controls.cbom.requirements[0] }}

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions