Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"name": "bmad-core-tools",
"version": "7.0.0",
"description": "BMad Agent (setup, updates, help), adaptive document facilitation, brainstorming, deep research, party mode, and multi-lens review.",
"description": "Required base for BMad plugins: BMad Agent (setup, updates, help), adaptive document facilitation, brainstorming, deep research, party mode, and multi-lens review.",
"author": {
"name": "Brian (BMad) Madison"
},
Expand All @@ -33,7 +33,7 @@
{
"name": "bmad-method",
"version": "7.0.0",
"description": "AI software delivery from idea to release with Mary, John, Sally, Winston, Sofia, and Amelia, plus right-sized build and review workflows.",
"description": "AI software delivery from idea to release with Mary, John, Sally, Winston, Sofia, and Amelia, plus right-sized build and review workflows. (Requires bmad-core-tools)",
"author": {
"name": "Brian (BMad) Madison"
},
Expand All @@ -56,7 +56,7 @@
{
"name": "bmad-toolsmith",
"version": "7.0.0",
"description": "Build, convert, review, package, migrate, and evaluate standalone or BMad skills, memory agents, and custom modules with Smithy and bmad-eval.",
"description": "Build, convert, review, package, migrate, and evaluate standalone or BMad skills, memory agents, and custom modules with Smithy and bmad-eval. (Requires bmad-core-tools)",
"author": {
"name": "Brian (BMad) Madison"
},
Expand All @@ -78,7 +78,7 @@
{
"name": "bmad-founder",
"version": "7.0.0",
"description": "Nadia, the Founder Advisor: startup diagnostics, customer evidence, Python runway and cap-table math, pitch decks, and an investor Pitch Room.",
"description": "Nadia, the Founder Advisor: startup diagnostics, customer evidence, Python runway and cap-table math, pitch decks, and an investor Pitch Room. (Requires bmad-core-tools)",
"author": {
"name": "Brian (BMad) Madison"
},
Expand All @@ -101,7 +101,7 @@
{
"name": "bmad-creative",
"version": "7.0.0",
"description": "Clio, the Creative Director: voice-grounded talks, essays, scripts, stories, worlds, visual decks, and non-code creative problem solving.",
"description": "Clio, the Creative Director: voice-grounded talks, essays, scripts, stories, worlds, visual decks, and non-code creative problem solving. (Requires bmad-core-tools)",
"author": {
"name": "Brian (BMad) Madison"
},
Expand All @@ -123,7 +123,7 @@
{
"name": "bmad-tea",
"version": "4.6.2",
"description": "Murat, the Test Architect: risk-based test strategy, framework setup, automation, test review, NFR assessment, traceability, and release gates.",
"description": "Murat, the Test Architect: risk-based test strategy, framework setup, automation, test review, NFR assessment, traceability, and release gates. (Requires bmad-core-tools)",
"author": {
"name": "Brian (BMad) Madison"
},
Expand All @@ -145,7 +145,7 @@
{
"name": "bmad-loop",
"version": "0.13.2",
"description": "Unattended ticket-tree build orchestrator: wires and resolves autonomous implementation, verification, and commit loops across coding agents.",
"description": "Unattended ticket-tree build orchestrator: wires and resolves autonomous implementation, verification, and commit loops across coding agents. (Requires bmad-core-tools and bmad-method)",
"author": {
"name": "Brian (BMad) Madison"
},
Expand Down
14 changes: 7 additions & 7 deletions .cursor-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,37 @@
{
"name": "bmad-core-tools",
"source": "plugins/core-tools",
"description": "BMad Agent (setup, updates, help), adaptive document facilitation, brainstorming, deep research, party mode, and multi-lens review."
"description": "Required base for BMad plugins: BMad Agent (setup, updates, help), adaptive document facilitation, brainstorming, deep research, party mode, and multi-lens review."
},
{
"name": "bmad-method",
"source": "plugins/method",
"description": "AI software delivery from idea to release with Mary, John, Sally, Winston, Sofia, and Amelia, plus right-sized build and review workflows."
"description": "AI software delivery from idea to release with Mary, John, Sally, Winston, Sofia, and Amelia, plus right-sized build and review workflows. (Requires bmad-core-tools)"
},
{
"name": "bmad-toolsmith",
"source": "plugins/toolsmith",
"description": "Build, convert, review, package, migrate, and evaluate standalone or BMad skills, memory agents, and custom modules with Smithy and bmad-eval."
"description": "Build, convert, review, package, migrate, and evaluate standalone or BMad skills, memory agents, and custom modules with Smithy and bmad-eval. (Requires bmad-core-tools)"
},
{
"name": "bmad-founder",
"source": "plugins/founder",
"description": "Nadia, the Founder Advisor: startup diagnostics, customer evidence, Python runway and cap-table math, pitch decks, and an investor Pitch Room."
"description": "Nadia, the Founder Advisor: startup diagnostics, customer evidence, Python runway and cap-table math, pitch decks, and an investor Pitch Room. (Requires bmad-core-tools)"
},
{
"name": "bmad-creative",
"source": "plugins/creative",
"description": "Clio, the Creative Director: voice-grounded talks, essays, scripts, stories, worlds, visual decks, and non-code creative problem solving."
"description": "Clio, the Creative Director: voice-grounded talks, essays, scripts, stories, worlds, visual decks, and non-code creative problem solving. (Requires bmad-core-tools)"
},
{
"name": "bmad-tea",
"source": "plugins/tea",
"description": "Murat, the Test Architect: risk-based test strategy, framework setup, automation, test review, NFR assessment, traceability, and release gates."
"description": "Murat, the Test Architect: risk-based test strategy, framework setup, automation, test review, NFR assessment, traceability, and release gates. (Requires bmad-core-tools)"
},
{
"name": "bmad-loop",
"source": "plugins/bmad-loop",
"description": "Unattended ticket-tree build orchestrator: wires and resolves autonomous implementation, verification, and commit loops across coding agents."
"description": "Unattended ticket-tree build orchestrator: wires and resolves autonomous implementation, verification, and commit loops across coding agents. (Requires bmad-core-tools and bmad-method)"
}
]
}
229 changes: 229 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
name: Sync Upstream Plugins

on:
workflow_dispatch:
inputs:
only:
description: Comma-separated plugin names or dirs (leave blank for all)
required: false
default: ""
type: string
upload_zips:
description: Upload dist/*.zip artifacts even when no sync PR is created or updated
required: false
default: true
type: boolean
repository_dispatch:
types: [upstream-release]
schedule:
- cron: "17 */6 * * *"

concurrency:
group: sync-upstream-plugins
cancel-in-progress: false

permissions:
contents: write
pull-requests: write

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.PLUGINS_SYNC_TOKEN || github.token }}
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Check existing open sync PR state
id: pr_state
env:
GH_TOKEN: ${{ secrets.PLUGINS_SYNC_TOKEN || github.token }}
ONLY_PLUGINS: ${{ inputs.only || '' }}
run: |
set -euo pipefail
EXISTING="$(gh pr list --repo "$GITHUB_REPOSITORY" --head chore/sync-upstream-plugins --base main --state open --limit 100 --json number,isCrossRepository --jq '[.[] | select(.isCrossRepository | not)][0].number // empty')"
echo "existing_pr=$EXISTING" >> "$GITHUB_OUTPUT"
if [ -n "$EXISTING" ] && [ -n "$ONLY_PLUGINS" ]; then
echo "::error::An open sync PR (#$EXISTING) already exists on chore/sync-upstream-plugins; merge or close it, or re-run with 'only' blank for a full sync." >&2
exit 1
fi

- name: Rebuild plugins from upstream
env:
ONLY_PLUGINS: ${{ inputs.only || '' }}
run: |
set -euo pipefail
if [ -n "$ONLY_PLUGINS" ]; then
python3 -B release.py --only "$ONLY_PLUGINS"
else
python3 -B release.py
fi

- name: Validate unit tests, manifests, and portal archives
run: |
set -euo pipefail
python3 -B -m unittest -v test_release.py
python3 -B release.py --validate
python3 -B release.py --zip-existing

- name: Check for new changes vs main and any open sync PR
id: diff
env:
GH_TOKEN: ${{ secrets.PLUGINS_SYNC_TOKEN || github.token }}
EXISTING_PR: ${{ steps.pr_state.outputs.existing_pr }}
run: |
set -euo pipefail
if git status --porcelain | grep -E '(^| )(dist/|__pycache__/)'; then
echo "error: dist/ or __pycache__/ appeared in git status" >&2
exit 1
fi
if [ -n "$(find plugins -name '__pycache__')" ]; then
echo "error: __pycache__ created inside plugins/" >&2
exit 1
fi

if [ -z "$(git status --porcelain)" ]; then
echo "needs_push=false" >> "$GITHUB_OUTPUT"
echo "needs_pr=false" >> "$GITHUB_OUTPUT"
if [ -n "$EXISTING_PR" ]; then
echo "close_stale_pr=true" >> "$GITHUB_OUTPUT"
else
echo "close_stale_pr=false" >> "$GITHUB_OUTPUT"
fi
exit 0
Comment thread
bmadcode marked this conversation as resolved.
Resolved
fi

echo "close_stale_pr=false" >> "$GITHUB_OUTPUT"

TMP_IDX="$(mktemp)"
trap 'rm -f "$TMP_IDX"' EXIT
cp .git/index "$TMP_IDX"
GIT_INDEX_FILE="$TMP_IDX" git add -A
TREE_SHA="$(GIT_INDEX_FILE="$TMP_IDX" git write-tree)"
echo "tree_sha=$TREE_SHA" >> "$GITHUB_OUTPUT"

NEEDS_PUSH=true
if git rev-parse --verify -q refs/remotes/origin/chore/sync-upstream-plugins >/dev/null; then
REMOTE_TREE="$(git rev-parse 'refs/remotes/origin/chore/sync-upstream-plugins^{tree}')"
if [ "$REMOTE_TREE" = "$TREE_SHA" ] && git merge-base --is-ancestor HEAD refs/remotes/origin/chore/sync-upstream-plugins; then
NEEDS_PUSH=false
fi
fi
echo "needs_push=$NEEDS_PUSH" >> "$GITHUB_OUTPUT"

if [ "$NEEDS_PUSH" = "true" ] || [ -z "$EXISTING_PR" ]; then
echo "needs_pr=true" >> "$GITHUB_OUTPUT"
exit 0
fi

PR_BODY="$(gh pr view "$EXISTING_PR" --repo "$GITHUB_REPOSITORY" --json body --jq '.body // ""')"
if printf '%s\n' "$PR_BODY" | grep -Fq -- "<!-- sync-tree:${TREE_SHA} -->"; then
echo "needs_pr=false" >> "$GITHUB_OUTPUT"
else
echo "needs_pr=true" >> "$GITHUB_OUTPUT"
fi

- name: Close obsolete sync pull request
if: steps.diff.outputs.close_stale_pr == 'true'
env:
GH_TOKEN: ${{ secrets.PLUGINS_SYNC_TOKEN || github.token }}
EXISTING_PR: ${{ steps.pr_state.outputs.existing_pr }}
run: |
set -euo pipefail
gh pr close "$EXISTING_PR" --repo "$GITHUB_REPOSITORY" \
--comment "Closing automatically: rebuilt plugins from upstream now match \`main\`."
RC=0
git ls-remote --exit-code --heads origin chore/sync-upstream-plugins >/dev/null || RC=$?
if [ "$RC" -eq 0 ]; then
git push origin --delete chore/sync-upstream-plugins
elif [ "$RC" -ne 2 ]; then
echo "::warning::git ls-remote failed with exit code $RC while checking chore/sync-upstream-plugins" >&2
exit "$RC"
fi

- name: Upload OpenAI/Codex portal .zip artifacts
id: upload_zips
if: steps.diff.outputs.needs_pr == 'true' || (github.event_name == 'workflow_dispatch' && inputs.upload_zips)
uses: actions/upload-artifact@v4
with:
name: bmad-plugins-zips
path: dist/*.zip
retention-days: 14
if-no-files-found: error

- name: Open or update sync pull request
if: steps.diff.outputs.needs_pr == 'true'
Comment thread
bmadcode marked this conversation as resolved.
Resolved
env:
GH_TOKEN: ${{ secrets.PLUGINS_SYNC_TOKEN || github.token }}
USING_SYNC_TOKEN: ${{ secrets.PLUGINS_SYNC_TOKEN != '' }}
EXISTING_PR: ${{ steps.pr_state.outputs.existing_pr }}
NEEDS_PUSH: ${{ steps.diff.outputs.needs_push }}
TREE_SHA: ${{ steps.diff.outputs.tree_sha }}
UPLOAD_OUTCOME: ${{ steps.upload_zips.outcome }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
if [ "$NEEDS_PUSH" = "true" ]; then
git switch -C chore/sync-upstream-plugins
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "chore(release): sync plugins from upstream"
git push --force origin chore/sync-upstream-plugins
fi

BODY_FILE="$(mktemp)"
trap 'rm -f "$BODY_FILE"' EXIT
python3 -B - "$BODY_FILE" "$RUN_URL" "$USING_SYNC_TOKEN" "$TREE_SHA" "$UPLOAD_OUTCOME" <<'PY'
import json
import sys
import tomllib
from pathlib import Path

out_path = Path(sys.argv[1])
run_url = sys.argv[2]
using_sync_token = sys.argv[3].lower() == "true"
tree_sha = sys.argv[4]
upload_outcome = sys.argv[5]

mp = json.loads(Path(".claude-plugin/marketplace.json").read_text(encoding="utf-8"))
catalog = tomllib.loads(Path("catalog.toml").read_text(encoding="utf-8"))
rows = [f"| `{p['name']}` | `{p['version']}` |" for p in mp.get("plugins", [])]
for bundle in catalog.get("portal_bundles", []):
manifest = json.loads(Path(f"plugins/{bundle['dir_name']}/.claude-plugin/plugin.json").read_text(encoding="utf-8"))
rows.append(f"| `{bundle['name']}` (portal bundle) | `{manifest['version']}` |")

lines = [
"Automated plugin sync from upstream default branches.",
"",
"| Plugin | Version |",
"| --- | --- |",
*rows,
]
if upload_outcome == "success":
lines.extend([
"",
f"Downloadable OpenAI/Codex portal `.zip` archives are attached to [this workflow run]({run_url}) (`bmad-plugins-zips`).",
])
if not using_sync_token:
lines.extend([
"",
"> Note: Built and validated inside the sync workflow above. Because `PLUGINS_SYNC_TOKEN` is unset, `pull_request` checks triggered by `GITHUB_TOKEN` require a maintainer with write access to approve workflows before running.",
])
lines.extend(["", f"<!-- sync-tree:{tree_sha} -->"])
out_path.write_text("\n".join(lines) + "\n", encoding="utf-8")
PY

if [ -n "$EXISTING_PR" ]; then
gh pr edit "$EXISTING_PR" --repo "$GITHUB_REPOSITORY" --body-file "$BODY_FILE"
else
gh pr create --repo "$GITHUB_REPOSITORY" --base main --head chore/sync-upstream-plugins \
--title "chore(release): sync plugins from upstream" \
--body-file "$BODY_FILE"
fi
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ python3 release.py --zip-existing
python3 -m unittest -v test_release.py
```

### Automated Upstream Sync

`.github/workflows/sync.yml` runs against `main` on a 6-hour schedule, manual **Actions -> Sync Upstream Plugins -> Run workflow** (`workflow_dispatch`), or `repository_dispatch` (`upstream-release`). It rebuilds plugins from upstream default branches, runs unit tests plus `--validate` / `--zip-existing`, uploads `dist/*.zip` portal artifacts (`bmad-plugins-zips`) whenever a sync PR is created or updated (or on manual dispatch with `upload_zips` enabled), and opens or updates a PR on `chore/sync-upstream-plugins` (skipping redundant commits/pushes if the open PR already matches upstream, closing an obsolete sync PR if upstream matches `main` again, and never pushing directly to `main`).

For repository permissions:

- Enable **Settings -> Actions -> General -> Workflow permissions -> Allow GitHub Actions to create and approve pull requests** if using the default `GITHUB_TOKEN` (note: `pull_request` workflow runs for PRs opened or updated by `GITHUB_TOKEN` require approval from a maintainer with write access before running, while `sync.yml` already runs every check before opening or updating the PR).
- Or configure a **`PLUGINS_SYNC_TOKEN`** secret (`contents: write` and `pull-requests: write`) so `Validate Plugins` CI runs automatically on generated sync PRs without manual approval. Cross-repo `repository_dispatch` (`upstream-release`) triggers from upstream repos likewise require an appropriately scoped token in those repos.

## License & Trademarks

MIT — see [LICENSE](LICENSE) and [TRADEMARK.md](TRADEMARK.md). See [Contributors](https://github.com/bmad-code-org/BMAD-METHOD/blob/main/CONTRIBUTORS.md) in [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD).
Loading
Loading