Skip to content

Commit 97d3240

Browse files
authored
feat(installer): universal source support for custom module installs (#2233)
* feat(installer): add plugin resolution strategies for custom URL installs When installing from a custom GitHub URL, the installer now analyzes marketplace.json plugin structures to determine how to locate module registration files (module.yaml, module-help.csv). Five strategies are tried in cascade: 1. Root module files at the common parent of listed skills 2. A -setup skill with registration files in its assets/ 3. Single standalone skill with registration files in assets/ 4. Multiple standalone skills, each with their own registration files 5. Fallback: synthesize registration from marketplace.json metadata and SKILL.md frontmatter Also changes the custom URL flow from confirm-all to multiselect, letting users pick which plugins to install. Already-installed modules are pre-checked for update; new modules are unchecked for opt-in. New file: tools/installer/modules/plugin-resolver.js Modified: custom-module-manager.js, official-modules.js, ui.js * fix(installer): address PR review findings for plugin resolver - Guard against path traversal in plugin-resolver.js: skill paths from unverified marketplace.json are now constrained to the repo root using path.resolve() + startsWith check - Skip npm install during browsing phase: cloneRepo() accepts skipInstall option, used in ui.js before user confirms selection, preventing arbitrary lifecycle script execution from untrusted repos - Add createModuleDirectories() call to installFromResolution() so modules with declarative directory config are fully set up - Fix ESLint: use replaceAll instead of replace with global regex * fix(installer): pass version and repoUrl to manifest for custom plugins installFromResolution was passing empty strings for version and repoUrl, which the manifest stores as null. Now threads the repo URL from ui.js through resolvePlugin into each ResolvedModule, and passes the plugin version and URL to the manifest correctly. * fix(installer): manifest-generator overwrites custom module version/repoUrl ManifestGenerator rebuilds the entire manifest via getModuleVersionInfo for every module. For custom modules, this returned null for version and repoUrl because it only checked _readMarketplaceVersion (which searches for marketplace.json on disk) and hardcoded repoUrl to null. Now checks the resolution cache first to get the correct version and repo URL. * fix(installer): resolve custom modules from disk cache on quick update When the resolution cache is empty (fresh CLI process, e.g. quick update), findModuleSourceByCode only matched plugin.name against the module code. This failed for modules like "sam" and "dw" where the code comes from module.yaml inside a setup/standalone skill, not from the plugin name in marketplace.json. Now runs the PluginResolver on cached repos when the direct name match fails, finding the correct module source and re-populating the cache for the install pipeline. * feat(installer): universal source support for custom modules Replace GitHub-only custom module installation with support for any Git host (GitHub, GitLab, Bitbucket, self-hosted) and local file paths. - Add parseSource() universal input parser (local paths, SSH, HTTPS with deep path/subdir extraction for GitHub, GitLab, Gitea) - Add resolveSource() coordinator: parse -> clone if URL -> detect discovery vs direct mode (marketplace.json present or not) - Clone-first approach eliminates host-specific raw URL fetching - 3-level cache structure (host/owner/repo) with .bmad-source.json metadata for URL reconstruction - Local paths install directly without caching; localPath persisted in manifest for quick-update source lookup - Direct mode scans target directory for SKILL.md when no marketplace.json - Fix version display bug where walk-up found parent repo marketplace.json and reported wrong version for custom modules * fix(installer): harden readMarketplaceJsonFromDisk and hoist require - Add try/catch to readMarketplaceJsonFromDisk so malformed JSON returns null instead of throwing an unhandled parse error - Hoist CustomModuleManager require outside the per-module loop in _installOfficialModules * fix(installer): restore validateGitHubUrl strictness and fix prettier - Restore original GitHub-only regex in deprecated validateGitHubUrl wrapper so existing tests pass (rejects non-GitHub URLs, trailing slashes) - Run prettier to fix formatting in custom-module-manager.js * feat(installer): add --custom-source CLI flag for non-interactive installs Allows installing custom modules from Git URLs or local paths directly from the command line without interactive prompts: npx bmad-method install --custom-source /path/to/module npx bmad-method install --custom-source https://gitlab.com/org/repo npx bmad-method install --custom-source /path/one,https://host/org/repo Works alongside --modules and --yes flags. All discovered modules from each source are auto-selected. * docs: add custom and community module installation guide New how-to page covering community module browsing, custom sources (any Git host, local paths), discovery vs direct mode, local development workflow, and the --custom-source CLI flag. Clarifies that .claude-plugin/ is a cross-tool convention, not Claude-specific. Also updates non-interactive installation docs with the new flag and examples, bumps sidebar ordering, and fixes --custom-source to install only core + custom modules when --modules is not specified.
1 parent 3ba51e1 commit 97d3240

18 files changed

Lines changed: 1496 additions & 225 deletions

docs/how-to/customize-bmad.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: "How to Customize BMad"
2+
title: 'How to Customize BMad'
33
description: Customize agents, workflows, and modules while preserving update compatibility
44
sidebar:
5-
order: 7
5+
order: 8
66
---
77

88
Use the `.customize.yaml` files to tailor agent behavior, personas, and menus while preserving your changes across updates.
@@ -15,9 +15,10 @@ Use the `.customize.yaml` files to tailor agent behavior, personas, and menus wh
1515
- You want agents to perform specific actions every time they start up
1616

1717
:::note[Prerequisites]
18+
1819
- BMad installed in your project (see [How to Install BMad](./install-bmad.md))
1920
- A text editor for YAML files
20-
:::
21+
:::
2122

2223
:::caution[Keep Your Customizations Safe]
2324
Always use the `.customize.yaml` files described here rather than editing agent files directly. The installer overwrites agent files during updates, but preserves your `.customize.yaml` changes.
@@ -136,10 +137,10 @@ npx bmad-method install
136137

137138
The installer detects the existing installation and offers these options:
138139

139-
| Option | What It Does |
140-
| ---------------------------- | ------------------------------------------------------------------- |
140+
| Option | What It Does |
141+
| ---------------------------- | -------------------------------------------------------------------- |
141142
| **Quick Update** | Updates all modules to the latest version and applies customizations |
142-
| **Modify BMad Installation** | Full installation flow for adding or removing modules |
143+
| **Modify BMad Installation** | Full installation flow for adding or removing modules |
143144

144145
For customization-only changes, **Quick Update** is the fastest option.
145146

docs/how-to/established-projects.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
2-
title: "Established Projects"
2+
title: 'Established Projects'
33
description: How to use BMad Method on existing codebases
44
sidebar:
5-
order: 6
5+
order: 7
66
---
77

88
Use BMad Method effectively when working on existing projects and legacy codebases.
99

1010
This guide covers the essential workflow for onboarding to existing projects with BMad Method.
1111

1212
:::note[Prerequisites]
13+
1314
- BMad Method installed (`npx bmad-method install`)
1415
- An existing codebase you want to work on
1516
- Access to an AI-powered IDE (Claude Code or Cursor)
16-
:::
17+
:::
1718

1819
## Step 1: Clean Up Completed Planning Artifacts
1920

@@ -36,6 +37,7 @@ bmad-generate-project-context
3637
```
3738

3839
This scans your codebase to identify:
40+
3941
- Technology stack and versions
4042
- Code organization patterns
4143
- Naming conventions
@@ -79,10 +81,10 @@ BMad-Help also **automatically runs at the end of every workflow**, providing cl
7981

8082
You have two primary options depending on the scope of changes:
8183

82-
| Scope | Recommended Approach |
83-
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
84+
| Scope | Recommended Approach |
85+
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
8486
| **Small updates or additions** | Run `bmad-quick-dev` to clarify intent, plan, implement, and review in a single workflow. The full four-phase BMad Method is likely overkill. |
85-
| **Major changes or additions** | Start with the BMad Method, applying as much or as little rigor as needed. |
87+
| **Major changes or additions** | Start with the BMad Method, applying as much or as little rigor as needed. |
8688

8789
### During PRD Creation
8890

docs/how-to/get-answers-about-bmad.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: "How to Get Answers About BMad"
2+
title: 'How to Get Answers About BMad'
33
description: Use an LLM to quickly answer your own BMad questions
44
sidebar:
5-
order: 4
5+
order: 5
66
---
77

88
Use BMad's built-in help, source docs, or the community to get answers — from quickest to most thorough.
@@ -46,35 +46,35 @@ If your AI can't read local files (ChatGPT, Claude.ai, etc.), fetch [llms-full.t
4646

4747
If neither BMad-Help nor the source answered your question, you now have a much better question to ask.
4848

49-
| Channel | Use For |
50-
| ------------------------- | ------------------------------------------- |
51-
| `help-requests` forum | Questions |
52-
| `#suggestions-feedback` | Ideas and feature requests |
49+
| Channel | Use For |
50+
| ----------------------- | -------------------------- |
51+
| `help-requests` forum | Questions |
52+
| `#suggestions-feedback` | Ideas and feature requests |
5353

5454
**Discord:** [discord.gg/gk8jAdXWmj](https://discord.gg/gk8jAdXWmj)
5555

5656
**GitHub Issues:** [github.com/bmad-code-org/BMAD-METHOD/issues](https://github.com/bmad-code-org/BMAD-METHOD/issues)
57-
*You!*
58-
*Stuck*
59-
*in the queue—*
60-
*waiting*
61-
*for who?*
62-
63-
*The source*
64-
*is there,*
65-
*plain to see!*
66-
67-
*Point*
68-
*your machine.*
69-
*Set it free.*
70-
71-
*It reads.*
72-
*It speaks.*
73-
*Ask away—*
74-
75-
*Why wait*
76-
*for tomorrow*
77-
*when you have*
78-
*today?*
79-
80-
*—Claude*
57+
_You!_
58+
_Stuck_
59+
_in the queue—_
60+
_waiting_
61+
_for who?_
62+
63+
_The source_
64+
_is there,_
65+
_plain to see!_
66+
67+
_Point_
68+
_your machine._
69+
_Set it free._
70+
71+
_It reads._
72+
_It speaks._
73+
_Ask away—_
74+
75+
_Why wait_
76+
_for tomorrow_
77+
_when you have_
78+
_today?_
79+
80+
_—Claude_

docs/how-to/install-bmad.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "How to Install BMad"
2+
title: 'How to Install BMad'
33
description: Step-by-step guide to installing BMad in your project
44
sidebar:
55
order: 1
@@ -16,10 +16,11 @@ If you want to use a non interactive installer and provide all install options o
1616
- Update the existing BMad Installation
1717

1818
:::note[Prerequisites]
19+
1920
- **Node.js** 20+ (required for the installer)
2021
- **Git** (recommended)
2122
- **AI tool** (Claude Code, Cursor, or similar)
22-
:::
23+
:::
2324

2425
## Steps
2526

@@ -31,6 +32,7 @@ npx bmad-method install
3132

3233
:::tip[Want the newest prerelease build?]
3334
Use the `next` dist-tag:
35+
3436
```bash
3537
npx bmad-method@next install
3638
```
@@ -40,9 +42,11 @@ This gets you newer changes earlier, with a higher chance of churn than the defa
4042

4143
:::tip[Bleeding edge]
4244
To install the latest from the main branch (may be unstable):
45+
4346
```bash
4447
npx github:bmad-code-org/BMAD-METHOD install
4548
```
49+
4650
:::
4751

4852
### 2. Choose Installation Location
@@ -99,11 +103,13 @@ your-project/
99103
Run `bmad-help` to verify everything works and see what to do next.
100104

101105
**BMad-Help is your intelligent guide** that will:
106+
102107
- Confirm your installation is working
103108
- Show what's available based on your installed modules
104109
- Recommend your first step
105110

106111
You can also ask it questions:
112+
107113
```
108114
bmad-help I just installed, what should I do first?
109115
bmad-help What are my options for a SaaS project?
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
title: 'Install Custom and Community Modules'
3+
description: Install third-party modules from the community registry, Git repositories, or local paths
4+
sidebar:
5+
order: 3
6+
---
7+
8+
Use the BMad installer to add modules from the community registry, third-party Git repositories, or local file paths.
9+
10+
## When to Use This
11+
12+
- Installing a community-contributed module from the BMad registry
13+
- Installing a module from a third-party Git repository (GitHub, GitLab, Bitbucket, self-hosted)
14+
- Testing a module you are developing locally with BMad Builder
15+
- Installing modules from a private or self-hosted Git server
16+
17+
:::note[Prerequisites]
18+
Requires [Node.js](https://nodejs.org) v20+ and `npx` (included with npm). Custom and community modules can be selected during a fresh install or added to an existing installation.
19+
:::
20+
21+
## Community Modules
22+
23+
Community modules are curated in the [BMad plugins marketplace](https://github.com/bmad-code-org/bmad-plugins-marketplace). They are organized by category and are pinned to an approved commit for safety.
24+
25+
### 1. Run the Installer
26+
27+
```bash
28+
npx bmad-method install
29+
```
30+
31+
### 2. Browse the Community Catalog
32+
33+
After selecting official modules, the installer asks:
34+
35+
```
36+
Would you like to browse community modules?
37+
```
38+
39+
Select **Yes** to enter the catalog browser. You can:
40+
41+
- Browse by category
42+
- View featured modules
43+
- View all available modules
44+
- Search by keyword
45+
46+
### 3. Select Modules
47+
48+
Pick modules from any category. The installer shows descriptions, versions, and trust tiers. Already-installed modules are pre-checked for update.
49+
50+
### 4. Continue with Installation
51+
52+
After selecting community modules, the installer proceeds to custom sources, then tool/IDE configuration and the rest of the install flow.
53+
54+
## Custom Sources (Git URLs and Local Paths)
55+
56+
Custom modules can come from any Git repository or a local directory on your machine. The installer resolves the source, analyzes the module structure, and installs it alongside your other modules.
57+
58+
### Interactive Installation
59+
60+
During installation, after the community module step, the installer asks:
61+
62+
```
63+
Would you like to install from a custom source (Git URL or local path)?
64+
```
65+
66+
Select **Yes**, then provide a source:
67+
68+
| Input Type | Example |
69+
| --------------------- | ------------------------------------------------- |
70+
| HTTPS URL (any host) | `https://github.com/org/repo` |
71+
| HTTPS URL with subdir | `https://github.com/org/repo/tree/main/my-module` |
72+
| SSH URL | `git@github.com:org/repo.git` |
73+
| Local path | `/Users/me/projects/my-module` |
74+
| Local path with tilde | `~/projects/my-module` |
75+
76+
The installer clones the repository (for URLs) or reads directly from disk (for local paths), then presents the discovered modules for selection.
77+
78+
### Non-Interactive Installation
79+
80+
Use the `--custom-source` flag to install custom modules from the command line:
81+
82+
```bash
83+
npx bmad-method install \
84+
--directory . \
85+
--custom-source /path/to/my-module \
86+
--tools claude-code \
87+
--yes
88+
```
89+
90+
When `--custom-source` is provided without `--modules`, only core and the custom modules are installed. To include official modules as well, add `--modules`:
91+
92+
```bash
93+
npx bmad-method install \
94+
--directory . \
95+
--modules bmm \
96+
--custom-source https://gitlab.com/myorg/my-module \
97+
--tools claude-code \
98+
--yes
99+
```
100+
101+
Multiple sources can be comma-separated:
102+
103+
```bash
104+
--custom-source /path/one,https://github.com/org/repo,/path/two
105+
```
106+
107+
## How Module Discovery Works
108+
109+
The installer uses two modes to find installable modules in a source:
110+
111+
| Mode | Trigger | Behavior |
112+
| --------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------- |
113+
| Discovery | Source contains `.claude-plugin/marketplace.json` | Lists all plugins from the manifest; you pick which to install |
114+
| Direct | No marketplace.json found | Scans the directory for skills (subdirectories with `SKILL.md`), resolves as a single module |
115+
116+
Discovery mode is typical for published modules. Direct mode is convenient when pointing at a skills directory during local development.
117+
118+
:::note[About `.claude-plugin/`]
119+
The `.claude-plugin/marketplace.json` path is a standard convention adopted across multiple AI tool installers for plugin discoverability. It does not require Claude, does not use Claude APIs, and has no effect on which AI tool you use. Any module with this file can be discovered by any installer that follows the convention.
120+
:::
121+
122+
## Local Development Workflow
123+
124+
If you are building a module with [BMad Builder](https://github.com/bmad-code-org/bmad-builder), you can install it directly from your working directory:
125+
126+
```bash
127+
npx bmad-method install \
128+
--directory ~/my-project \
129+
--custom-source ~/my-module-repo/skills \
130+
--tools claude-code \
131+
--yes
132+
```
133+
134+
Local sources are referenced by path, not copied to a cache. When you update your module source and reinstall, the installer picks up the latest changes.
135+
136+
:::caution[Source Removal]
137+
If you delete the local source directory after installation, the installed module files in `_bmad/` are preserved. The module will be skipped during updates until the source path is restored.
138+
:::
139+
140+
## What You Get
141+
142+
After installation, custom modules appear in `_bmad/` alongside official modules:
143+
144+
```
145+
your-project/
146+
├── _bmad/
147+
│ ├── core/ # Built-in core module
148+
│ ├── bmm/ # Official module (if selected)
149+
│ ├── my-module/ # Your custom module
150+
│ │ ├── my-skill/
151+
│ │ │ └── SKILL.md
152+
│ │ └── module-help.csv
153+
│ └── _config/
154+
│ └── manifest.yaml # Tracks all modules, versions, and sources
155+
└── ...
156+
```
157+
158+
The manifest records the source of each custom module (`repoUrl` for Git sources, `localPath` for local sources) so that quick updates can locate the source again.
159+
160+
## Updating Custom Modules
161+
162+
Custom modules participate in the normal update flow:
163+
164+
- **Quick update** (`--action quick-update`): Refreshes all modules from their original sources. Git-based modules are re-fetched; local modules are re-read from their source path.
165+
- **Full update**: Re-runs module selection so you can add or remove custom modules.
166+
167+
## Creating Your Own Modules
168+
169+
Use [BMad Builder](https://github.com/bmad-code-org/bmad-builder) to create modules that others can install:
170+
171+
1. Run `bmad-module-builder` to scaffold your module structure
172+
2. Add skills, agents, and workflows with the various bmad builder tools
173+
3. Publish to a Git repository or share the folder collection
174+
4. Others install with `--custom-source <your-repo-url>`
175+
176+
For modules to support discovery mode, include a `.claude-plugin/marketplace.json` in your repository root (this is a cross-tool convention, not Claude-specific). See the [BMad Builder documentation](https://github.com/bmad-code-org/bmad-builder) for the marketplace.json format.
177+
178+
:::tip[Testing Locally First]
179+
During development, install your module with a local path to iterate quickly before publishing to a Git repository.
180+
:::

0 commit comments

Comments
 (0)