|
3 | 3 | This document tracks all notable changes to ArgMojo, including new features, API changes, bug fixes, and documentation updates. |
4 | 4 |
|
5 | 5 | <!-- |
6 | | -Comment out unreleased changes here. This file will be edited just before each release to reflect the final changelog for that version. |
| 6 | +Unreleased changes should be commented out from here. This file will be edited just before each release to reflect the final changelog for that version. Otherwise, the users would be confused. |
7 | 7 | --> |
8 | 8 |
|
| 9 | +## 20260404 (v0.5.0) |
| 10 | + |
| 11 | +ArgMojo v0.5.0 introduces the **struct-based declarative API** — define a `Parsable` struct with typed wrapper fields (`Option`, `Flag`, `Positional`, `Count`), call `MyArgs.parse()`, and get typed results. The declarative API coexists with the existing builder API and bridges between them via `to_command()` / `parse_from_command()`. This release also adds asterisk-masked password input and reorganises internal modules. |
| 12 | + |
| 13 | +ArgMojo v0.5.0 targets Mojo v0.26.2. |
| 14 | + |
| 15 | +### ⭐️ New in v0.5.0 |
| 16 | + |
| 17 | +1. **Declarative API core** — `Parsable` trait with compile-time reflection over wrapper-typed fields. Conforming structs need only declare fields and provide `description()`; all parsing, Command-building, and write-back methods are provided as trait defaults (PR #34, #35, #37, #40). |
| 18 | +2. **Wrapper types** — `Option[T, ...]`, `Flag[...]`, `Positional[T, ...]`, `Count[...]` parametric structs encode CLI metadata as compile-time parameters. Conform to the internal `ArgumentLike` trait with `add_to_command()` / `read_from_result()` hooks (PR #34). |
| 19 | +3. **Auto-initialisation** — `Parsable.__init__` uses `mark_initialized` + `comptime for` + `UnsafePointer.init_pointee_move` to default-construct all fields via reflection. Users never need to write `__init__` (PR #37). |
| 20 | +4. **Hybrid bridge** — `to_command()` reflects a `Parsable` struct into an owned `Command` for builder-level customisation; `parse_from_command(cmd^)` parses back into a typed struct (PR #35, #40). |
| 21 | +5. **Dual-return parsing** — `parse_full()` returns `Tuple[Self, ParseResult]` for workflows that need both typed struct fields and raw `ParseResult` access (e.g. subcommand dispatch). `parse_full_from_command(cmd^)` does the same from a pre-configured Command (PR #40, #42). |
| 22 | +6. **Subcommand support** — `subcommands()` hook on `Parsable` returns `List[Command]`; called automatically by `to_command()` for recursive tree assembly. `run(self)` method for leaf command execution. `from_parse_result()` for typed write-back from subcommand results (PR #39, #43). |
| 23 | +7. **Asterisk-masked password input** — `.password[True]()` on `Argument` echoes `*` for each keystroke (sudo-rs style), complementing the existing `.password()` which hides input entirely. Uses raw terminal mode with ICANON/ISIG disabled (PR #32). |
| 24 | + |
| 25 | +### 🦋 Changed in v0.5.0 |
| 26 | + |
| 27 | +1. Remove `Arg` alias for `Argument` and drop `ArgumentLike` from the public export list. The public API now exports: `Argument`, `Command`, `ParseResult`, `Parsable`, `Option`, `Flag`, `Positional`, `Count` (PR #42). |
| 28 | +2. `subcommands()` hook signature changed from `subcommands(mut cmd: Command) raises` to `subcommands() raises -> List[Command]` — returns a list of Commands instead of mutating one (PR #43). |
| 29 | +3. Reorganise `Argument` and `Command` source files into clearly grouped internal sections for readability (PR #33). |
| 30 | + |
| 31 | +### 📚 Documentation and testing in v0.5.0 |
| 32 | + |
| 33 | +- Add `docs/declarative_api_planning.md` — comprehensive design document for the declarative API (PR #33). |
| 34 | +- Add 4 declarative examples: `search.mojo` (pure declarative), `deploy.mojo` (hybrid), `convert.mojo` (full parse + extra builder args), `jomo.mojo` (subcommands with hybrid tree) (PR #41). |
| 35 | +- Add 4 test modules: `test_wrappers.mojo` (wrapper defaults, copy/move, `Flag.__bool__`), `test_declarative.mojo` (to_command, parse_args, from_parse_result), `test_hybrid.mojo` (builder customisation, mutually exclusive, implies, configure pattern), `test_subcommands_declarative.mojo` (flat/nested subcommands, run() dispatch, dual return) (PR #38, #39). |
| 36 | +- Add `test_interactive.mojo` for interactive prompting edge cases (PR #33). |
| 37 | +- Add method matrix table to README, user manual, and planning doc. |
| 38 | +- Update README with declarative API Quick Start, examples table, and project structure. |
| 39 | +- Update user manual with declarative API usage guide, full-parse section, and API summary. |
| 40 | + |
| 41 | +--- |
| 42 | + |
9 | 43 | ## 20260321 (v0.4.0) |
10 | 44 |
|
11 | 45 | ArgMojo v0.4.0 adds interactive prompting, password input, confirmation, argument parents, custom usage lines, response files, CJK-aware help formatting, and full-width auto-correction. The builder API is fully parameterised with compile-time `StringLiteral` parameters. The codebase is migrated to Mojo v0.26.2 and the test suite consolidated from 20 files into 8 modules. |
|
0 commit comments