Skip to content

Commit 6cd2eb9

Browse files
ST0008: orthogonalising output styling and formatting
1 parent b9f79be commit 6cd2eb9

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

intent/st/ST0008/design.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Leverage Arca.Cli's existing callback system (ST0003) to create an orthogonal ou
66

77
1. Extends callbacks beyond REPL mode to ALL command execution
88
2. Adds a context structure for carrying structured output data
9-
3. Provides style renderers for different output modes (fancy, plain, dump)
9+
3. Provides style renderers for different output modes (ansi, plain, json, dump)
1010
4. Maintains full backwards compatibility with existing commands
1111

1212
The system follows pure functional Elixir idioms with composable functions and pattern matching throughout.
@@ -84,7 +84,7 @@ The system follows pure functional Elixir idioms with composable functions and p
8484
┌────┴────┐
8585
▼ ▼
8686
┌──────────┐ ┌──────────┐
87-
Fancy │ │ Plain │
87+
ANSI │ │ Plain │
8888
│ Renderer │ │ Renderer │
8989
└──────────┘ └──────────┘
9090
```
@@ -94,8 +94,9 @@ The system follows pure functional Elixir idioms with composable functions and p
9494
```elixir
9595
Arca.Cli.Ctx # Context struct and composition functions
9696
Arca.Cli.Output # Main rendering pipeline
97-
Arca.Cli.Output.FancyRenderer # Colored, formatted output
97+
Arca.Cli.Output.AnsiRenderer # Colored, formatted output
9898
Arca.Cli.Output.PlainRenderer # No ANSI codes
99+
Arca.Cli.Output.JsonRenderer # JSON structured output
99100
Arca.Cli.Output.DumpRenderer # Raw data inspection
100101
```
101102

@@ -137,7 +138,7 @@ Arca.Cli.Output.DumpRenderer # Raw data inspection
137138
{:list, items, title: title}
138139
{:text, content}
139140

140-
# Interactive elements (fancy mode only)
141+
# Interactive elements (ansi mode only)
141142
{:spinner, label, func}
142143
{:progress, label, func}
143144
```
@@ -148,16 +149,16 @@ Arca.Cli.Output.DumpRenderer # Raw data inspection
148149

149150
1. Add `Arca.Cli.Ctx` module with composition functions
150151
2. Add `Arca.Cli.Output` module with rendering pipeline
151-
3. Implement FancyRenderer and PlainRenderer modules
152+
3. Implement AnsiRenderer and PlainRenderer modules
152153
4. Register `:format_command_result` callback point
153154
5. Update `execute_command` to handle Ctx returns
154155

155-
### Phase 2: Global Options
156+
### Phase 2: Style Control
156157

157-
1. Add `--style` option to global CLI options
158-
2. Add `--no-ansi` as alias for `--style plain`
159-
3. Add environment variable support (NO_COLOR)
160-
4. Update help text to document new options
158+
1. Add environment variable support:
159+
- `ARCA_STYLE` to set output style (ansi, plain, json, dump)
160+
- `NO_COLOR` to force plain output
161+
2. Automatic style detection based on environment
161162

162163
### Phase 3: Testing & Documentation
163164

@@ -230,10 +231,12 @@ end
230231
mix my.cli command
231232

232233
# Force plain style
233-
mix my.cli --style plain command
234-
mix my.cli --no-ansi command
234+
ARCA_STYLE=plain mix my.cli command
235235
NO_COLOR=1 mix my.cli command
236236

237+
# Use JSON output
238+
ARCA_STYLE=json mix my.cli command
239+
237240
# Test environment (automatic plain)
238241
MIX_ENV=test mix my.cli command
239242
```

intent/st/ST0008/done.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@
317317
- Renamed FancyRenderer module to AnsiRenderer
318318
- Updated all test files and references
319319
- Updated environment variable handling
320-
- Updated global CLI options
321320
- Maintained full backwards compatibility
322321
- All 306 tests passing after refactor
323322

@@ -380,6 +379,12 @@
380379

381380
---
382381

382+
## GitHub Actions Fix
383+
384+
**Issue**: AnsiRenderer tests were failing in GitHub Actions because TERM environment variable wasn't set.
385+
386+
**Solution**: Added `TERM: xterm` to `.github/workflows/ci_cd.yml` environment variables to ensure AnsiRenderer detects a terminal environment in CI.
387+
383388
## Test Coverage
384389

385390
- All tests passing (337 tests total in project)
@@ -393,7 +398,7 @@
393398
- PlainRenderer, AnsiRenderer, and JsonRenderer fully functional
394399
- Output module integrated with Arca.Cli main flow
395400
- Callbacks integrated with rendering pipeline
396-
- Global CLI options functional and tested
401+
- Environment variable style control functional and tested
397402
- Three commands migrated to Context pattern: sys.info, settings.all, cli.history
398403
- No breaking changes to existing code
399404
- Full backwards compatibility maintained

intent/st/ST0008/tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**Overall Status**: 80% Complete (8 of 10 work packages)
66

7-
- ✅ Completed: WP1 (Context Module), WP2 (Plain Renderer), WP3 (ANSI Renderer), WP4 (Output Pipeline), WP5 (Callback Integration), WP6 (Command Execution Integration), WP7 (Global Options), WP8 (Command Migration) - See done.md
7+
- ✅ Completed: WP1 (Context Module), WP2 (Plain Renderer), WP3 (ANSI Renderer), WP4 (Output Pipeline), WP5 (Callback Integration), WP6 (Command Execution Integration), WP7 (Environment Variables), WP8 (Command Migration) - See done.md
88
- 🎯 Ready to Start: WP9 (Test Infrastructure Updates)
99
- ⏸️ Blocked: WP10 (Documentation - waiting on WP9)
1010

0 commit comments

Comments
 (0)