Skip to content

py-strictcli@v0.21.0

Choose a tag to compare

@smm-h smm-h released this 05 Sep 14:52
· 2634 commits to main since this release

Command declaration framework: structured handler returns, programmatic invocation, typed args, config fields, compound types, tool export, MCP projection, and scope-based check filtering.

Context

This release transforms strictcli from a CLI framework into a command declaration framework with multiple output projections. Commands declared once can be invoked via CLI (existing), programmatic API (app.call/acall), tool export (as_tools with JSON Schema), and MCP server (--mcp flag).

Key additions: handlers can return structured data (backward compatible -- int returns still work), positional args gain type and choices support, first-class config fields with per-command binding and startup validation, compound types (list[T] and dict[str,T]), command visibility (hidden/interactive), schema enrichment with versioning and constraint serialization, and declarative scope field on check definitions with set_scope_adapter() for context-dependent pre-check filtering.

Features

  • [strictcli] New feature. Programmatic invocation via app.call() and app.acall() with InvokeError exception for structured error handling.
  • [strictcli] New feature. Schema versioning with schema_version field, constraint serialization (mutex, CoRequired, Requires, Implies), tag contracts, and arg defaults in --dump-schema output.
  • [strictcli] New feature. Typed positional args with type (str/int/float/bool) and choices support, matching the flag type system.
  • [strictcli] New feature. Command visibility: hidden and interactive declarations with help text filtering and schema serialization.
  • [strictcli] New feature. First-class config fields with config_field() declarations, per-command binding, startup validation, config init template generation, and unknown-key rejection.
  • [strictcli] New feature. Compound types list[T] and dict[str, T] on flags and args with projection-specific CLI parsing.
  • [strictcli] New feature. Tool export: json_schema(), as_tools(), Tool dataclass, and router tool for AI agent integration.
  • [strictcli] New feature. MCP projection via serve_mcp() and --mcp flag for Model Context Protocol tool serving.
  • [strictcli] New feature. Optional scope field on check definitions for declarative pre-check context filtering, and set_scope_adapter() method on App for registering scope transformation callbacks.

Fixes

  • [strictcli] Fix. Validate unknown kwargs and enforce required globals in passthrough invoke path.