You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: explicit human views, composable field/column selection, --schema short-circuit
Assign human views to commands explicitly with CommandSpec::with_view (inline
columns) or with_view_id (shared view); the implicit command-path/system lookup
is removed and system is now pure backend attribution. --fields (defaulting to
default_fields) selects JSON fields when there is no view, or view columns when
there is one. --schema short-circuits for any leaf command and reports when no
schema is registered instead of running the command.
BREAKING CHANGE: human views are no longer inferred from the command path or
system — assign them with CommandSpec::with_view or with_view_id or they will
not apply. Human output now honors default_fields and --fields narrows a
registered view's columns, so human tables that previously showed every column
now show only the selected set. New public fields were added to CommandSpec
(view_columns, view_id) and MiddlewareRequest (view_id).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Register schemas with `.with_json_schema::<T>()` when a Rust response type exists.
242
238
- Use manual `OutputSchema`, `OutputField`, `FieldInfo`, and `SchemaInfo` only when generated JSON Schema is not practical.
243
-
-Register human views with `HumanViewDef::new` and `TableColumn::new` when a command needs column-oriented terminal output.
239
+
-Assign a human view to a command with `.with_view(vec![TableColumn::new(...), ...])` for an inline table, or `.with_view_id("shared-id")` to reuse a `HumanViewDef` registered on the module/CLI.
244
240
- Keep stdout machine-friendly and stderr human-friendly for executable paths.
245
241
246
242
Handlers should not print directly. Return data or an error and let the framework render the output envelope.
@@ -255,7 +251,7 @@ For agentic programming tools generating a new CLI or module:
255
251
2. Create or update the module file first.
256
252
3. Define response structs with `Serialize` and `JsonSchema` for command output.
257
253
4. Add command specs and handlers with the builder API.
258
-
5.Register human views for list commands.
254
+
5.Assign human views to list commands with `.with_view(...)` (or `.with_view_id(...)`).
259
255
6. Add integration tests that call `Cli::run(...)` or the consumer binary and assert exit code, stdout shape, stderr shape, and key output fields.
// Registered on the module/CLI with `.with_view(...)`:
544
+
letshared=HumanViewDef::new(
545
+
"projects-table",
530
546
vec![
531
547
TableColumn::new("id", "ID"),
532
548
TableColumn::new("name", "Name"),
533
549
TableColumn::new("status", "Status"),
534
550
],
535
551
);
552
+
553
+
// Referenced from any command that should use it:
554
+
letspec=CommandSpec::new("get", "Get a project").with_view_id("projects-table");
536
555
```
537
556
557
+
Field selection composes with views. `--fields` (defaulting to the command's `default_fields`) selects which JSON fields appear when there is no view, and which of a view's columns appear when there is one. So a command with a view of `id`/`name`/`status` columns and `default_fields = "id,name"` shows just those two columns by default; `--fields all` shows every column, and `--fields id,status` shows that pair. A custom view renderer receives the full payload and
558
+
ignores field selection.
559
+
538
560
## Guides
539
561
540
562
Guides are markdown documents registered with the CLI or with modules. They document workflows,
0 commit comments