Skip to content

Calm Docify MVP for CLI v1.0.0 #1452

@LeighFinegold

Description

@LeighFinegold

Introduction

This issue defines the MVP scope for the Calm Docify for the cli v1.0.0 release.


Background


1. CLI Usage End‑State

  • Inline file rendering

    calm docify --input architecture.json --template my-doc.md
    

    Renders a single markdown file, injecting data inline. (this doesn't need to be an md file specifically)

  • Directory‑wide rendering

    calm docify --input architecture.json --templates docs/
    

    Processes every template file under docs/, preserving folder structure and injecting data into each.

  • Default website output

    calm docify --input architecture.json
    
    • Generates a basic Docify website bundle (HTML/CSS/JS) using built‑in templates.
    • Any current widgets which are known to have bugs e.g. C4 architecture diagram will not be included in the default website, but will be reintroduced in a minor version.

Note: for custom bundles, continue to use the existing
calm template --bundle <bundle-folder> … workflow.


2. CLI Path Handling

  • Template authors can navigate the architecture model with either:

    • Dot‑notation

      {{ architecture.metadata.name }}
      {{ architecture.nodes.0['node-type'] }}
      

      This would be a self-maintained capability and syntax would have to be maintained by calm developers

    • JSONPath via helper

      {{ jsonpath architecture '$.nodes[?(@.node-type=="service")].name' }}
      

      JSONPath is a standard (even if the expression syntax looks complicated)

  • The CLI will normalize dot‑paths under the hood to JSONPath for consistent lookup semantics, so both styles yield the same results.

  • The traversing will be based on the CALM schema and not on an abstraction model.

Note: the same change will be applied to calm template, but we could provide a helper function or a cli option to convert to the abstract model for backwards compatibility


3. Document Dereferencing

All external Calm documents and schemas (detailed-architecture, config-url) are automatically fetched and inlined into your architecture object.

Root document example:

{
  "nodes": [
    {
      "unique-id": "systemA",
      "node-type": "system",
      "name": "System A",
      "description": "Top‑level system",
      "details": {
        "detailed-architecture": "./systemA-details.json"
      }
    }
  ],
  "relationships": [],
  "metadata": {},
  "controls": {},
  "flows": []
}

systemA-details.json might look like:

{
  "$schema": "https://calm.finos.org/release/1.0-rc2/meta/core.json",
  "nodes": [
    {
      "unique-id": "component1",
      "node-type": "service",
      "name": "Component One",
      "description": "Handles incoming API requests"
    },
    {
      "unique-id": "component2",
      "node-type": "database",
      "name": "Component Two",
      "description": "Stores transaction data"
    }
  ],
  "relationships": [],
  "metadata": {},
  "controls": {},
  "flows": []
}

After dereferencing, in your template you can write:

{{!-- list components of systemA --}}
{{#each architecture.nodes[0].details['detailed-architecture'].nodes}}
- {{ this.name }} ({{ this['node-type'] }})
{{/each}}

4. Injecting Widgets

  • Syntax

    {{> widgetName dataPath widgetAttribute1=[x] widgetAttribute2=[y]}}
    

    – where

    • widgetName is the name of the widget (e.g. table, list)
    • dataPath is the path into your architecture model (dot or bracket notation)
    • widgetAttribute pairs control formatting, columns, etc.
  • Default widgets shipped in v1.0.0:

    • table: renders an array of objects as a table
    • list: renders an array of values or objects as a Markdown list
    • json: renders the following part of the document as a json document
  • Examples

    {{> table architecture.nodes columns="unique-id,name,node-type"}}
    {{> list architecture.flows format="bullet"}}
    {{> table architecture.nodes[0].details['detailed-architecture'].nodes headers=false}}
    {{> json architecture.relationships}}
    
  • Context binding expectation
    Users must specify the correct path to the data that each widget will render.

  • Future v1.x
    We’ll add a capability to allow folks to register additional widgets.


5. Offline Support

  • Reference documents often use URLs or document IDs.

  • Users can supply a directory.json mapping file for offline mode:

    calm docify --input architecture.json --template doc.md --mapping directory.json
    
  • Example directory.json:

    {
      "https://calm.finos.org/release/1.0-rc1/meta/control-requirement.json": "../release/1.0-rc1/meta/control-requirement.json",
      "https://calm.finos.org/workshop/controls/micro-segmentation.config.json": "controls/micro-segmentation.config.json",
      "https://calm.finos.org/workshop/controls/micro-segmentation.requirement.json": "controls/micro-segmentation.requirement.json",
      "https://calm.finos.org/workshop/controls/permitted-connection.requirement.json": "controls/permitted-connection.requirement.json",
      "https://calm.finos.org/workshop/controls/permitted-connection-http.config.json": "controls/permitted-connection-http.config.json",
      "https://calm.finos.org/workshop/controls/permitted-connection-jdbc.config.json": "controls/permitted-connection-jdbc.config.json"
    }
    
  • During dereferencing, the CLI resolves references via directory.json entries first, falling back to network fetch only if no mapping exists.


Aim: Confirm the above scope for the v1.0.0 MVP.

Sub-issues

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions