architecture-as-code icon indicating copy to clipboard operation
architecture-as-code copied to clipboard

Introduce a two-stage website generation flow for CALM Docify that integrates with Docusaurus

Open LeighFinegold opened this issue 3 months ago • 1 comments

Target Project:

@finos/calm-docify (CLI + shared template processing)

Description of Feature:

Introduce a two-stage website generation flow for CALM Docify that integrates with Docusaurus.

  • Stage 1 (Scaffold): Generate a Docusaurus skeleton website with MDX files containing unrendered widget placeholders (e.g., {{flow-sequence flow-id="..."}}).
  • Stage 2 (Deploy): Fully process those placeholders using Docify templates and widgets, producing a ready-to-deploy static site.

This enables teams to:

  • Quickly bootstrap a documentation website with CALM-aware scaffolding.
  • Edit, extend, or review placeholder docs in MDX before rendering.
  • Consistently deploy rendered static sites via calm docify --deploy.

User Stories:

  • As an architect, I want to first scaffold a website or documentation with calm widget placeholders so that I can review, edit, or add explanatory text before running a final deploy that renders all widgets into diagrams and tables.

Current Limitations:

  • Docify Website Mode currently renders templates directly, producing static docs immediately.
  • No way exists to generate a Docusaurus skeleton with unprocessed widget calls for teams who want editable scaffolding.
  • Editing or reviewing docs before final widget rendering is difficult.

Proposed Implementation:

  • Add two new CLI commands:

    • calm docify scaffold → scaffolds a Docusaurus project with MDX files containing unrendered widget placeholders.
      • Extra argument: --scaffold (shorthand mode to trigger scaffold flow).
    • calm docify deploy → processes placeholders into final rendered content and runs through the chosen renderer (default: Docusaurus).
      • Extra argument: --deploy.
  • Front matter in scaffolded pages will include minimal CALM metadata so the VS Code extension and Docify know what they’re looking at:

---
id: architecture
title: Architecture Overview
calm:
  type: architecture
  modelRef: ./models/main.calm.json
  urlToLocalFileMapping: true
---
  • Pages generated during --scaffold will contain placeholders such as:
# Architecture

{{w:table key="nodes"}}
{{w:flow-sequence flow-id="flow-add-account"}}
  • Running --deploy replaces those placeholders with actual rendered diagrams/tables while keeping the surrounding text intact.

LeighFinegold avatar Sep 03 '25 22:09 LeighFinegold

I think this split is also required to enable us to add a 'Docify Preview' capability to the VS Code Plugin.

rocketstack-matt avatar Sep 04 '25 13:09 rocketstack-matt