Module Development Guide
This guide defines the required structure and contracts for authoring SpecFact modules.
Required structure
src/specfact_cli/modules/<module-name>/
module-package.yaml
src/
__init__.py
app.py
commands.py
For workspace-level modules, keep the same structure under the configured modules root.
module-package.yaml schema
Required fields:
name: module identifierversion: semantic version stringcommands: top-level command names provided by this module
Common optional fields:
command_helppip_dependenciesmodule_dependenciescore_compatibilitytieraddon_id
Extension/security fields:
schema_extensionsservice_bridgespublisherintegrity
Command code expectations
src/app.pyexposes the Typerappused by registry loaders.src/commands.pyholds command handlers and options.- Public APIs should use contract-first decorators:
@icontract(@require,@ensure)@beartype
Naming and design conventions
- File/module names:
snake_case - Classes:
PascalCase - Keep command implementations scoped to module boundaries.
- Use
get_bridge_loggerfor production command logging paths.
Integration checklist
- Add
module-package.yaml. - Implement
src/app.pyandsrc/commands.py. - Ensure loader/import path works with registry discovery.
- Run format/type-check/lint/contract checks.