Skip to content

Commit 039da8b

Browse files
authored
feat: module-migration-02 bundle extraction (#332)
* docs: add module-migration-02-bundle-extraction to CHANGE_ORDER.md * feat: implement module-migration-02 bundle extraction * fix(ci): checkout module bundles repo for test jobs * Fix test failures * fix(modules): load local bundle sources in compatibility aliases * fix: run worktree policy code in tests/CI and silence reexport deprecation - Prefer src/<name>/main.py over app.py when SPECFACT_REPO_ROOT is set so policy init uses worktree templates.py (SPECFACT_POLICY_TEMPLATES_DIR). - Policy engine module-package.yaml: version 0.1.5 and re-signed checksum. - conftest: set SPECFACT_REPO_ROOT, SPECFACT_POLICY_TEMPLATES_DIR; add bundle package roots when specfact-cli-modules present. - Policy engine integration tests: rely on conftest env, clear registry and re-register before invoke so loader uses worktree. - test_reexport_shims: filter deprecation warning for legacy analyze import. Made-with: Cursor * fix: defer specfact_backlog import in shims so CI can register bridges - backlog and policy_engine __init__.py: import specfact_backlog only in __getattr__ (cached), not at module load. Allows loading .src.adapters.* for bridge registration without requiring specfact_backlog installed. - Re-sign backlog and policy_engine module-package.yaml after init changes. - openspec: update module-migration-02 tasks.md. Made-with: Cursor * fix: defer bundle import in all module shims to fix CI collection errors - Apply deferred import (only in __getattr__, cached) to analyze, contract, drift, enforce, generate, import_cmd, migrate, patch_mode, plan, project, repro, sdd, spec, sync, validate. Matches backlog and policy_engine. - Prevents ImportError when tests import specfact_cli.modules.<name>.src.* without specfact_backlog/specfact_govern/specfact_project/specfact_spec installed (e.g. CI). Fixes 78 collection errors. - Re-sign all affected module-package.yaml manifests. Made-with: Cursor * fix(ci): include module shims in hatch cache key so CI uses current code * feat(modules): registry descriptions, --bump-version for publish, tasks and format fixes - Add description to registry index entries in publish-module.py (module search) - Add --bump-version patch|minor|major for bundle re-publish in publish-module.py - Format fixes in validate-modules-repo-sync.py (SIM108, B007) - Mark completed tasks in module-migration-02-bundle-extraction tasks.md - Update test for publish_bundle(bump_version=) signature Made-with: Cursor * Add missing migration tasks to the open change to completely isolate modules into specfact-cli-modules repo. * Add gap analysis and update changes * Update follow-up changes to avoid ambiguities and overlaps * docs: complete migration-02 section-18 parity and 17.8 gate evidence * docs: mark migration-02 import-categorization commit checkpoint done * Update change constraints and blockers for module migration * docs: add migration-05 issue #334 and complete task 17.10.4 * Update change constraints and blockers for module migration --------- Co-authored-by: Dominikus Nold <djm81@users.noreply.github.com>
1 parent c480e19 commit 039da8b

File tree

139 files changed

+4894
-27322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+4894
-27322
lines changed

.github/workflows/pr-orchestrator.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ jobs:
118118
- uses: actions/checkout@v4
119119
if: needs.changes.outputs.skip_tests_dev_to_main != 'true'
120120

121+
- name: Checkout module bundles repo
122+
if: needs.changes.outputs.skip_tests_dev_to_main != 'true'
123+
uses: actions/checkout@v4
124+
with:
125+
repository: nold-ai/specfact-cli-modules
126+
path: specfact-cli-modules
127+
ref: ${{ (github.ref == 'refs/heads/main' || github.head_ref == 'main') && 'main' || 'dev' }}
128+
129+
- name: Export module bundles path
130+
if: needs.changes.outputs.skip_tests_dev_to_main != 'true'
131+
run: echo "SPECFACT_MODULES_REPO=${GITHUB_WORKSPACE}/specfact-cli-modules" >> "$GITHUB_ENV"
132+
121133
- name: Set up Python 3.12
122134
if: needs.changes.outputs.skip_tests_dev_to_main != 'true'
123135
uses: actions/setup-python@v5
@@ -140,7 +152,7 @@ jobs:
140152
path: |
141153
~/.local/share/hatch
142154
~/.cache/uv
143-
key: ${{ runner.os }}-hatch-tests-py312-${{ hashFiles('pyproject.toml') }}
155+
key: ${{ runner.os }}-hatch-tests-py312-${{ hashFiles('pyproject.toml', 'src/specfact_cli/modules/*/__init__.py') }}
144156
restore-keys: |
145157
${{ runner.os }}-hatch-tests-py312-
146158
${{ runner.os }}-hatch-
@@ -214,6 +226,14 @@ jobs:
214226
contents: read
215227
steps:
216228
- uses: actions/checkout@v4
229+
- name: Checkout module bundles repo
230+
uses: actions/checkout@v4
231+
with:
232+
repository: nold-ai/specfact-cli-modules
233+
path: specfact-cli-modules
234+
ref: ${{ (github.ref == 'refs/heads/main' || github.head_ref == 'main') && 'main' || 'dev' }}
235+
- name: Export module bundles path
236+
run: echo "SPECFACT_MODULES_REPO=${GITHUB_WORKSPACE}/specfact-cli-modules" >> "$GITHUB_ENV"
217237
- name: Set up Python 3.11
218238
uses: actions/setup-python@v5
219239
with:
@@ -231,7 +251,7 @@ jobs:
231251
path: |
232252
~/.local/share/hatch
233253
~/.cache/uv
234-
key: ${{ runner.os }}-hatch-compat-py311-${{ hashFiles('pyproject.toml') }}
254+
key: ${{ runner.os }}-hatch-compat-py311-${{ hashFiles('pyproject.toml', 'src/specfact_cli/modules/*/__init__.py') }}
235255
restore-keys: |
236256
${{ runner.os }}-hatch-compat-py311-
237257
${{ runner.os }}-hatch-
@@ -261,6 +281,14 @@ jobs:
261281
contents: read
262282
steps:
263283
- uses: actions/checkout@v4
284+
- name: Checkout module bundles repo
285+
uses: actions/checkout@v4
286+
with:
287+
repository: nold-ai/specfact-cli-modules
288+
path: specfact-cli-modules
289+
ref: ${{ (github.ref == 'refs/heads/main' || github.head_ref == 'main') && 'main' || 'dev' }}
290+
- name: Export module bundles path
291+
run: echo "SPECFACT_MODULES_REPO=${GITHUB_WORKSPACE}/specfact-cli-modules" >> "$GITHUB_ENV"
264292
- name: Set up Python 3.12
265293
uses: actions/setup-python@v5
266294
with:
@@ -278,7 +306,7 @@ jobs:
278306
path: |
279307
~/.local/share/hatch
280308
~/.cache/uv
281-
key: ${{ runner.os }}-hatch-contract-first-py312-${{ hashFiles('pyproject.toml') }}
309+
key: ${{ runner.os }}-hatch-contract-first-py312-${{ hashFiles('pyproject.toml', 'src/specfact_cli/modules/*/__init__.py') }}
282310
restore-keys: |
283311
${{ runner.os }}-hatch-contract-first-py312-
284312
${{ runner.os }}-hatch-

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ If remote cleanup is needed:
154154
git push origin --delete feature/<branch-slug>
155155
```
156156

157+
### Developing specfact-cli-modules (IDE dependencies)
158+
159+
Bundle code in **specfact-cli-modules** imports from `specfact_cli` (models, runtime, validators, etc.). That repo uses **Hatch**: a `pyproject.toml` with optional dependency `.[dev]` pulls in `specfact-cli` from a sibling path (`file://../specfact-cli`). When opening the modules repo in Cursor/VS Code:
160+
161+
- In **specfact-cli-modules**: run `hatch env create` (with specfact-cli at `../specfact-cli`, or symlink / edit path in pyproject), then in the IDE select **Python: Select Interpreter**`.venv` in that repo.
162+
- See **specfact-cli-modules** `README.md` → "Local development (IDE / Cursor)" for sibling layout and worktree/symlink options.
163+
157164
### Pre-Commit Checklist
158165

159166
Run all steps in order before committing. Every step must pass with no errors.

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ All notable changes to this project will be documented in this file.
88
**Important:** Changes need to be documented below this block as this is the header section. Each section should be separated by a horizontal rule. Newer changelog entries need to be added on top of prior ones to keep the history chronological with most recent changes first.
99

1010

11+
---
12+
13+
## [0.40.0] - 2026-02-28
14+
15+
### Added
16+
17+
- Official marketplace bundle extraction (OpenSpec change `module-migration-02-bundle-extraction`, issue [#316](https://github.com/nold-ai/specfact-cli/issues/316)): five bundle packages (`specfact-project`, `specfact-backlog`, `specfact-codebase`, `specfact-spec`, `specfact-govern`) are now produced in the dedicated `nold-ai/specfact-cli-modules` repository.
18+
- Official-tier trust model in module validation and display: `official` tier verification path with `nold-ai` publisher allowlist and `[official]` module list badge.
19+
- Bundle dependency auto-install in module installer: installing `nold-ai/specfact-spec` or `nold-ai/specfact-govern` now auto-installs `nold-ai/specfact-project` when missing.
20+
- Bundle publishing mode in `scripts/publish-module.py` (`--bundle` and `--modules-repo-dir`) for packaging/signing/index updates against the dedicated modules repository.
21+
- New marketplace bundles guide: `docs/guides/marketplace.md`.
22+
23+
### Changed
24+
25+
- Module source relocation to bundle namespaces with compatibility shims: legacy `specfact_cli.modules.*` imports now re-export from `specfact_<bundle>.*` namespaces during migration.
26+
- Official module install output now explicitly confirms verification status (`Verified: official (nold-ai)`).
27+
- Documentation updates across getting-started, docs landing page, module categories, marketplace guides, layout navigation, and root README to reflect marketplace-distributed official bundles.
28+
29+
### Deprecated
30+
31+
- Legacy flat import paths under `specfact_cli.modules.*` are deprecated in favor of bundle namespaces (`specfact_project.*`, `specfact_backlog.*`, `specfact_codebase.*`, `specfact_spec.*`, `specfact_govern.*`) and are planned for removal in the next major release.
32+
1133
---
1234

1335
## [0.39.0] - 2026-02-28

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,27 @@ For technical architecture details (module lifecycle, registry internals, adapte
188188
- [Architecture Docs Index](docs/architecture/README.md)
189189
- [Architecture Implementation Status](docs/architecture/implementation-status.md)
190190

191+
### Official Marketplace Bundles
192+
193+
SpecFact ships official bundle packages via the dedicated marketplace registry repository
194+
`nold-ai/specfact-cli-modules`.
195+
196+
Install examples:
197+
198+
```bash
199+
specfact module install nold-ai/specfact-project
200+
specfact module install nold-ai/specfact-backlog
201+
specfact module install nold-ai/specfact-codebase
202+
specfact module install nold-ai/specfact-spec
203+
specfact module install nold-ai/specfact-govern
204+
```
205+
206+
Official bundles are verified as `official` tier (`nold-ai` publisher). Some bundles
207+
auto-install dependencies:
208+
209+
- `nold-ai/specfact-spec` pulls `nold-ai/specfact-project`
210+
- `nold-ai/specfact-govern` pulls `nold-ai/specfact-project`
211+
191212
---
192213

193214
## Where SpecFact Fits

docs/_layouts/default.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ <h2 class="docs-sidebar-title">
150150
<li><a href="{{ '/guides/extending-projectbundle/' | relative_url }}">Extending ProjectBundle</a></li>
151151
<li><a href="{{ '/guides/installing-modules/' | relative_url }}">Installing Modules</a></li>
152152
<li><a href="{{ '/guides/module-marketplace/' | relative_url }}">Module Marketplace</a></li>
153+
<li><a href="{{ '/guides/marketplace/' | relative_url }}">Marketplace Bundles</a></li>
153154
<li><a href="{{ '/guides/module-signing-and-key-rotation/' | relative_url }}">Module Signing and Key Rotation</a></li>
154155
<li><a href="{{ '/guides/using-module-security-and-extensions/' | relative_url }}">Using Module Security and Extensions</a></li>
155156
<li><a href="{{ '/brownfield-engineer/' | relative_url }}">Working With Existing Code</a></li>

docs/getting-started/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ specfact init --profile solo-developer
5050
specfact init --install backlog,codebase
5151
```
5252

53+
Marketplace bundle install examples:
54+
55+
```bash
56+
specfact module install nold-ai/specfact-codebase
57+
specfact module install nold-ai/specfact-backlog
58+
```
59+
60+
Official bundles are published in the `nold-ai/specfact-cli-modules` registry and verified as `official` tier during install.
61+
Some bundles install dependencies automatically:
62+
63+
- `nold-ai/specfact-spec` -> pulls `nold-ai/specfact-project`
64+
- `nold-ai/specfact-govern` -> pulls `nold-ai/specfact-project`
65+
5366
### Modernizing Legacy Code?
5467

5568
**New to brownfield modernization?** See our **[Brownfield Engineer Guide](../guides/brownfield-engineer.md)** for a complete walkthrough of modernizing legacy Python code with SpecFact CLI.

docs/guides/marketplace.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
layout: default
3+
title: Marketplace Bundles
4+
nav_order: 23
5+
permalink: /guides/marketplace/
6+
description: Official SpecFact bundle IDs, trust tiers, and bundle dependency behavior.
7+
---
8+
9+
# Marketplace Bundles
10+
11+
SpecFact publishes official workflow bundles in the dedicated modules repository:
12+
13+
- Registry repository: <https://github.com/nold-ai/specfact-cli-modules>
14+
- Registry index: `registry/index.json`
15+
16+
## Official Bundles
17+
18+
Install commands:
19+
20+
```bash
21+
specfact module install nold-ai/specfact-project
22+
specfact module install nold-ai/specfact-backlog
23+
specfact module install nold-ai/specfact-codebase
24+
specfact module install nold-ai/specfact-spec
25+
specfact module install nold-ai/specfact-govern
26+
```
27+
28+
Bundle overview:
29+
30+
- `nold-ai/specfact-project`: project lifecycle commands (`project`, `plan`, `import`, `sync`, `migrate`)
31+
- `nold-ai/specfact-backlog`: backlog and policy workflows (`backlog`, `policy`)
32+
- `nold-ai/specfact-codebase`: codebase analysis and validation (`analyze`, `drift`, `validate`, `repro`)
33+
- `nold-ai/specfact-spec`: API/spec workflows (`contract`, `api`, `sdd`, `generate`)
34+
- `nold-ai/specfact-govern`: governance and patch workflows (`enforce`, `patch`)
35+
36+
## Trust Tiers
37+
38+
Marketplace modules are validated with tier and publisher metadata:
39+
40+
- `official`: trusted publisher allowlist (`nold-ai`) with official verification output
41+
- `community`: signed/verified community publisher module
42+
- unsigned/local-dev: local or unsigned content, intended for development workflows only
43+
44+
When listing modules, official modules display an `[official]` marker.
45+
When installing an official bundle, output confirms verification (for example `Verified: official (nold-ai)`).
46+
47+
## Bundle Dependencies
48+
49+
Some bundles declare bundle-level dependencies that are auto-installed:
50+
51+
- `nold-ai/specfact-spec` auto-installs `nold-ai/specfact-project`
52+
- `nold-ai/specfact-govern` auto-installs `nold-ai/specfact-project`
53+
54+
If a dependency bundle is already installed, installer skips it and continues.
55+
56+
## See Also
57+
58+
- [Module Marketplace](module-marketplace.md)
59+
- [Installing Modules](installing-modules.md)
60+
- [Module Categories](../reference/module-categories.md)

docs/guides/module-marketplace.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ description: Registry model, discovery priority, trust semantics, and security c
99

1010
SpecFact supports centralized marketplace distribution with local multi-source discovery.
1111

12+
For the curated official bundle list and trust/dependency quick reference, see
13+
[Marketplace Bundles](marketplace.md).
14+
1215
## Registry Overview
1316

1417
- **Official registry**: <https://github.com/nold-ai/specfact-cli-modules> (index: `registry/index.json`)

docs/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,17 @@ See [Module Categories](reference/module-categories.md) for full mappings and pr
141141

142142
SpecFact now supports a central marketplace workflow for module installation and lifecycle management.
143143

144+
Official bundles are now marketplace-distributed as `nold-ai/specfact-*` modules:
145+
146+
- `nold-ai/specfact-project`
147+
- `nold-ai/specfact-backlog`
148+
- `nold-ai/specfact-codebase`
149+
- `nold-ai/specfact-spec`
150+
- `nold-ai/specfact-govern`
151+
144152
- **[Installing Modules](guides/installing-modules.md)** - Install, list, uninstall, and upgrade modules
145153
- **[Module Marketplace](guides/module-marketplace.md)** - Registry model, security checks, and discovery priority
154+
- **[Marketplace Bundles](guides/marketplace.md)** - Official bundle ids, trust tiers, and dependency auto-install behavior
146155
- **[Module Signing and Key Rotation](guides/module-signing-and-key-rotation.md)** - Signing and key management runbook
147156

148157
Module lifecycle note: use `specfact module` (`init`, `install`, `list`, `show`, `search`, `enable`, `disable`, `uninstall`, `upgrade`) for module management.

docs/reference/module-categories.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,25 @@ Category command groups:
5858
- `specfact-spec`: `contract`, `api`, `sdd`, `generate`
5959
- `specfact-govern`: `enforce`, `patch`
6060

61+
## Bundle Package Layout and Namespaces
62+
63+
Official bundle packages are published from the dedicated modules repository:
64+
65+
- Repository: `nold-ai/specfact-cli-modules`
66+
- Package roots: `packages/specfact-project/`, `packages/specfact-backlog/`, `packages/specfact-codebase/`, `packages/specfact-spec/`, `packages/specfact-govern/`
67+
68+
Namespace mapping:
69+
70+
- `specfact-project` -> import namespace `specfact_project.*`
71+
- `specfact-backlog` -> import namespace `specfact_backlog.*`
72+
- `specfact-codebase` -> import namespace `specfact_codebase.*`
73+
- `specfact-spec` -> import namespace `specfact_spec.*`
74+
- `specfact-govern` -> import namespace `specfact_govern.*`
75+
76+
Compatibility note:
77+
78+
- Legacy `specfact_cli.modules.*` import paths remain as re-export shims during migration.
79+
6180
## First-Run Profiles
6281

6382
`specfact init` supports profile presets and explicit bundle selection:

0 commit comments

Comments
 (0)