Splits Swimm program documentation (.sw.md files) into two separate deliverables:
- Business Logic -- section headers, descriptions, flowcharts, business rules
- Technical Description -- section headers, code walkthroughs (SwmSnippet blocks)
User stories are excluded from both outputs.
Python 3.10+ (stdlib only, no external dependencies).
python split_swmd.py --swm-dir /path/to/.swm --program <program-name> [--output-dir ./output]| Argument | Required | Description |
|---|---|---|
--swm-dir |
Yes | Path to the .swm directory containing the source .sw.md files |
--program |
Yes | Program name to split (e.g., b12345). Case-insensitive. |
--output-dir |
No | Output directory (defaults to current directory) |
python split_swmd.py \
--swm-dir /path/to/repo/.swm \
--program b12345 \
--output-dir ./outputOutput:
Found 1 document(s) for program 'b12345':
b12345-example-program.wsnpt.sw.md
Parsed b12345-example-program-wsnpt.sw.md
Output written to ./output/:
b12345-business-logic.md
b12345-business-logic.sw.md
b12345-technical.md
b12345-technical.sw.md
Each run produces four files:
| File | Format | Contents |
|---|---|---|
{program}-business-logic.md |
Plain Markdown | Preamble + section descriptions + flowcharts + business rules |
{program}-business-logic.sw.md |
Swimm Markdown | Same content with YAML front matter and SwmMeta footer |
{program}-technical.md |
Plain Markdown | Section headings + SwmSnippet code walkthroughs |
{program}-technical.sw.md |
Swimm Markdown | Same content with YAML front matter and SwmMeta footer |
| Content type | Business Logic | Technical Description |
|---|---|---|
| Preamble (Overview, high-level flowchart, Dependencies) | Yes | -- |
| Section headings | Yes | Yes |
| Mermaid flowcharts | Yes | -- |
| Description text | Yes | -- |
Business rules tables (| Rule ID |) |
Yes | -- |
| SwmSnippet code walkthroughs | -- | Yes |
| User stories | Excluded | Excluded |
A program can span multiple .sw.md files (e.g., prog-name.sw.md, prog-1-part.sw.md, prog-2-part.sw.md). The tool automatically discovers and orders them:
- The main (unnumbered) doc sorts first and contributes the preamble
- Numbered docs (
-1-,-2-, etc.) follow in numeric order - Sections from all docs are concatenated into the outputs
The tool expects source .sw.md files to follow this structure:
---
title: Program Name - Description
---
# Overview <- Preamble (business logic only)
[intro text]
```mermaid [high-level flowchart] ```
## Dependencies
### Programs / ### Copybooks
# Workflow <- Preamble end marker
# Section Name <- Section start
```mermaid [flowchart] ``` <- Business logic
Description text... <- Business logic
| Rule ID | Code Location | ... <- Business logic
# User Stories <- Excluded
...
<SwmSnippet ...> <- Technical description
walkthrough text + code
</SwmSnippet>
*This is an auto-generated document...*
<SwmMeta ...>...</SwmMeta>