Module Development Guide
This guide defines the required structure and contracts for authoring SpecFact modules.
Modules docs handoff: this page remains in the core docs set as release-line overview content. Canonical bundle-specific deep guidance now lives in the canonical modules docs site, currently published at
https://modules.specfact.io/.
Official workflow bundle implementation now lives in the dedicated nold-ai/specfact-cli-modules
repository. specfact-cli owns the lean runtime, registry, marketplace lifecycle, shared
contracts, and bundle loading/orchestration surfaces consumed by installed bundles.
Required structure
specfact-cli-modules/
packages/<bundle-package>/
pyproject.toml
src/<bundle_namespace>/<command_or_feature>/
__init__.py
app.py
commands.py
specfact-cli/
src/specfact_cli/
registry/
groups/
common/
adapters/
models/
For local/project-scoped modules discovered by the CLI, keep the configured module root structure
under <repo>/.specfact/modules or ~/.specfact/modules and ensure marketplace metadata remains
compatible with the runtime loader.
module-package.yaml schema
Required fields:
name: module or bundle identifierversion: semantic version stringcommands: command names provided by this module or package entrypoint
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 or update the package/module manifest (
module-package.yaml) and package metadata in the modules repository. - Implement command entrypoints in the bundle package namespace.
- Ensure runtime loader/import paths remain compatible with
specfact-cliregistry discovery and bundle grouping. - Run format/type-check/lint/contract/signature checks in the owning repository.
- Keep core-only docs and runtime contracts in
specfact-cli; keep bundle behavior/docs with the modules repo whenever possible.