-
Notifications
You must be signed in to change notification settings - Fork 92
Description
Introduction
This issue defines the MVP scope for the Calm Docify for the cli v1.0.0 release.
Background
-
CALM Templating (CALM Templating #890) introduced template bundles—a structured package (defined by index.json) that encapsulates templates, transformers, and custom helpers—alongside the calm template CLI command for generating outputs from CALM models.
-
Dereferencing Enhancement (Extend
calm templateto support dereferencing #1026) added automatic resolution for JSON documents, ensuring that all referenced models are recursively merged and exposed to templates without manual imports. -
Widgets Proposal (CALM Widgets - Simplified Handlebars Template Library for Architecture Documentation #1416) outlined the standalone
calm-widgetsproject for registering reusable templates and helps with simplifying syntax, bracket notation, array indexing for traversing the document you are templating.
1. CLI Usage End‑State
-
Inline file rendering
calm docify --input architecture.json --template my-doc.mdRenders 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
architecturemodel 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
widgetNameis the name of the widget (e.g.table,list)dataPathis the path into yourarchitecturemodel (dot or bracket notation)widgetAttributepairs control formatting, columns, etc.
-
Default widgets shipped in v1.0.0:
table: renders an array of objects as a tablelist: renders an array of values or objects as a Markdown listjson: 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.jsonmapping 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.jsonentries 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
Type
Projects
Status