Skip to content

Commit 6b7f6fb

Browse files
johnnytclaude
andauthored
Adds docs.validate mix task, runs example tests in CI (#100)
* Adds Statifier.initialize * Runs example tests during CI * Includes README as source for docs in agent * Adds docs.validate mix task * Streamlines README and creates comprehensive docs Co-authored-by: Claude <noreply@anthropic.com>
1 parent d5a6a88 commit 6b7f6fb

22 files changed

Lines changed: 1304 additions & 740 deletions

.claude/agents/docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ You are a specialized documentation agent for the Statifier SCXML library with e
7171

7272
## Specialized Tasks
7373

74-
- Migrate existing CLAUDE.md content to structured Diataxis documentation
74+
- Migrate existing CLAUDE.md and README.md content to structured Diataxis documentation
7575
- Create interactive SCXML examples with state machine visualizations
7676
- Generate API documentation from Elixir modules with @doc annotations
7777
- Develop tutorial series progressing from basic to advanced state machine concepts

.credo.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"src/",
2828
"test/"
2929
],
30-
excluded: [~r"/lib/mix/test", ~r"/lib/mix/quality", ~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
30+
excluded: [~r"/lib/mix", ~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
3131
},
3232
#
3333
# Load and configure plugins here:

.dialyzer_ignore.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
# Ignore all Mix tasks - these are development tools, not core library functionality
3+
~r/lib\/mix\/tasks\/.*/
4+
]

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,39 @@ jobs:
224224

225225
- name: Run regression tests
226226
run: mix test.regression
227+
228+
example-tests:
229+
name: Examples Test Suite
230+
runs-on: ubuntu-latest
231+
defaults:
232+
run:
233+
working-directory: examples
234+
235+
steps:
236+
- name: Checkout code
237+
uses: actions/checkout@v4
238+
239+
- name: Set up Elixir
240+
uses: erlef/setup-beam@v1
241+
with:
242+
elixir-version: '1.18.3'
243+
otp-version: '27.3'
244+
245+
- name: Cache deps
246+
uses: actions/cache@v4
247+
with:
248+
path: |
249+
examples/deps
250+
examples/_build
251+
key: example-deps-${{ runner.os }}-27.3-1.18.3-${{ hashFiles('examples/**/mix.lock') }}
252+
restore-keys: |
253+
example-deps-${{ runner.os }}-27.3-1.18.3-
254+
255+
- name: Install dependencies
256+
run: mix deps.get
257+
258+
- name: Compile project
259+
run: mix compile
260+
261+
- name: Run tests
262+
run: mix test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ erl_crash.dump
2121

2222
# Generated docs site
2323
/docs/.vitepress/dist
24+
/docs/.vitepress/cache
2425

2526
# Ignore package tarball (built via "mix hex.build").
2627
statifier-*.tar

CLAUDE.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ When verifying code changes, always follow this sequence (also automated via pre
4242
- `mix test test/statifier/logging/` - Run comprehensive logging infrastructure tests (30 tests)
4343
- `mix test test/statifier/actions/` - Run action execution tests with integrated StateChart logging
4444

45+
**Documentation:**
46+
47+
- `mix docs.validate` - Validate code examples in documentation files (README.md, docs/*.md)
48+
- `mix docs.validate --file README.md` - Validate specific file only
49+
- `mix docs.validate --verbose` - Show detailed validation output
50+
- `mix docs.validate --path docs/` - Validate specific directory
51+
4552
**Development:**
4653

4754
- `mix deps.get` - Install dependencies
@@ -214,7 +221,7 @@ The implementation follows a clean **Parse → Validate → Optimize** architect
214221
{:ok, optimized_document, warnings} = Statifier.Validator.validate(document)
215222

216223
# 3. Interpret Phase: Use optimized document for runtime
217-
{:ok, state_chart} = Statifier.Interpreter.initialize(optimized_document)
224+
{:ok, state_chart} = Statifier.initialize(optimized_document)
218225
```
219226

220227
**Benefits:**
@@ -376,7 +383,7 @@ invoke_handlers = %{
376383
"email_service" => &MyApp.EmailService.handle_invoke/3
377384
}
378385

379-
{:ok, state_chart} = Interpreter.initialize(document, [
386+
{:ok, state_chart} = Statifier.initialize(document, [
380387
invoke_handlers: invoke_handlers,
381388
log_level: :debug
382389
])
@@ -629,13 +636,13 @@ When debugging state chart execution, configure enhanced logging for detailed vi
629636

630637
```elixir
631638
# Enable detailed tracing for debugging
632-
{:ok, state_chart} = Interpreter.initialize(document, [
639+
{:ok, state_chart} = Statifier.initialize(document, [
633640
log_adapter: :elixir,
634641
log_level: :trace
635642
])
636643

637644
# Alternative: use internal adapter for testing/development
638-
{:ok, state_chart} = Interpreter.initialize(document, [
645+
{:ok, state_chart} = Statifier.initialize(document, [
639646
log_adapter: :internal,
640647
log_level: :trace
641648
])
@@ -697,10 +704,10 @@ config :statifier,
697704
```elixir
698705
# In dev environment, no additional configuration needed
699706
{:ok, document, _warnings} = Statifier.parse(xml)
700-
{:ok, state_chart} = Interpreter.initialize(document) # Auto-configured for dev
707+
{:ok, state_chart} = Statifier.initialize(document) # Auto-configured for dev
701708

702709
# Manual configuration for other environments
703-
{:ok, state_chart} = Interpreter.initialize(document, [
710+
{:ok, state_chart} = Statifier.initialize(document, [
704711
log_adapter: :elixir,
705712
log_level: :trace
706713
])

0 commit comments

Comments
 (0)