Skip to content

swimmio/split-swmd-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

sw.md Program Doc Splitter

Splits Swimm program documentation (.sw.md files) into two separate deliverables:

  1. Business Logic -- section headers, descriptions, flowcharts, business rules
  2. Technical Description -- section headers, code walkthroughs (SwmSnippet blocks)

User stories are excluded from both outputs.

Requirements

Python 3.10+ (stdlib only, no external dependencies).

Usage

python split_swmd.py --swm-dir /path/to/.swm --program <program-name> [--output-dir ./output]

Arguments

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)

Example

python split_swmd.py \
  --swm-dir /path/to/repo/.swm \
  --program b12345 \
  --output-dir ./output

Output:

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

Output Files

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

What goes where

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

Multi-part Documents

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

Document Structure Assumptions

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>

&nbsp;
*This is an auto-generated document...*
<SwmMeta ...>...</SwmMeta>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages