Commit graph

3 commits

Author SHA1 Message Date
Jeremie Fraeys
3e557e4565
fix(cli): correct const qualifier in jupyter lifecycle
Fixed compilation error in jupyter/lifecycle.zig:
- Changed 'const client' to 'var client' in ConnectionCtx.init()
- Allows errdefer client.close() to work correctly
- close() requires mutable reference to ws.Client

All tests pass.
2026-03-05 10:57:57 -05:00
Jeremie Fraeys
923ccaf22b
refactor(cli): consolidate config parsing duplication in jupyter/lifecycle.zig
Introduce ConnectionCtx helper struct that encapsulates the common pattern:
- Config.load() + getWebSocketUrl() + hashApiKey() + Client.connect()

Applied to 4 functions in lifecycle.zig:
- startJupyter (was 76 lines, now 58 lines)
- stopJupyter (was 62 lines, now 44 lines)
- removeJupyter (was 101 lines, now 83 lines)
- restoreJupyter (was 62 lines, now 44 lines)

Total reduction: ~50 lines of duplicated boilerplate code.
Also created commands/common.zig for future shared patterns.

All tests pass.
2026-03-05 09:55:28 -05:00
Jeremie Fraeys
90e5c6dc17
refactor(cli): modularize jupyter command
Break down jupyter.zig (31KB, 906 lines) into focused modules:
- jupyter/mod.zig - Main entry point and command dispatch
- jupyter/validation.zig - Security validation functions
- jupyter/lifecycle.zig - Service create/start/stop/remove/restore
- jupyter/query.zig - List, status, and package queries
- jupyter/workspace.zig - Workspace and experiment management

Original jupyter.zig now acts as backward-compatible wrapper.
Removed 5 unimplemented placeholder functions (~50 lines of dead code).

Benefits:
- Each module <250 lines (maintainable)
- Clear separation of concerns
- Easier to test individual components
- Better code organization

All tests pass.
2026-03-04 21:55:37 -05:00