A command-line tool to generate HTML documentation and state diagrams from ALPS (Application-Level Profile Semantics) profiles.
- Parse JSON and XML ALPS profiles
- Validate ALPS documents with detailed error/warning messages
- Generate interactive HTML documentation with:
- State diagrams (via Graphviz WASM)
- Semantic descriptor tables
- Tag filtering
- Link navigation
- Output formats: HTML, SVG, DOT
- External file reference resolution
git clone https://github.com/alps-asd/app-state-diagram.git
cd app-state-diagram
git checkout ts
npm install
npm run build
npm link# Generate HTML (default) - includes validation
asd profile.json
# Specify output file
asd profile.xml -o documentation.html
# Output to stdout
asd profile.json --echo# Generate SVG diagram
asd profile.json -f svg
# Generate DOT format (Graphviz)
asd profile.json -f dot -o diagram.dot# Validate and output results as JSON (no HTML generation)
asd profile.json --validateThe generated HTML includes:
- Title and Description - From ALPS
titleanddocelements - State Diagram - Interactive SVG showing application states and transitions
- Descriptor Table - All semantic descriptors with:
- Type indicator (semantic/safe/unsafe/idempotent)
- ID and title
- Contained descriptors
- Extra info (def, rt, rel, doc, tags)
- Legend - Color coding for descriptor types
- Links - External links from ALPS
linkelements
The validator checks for:
E001- Missing id or hrefE002- Missing rt (return type) for transitionsE003- Invalid type valueE004- Broken reference (href/rt pointing to non-existent id)E005- Duplicate idE006- Invalid href formatE007- Invalid rt formatE008- Missing alps propertyE009- Missing descriptor arrayE010- Invalid XML characters in titleE011- Tag must be string (not array)
W001- Missing title attributeW002- Safe transitions should start with "go"W003- Unsafe/idempotent transitions should start with "do"W004- Orphan descriptor (defined but never referenced)
S001- Consider adding doc to transitionsS002- Consider adding title to ALPS documentS003- Consider adding doc to ALPS document
import {
AlpsParser,
AlpsTransformer,
DotGenerator,
HtmlGenerator,
dotToSvg
} from '@alps-asd/asd';
// Parse ALPS document
const parser = new AlpsParser();
const document = parser.parse(alpsContent);
// Validate
const validation = parser.validate(document);
if (!validation.isValid) {
console.error(validation.errors);
process.exit(1);
}
// Transform to internal model
const transformer = new AlpsTransformer();
const model = transformer.transform(document);
// Generate DOT
const dotGenerator = new DotGenerator();
const dot = dotGenerator.generate(model);
// Convert to SVG
const svg = await dotToSvg(dot);
// Generate HTML
const htmlGenerator = new HtmlGenerator();
const html = htmlGenerator.generate(document, svg, alpsContent);- Node.js 18.0.0 or higher
- ALPS Specification
- app-state-diagram - PHP implementation
- alps-editor - Online ALPS editor
MIT