Repository navigation
feat(bmad): add polyrepo workspace linking, root stacking, and no-_bmad degradation - #3313
Conversation
[High impact] Shared BMad configuration and planning workflows can now inherit settings across repositories. Fix module-default expansion and setup's overwriting of inherited workspace settings before merging. FindingsFix with agent prompt### Issue 1
skills/core-tools/bmad/scripts/config_utils.py:1004-1005
If an installed module declares `reports_folder = "{project-root}/reports/{directory_name}"` and that key has not been saved yet, `load_module_defaults` returns the literal `{directory_name}` placeholder. Setup expands the same default to the project folder name, so resolving or rendering before setup uses a different, incorrect folder. Expand `{directory_name}` against the effective project root when loading runtime defaults.
### Issue 2
skills/core-tools/bmad/scripts/setup.py:658-666
If the workspace sets `modules.acme.depth = "thorough"` and the module ships `depth = "standard"`, setting up a child repo writes `"standard"` into its local `_bmad/config.toml`. That local layer overrides the workspace's choice and blocks later workspace updates. The new inheritance check preserves `core.output_folder`, but module defaults need the same check before setup writes them locally.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds workspace links, workspace-to-repo configuration layers, shared ticket stores, and
|
|
Addressed both review findings and the Windows subprocess test issue in
Added regression coverage for both scenarios in |
|
Fixed the sparse-target interaction in
@greptileai please re-review. |
c81ca57 to
a21b69c
Compare
687f1a3 to
07befe6
Compare
a21b69c to
398f9ae
Compare
07befe6 to
155c502
Compare
…mization Add `[bmod.defaults]` support in bmod.toml (validating table shape and key uniqueness against `config_questions`), 4-layer central config precedence with home-installed module discovery and `resolve_config.py --check`, `_bmad/custom/rules.toml` / `rules.user.toml` cross-skill rule matching (skipping heterogeneous type mismatches gracefully with `--check` warnings and read-only linked-worktree fallbacks), unified customization across all four surfaces in `bmad-customize` with trigger evals, and aligned reference docs and tests.
…ation Ensure `render_skill.render()` preserves explicit/project `skill_roots` precedence ahead of `skill_dir.parent`, validate per-harness `core.models.<harness>` and `core.capabilities.<harness>` tables inside `check_central_config()`, validate list element shapes across cross-skill rules and per-skill overrides, allow populated `[bmod.defaults]` tables with sibling non-colliding `config_questions` keys, and invoke `READ_RE` explicitly in the `scan_config_reads` open-table test.
Include `.agent/skills`, `.cline/skills`, `.bob/skills`, and `.adal/skills` in `DEFAULT_SKILL_ROOT_CANDIDATES` and `HOME_SKILL_ROOT_CANDIDATES` so automatic `[bmod.defaults]` discovery covers all supported tool installs without requiring `--root`, and rename the regression test cleanly.
…ad degradation
Add pure-Python `git config bmad.workspace` discovery across repos,
linked worktrees, and submodules with exact git-config escaping/line
continuation and diagnostic reporting; stack workspace-to-repo central
and skill customization layers with per-layer `{project-root}` / `file:`
and relative path anchoring plus `core.standalone = true` and
`--no-workspace` isolation; keep `setup.py` workspace-aware for shared
`output_folder` and answered module questions; enforce cross-boundary
write safety for mutating setup and onboarding CLI calls; update
`tickets.py` (with `--no-workspace`), `read_store.py`, and
`eval_common.py` for workspace-linked and stacked stores; fix non-`_bmad`
fallbacks in `resolve_personas.py` and `resolve_party.py`; and document
multi-repo, worktree, standalone, and harness skill-discovery topologies
with comprehensive test coverage.
…ing, and UTF-8 test subprocesses Pass `include_workspace` into initial root discovery across `resolve_config.py`, `resolve_customization.py`, and `render_skill.py` so `--no-workspace` without `--project-root` never leaks an inherited outer workspace root when a linked or child repository has no local `_bmad/`. Track cumulative outer-layer metadata when anchoring sparse `knowledge_sources.<id>.target` and `artifact_destinations.<id>.target` overrides in `config_utils.central_config_layers_for_roots`. Pin UTF-8 decoding on subprocess test runners in `test_story17_polyrepo_and_degradation.py` so Windows runs decode UTF-8 CLI output cleanly.
Update `effective_merged` across inner repository layers as well as outer layers inside `central_config_layers_for_roots`, so workspace personal overrides that change only `target` observe any intermediate repo-team `kind` override and never rewrite non-path external targets as filesystem paths.
155c502 to
169c897
Compare
| if raw_defaults and code not in modules_defaults: | ||
| modules_defaults[code] = copy.deepcopy(raw_defaults) |
There was a problem hiding this comment.
Defaults keep literal folder placeholders
If an installed module declares reports_folder = "{project-root}/reports/{directory_name}" and that key has not been saved yet, load_module_defaults returns the literal {directory_name} placeholder. Setup expands the same default to the project folder name, so resolving or rendering before setup uses a different, incorrect folder. Expand {directory_name} against the effective project root when loading runtime defaults.
Prompt To Fix With AI
This is a comment left during a code review.
Path: skills/core-tools/bmad/scripts/config_utils.py
Line: 1004-1005
Comment:
**Defaults keep literal folder placeholders**
If an installed module declares `reports_folder = "{project-root}/reports/{directory_name}"` and that key has not been saved yet, `load_module_defaults` returns the literal `{directory_name}` placeholder. Setup expands the same default to the project folder name, so resolving or rendering before setup uses a different, incorrect folder. Expand `{directory_name}` against the effective project root when loading runtime defaults.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| outer_root, outer_team, _outer_user = _outer_workspace_layers(project_root) | ||
| if ( | ||
| outer_root is not None | ||
| and lookup(outer_team, ("core", "output_folder")) is not _MISSING | ||
| and lookup(existing, ("core", "output_folder")) is _MISSING | ||
| and isinstance(template.get("core"), dict) | ||
| ): | ||
| # Preserve workspace-inherited output_folder instead of stamping a repo default over it. | ||
| template["core"].pop("output_folder", None) |
There was a problem hiding this comment.
Setup hides shared module settings
If the workspace sets modules.acme.depth = "thorough" and the module ships depth = "standard", setting up a child repo writes "standard" into its local _bmad/config.toml. That local layer overrides the workspace's choice and blocks later workspace updates. The new inheritance check preserves core.output_folder, but module defaults need the same check before setup writes them locally.
Prompt To Fix With AI
This is a comment left during a code review.
Path: skills/core-tools/bmad/scripts/setup.py
Line: 658-666
Comment:
**Setup hides shared module settings**
If the workspace sets `modules.acme.depth = "thorough"` and the module ships `depth = "standard"`, setting up a child repo writes `"standard"` into its local `_bmad/config.toml`. That local layer overrides the workspace's choice and blocks later workspace updates. The new inheritance check preserves `core.output_folder`, but module defaults need the same check before setup writes them locally.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Implements Story 17 atop PR #3311 (
story-04-phase-2-module-defaults-rules-customize), decoupling workspace linking, multi-repo_bmad/config/customization layering, Obeya planning/store resolution, and non-_bmadgraceful degradation:git config bmad.workspace <path>):.git->gitdir->commondir), and submodules inconfig_utils.py,tickets.py, andeval_common.py, handling escaping in/outside quotes, backslash-newline continuations, inline comments, and empty/invalid entries without spawninggitsubprocesses.find_linked_workspace_root,find_outer_workspace_root, andworkspace_link_diagnostics, wiringworkspace_linkintosetup.py --statusandbroken-workspace-linkintoresolve_config.py --check.rules.toml/rules.user.toml), per-skill overrides, and module setup answers (find_bmad_roots), anchoring{project-root},file:references (including workspace paths with spaces), and relative paths only on outer layers while preserving Story 16 worktree main-checkout fallbacks on inner layers.core.standalone = trueacross central config layers (with strictboolvalidation in--check) and--no-workspaceCLI isolation inresolve_config.py,resolve_customization.py,render_skill.py,tickets.py, andread_store.py.setup.pyworkspace-aware so inherited workspaceoutput_folderand answered module questions are neither shadowed nor re-asked, while enforcing cross-boundary write safety for mutatingsetup.pyandstartup_check.pyruns.tickets.py,read_store.py):ticketing-store-config.toml, locatesfrontmatter.pyacross stacked roots, supports--no-workspacein both scripts, and halts cleanly when required_bmad/runtime state is absent._bmadgraceful degradation & docs:"can't open file"subprocess noise in isolatedresolve_personas.pyandresolve_party.pyruns when neither_bmad/nor siblingbmad/exists.docs/reference/configuration.md,docs/customize/adopt-bmad-across-a-team.md,skills/core-tools/bmod-core-tools/help/team-adoption.md, andskills/core-tools/bmad/references/setup.mdcovering single-repo, shared-parent polyrepo, scattered polyrepo, out-of-tree worktrees, standalone opt-out, and harness.gitskill-discovery boundaries (including Antigravity).Stacked PR Order
story-04-remove-global-bmad->dev)story-16-git-worktree-bmad-root->story-04-remove-global-bmad)story-04-phase-2-module-defaults-rules-customize->story-16-git-worktree-bmad-root)story-17-polyrepo-workspace-obeya-decoupling->story-04-phase-2-module-defaults-rules-customize)Verification
uv run --frozen python -B -m pytest:1703 passed, 1 skipped, 372 subtests passeduv run ruff check&uv run ruff format --check: passing cleanlyuv run tools/validate_skills.py --strict,uv run tools/validate_file_refs.py --strict,uv run skills/core-tools/bmad/scripts/validate_manifests.py,uv run tools/check_help_freshness.py, andprepass.py: passing cleanlynpm --prefix docs-site run validate-links&npm --prefix docs-site run build: passing cleanly