diff --git a/.claude/agents/docs.md b/.claude/agents/docs.md
index eff9e3a..b2026c7 100644
--- a/.claude/agents/docs.md
+++ b/.claude/agents/docs.md
@@ -71,7 +71,7 @@ You are a specialized documentation agent for the Statifier SCXML library with e
## Specialized Tasks
-- Migrate existing CLAUDE.md content to structured Diataxis documentation
+- Migrate existing CLAUDE.md and README.md content to structured Diataxis documentation
- Create interactive SCXML examples with state machine visualizations
- Generate API documentation from Elixir modules with @doc annotations
- Develop tutorial series progressing from basic to advanced state machine concepts
diff --git a/.credo.exs b/.credo.exs
index 1e5371e..8c0278c 100644
--- a/.credo.exs
+++ b/.credo.exs
@@ -27,7 +27,7 @@
"src/",
"test/"
],
- excluded: [~r"/lib/mix/test", ~r"/lib/mix/quality", ~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
+ excluded: [~r"/lib/mix", ~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
},
#
# Load and configure plugins here:
diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs
new file mode 100644
index 0000000..5766bde
--- /dev/null
+++ b/.dialyzer_ignore.exs
@@ -0,0 +1,4 @@
+[
+ # Ignore all Mix tasks - these are development tools, not core library functionality
+ ~r/lib\/mix\/tasks\/.*/
+]
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c1ebbd1..883944c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -224,3 +224,39 @@ jobs:
- name: Run regression tests
run: mix test.regression
+
+ example-tests:
+ name: Examples Test Suite
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: examples
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Elixir
+ uses: erlef/setup-beam@v1
+ with:
+ elixir-version: '1.18.3'
+ otp-version: '27.3'
+
+ - name: Cache deps
+ uses: actions/cache@v4
+ with:
+ path: |
+ examples/deps
+ examples/_build
+ key: example-deps-${{ runner.os }}-27.3-1.18.3-${{ hashFiles('examples/**/mix.lock') }}
+ restore-keys: |
+ example-deps-${{ runner.os }}-27.3-1.18.3-
+
+ - name: Install dependencies
+ run: mix deps.get
+
+ - name: Compile project
+ run: mix compile
+
+ - name: Run tests
+ run: mix test
diff --git a/.gitignore b/.gitignore
index 19e950a..a8abf1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ erl_crash.dump
# Generated docs site
/docs/.vitepress/dist
+/docs/.vitepress/cache
# Ignore package tarball (built via "mix hex.build").
statifier-*.tar
diff --git a/CLAUDE.md b/CLAUDE.md
index 4035a59..933ec6d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -42,6 +42,13 @@ When verifying code changes, always follow this sequence (also automated via pre
- `mix test test/statifier/logging/` - Run comprehensive logging infrastructure tests (30 tests)
- `mix test test/statifier/actions/` - Run action execution tests with integrated StateChart logging
+**Documentation:**
+
+- `mix docs.validate` - Validate code examples in documentation files (README.md, docs/*.md)
+- `mix docs.validate --file README.md` - Validate specific file only
+- `mix docs.validate --verbose` - Show detailed validation output
+- `mix docs.validate --path docs/` - Validate specific directory
+
**Development:**
- `mix deps.get` - Install dependencies
@@ -214,7 +221,7 @@ The implementation follows a clean **Parse → Validate → Optimize** architect
{:ok, optimized_document, warnings} = Statifier.Validator.validate(document)
# 3. Interpret Phase: Use optimized document for runtime
-{:ok, state_chart} = Statifier.Interpreter.initialize(optimized_document)
+{:ok, state_chart} = Statifier.initialize(optimized_document)
```
**Benefits:**
@@ -376,7 +383,7 @@ invoke_handlers = %{
"email_service" => &MyApp.EmailService.handle_invoke/3
}
-{:ok, state_chart} = Interpreter.initialize(document, [
+{:ok, state_chart} = Statifier.initialize(document, [
invoke_handlers: invoke_handlers,
log_level: :debug
])
@@ -629,13 +636,13 @@ When debugging state chart execution, configure enhanced logging for detailed vi
```elixir
# Enable detailed tracing for debugging
-{:ok, state_chart} = Interpreter.initialize(document, [
+{:ok, state_chart} = Statifier.initialize(document, [
log_adapter: :elixir,
log_level: :trace
])
# Alternative: use internal adapter for testing/development
-{:ok, state_chart} = Interpreter.initialize(document, [
+{:ok, state_chart} = Statifier.initialize(document, [
log_adapter: :internal,
log_level: :trace
])
@@ -697,10 +704,10 @@ config :statifier,
```elixir
# In dev environment, no additional configuration needed
{:ok, document, _warnings} = Statifier.parse(xml)
-{:ok, state_chart} = Interpreter.initialize(document) # Auto-configured for dev
+{:ok, state_chart} = Statifier.initialize(document) # Auto-configured for dev
# Manual configuration for other environments
-{:ok, state_chart} = Interpreter.initialize(document, [
+{:ok, state_chart} = Statifier.initialize(document, [
log_adapter: :elixir,
log_level: :trace
])
diff --git a/README.md b/README.md
index dc8aa08..e3f53a0 100644
--- a/README.md
+++ b/README.md
@@ -72,666 +72,78 @@ An Elixir implementation of SCXML (State Chart XML) state charts with a focus on
- Enhanced datamodel support with JavaScript expression engine
- Enhanced validation for complex SCXML constructs
-## Recent Completions
+## Documentation
-### **✅ Secure Invoke System with Centralized Parameters (v1.9.0)**
+For comprehensive guides, examples, and technical details, see the [Statifier Documentation](https://riddler.github.io/statifier):
-- **`Handler-Based Security`** - Replaces dangerous arbitrary function execution with secure handler registration system
-- **`SCXML Event Compliance`** - Generates proper `done.invoke.{id}`, `error.execution`, and `error.communication` events per specification
-- **`Centralized Parameter Processing`** - Unified `` evaluation with strict (InvokeAction) and lenient (SendAction) error handling modes
-- **`External Service Integration`** - Safe way to integrate SCXML state machines with external services and APIs
-- **`Complete Test Coverage`** - InvokeAction and InvokeHandler modules achieve 100% test coverage
-- **`Parameter Architecture Refactor`** - Consolidated parameter evaluation logic removes code duplication across actions
+- **[Getting Started](https://riddler.github.io/statifier/getting-started)** - Build your first state machine with working examples
+- **[External Services](https://riddler.github.io/statifier/external-services)** - Secure integration with APIs and external systems
+- **[Changelog](https://riddler.github.io/statifier/changelog)** - Recent major feature completions
+- **[Roadmap](https://riddler.github.io/statifier/roadmap)** - Planned features and priorities
-### **✅ Complete History State Support (v1.4.0)**
-
-- **`Shallow History`** - Records and restores immediate children of parent states that contain active descendants
-- **`Deep History`** - Records and restores all atomic descendant states within parent states
-- **`History Tracking`** - Complete `Statifier.HistoryTracker` module with efficient MapSet operations
-- **`History Validation`** - Comprehensive `Statifier.Validator.HistoryStateValidator` with W3C specification compliance
-- **`History Resolution`** - Full W3C SCXML compliant history state transition resolution during interpreter execution
-- **`StateChart Integration`** - History tracking integrated into StateChart lifecycle with recording before onexit actions
-- **`SCION Test Coverage`** - Major improvement in SCION history test compliance (5/8 tests now passing)
-
-### **✅ Multiple Transition Target Support (v1.4.0)**
-
-- **`Space-Separated Parsing`** - Handles `target="state1 state2 state3"` syntax with proper whitespace splitting
-- **`API Enhancement`** - `Statifier.Transition.targets` field (list) replaces `target` field (string) for better readability
-- **`Validator Updates`** - All transition validators updated for list-based target validation with comprehensive testing
-- **`Parallel State Fixes`** - Critical parallel state exit logic improvements with proper W3C SCXML exit set computation
-- **`SCION Compatibility`** - history4b and history5 SCION tests now pass completely with multiple target support
-
-### **✅ SCXML-Compliant Processing Engine**
-
-- **`Microstep/Macrostep Execution`** - Implements SCXML event processing model with microstep (single transition set execution) and macrostep (series of microsteps until stable)
-- **`Eventless Transitions`** - Transitions without event attributes (called NULL transitions in SCXML spec) that fire automatically upon state entry
-- **`Exit Set Computation`** - Implements W3C SCXML exit set calculation algorithm for determining which states to exit during transitions
-- **`LCCA Algorithm`** - Full Least Common Compound Ancestor computation for accurate transition conflict resolution and exit set calculation
-- **`Cycle Detection`** - Prevents infinite loops with configurable iteration limits (100 iterations default)
-- **`Parallel Region Preservation`** - Proper SCXML exit semantics for transitions within and across parallel regions
-- **`Optimal Transition Set`** - SCXML-compliant transition conflict resolution where child state transitions take priority over ancestors
-
-### **✅ Enhanced Parallel State Support**
-
-- **`Cross-Parallel Boundaries`** - Proper exit semantics when transitions leave parallel regions
-- **`Sibling State Management`** - Automatic exit of parallel siblings when transitions exit their shared parent
-- **`Self-Transitions`** - Transitions within parallel regions preserve unaffected parallel regions
-- **`Parallel Ancestor Detection`** - New functions for identifying parallel ancestors and region relationships
-- **`Enhanced Exit Logic`** - All parallel regions properly exited when transitioning to external states
-
-### **✅ Feature-Based Test Validation System**
-
-- **`Statifier.FeatureDetector`** - Analyzes SCXML documents to detect used features
-- **Feature validation** - Tests fail when they depend on unsupported features
-- **False positive prevention** - No more "passing" tests that silently ignore unsupported features
-- **Capability tracking** - Clear visibility into which SCXML features are supported
-
-### **✅ Modular Validator Architecture**
-
-- **`Statifier.Validator`** - Main orchestrator (from 386-line monolith)
-- **`Statifier.Validator.StateValidator`** - State ID validation
-- **`Statifier.Validator.TransitionValidator`** - Transition target validation
-- **`Statifier.Validator.InitialStateValidator`** - All initial state constraints
-- **`Statifier.Validator.ReachabilityAnalyzer`** - State reachability analysis
-- **`Statifier.Validator.Utils`** - Shared utilities
-
-### **✅ Initial State Elements**
-
-- **Parser support** - `` elements with `` children
-- **Interpreter logic** - Proper initial state entry via initial elements
-- **Comprehensive validation** - Conflict detection, target validation, structure validation
-- **Feature detection** - Automatic detection of initial element usage
-
-## Future Extensions
-
-The next major areas for development focus on expanding SCXML feature support:
-
-### **High Priority Features**
-
-- **Executable Content** - `