From 217c7ec0ed705cb2a637ff07b6e006004a59aeca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eW=C9=98yn?= <5607939+Llewellynvdm@users.noreply.github.com> Date: Mon, 28 Sep 2026 16:03:17 +0200 Subject: [PATCH 1/3] Simplify release workflow to direct Octoleo actions --- .github/workflows/release.yml | 270 +++++----------------------------- 1 file changed, 37 insertions(+), 233 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca99973..a26546a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,12 +4,12 @@ on: workflow_dispatch: inputs: version: - description: 'Stable version to release (for example 1.2.3 or v1.2.3); repeat to resume a failed release' + description: 'Version to release (for example 1.2.3 or v1.2.3)' required: true type: string permissions: - contents: write + contents: read concurrency: group: joomla-extension-release @@ -17,251 +17,55 @@ concurrency: jobs: release: + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest - timeout-minutes: 30 - env: - RELEASE_BRANCH: ${{ vars.RELEASE_BRANCH || github.event.repository.default_branch }} - INPUT_VERSION: ${{ inputs.version }} - OCTOSHOOM_REPOSITORY: ${{ vars.OCTOSHOOM_REPOSITORY }} - OCTOSHOOM_REF: ${{ vars.OCTOSHOOM_REF }} - RELEASE_SSH_KNOWN_HOSTS: ${{ vars.RELEASE_SSH_KNOWN_HOSTS }} - GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} - GIT_AUTHOR_NAME: github-actions[bot] - GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com - GIT_COMMITTER_NAME: github-actions[bot] - GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com - OCTOJPACK_REPOSITORY: ${{ vars.OCTOJPACK_REPOSITORY }} - OCTOJPACK_REF: ${{ vars.OCTOJPACK_REF }} - PACKAGE_REPOSITORY: ${{ vars.PACKAGE_REPOSITORY }} - PACKAGE_BRANCH: ${{ vars.PACKAGE_BRANCH }} - PACKAGE_UPDATE_SERVER: ${{ vars.PACKAGE_UPDATE_SERVER }} - PACKAGE_CHANGELOG_SERVER: ${{ vars.PACKAGE_CHANGELOG_SERVER }} - CONSOLE_REPOSITORY: ${{ vars.CONSOLE_REPOSITORY }} - CONSOLE_TAG: ${{ vars.CONSOLE_TAG }} steps: - - name: Validate release configuration before changing the repository - id: configuration - env: - RELEASE_SSH_KEY: ${{ secrets.RELEASE_SSH_KEY }} - shell: bash - run: | - set -euo pipefail - fail() { echo "::error::$1"; exit 1; } - for variable in RELEASE_BRANCH OCTOSHOOM_REPOSITORY OCTOSHOOM_REF RELEASE_SSH_KNOWN_HOSTS GH_TOKEN RELEASE_SSH_KEY; do - [[ -n "${!variable}" ]] || fail "Configure the required variable or secret: $variable" - done - [[ "$GITHUB_REF" == "refs/heads/$RELEASE_BRANCH" ]] || fail "Run this workflow from $RELEASE_BRANCH." - git check-ref-format "refs/heads/$RELEASE_BRANCH" - [[ "$OCTOSHOOM_REPOSITORY" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]] || fail 'Invalid OCTOSHOOM_REPOSITORY.' - [[ "$OCTOSHOOM_REF" =~ ^[a-fA-F0-9]{40}$ ]] || fail 'Pin OCTOSHOOM_REF to a full reviewed commit SHA.' - version="${INPUT_VERSION#v}" - [[ "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] || fail 'Use a stable version such as 1.2.3.' - printf 'RELEASE_VERSION=%s\nRELEASE_TAG=v%s\n' "$version" "$version" >> "$GITHUB_ENV" - printf 'version=%s\ntag=v%s\n' "$version" "$version" >> "$GITHUB_OUTPUT" - mkdir -p "$RUNNER_TEMP/release-ssh" - chmod 700 "$RUNNER_TEMP/release-ssh" - printf '%s\n' "$RELEASE_SSH_KEY" > "$RUNNER_TEMP/release-ssh/key" - printf '%s\n' "$RELEASE_SSH_KNOWN_HOSTS" > "$RUNNER_TEMP/release-ssh/known_hosts" - chmod 600 "$RUNNER_TEMP/release-ssh/key" "$RUNNER_TEMP/release-ssh/known_hosts" - printf 'GIT_SSH_COMMAND=ssh -i %s/release-ssh/key -o IdentitiesOnly=yes -o UserKnownHostsFile=%s/release-ssh/known_hosts -o StrictHostKeyChecking=yes\n' "$RUNNER_TEMP" "$RUNNER_TEMP" >> "$GITHUB_ENV" - git config --global user.name "$GIT_AUTHOR_NAME" - git config --global user.email "$GIT_AUTHOR_EMAIL" - config="$(jq -cn --arg owner "${GITHUB_REPOSITORY%/*}" --arg repo "${GITHUB_REPOSITORY#*/}" --arg branch "$RELEASE_BRANCH" \ - '{update_servers:[{owner:$owner,repo:$repo,branch:$branch,path:"joomengine_mcp_update_server.xml"}]}')" - printf 'shoom=%s\n' "$config" >> "$GITHUB_OUTPUT" - for variable in OCTOJPACK_REPOSITORY OCTOJPACK_REF PACKAGE_REPOSITORY PACKAGE_BRANCH PACKAGE_UPDATE_SERVER PACKAGE_CHANGELOG_SERVER CONSOLE_REPOSITORY CONSOLE_TAG; do - [[ -n "${!variable}" ]] || fail "Configure the required variable: $variable" - done - for repository in "$OCTOJPACK_REPOSITORY" "$PACKAGE_REPOSITORY" "$CONSOLE_REPOSITORY"; do - [[ "$repository" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]] || fail 'Repository variables must use owner/name.' - done - [[ "$OCTOJPACK_REF" =~ ^[a-fA-F0-9]{40}$ ]] || fail 'Pin OCTOJPACK_REF to a reviewed commit with GitHub tag archive support.' - [[ "$CONSOLE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] || fail 'CONSOLE_TAG must be an immutable released vX.Y.Z tag.' - for source in "$GITHUB_REPOSITORY" "$CONSOLE_REPOSITORY" "$OCTOSHOOM_REPOSITORY" "$OCTOJPACK_REPOSITORY"; do - [[ "${PACKAGE_REPOSITORY,,}" != "${source,,}" ]] || fail 'PACKAGE_REPOSITORY must be a separate distribution repository.' - done - git check-ref-format "refs/heads/$PACKAGE_BRANCH" - [[ "$PACKAGE_UPDATE_SERVER" =~ ^https://[^[:space:]]+$ && "$PACKAGE_CHANGELOG_SERVER" =~ ^https://[^[:space:]]+$ ]] || fail 'Package feed and changelog URLs must be HTTPS URLs.' - - name: Check out the current release branch - uses: actions/checkout@v7 + - uses: actions/checkout@v7 with: - ref: ${{ env.RELEASE_BRANCH }} + ref: main fetch-depth: 0 - token: ${{ secrets.RELEASE_TOKEN }} - - name: Check out the reviewed OctoShoom action - uses: actions/checkout@v7 - with: - repository: ${{ vars.OCTOSHOOM_REPOSITORY }} - ref: ${{ vars.OCTOSHOOM_REF }} - path: .release-actions/octoshoom - token: ${{ secrets.RELEASE_TOKEN }} persist-credentials: false + - name: Setup Git User + uses: octoleo/git-user@v2 + with: + gpg-key: ${{ secrets.GPG_KEY }} + gpg-user: ${{ secrets.GPG_USER }} + ssh-key: ${{ secrets.SSH_KEY }} + ssh-pub: ${{ secrets.SSH_PUB }} + git-user: ${{ secrets.GIT_USER }} + git-email: ${{ secrets.GIT_EMAIL }} - uses: shivammathur/setup-php@v2 with: php-version: '8.3' - extensions: dom, simplexml, zip coverage: none - - name: Check out the reviewed OctoJPack action - uses: actions/checkout@v7 - with: - repository: ${{ vars.OCTOJPACK_REPOSITORY }} - ref: ${{ vars.OCTOJPACK_REF }} - path: .release-actions/octojpack - token: ${{ secrets.RELEASE_TOKEN }} - persist-credentials: false - - name: Verify the released console plugin and separate package destination - shell: bash - run: | - set -euo pipefail - # All prerequisites are checked before publishing the component tag. - gh api "repos/$CONSOLE_REPOSITORY/git/ref/tags/$CONSOLE_TAG" --silent - curl --fail --silent --show-error --location --retry 3 \ - "https://github.com/$CONSOLE_REPOSITORY/archive/refs/tags/$CONSOLE_TAG.zip" --output "$RUNNER_TEMP/console.zip" - console_update_server="$(php -r ' - $zip = new ZipArchive(); - if ($zip->open($argv[1]) !== true) { throw new RuntimeException("Invalid console ZIP."); } - $matches = []; - for ($i = 0; $i < $zip->numFiles; $i++) - { if (preg_match("~^[^/]+/joomengine_mcp.xml$~D", $zip->getNameIndex($i))) { $matches[] = $i; } } - if (count($matches) !== 1) { throw new RuntimeException("Missing console root manifest."); } - $manifest = simplexml_load_string($zip->getFromIndex($matches[0]), SimpleXMLElement::class, LIBXML_NONET); - if ((string) $manifest["type"] !== "plugin" || (string) $manifest["group"] !== "console" - || (string) $manifest->version !== substr($argv[3], 1) - || explode(".", (string) $manifest->version)[0] !== explode(".", $argv[4])[0]) - { throw new RuntimeException("Console tag must have a matching manifest and the same major version as the component."); } - $url = (string) $manifest->updateservers->server; - if (!str_starts_with($url, "https://raw.githubusercontent.com/" . $argv[2] . "/") - || !str_ends_with($url, "/joomengine_mcp_update_server.xml") || preg_match("/[\\x00-\\x20]/", $url)) - { throw new RuntimeException("Console manifest must declare its repository update server."); } - echo $url; - ' "$RUNNER_TEMP/console.zip" "$CONSOLE_REPOSITORY" "$CONSOLE_TAG" "$RELEASE_VERSION")" - curl --fail --silent --show-error --location --retry 3 "$console_update_server" --output "$RUNNER_TEMP/console-feed.xml" - php -r ' - $feed = simplexml_load_file($argv[1], SimpleXMLElement::class, LIBXML_NONET); - $entries = $feed->xpath("update[version=\"" . substr($argv[4], 1) . "\"]"); - $url = "https://github.com/" . $argv[3] . "/archive/refs/tags/" . $argv[4] . ".zip"; - if (count($entries) !== 1 || (string) $entries[0]->type !== "plugin" - || (string) $entries[0]->element !== "joomengine_mcp" || (string) $entries[0]->folder !== "console" - || (string) $entries[0]->downloads->downloadurl !== $url - || !hash_equals(hash_file("sha512", $argv[2]), strtolower((string) $entries[0]->sha512))) - { throw new RuntimeException("Release the console tag and finish its OctoShoom workflow first."); } - ' "$RUNNER_TEMP/console-feed.xml" "$RUNNER_TEMP/console.zip" "$CONSOLE_REPOSITORY" "$CONSOLE_TAG" - git clone --no-checkout --depth=1 --branch "$PACKAGE_BRANCH" \ - "git@github.com:$PACKAGE_REPOSITORY.git" "$RUNNER_TEMP/package-target" - - name: Verify metadata transitions - run: php tests/release.php - - name: Freeze the changelogs and create the immutable tag - shell: bash + - name: Publish the version and Joomla update entry + env: + VERSION: ${{ inputs.version }} run: | - set -euo pipefail - git fetch origin "$RELEASE_BRANCH" --tags - git checkout -B release-source "origin/$RELEASE_BRANCH" - if git show-ref --verify --quiet "refs/tags/$RELEASE_TAG"; then - git merge-base --is-ancestor "$RELEASE_TAG^{commit}" "origin/$RELEASE_BRANCH" - git worktree add --detach "$RUNNER_TEMP/released-source" "$RELEASE_TAG" - php -r 'require $argv[1]; mcpRelease(["verify-tag", $argv[3], $argv[4], $argv[5]], $argv[2]);' \ - tools/release.php "$RUNNER_TEMP/released-source" "$RELEASE_VERSION" "$GITHUB_REPOSITORY" "$RELEASE_BRANCH" - git worktree remove "$RUNNER_TEMP/released-source" - echo "Resuming $RELEASE_TAG; its tag and release metadata remain unchanged." - else - php tools/release.php prepare "$RELEASE_VERSION" "$GITHUB_REPOSITORY" "$RELEASE_BRANCH" - git add joomengine_mcp.xml CHANGELOG.md changelog.xml .octojpack plugins/webservices/joomengine_mcp/joomengine_mcp.xml - git commit -m "Release $RELEASE_TAG" - git tag -a "$RELEASE_TAG" -m "Release $RELEASE_TAG" - git push --atomic origin "HEAD:refs/heads/$RELEASE_BRANCH" "refs/tags/$RELEASE_TAG" + version="${VERSION#v}" + tag="v$version" + git remote set-url origin git@github.com:joomengine/mcp_component.git + if ! git show-ref --verify --quiet "refs/tags/$tag"; then + php tools/release.php prepare "$version" joomengine/mcp_component main + git add joomengine_mcp.xml CHANGELOG.md changelog.xml plugins/webservices/joomengine_mcp/joomengine_mcp.xml + git commit -m "Release $tag" + git tag -a "$tag" -m "Release $tag" + git push --atomic origin HEAD:main "refs/tags/$tag" fi - - name: Add the Joomla update entry after its tag exists - shell: bash - run: | - set -euo pipefail - # Fetch current main again: a retry or another contributor may have advanced it. - git fetch origin "$RELEASE_BRANCH" - git checkout -B release-source "origin/$RELEASE_BRANCH" - php tools/release.php feed "$RELEASE_VERSION" "$GITHUB_REPOSITORY" "$RELEASE_BRANCH" + php tools/release.php feed "$version" joomengine/mcp_component main git add joomengine_mcp_update_server.xml if ! git diff --cached --quiet; then - git commit -m "Add $RELEASE_TAG to the Joomla update server" - git push origin "HEAD:refs/heads/$RELEASE_BRANCH" + git commit -m "Add $tag to the Joomla update server" + git push origin HEAD:main fi - - name: Generate and publish update hashes with OctoShoom - uses: ./.release-actions/octoshoom + - name: Update hashes + uses: octoleo/octoshoom@master with: - config-json: ${{ steps.configuration.outputs.shoom }} - git-url: github.com - git-user: github-actions[bot] - git-email: 41898282+github-actions[bot]@users.noreply.github.com - commit-message: 'Add Joomla release archive SHA-512 values' - - name: Verify the committed SHA-512 against the actual tag download - shell: bash - run: | - set -euo pipefail - git fetch origin "$RELEASE_BRANCH" - git show "origin/$RELEASE_BRANCH:joomengine_mcp_update_server.xml" > joomengine_mcp_update_server.xml - curl --fail --silent --show-error --location --retry 3 \ - "https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/$RELEASE_TAG.zip" \ - --output "$RUNNER_TEMP/released-extension.zip" - php tools/release.php verify-hash "$RELEASE_VERSION" "$GITHUB_REPOSITORY" "$RELEASE_BRANCH" "$RUNNER_TEMP/released-extension.zip" - - name: Render the external package configuration and preserve existing package tags - id: package - shell: bash - run: | - set -euo pipefail - git show "$RELEASE_TAG:.octojpack" > "$RUNNER_TEMP/released.octojpack" - package_name="$(jq -r .package.package_name "$RUNNER_TEMP/released.octojpack")" - target="$RUNNER_TEMP/package-target" - git -C "$target" fetch origin "$PACKAGE_BRANCH" - if [[ -n "$(git -C "$target" ls-remote origin "refs/tags/$RELEASE_TAG")" ]]; then - git -C "$target" fetch --depth=1 origin "refs/tags/$RELEASE_TAG:refs/tags/$RELEASE_TAG" - git -C "$target" show "$RELEASE_TAG:$package_name.xml" > "$RUNNER_TEMP/existing-package.xml" - php -r '$m = simplexml_load_file($argv[1]); if ((string) $m["type"] !== "package" || (string) $m->version !== $argv[2]) { throw new RuntimeException("Existing package tag has conflicting metadata."); }' \ - "$RUNNER_TEMP/existing-package.xml" "$RELEASE_VERSION" - echo 'publish=false' >> "$GITHUB_OUTPUT" - echo "Package $RELEASE_TAG already exists; preserving its tag and destination branch." - exit 0 - fi - if git -C "$target" cat-file -e "FETCH_HEAD:$package_name.xml" 2>/dev/null; then - git -C "$target" show "FETCH_HEAD:$package_name.xml" > "$RUNNER_TEMP/current-package.xml" - php -r '$m = simplexml_load_file($argv[1]); if (version_compare((string) $m->version, $argv[2], ">")) { throw new RuntimeException("Refusing to replace a newer package branch with an older release."); }' \ - "$RUNNER_TEMP/current-package.xml" "$RELEASE_VERSION" - fi - configuration="$(jq -c \ - --arg source_owner "${GITHUB_REPOSITORY%/*}" --arg source_repo "${GITHUB_REPOSITORY#*/}" \ - --arg component_tag "$RELEASE_TAG" --arg console_owner "${CONSOLE_REPOSITORY%/*}" \ - --arg console_repo "${CONSOLE_REPOSITORY#*/}" --arg console_tag "$CONSOLE_TAG" \ - --arg package_owner "${PACKAGE_REPOSITORY%/*}" --arg package_repo "${PACKAGE_REPOSITORY#*/}" \ - --arg package_branch "$PACKAGE_BRANCH" --arg update "$PACKAGE_UPDATE_SERVER" --arg changelog "$PACKAGE_CHANGELOG_SERVER" \ - '.repository = {owner:$package_owner,repo:$package_repo,branch:$package_branch} - | .package.update_servers = $update | .package.changelog_servers = $changelog - | .files[0].owner = $source_owner | .files[0].repo = $source_repo | .files[0].mode = $component_tag - | .files[1].owner = $console_owner | .files[1].repo = $console_repo | .files[1].mode = $console_tag' \ - "$RUNNER_TEMP/released.octojpack")" - [[ "$configuration" != *'[[['* ]] || { echo 'Unresolved OctoJPack configuration value.' >&2; exit 1; } - printf 'config=%s\npublish=true\n' "$configuration" >> "$GITHUB_OUTPUT" - - name: Build and publish the separate Joomla package with OctoJPack - if: steps.package.outputs.publish == 'true' - uses: ./.release-actions/octojpack + config-json: | + {"update_servers":[{"owner":"joomengine","repo":"mcp_component","branch":"main","path":"joomengine_mcp_update_server.xml"}]} + - name: Build and push the package + uses: octoleo/octojpack@master with: - config-json: ${{ steps.package.outputs.config }} - token: ${{ secrets.RELEASE_TOKEN }} - url: github.com - api: https://api.github.com - version: ${{ steps.configuration.outputs.tag }} - licence-dir: ${{ github.workspace }} + config: .octojpack + token: ${{ secrets.GIT_TOKEN }} push: 'true' - upload-artifact: 'true' - - name: Confirm the package tag was published - shell: bash - run: | - set -euo pipefail - git ls-remote --exit-code "git@github.com:$PACKAGE_REPOSITORY.git" "refs/tags/$RELEASE_TAG" - printf 'Package: [%s](https://github.com/%s/tree/%s).\n' \ - "$RELEASE_TAG" "$PACKAGE_REPOSITORY" "$RELEASE_TAG" >> "$GITHUB_STEP_SUMMARY" - - name: Record the completed extension release - shell: bash - run: | - printf 'Released [%s](https://github.com/%s/tree/%s). The Joomla update server contains the verified OctoShoom SHA-512.\n' \ - "$RELEASE_TAG" "$GITHUB_REPOSITORY" "$RELEASE_TAG" >> "$GITHUB_STEP_SUMMARY" - - name: Remove temporary authentication material - if: always() - shell: bash - run: rm -rf -- "$RUNNER_TEMP/release-ssh" From 21eb3406c1b4d3acd7d0d8c28a51becd17e38062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eW=C9=98yn?= <5607939+Llewellynvdm@users.noreply.github.com> Date: Mon, 28 Sep 2026 16:10:55 +0200 Subject: [PATCH 2/3] Remove duplicated release support and simplify configuration --- .github/workflows/release.yml | 7 +- .octojpack | 17 +-- AGENTS.md | 6 +- CHANGELOG.md | 9 +- changelog.xml | 12 +- docs/ARCHITECTURE.md | 2 +- docs/IMPLEMENTATION.md | 2 + docs/RELEASE.md | 84 ++++-------- joomengine_mcp_update_server.xml | 2 +- tests/release.php | 180 +++++++++--------------- tools/release.php | 226 +++++++------------------------ 11 files changed, 173 insertions(+), 374 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a26546a..33556aa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,8 @@ jobs: release: if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest + env: + VDM_GLOBAL_TOKEN: ${{ secrets.GIT_TOKEN }} steps: - uses: actions/checkout@v7 with: @@ -46,13 +48,13 @@ jobs: tag="v$version" git remote set-url origin git@github.com:joomengine/mcp_component.git if ! git show-ref --verify --quiet "refs/tags/$tag"; then - php tools/release.php prepare "$version" joomengine/mcp_component main + php tools/release.php prepare "$version" git add joomengine_mcp.xml CHANGELOG.md changelog.xml plugins/webservices/joomengine_mcp/joomengine_mcp.xml git commit -m "Release $tag" git tag -a "$tag" -m "Release $tag" git push --atomic origin HEAD:main "refs/tags/$tag" fi - php tools/release.php feed "$version" joomengine/mcp_component main + php tools/release.php feed "$version" git add joomengine_mcp_update_server.xml if ! git diff --cached --quiet; then git commit -m "Add $tag to the Joomla update server" @@ -67,5 +69,4 @@ jobs: uses: octoleo/octojpack@master with: config: .octojpack - token: ${{ secrets.GIT_TOKEN }} push: 'true' diff --git a/.octojpack b/.octojpack index 2134f39..8a6c174 100644 --- a/.octojpack +++ b/.octojpack @@ -14,13 +14,12 @@ "copyright": "Copyright (C) 2026 Vast Development Method. All rights reserved.", "copyright_year": "2026", "license": "GNU General Public License version 3 or later; see LICENSE", - "license_file": "LICENSE", + "license_file": "https://raw.githubusercontent.com/joomengine/mcp_component/main/LICENSE", "author": "Llewellyn van der Merwe", "author_email": "joomla@vdm.io", "author_url": "https://dev.vdm.io/", "description": "JoomEngine MCP component, webservices routing, and local console server.", "version_id": "com_joomengine_mcp", - "version": "0.1.1", "update_servers": "[[[PACKAGE_UPDATE_SERVER]]]", "changelog_servers": "[[[PACKAGE_CHANGELOG_SERVER]]]" }, @@ -31,19 +30,17 @@ }, "files": [ { - "owner": "[[[SOURCE_OWNER]]]", - "repo": "[[[SOURCE_REPOSITORY]]]", + "owner": "joomengine", + "repo": "mcp_component", "id": "com_joomengine_mcp", - "type": "component", - "mode": "[[[COMPONENT_TAG]]]" + "type": "component" }, { - "owner": "[[[CONSOLE_OWNER]]]", - "repo": "[[[CONSOLE_REPOSITORY]]]", + "owner": "joomengine", + "repo": "mcp_plugin", "id": "joomengine_mcp", "type": "plugin", - "group": "console", - "mode": "[[[CONSOLE_TAG]]]" + "group": "console" } ], "languages": [ diff --git a/AGENTS.md b/AGENTS.md index 0585886..452e9bf 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -34,11 +34,11 @@ PHP style authority: https://github.com/extension-builder/joomla/blob/main/docs/ - This is exclusively the component repository. A GitHub source ZIP of any reviewed branch or tag must install directly in Joomla, with every manifest file, production Composer dependency, licence, routing plugin and seed already tracked. No downstream Composer run, staging, compilation or packaging is allowed. - Keep production dependencies in `admin/vendor` and the installation seed in `admin/data`. When changing dependencies, run Composer as a maintainer, commit the lock and complete resolved runtime, and verify its autoload paths after relocation to Joomla's administrator component directory. Never hand-edit third-party vendor source. - Preserve SQL installation/schema updates and the JSON-driven customization-preserving seed updater. They are approved installation mechanisms; do not replace them merely to change the release process. -- OctoJPack alone combines extensions using `.octojpack` and writes to a separate configured package repository. Package manifests, package update feeds, assembly scripts and bundled console copies do not belong here. Improve shared Octo tools upstream instead of copying their implementation into this repository. -- The manual Release workflow takes the next version. It freezes metadata, creates the immutable tag, adds that tag archive to the native component feed, runs OctoShoom synchronously and verifies its committed checksum, then invokes OctoJPack. A failed hash stage must prevent packaging. Never move an existing tag. Keep destination repositories, tool refs and credentials in documented GitHub variables/secrets. +- OctoJPack alone combines extensions using `.octojpack` and writes to the separate package repository. Package manifests, package update feeds, assembly scripts and bundled console copies do not belong here. Keep `.octojpack` concrete and usable from any machine: hardcode stable source/destination repositories, branch, raw GitHub update/changelog URLs and the raw licence URL. Use native latest-tag selection and `version_id`; do not render placeholders or rewrite the configuration during releases. Never change the shared Octo engines without an explicit request. +- The manual Release workflow takes the next version, freezes metadata, creates the tag and adds its archive URL to the native component feed. Follow the upstream quick-start examples: call `octoleo/git-user@v2` once, then `octoleo/octoshoom@master`, then `octoleo/octojpack@master` with `.octojpack`. Both actions inherit the same Git setup and environment. A failed hash step stops packaging. Keep credentials in GitHub secrets. Do not duplicate authentication, hashing, archive checks, packaging, configuration rendering or repository preflight logic locally. Local release code only edits this component's version, changelogs and update entry. Never move a released tag. - Update **both** `CHANGELOG.md` and `changelog.xml` with every meaningful change. Put pending entries under the exact literal `[[[NEXT_VERSION]]]`; create a new pending section after the previous one is released. Do not invent a version or modify historical released entries. The workflow replaces this marker with its input version in both files. - Joomla changelog identity is `com_joomengine_mcp` / `component`. Use native categories `security`, `fix`, `language`, `addition`, `change`, `remove`, and `note`, each containing `item` children. Use matching human headings in Markdown. Record compatibility warnings under Note, errors fixed under Fix, and security fixes under Security. Keep both changelogs consistent and the manifest's `changelogurl` valid. -- Workflow changes require positive/negative metadata and ordering checks; source installation checks must inspect the tracked source archive. Do not restore package builders to make a test pass. See `docs/RELEASE.md` for the configuration and retry contract. +- Check workflow syntax and changed metadata behavior. Source installation checks inspect the tracked source archive. Do not copy upstream action tests or restore package builders to make a test pass. See `docs/RELEASE.md`. ## Verification diff --git a/CHANGELOG.md b/CHANGELOG.md index cd85adb..1dd93cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,21 +12,24 @@ ### Addition - Add a manual version release workflow that freezes both changelogs, creates an immutable tag, updates the Joomla feed and waits for OctoShoom before invoking OctoJPack. -- Document GitHub variables/secrets, release retries and the source-installation contract for future agents. +- Document GitHub secrets and the source-installation contract for future agents. ### Change +- Follow the Octoleo quick starts: set up Git once, run OctoShoom, then let OctoJPack read `.octojpack` directly. + - Delegate combined Joomla package assembly exclusively to OctoJPack and a separate package repository. - Verify tracked source archives in component and console installation tests. ### Remove - Remove repository-local ZIP/package builders, distribution locks and package update metadata. +- Remove temporary action checkouts, configuration rendering, custom SSH setup, duplicate hash verification and package repository checks. ### Note -- Release the console plugin first and select its immutable tag in the component release configuration. -- Configure the variables and secrets in docs/RELEASE.md before the first release. OctoJPack must include GitHub tag-archive support. +- Release the console plugin first; OctoJPack selects the latest tags using its native configuration. +- Configure the secrets documented in docs/RELEASE.md before the first release. ## 0.1.1 — development baseline diff --git a/changelog.xml b/changelog.xml index d60b9be..5744f87 100644 --- a/changelog.xml +++ b/changelog.xml @@ -11,16 +11,20 @@ Add manual version releases with changelog freezing, immutable tags, Joomla update entries and synchronous OctoShoom before OctoJPack. - Document release configuration, retries and source installation requirements for maintainers and agents. + Document release secrets and source installation requirements for maintainers and agents. + Follow the Octoleo quick starts: set up Git once, run OctoShoom, then let OctoJPack read .octojpack directly. Delegate combined Joomla package assembly exclusively to OctoJPack and a separate package repository. Verify tracked source archives in component and console installation tests. - Remove local ZIP/package builders, distribution locks and package update metadata. + + Remove local ZIP/package builders, distribution locks and package update metadata. + Remove temporary action checkouts, configuration rendering, custom SSH setup, duplicate hash verification and package repository checks. + - Release the console plugin first and configure its immutable tag before the component release. - Configure the documented GitHub variables and secrets; OctoJPack must include GitHub tag-archive support. + Release the console plugin first; OctoJPack selects the latest tags using its native configuration. + Configure the secrets documented in docs/RELEASE.md before the first release. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 2d71e2b..e424325 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -52,7 +52,7 @@ JCB source-code fields remain permitted inert definition data under appropriate ## Distribution and references -This repository is a directly installable component source tree, with routing glue, locked production dependencies and installation data committed in place. MySQL/MariaDB and PostgreSQL schema updates and customization-preserving JSON seed updates remain installer-owned. The console plugin is independently installable. Manual version releases freeze both changelogs, tag source, update the native feed and wait for OctoShoom. Only then does external OctoJPack use `.octojpack` and the configured immutable console tag to assemble a combined package in a separate repository. No package builder or combined-package manifest belongs here. See RELEASE.md. +This repository is a directly installable component source tree, with routing glue, locked production dependencies and installation data committed in place. MySQL/MariaDB and PostgreSQL schema updates and customization-preserving JSON seed updates remain installer-owned. The console plugin is independently installable. Manual version releases freeze both changelogs, tag source, update the native feed and wait for OctoShoom. Only then does the OctoJPack action use the same standalone `.octojpack` configuration and latest component/console tags to assemble a combined package in a separate repository. No package builder or combined-package manifest belongs here. See RELEASE.md. - Original MCP: https://github.com/joomengine/joomla-mcp/tree/2cff50f4f6b440da3c684f9995a77efad32e1a36 - Joomla/JCB layout: https://github.com/joomengine/Joomla-Component-Builder/tree/6.x diff --git a/docs/IMPLEMENTATION.md b/docs/IMPLEMENTATION.md index 3110c54..d13432b 100644 --- a/docs/IMPLEMENTATION.md +++ b/docs/IMPLEMENTATION.md @@ -24,6 +24,8 @@ The administrator Operations screen includes jobs/artifact metadata and cancella The tracked component source now contains production dependencies, installation data and its administrator licence. Source ZIP installation replaces local archive builders. The manual next-version release freezes changelogs and manifest metadata, creates an immutable tag, updates the native feed, waits for OctoShoom to commit its checksum, and then invokes external OctoJPack. Combined package manifests and publication belong to a separate configured repository. See [RELEASE.md](RELEASE.md). +Release simplification in PR #3 follows the native Octoleo action examples: one `git-user` setup, then OctoShoom and OctoJPack using their shared environment. Local release code now only edits version, changelog and feed metadata. Workflow lint, 22 metadata checks and 34 source-installation checks passed locally. The separate package destination and its raw XML URLs still need to be supplied before `.octojpack` is complete; no release was run. + ## Historical verified runtime evidence The following results belong to the recorded September 24 revisions. Their distribution builders have since been removed; they do not certify the current release workflow. Current source/release verification is recorded separately in the release-alignment PR. diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 2b41759..cc31b73 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -1,79 +1,41 @@ # Source installation and releases -This repository is exclusively the component. **Code → Download ZIP** and tagged source ZIPs install directly through Joomla's extension installer. Production Composer dependencies, the catalogue seed, licences and owned webservices plugin are already tracked. No user or downstream packager runs Composer or a build script. +This is the component repository. Its source ZIP installs directly in Joomla: production dependencies, installation data, licence and owned webservices plugin are already tracked. No downstream Composer or build step is required. The console plugin has its own installable repository. -The console plugin has its own installable source repository and version. OctoJPack combines both extensions using `.octojpack` and publishes the Joomla package to a **separate repository**. The package manifest and package update/changelog files belong there, never in this component repository. +OctoJPack combines the latest tagged component and console plugin using `.octojpack`. It owns package assembly and publication in the separate package repository. The package manifest and package update/changelog files belong there. -## Release sequence +## GitHub setup -After merging reviewed changes and checking CI, open Actions → **Release component with OctoShoom and OctoJPack**, select the configured release branch and enter the next stable version, such as `1.0.0`. An optional `v` prefix is accepted; tags always use `vX.Y.Z` and Joomla XML uses `X.Y.Z`. +Follow the upstream [git-user](https://github.com/octoleo/git-user#workflows), [OctoShoom](https://github.com/octoleo/octoshoom#quick-start) and [OctoJPack](https://github.com/octoleo/octojpack#quick-start) examples. Configure these repository or organization Actions secrets: -1. Validate configuration, the previously released console tag and its OctoShoom checksum, and the separate package destination. -2. Replace `[[[NEXT_VERSION]]]` in both changelogs, update component/routing manifest versions and creation dates, and update `.octojpack`'s version. Commit those files and atomically push the release branch and new immutable tag. -3. Add the tag's `https://github.com/OWNER/REPO/archive/refs/tags/vVERSION.zip` URL to `joomengine_mcp_update_server.xml`, then commit the feed. Existing versions and checksums remain intact. -4. Run the configured OctoShoom composite action synchronously. It downloads the tagged archive and commits SHA-512 to the source feed. Fetch that committed feed and verify its hash against the real download. Any failure stops the workflow. -5. Render `.octojpack`'s repository/tag placeholders from GitHub configuration and invoke the configured OctoJPack composite action. It builds and pushes the combined package and version tag to the separate destination. The component workflow does not implement ZIP assembly or generate the package manifest. - -A manually pushed tag alone does not start this process: use the version-input workflow so changelogs and manifests are frozen before the immutable tag is created. No GitHub Release asset uploads are required. The first run populates the initially empty component feed with a real existing tag; no nonexistent historical downloads are advertised. - -The component manifest points at the live branch feed and Joomla XML changelog. The tag is created before the new feed entry/hash so hashing the immutable download cannot create a self-referential checksum. - -## GitHub configuration - -Set these under **Settings → Secrets and variables → Actions**. Values shown as descriptions must be supplied for your repositories; no destination repository is hardcoded in the workflow. - -| Variable | Value | -| --- | --- | -| `RELEASE_BRANCH` | Optional source release branch; defaults to this repository's default branch. Run the workflow from that branch. | -| `OCTOSHOOM_REPOSITORY` | Shared hash action repository, normally `octoleo/octoshoom`. | -| `OCTOSHOOM_REF` | Full reviewed 40-character commit SHA for the action. Inspected compatible revision: `a4eba6191388335e0301f74969d92151bc0f520d`. | -| `OCTOJPACK_REPOSITORY` | Shared packaging action repository, normally `octoleo/octojpack`. | -| `OCTOJPACK_REF` | Full reviewed commit SHA containing GitHub tag-archive support and required-extension failure handling; see [OctoJPack PR #2](https://github.com/octoleo/octojpack/pull/2). Pin the reviewed result, not an older Gitea-only implementation. | -| `RELEASE_SSH_KNOWN_HOSTS` | Verified GitHub SSH `known_hosts` lines. Strict host-key checking remains enabled. | -| `CONSOLE_REPOSITORY` | Console plugin `owner/repository`, normally `joomengine/mcp_plugin`. | -| `CONSOLE_TAG` | Exact plugin tag, `vX.Y.Z`, whose plugin release and OctoShoom run have completed. It has an independent version with the same major as the component, as required by the plugin installer. | -| `PACKAGE_REPOSITORY` | Existing separate `owner/repository` for the combined Joomla package. It must differ from component, console and tool repositories. | -| `PACKAGE_BRANCH` | Existing branch in the package repository. OctoJPack owns its package contents. | -| `PACKAGE_UPDATE_SERVER` | HTTPS URL of the package repository's own Joomla update feed. | -| `PACKAGE_CHANGELOG_SERVER` | HTTPS URL of the package repository's own Joomla changelog. | - -| Secret | Access needed | +| Secret | Value | | --- | --- | -| `RELEASE_TOKEN` | GitHub token for source Contents writes, tool checkouts and API reads of source/console/package repositories. It must also permit changes to workflow files if source release commits include such files. | -| `RELEASE_SSH_KEY` | Unencrypted SSH private key for OctoShoom's source-feed push and OctoJPack's package push. Use a machine/user identity with write access to both repositories; one GitHub deploy key cannot be reused across repositories. | +| `GIT_USER`, `GIT_EMAIL` | Release Git identity. | +| `GPG_KEY`, `GPG_USER` | Signing key and its user ID. | +| `SSH_KEY`, `SSH_PUB` | Matching SSH keypair for that identity, with write access to the component and package repositories. | +| `GIT_TOKEN` | GitHub API token for OctoJPack to read the source repositories. | -The release identity must be allowed to push metadata commits and tags under your branch/ruleset policy. This workflow does not bypass branch protections. Do not store tokens or private keys in `.octojpack` or committed files. Package feeds/changelogs are owned and maintained by the package repository; their configured URLs must resolve to that repository's real metadata. +`git-user` runs once. OctoShoom and OctoJPack inherit its Git configuration; OctoJPack reads the token from `VDM_GLOBAL_TOKEN`. The workflow supplies each action's configuration input and enables OctoJPack's native `push` option. There are no per-release repository, tool-ref or package-URL variables. -`.octojpack` contains ordinary OctoJPack package identity and extension definitions. Its visible `[[[...]]]` configuration markers are resolved in a temporary runner configuration from the table above. They are not install-time placeholders. Exact component and console tags are selected instead of "latest" modes, so unrelated releases cannot change the chosen extension versions. +## Release -## Changelogs - -Maintain `CHANGELOG.md` and `changelog.xml` together. New changes go at the top under the literal `[[[NEXT_VERSION]]]`. Use one pending section in each file, and create a new one after a release when subsequent changes begin. The release workflow assigns the version; agents must not guess it or relabel an already released section. - -Joomla XML uses `changelogs/changelog`, component `element` = `com_joomengine_mcp`, `type` = `component`, and category elements `security`, `fix`, `language`, `addition`, `change`, `remove`, `note`, each containing `item` children. Markdown uses matching readable headings. Record compatibility warnings under Note, errors fixed under Fix, and security changes under Security. Preserve historical entries. +Release the console plugin first, then run **Release component with OctoShoom and OctoJPack** on `main` with the next version, such as `1.2.3` or `v1.2.3`. -The current 0.1.0/0.1.1 entries identify development baselines, not published tags. Choose a new unused version for the first release; the workflow refuses duplicate changelog versions. +1. Freeze the pending changelogs and manifest versions, commit and create `v1.2.3`. +2. Add the tag archive URL to the component's Joomla update feed. +3. OctoShoom adds and commits the SHA-512 hashes. +4. After it succeeds, OctoJPack reads `.octojpack` and builds/pushes the combined package. -## Retry a failed release +Both shared actions do their own work. There is no local packaging, hash calculation, checksum recheck or configuration rendering. `tools/release.php` only updates this component's release metadata. Existing tags are retained when rerunning an interrupted release; existing feed entries and hashes are preserved. -Run the same workflow with the same version. An existing source tag must be an ancestor of the release branch and contain matching released metadata; it is never recreated or moved. Missing feed metadata can then be added, and OctoShoom can finish or verify its hash without changing older releases. +`.octojpack` is also the standalone OctoJPack configuration. Its stable repository identities, raw GitHub feed/changelog URLs and raw licence URL belong in that file. Native latest-tag selection and `version_id` determine the package version. Workflow-only placeholders and generated configuration copies do not belong here. -An existing matching package tag is preserved. A retry cannot replace a newer package branch with an older version. Keep the same console selection and package configuration while resuming an interrupted version. If an existing tag has conflicting metadata, resolve it explicitly rather than deleting or force-updating tags. - -The component and plugin workflows serialize their own releases. A concurrent ordinary source push can cause a normal non-fast-forward rejection; the workflow stops and can be rerun safely. - -## Maintainer verification +## Changelogs -Dependency changes are resolved once by a maintainer using the root `composer.json`/lock and committed under `admin/vendor`. Use Composer 2 with PHP 8.3+ and the declared extensions: +Keep `CHANGELOG.md` and `changelog.xml` consistent. Record new changes under one literal `[[[NEXT_VERSION]]]` section in each file. The release replaces that marker with the entered version. Create the next pending section when subsequent changes begin; preserve released history. -```bash -composer validate --no-check-publish -composer install --no-dev --prefer-dist --no-interaction --no-scripts -php tests/package.php -php tests/release.php -php tests/run.php -``` +Joomla XML uses `changelogs/changelog`, `element` = `com_joomengine_mcp`, `type` = `component`, and `security`, `fix`, `language`, `addition`, `change`, `remove` or `note` categories containing `item` children. Use matching Markdown headings. The manifest points to the raw GitHub changelog and update feed. -Commit the complete dependency tree with its licences and lock. `admin/autoload.php` supplies the component namespace before and after Joomla relocates the administrator files. Do not manually patch third-party vendor code. CI checks a plain Git source archive, tests the relocated runtime, checks seed regeneration and runs the behavioral suites. Installed Joomla/MySQL/PostgreSQL and JCB workflows install source archives directly. These test archives are verification fixtures, not maintained distribution builders. +## Dependencies and checks -Release metadata tests exercise successive versions, invalid inputs, preserved history, retry behavior and missing/mismatched checksums without publishing anything. Running the real release workflow is the explicit publication action. +When dependencies change, maintainers run Composer and commit the lock and complete production runtime under `admin/vendor`, including licences. Do not edit vendor source by hand. CI checks source archives, relocated autoloading and the runtime; `php tests/release.php` checks version/changelog/feed edits without publishing. diff --git a/joomengine_mcp_update_server.xml b/joomengine_mcp_update_server.xml index 80aa75a..3adf91c 100644 --- a/joomengine_mcp_update_server.xml +++ b/joomengine_mcp_update_server.xml @@ -1,3 +1,3 @@ - + diff --git a/tests/release.php b/tests/release.php index aba672a..90e62a0 100644 --- a/tests/release.php +++ b/tests/release.php @@ -6,10 +6,10 @@ * @license GNU General Public License version 3 or later; see LICENSE */ -/** Exercise release transitions without network, publishing tags, or building packages. */ +/** Exercise component release metadata without publishing or building packages. */ require dirname(__DIR__) . '/tools/release.php'; -$directory = sys_get_temp_dir() . '/mcp-release-' . bin2hex(random_bytes(8)); -mkdir($directory, 0700, true); +$root = sys_get_temp_dir() . '/mcp-release-' . bin2hex(random_bytes(8)); +mkdir($root . '/plugins/webservices/joomengine_mcp', 0700, true); $checks = 0; $check = static function (bool $condition, string $message) use (&$checks): void { @@ -20,137 +20,89 @@ $checks++; }; -$reject = static function (array $arguments, string $root) use ($check): void + +try { - $before = []; + $pending = 'com_joomengine_mcpcomponent' + . '[[[NEXT_VERSION]]]Preserve existing releases.'; + $metadata = [ + 'joomengine_mcp.xml' => '1.0.0January 2026', + 'plugins/webservices/joomengine_mcp/joomengine_mcp.xml' => '' + . '1.0.0January 2026', + '.octojpack' => '{"package":{"version_id":"com_joomengine_mcp"}}', + 'changelog.xml' => '' . $pending . '', + 'CHANGELOG.md' => "# Changelog\n\n## [[[NEXT_VERSION]]]\n\n### Fix\n\n- Preserve updates.\n", + 'joomengine_mcp_update_server.xml' => '', + ]; - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS)) as $file) + foreach ($metadata as $path => $contents) { - $before[$file->getPathname()] = hash_file('sha256', $file->getPathname()); + file_put_contents($root . '/' . $path, $contents); } - $rejected = false; - - try - { - mcpRelease($arguments, $root); - } - catch (RuntimeException) + foreach (['01.1.0', '1.0', '1.0.0-beta', '1.0.0;false', '0.9.0'] as $invalid) { - $rejected = true; - } + $rejected = false; - $check($rejected, 'Invalid release operation must fail.'); + try + { + mcpRelease(['prepare', $invalid], $root); + } + catch (RuntimeException) + { + $rejected = true; + } - foreach ($before as $path => $hash) - { - $check(hash_file('sha256', $path) === $hash, 'Rejected operation must not change existing metadata.'); + $check($rejected, 'Invalid or older versions must fail.'); } -}; -try -{ - foreach (['component', 'plugin'] as $type) + foreach ($metadata as $path => $contents) { - $root = $directory . '/' . $type; - mkdir($root . '/plugins/webservices/joomengine_mcp', 0700, true); - $element = $type === 'component' ? 'com_joomengine_mcp' : 'joomengine_mcp'; - $folder = $type === 'plugin' ? 'console' : ''; - $changelogName = $type === 'component' ? 'changelog.xml' : 'joomengine_mcp_changelog.xml'; - $pending = '' . $element . '' . $type . '' . $folder - . '[[[NEXT_VERSION]]]Preserve existing releases & user changes.'; - file_put_contents($root . '/joomengine_mcp.xml', '' - . '1.0.0January 2026' - . 'https://example.invalid/old.xml' - . 'https://example.invalid/old-changelog.xml'); - file_put_contents($root . '/plugins/webservices/joomengine_mcp/joomengine_mcp.xml', - '1.0.0January 2026'); - file_put_contents($root . '/.octojpack', '{"package":{"version":"1.0.0"},"repository":{"owner":"[[[PACKAGE_OWNER]]]"}}'); - file_put_contents($root . '/' . $changelogName, '' . $pending . ''); - file_put_contents($root . '/CHANGELOG.md', "# Changelog\n\n## [[[NEXT_VERSION]]]\n\n### Fixed\n\n- Preserve updates.\n"); - file_put_contents($root . '/joomengine_mcp_update_server.xml', ''); - $repository = 'test-owner/' . $type; - $branch = $type === 'component' ? 'stable/6.x' : 'stable/release&next#1'; - $encodedBranch = $type === 'component' ? 'stable/6.x' : 'stable/release%26next%231'; - - foreach (['01.1.0', '1.0', '1.0.0-beta', '1.0.0;false', '0.9.0'] as $invalid) - { - $reject(['prepare', $invalid, $repository, $branch], $root); - } + $check(file_get_contents($root . '/' . $path) === $contents, 'Rejected releases must leave metadata unchanged.'); + } - $reject(['prepare', '1.1.0', 'invalid repository', $branch], $root); - $reject(['prepare', '1.1.0', $repository, "main\ninjected"], $root); - $initialFeed = file_get_contents($root . '/joomengine_mcp_update_server.xml'); - mcpRelease(['prepare', 'v1.1.0', $repository, $branch], $root); - $manifest = mcpReleaseXml($root . '/joomengine_mcp.xml', 'extension'); - $check(mcpReleaseValue($manifest, '/extension/version') === '1.1.0', 'Release normalizes the v prefix.'); - $check(mcpReleaseValue($manifest, '/extension/creationDate') === gmdate('F Y'), 'Release refreshes the manifest date.'); - $check(mcpReleaseValue($manifest, '/extension/updateservers/server') - === 'https://raw.githubusercontent.com/' . $repository . '/' . $encodedBranch . '/joomengine_mcp_update_server.xml', - 'Repository and branch determine the live feed URL.'); - $check(!str_contains(file_get_contents($root . '/CHANGELOG.md'), '[[[NEXT_VERSION]]]') - && !str_contains(file_get_contents($root . '/' . $changelogName), '[[[NEXT_VERSION]]]'), - 'Both pending changelog sections are frozen into the release.'); - $check(file_get_contents($root . '/joomengine_mcp_update_server.xml') === $initialFeed, - 'Preparing a tag does not advertise its download before the tag exists.'); - mcpRelease(['verify-tag', '1.1.0', $repository, $branch], $root); - $checks++; - $reject(['verify-tag', '1.0.0', $repository, $branch], $root); - $reject(['prepare', '1.1.0', $repository, $branch], $root); - mcpRelease(['feed', '1.1.0', $repository, $branch], $root); - $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml', 'updates'); - $check(mcpReleaseValue($feed, '/updates/update/downloads/downloadurl') - === 'https://github.com/' . $repository . '/archive/refs/tags/v1.1.0.zip', 'Update uses the immutable repository tag ZIP.'); - $check((new DOMXPath($feed))->query('/updates/update/sha512')->length === 0, - 'Only OctoShoom supplies the release checksum.'); - $check(mcpReleaseValue($feed, '/updates/update/' . ($type === 'component' ? 'client' : 'folder')) - === ($type === 'component' ? '1' : 'console'), 'Update preserves Joomla extension identity.'); - $archive = $root . '/archive.zip'; - file_put_contents($archive, 'Synthetic archive bytes for checksum comparison only.'); - $reject(['verify-hash', '1.1.0', $repository, $branch, $archive], $root); - mcpReleaseAppend($feed->documentElement->firstChild, 'sha512', hash_file('sha512', $archive)); - $feed->save($root . '/joomengine_mcp_update_server.xml'); - mcpRelease(['verify-hash', '1.1.0', $repository, $branch, $archive], $root); - $checks++; - $hashedFeed = file_get_contents($root . '/joomengine_mcp_update_server.xml'); - mcpRelease(['feed', '1.1.0', $repository, $branch], $root); - $check(file_get_contents($root . '/joomengine_mcp_update_server.xml') === $hashedFeed, - 'Retry preserves published feed bytes including the OctoShoom hash.'); - file_put_contents($archive, 'Tampered archive'); - $reject(['verify-hash', '1.1.0', $repository, $branch, $archive], $root); - $reject(['feed', '1.1.0', 'different-owner/' . $type, $branch], $root); - $reject(['feed', '2.0.0', $repository, $branch], $root); + mcpRelease(['prepare', 'v1.1.0'], $root); + $manifest = mcpReleaseXml($root . '/joomengine_mcp.xml'); + $routing = mcpReleaseXml($root . '/plugins/webservices/joomengine_mcp/joomengine_mcp.xml'); + $check((string) $manifest->version === '1.1.0' && (string) $routing->version === '1.1.0', 'Component and routing versions agree.'); + $check((string) $manifest->creationDate === gmdate('F Y'), 'Release refreshes the manifest date.'); + $check((string) mcpReleaseXml($root . '/changelog.xml')->changelog->version === '1.1.0' + && str_contains(file_get_contents($root . '/CHANGELOG.md'), '## 1.1.0'), 'Both changelogs freeze the pending version.'); + $check(file_get_contents($root . '/.octojpack') === $metadata['.octojpack'], 'Package configuration stays independent of release metadata.'); + $check(file_get_contents($root . '/joomengine_mcp_update_server.xml') === $metadata['joomengine_mcp_update_server.xml'], + 'Preparing a tag does not advertise its download before the tag exists.'); + mcpRelease(['feed', '1.1.0'], $root); + $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml'); + $check((string) $feed->update->downloads->downloadurl === 'https://github.com/joomengine/mcp_component/archive/refs/tags/v1.1.0.zip', + 'Update uses the immutable tag ZIP.'); + $check((string) $feed->update->client === '1' && (string) $feed->update->php_minimum === '8.3.0' + && (string) $feed->update->targetplatform['version'] === '6\\.[1-9][0-9]*', 'Update carries supported Joomla/PHP versions.'); + $check(!isset($feed->update->sha512), 'OctoShoom supplies the checksum.'); + $feed->update->addChild('sha512', str_repeat('a', 128)); + $feed->asXML($root . '/joomengine_mcp_update_server.xml'); + $hashedFeed = file_get_contents($root . '/joomengine_mcp_update_server.xml'); + mcpRelease(['feed', '1.1.0'], $root); + $check(file_get_contents($root . '/joomengine_mcp_update_server.xml') === $hashedFeed, 'Existing feed entries and hashes stay unchanged.'); - $changelog = file_get_contents($root . '/' . $changelogName); - file_put_contents($root . '/' . $changelogName, str_replace('', '' . $pending, $changelog)); - $markdown = file_get_contents($root . '/CHANGELOG.md'); - file_put_contents($root . '/CHANGELOG.md', str_replace('# Changelog', "# Changelog\n\n## [[[NEXT_VERSION]]]\n\n- Next changes.", $markdown)); - mcpRelease(['prepare', '1.2.0', $repository, $branch], $root); - mcpRelease(['feed', '1.2.0', $repository, $branch], $root); - $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml', 'updates'); - $check((new DOMXPath($feed))->query('/updates/update')->length === 2, 'Next release retains previous update entries.'); - $check(strlen(mcpReleaseValue($feed, '/updates/update[version="1.1.0"]/sha512')) === 128, - 'Next release retains the previous immutable checksum.'); - $latestFeed = file_get_contents($root . '/joomengine_mcp_update_server.xml'); - mcpRelease(['feed', '1.1.0', $repository, $branch], $root); - $check(file_get_contents($root . '/joomengine_mcp_update_server.xml') === $latestFeed, - 'Retrying an older published tag never rolls back a newer feed entry.'); - $duplicate = $feed->documentElement->lastChild->cloneNode(true); - $feed->documentElement->appendChild($duplicate); - $feed->save($root . '/joomengine_mcp_update_server.xml'); - $reject(['feed', '1.1.0', $repository, $branch], $root); - } + $history = file_get_contents($root . '/changelog.xml'); + file_put_contents($root . '/changelog.xml', str_replace('', '' . $pending, $history)); + file_put_contents($root . '/CHANGELOG.md', $metadata['CHANGELOG.md'] . "\n## 1.1.0\n\n- Preserve updates.\n"); + mcpRelease(['prepare', '1.2.0'], $root); + mcpRelease(['feed', '1.2.0'], $root); + $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml'); + $check(count($feed->update) === 2 && (string) $feed->update[0]->sha512 === str_repeat('a', 128), + 'Next release retains the previous update and checksum.'); + $check((string) mcpReleaseXml($root . '/changelog.xml')->changelog[1]->version === '1.1.0', 'Next release retains the previous changelog.'); - echo json_encode(['checks' => $checks, 'metadataTransitions' => 'passed', - 'publication' => 'not run; no network or package generation'], JSON_THROW_ON_ERROR) . "\n"; + echo json_encode(['checks' => $checks, 'metadataTransitions' => 'passed'], JSON_THROW_ON_ERROR) . "\n"; } finally { - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS), + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $file) { $file->isDir() ? rmdir($file->getPathname()) : unlink($file->getPathname()); } - rmdir($directory); + rmdir($root); } diff --git a/tools/release.php b/tools/release.php index 3921496..f0e1a48 100644 --- a/tools/release.php +++ b/tools/release.php @@ -6,220 +6,98 @@ * @license GNU General Public License version 3 or later; see LICENSE */ -/** Read local release metadata without resolving external XML entities. */ -function mcpReleaseXml(string $path, string $rootName): DOMDocument +/** Read this component's local release metadata. */ +function mcpReleaseXml(string $path): SimpleXMLElement { - $document = new DOMDocument('1.0', 'utf-8'); - $document->preserveWhiteSpace = false; - $document->formatOutput = true; + $xml = simplexml_load_file($path, SimpleXMLElement::class, LIBXML_NONET); - if (!is_file($path) || !$document->load($path, LIBXML_NONET) - || $document->doctype !== null || $document->documentElement->nodeName !== $rootName) + if ($xml === false) { throw new RuntimeException('Invalid release XML: ' . $path); } - return $document; + return $xml; } -/** Append escaped text to an XML element. */ -function mcpReleaseAppend(DOMNode $parent, string $name, string $value): DOMElement -{ - $node = $parent->ownerDocument->createElement($name); - $node->appendChild($parent->ownerDocument->createTextNode($value)); - $parent->appendChild($node); - - return $node; -} - -/** Require a single metadata value, preventing ambiguous manifests and feeds. */ -function mcpReleaseValue(DOMDocument $document, string $expression): string -{ - $nodes = (new DOMXPath($document))->query($expression); - - if ($nodes === false || $nodes->length !== 1) - { - throw new RuntimeException('Expected exactly one XML value: ' . $expression); - } - - return $nodes->item(0)->textContent; -} - -/** Change one existing metadata value. */ -function mcpReleaseSet(DOMDocument $document, string $expression, string $value): void -{ - mcpReleaseValue($document, $expression); - $node = (new DOMXPath($document))->query($expression)->item(0); - - while ($node->firstChild !== null) - { - $node->removeChild($node->firstChild); - } - - $node->appendChild($document->createTextNode($value)); -} - -/** Prepare version metadata, append a tag update, or verify OctoShoom's published checksum. */ +/** Freeze the pending version or add its tag archive to the component update feed. */ function mcpRelease(array $arguments, string $root): void { - [$command, $version, $repository, $branch] = array_pad($arguments, 4, ''); + [$command, $version] = array_pad($arguments, 2, ''); $version = preg_replace('/\Av/', '', $version); - if (!in_array($command, ['prepare', 'verify-tag', 'feed', 'verify-hash'], true) - || preg_match('/\A(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\z/D', $version) !== 1 - || preg_match('/\A[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\z/D', $repository) !== 1 - || $branch === '' || preg_match('/[\x00-\x20\x7f?*\[\\\\~^:]/', $branch) - || str_contains($branch, '..') || str_contains($branch, '@{')) - { - throw new RuntimeException('Usage: release.php prepare|verify-tag|feed|verify-hash VERSION OWNER/REPOSITORY BRANCH [ARCHIVE]'); - } - - $tag = 'v' . $version; - $manifest = mcpReleaseXml($root . '/joomengine_mcp.xml', 'extension'); - $type = $manifest->documentElement->getAttribute('type'); - $isComponent = $type === 'component'; - - if (!$isComponent && ($type !== 'plugin' || $manifest->documentElement->getAttribute('group') !== 'console')) + if (!in_array($command, ['prepare', 'feed'], true) + || preg_match('/\A(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\z/D', $version) !== 1) { - throw new RuntimeException('This release helper supports the MCP component or console plugin only.'); + throw new RuntimeException('Usage: release.php prepare|feed VERSION'); } - $element = $isComponent ? 'com_joomengine_mcp' : 'joomengine_mcp'; - $changelogName = $isComponent ? 'changelog.xml' : 'joomengine_mcp_changelog.xml'; - $changelog = mcpReleaseXml($root . '/' . $changelogName, 'changelogs'); - $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml', 'updates'); - $encodedBranch = implode('/', array_map('rawurlencode', explode('/', $branch))); - $rawBase = 'https://raw.githubusercontent.com/' . $repository . '/' . $encodedBranch . '/'; - $archiveUrl = 'https://github.com/' . $repository . '/archive/refs/tags/' . $tag . '.zip'; - $currentVersion = mcpReleaseValue($manifest, '/extension/version'); - $entryPath = '/updates/update[version="' . $version . '"]'; - $entryNodes = (new DOMXPath($feed))->query($entryPath); + $manifest = mcpReleaseXml($root . '/joomengine_mcp.xml'); $writes = []; if ($command === 'prepare') { + $changelog = mcpReleaseXml($root . '/changelog.xml'); + $pending = $changelog->xpath('changelog[version="[[[NEXT_VERSION]]]"]'); $markdown = file_get_contents($root . '/CHANGELOG.md'); - $pending = (new DOMXPath($changelog))->query('/changelogs/changelog[version="[[[NEXT_VERSION]]]"]'); - $existing = (new DOMXPath($changelog))->query('/changelogs/changelog[version="' . $version . '"]'); - - if (version_compare($version, $currentVersion, '<') || $existing->length !== 0 || $pending->length !== 1 - || substr_count($markdown, '[[[NEXT_VERSION]]]') !== 1 - || preg_match('/^## \[\[\[NEXT_VERSION\]\]\]/m', $markdown) !== 1) - { - throw new RuntimeException('Choose an unreleased version at least as new as the manifest and provide exactly one pending changelog section in both files.'); - } - $pendingEntry = $pending->item(0); - $pendingQuery = new DOMXPath($changelog); - - if ($pendingQuery->query('element[text()="' . $element . '"]', $pendingEntry)->length !== 1 - || $pendingQuery->query('type[text()="' . $type . '"]', $pendingEntry)->length !== 1 - || $pendingQuery->query('security/item|fix/item|language/item|addition/item|change/item|remove/item|note/item', $pendingEntry)->length === 0 - || (!$isComponent && $pendingQuery->query('folder[text()="console"]', $pendingEntry)->length !== 1)) + if (version_compare($version, (string) $manifest->version, '<') + || count($changelog->xpath('changelog[version="' . $version . '"]')) !== 0 + || count($pending) !== 1 || substr_count($markdown, '[[[NEXT_VERSION]]]') !== 1) { - throw new RuntimeException('Pending Joomla changelog must identify this extension and contain categorized changes.'); + throw new RuntimeException('Choose an unreleased version at least as new as the manifest, with one pending section in both changelogs.'); } - mcpReleaseSet($manifest, '/extension/version', $version); - mcpReleaseSet($manifest, '/extension/creationDate', gmdate('F Y')); - mcpReleaseSet($manifest, '/extension/updateservers/server', $rawBase . 'joomengine_mcp_update_server.xml'); - mcpReleaseSet($manifest, '/extension/changelogurl', $rawBase . $changelogName); - mcpReleaseSet($changelog, '/changelogs/changelog/version[text()="[[[NEXT_VERSION]]]"]', $version); - $writes['joomengine_mcp.xml'] = $manifest->saveXML(); - $writes[$changelogName] = $changelog->saveXML(); + $routingPath = 'plugins/webservices/joomengine_mcp/joomengine_mcp.xml'; + $routing = mcpReleaseXml($root . '/' . $routingPath); + $manifest->version = $routing->version = $version; + $manifest->creationDate = $routing->creationDate = gmdate('F Y'); + $writes['joomengine_mcp.xml'] = $manifest->asXML(); + $writes[$routingPath] = $routing->asXML(); + $writes['changelog.xml'] = str_replace('[[[NEXT_VERSION]]]', $version, file_get_contents($root . '/changelog.xml')); $writes['CHANGELOG.md'] = str_replace('[[[NEXT_VERSION]]]', $version, $markdown); - - if ($isComponent) - { - $routingPath = 'plugins/webservices/joomengine_mcp/joomengine_mcp.xml'; - $routing = mcpReleaseXml($root . '/' . $routingPath, 'extension'); - mcpReleaseSet($routing, '/extension/version', $version); - mcpReleaseSet($routing, '/extension/creationDate', gmdate('F Y')); - $configuration = json_decode(file_get_contents($root . '/.octojpack'), true, 64, JSON_THROW_ON_ERROR); - $configuration['package']['version'] = $version; - $writes[$routingPath] = $routing->saveXML(); - $writes['.octojpack'] = json_encode($configuration, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR) . "\n"; - } - } - elseif ($command === 'verify-tag') - { - $record = '/changelogs/changelog[version="' . $version . '"]'; - - if ($currentVersion !== $version || mcpReleaseValue($changelog, $record . '/element') !== $element - || mcpReleaseValue($changelog, $record . '/type') !== $type - || (!$isComponent && mcpReleaseValue($changelog, $record . '/folder') !== 'console') - || mcpReleaseValue($manifest, '/extension/updateservers/server') !== $rawBase . 'joomengine_mcp_update_server.xml' - || mcpReleaseValue($manifest, '/extension/changelogurl') !== $rawBase . $changelogName - || !preg_match('/^## ' . preg_quote($version, '/') . '(?:\s|$)/m', file_get_contents($root . '/CHANGELOG.md'))) - { - throw new RuntimeException('The existing tag does not contain the requested released extension metadata.'); - } - - if ($isComponent) - { - $routing = mcpReleaseXml($root . '/plugins/webservices/joomengine_mcp/joomengine_mcp.xml', 'extension'); - $config = json_decode(file_get_contents($root . '/.octojpack'), true, 64, JSON_THROW_ON_ERROR); - - if (mcpReleaseValue($routing, '/extension/version') !== $version || ($config['package']['version'] ?? '') !== $version) - { - throw new RuntimeException('The tag contains inconsistent routing plugin or OctoJPack versions.'); - } - } } else { - if ($entryNodes->length > 1 || version_compare($version, $currentVersion, '>')) + $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml'); + $existing = $feed->xpath('update[version="' . $version . '"]'); + $archive = 'https://github.com/joomengine/mcp_component/archive/refs/tags/v' . $version . '.zip'; + + if (count($existing) > 1 || version_compare($version, (string) $manifest->version, '>')) { throw new RuntimeException('Duplicate update versions or update newer than the prepared manifest.'); } - if ($entryNodes->length === 1) + if ($existing) { - if (mcpReleaseValue($feed, $entryPath . '/element') !== $element - || mcpReleaseValue($feed, $entryPath . '/type') !== $type - || mcpReleaseValue($feed, $entryPath . '/downloads/downloadurl') !== $archiveUrl - || (!$isComponent && mcpReleaseValue($feed, $entryPath . '/folder') !== 'console')) + if ((string) $existing[0]->element !== 'com_joomengine_mcp' + || (string) $existing[0]->type !== 'component' + || (string) $existing[0]->downloads->downloadurl !== $archive) { throw new RuntimeException('Existing update identity or tag URL differs; refusing to overwrite it.'); } - } - elseif ($command === 'feed') - { - $entry = $feed->createElement('update'); - $feed->documentElement->insertBefore($entry, $feed->documentElement->firstChild); - - foreach (['name' => $isComponent ? 'JoomEngine MCP' : 'JoomEngine MCP Console', - 'description' => $isComponent ? 'JoomEngine MCP component.' : 'JoomEngine MCP console plugin.', - 'element' => $element, 'type' => $type, 'version' => $version] as $name => $value) - { - mcpReleaseAppend($entry, $name, $value); - } - mcpReleaseAppend($entry, $isComponent ? 'client' : 'folder', $isComponent ? '1' : 'console'); - $download = mcpReleaseAppend(mcpReleaseAppend($entry, 'downloads', ''), 'downloadurl', $archiveUrl); - $download->setAttribute('type', 'full'); - $download->setAttribute('format', 'zip'); - mcpReleaseAppend(mcpReleaseAppend($entry, 'tags', ''), 'tag', 'stable'); - $platform = mcpReleaseAppend($entry, 'targetplatform', ''); - $platform->setAttribute('name', 'joomla'); - $platform->setAttribute('version', '6\\.[1-9][0-9]*'); - mcpReleaseAppend($entry, 'php_minimum', '8.3.0'); - mcpReleaseAppend($entry, 'detailsurl', 'https://github.com/' . $repository . '/tree/' . $tag); - mcpReleaseAppend($entry, 'changelogurl', $rawBase . $changelogName); - $writes['joomengine_mcp_update_server.xml'] = $feed->saveXML(); + return; } - if ($command === 'verify-hash') - { - $archive = $arguments[4] ?? ''; - $hash = strtolower(mcpReleaseValue($feed, $entryPath . '/sha512')); + $entry = $feed->addChild('update'); - if (!is_file($archive) || preg_match('/\A[a-f0-9]{128}\z/D', $hash) !== 1 - || !hash_equals($hash, hash_file('sha512', $archive))) - { - throw new RuntimeException('OctoShoom has not published a matching SHA-512 for the immutable tag archive.'); - } + foreach (['name' => 'JoomEngine MCP', 'description' => 'JoomEngine MCP component.', + 'element' => 'com_joomengine_mcp', 'type' => 'component', 'version' => $version, 'client' => '1'] as $name => $value) + { + $entry->addChild($name, $value); } + + $download = $entry->addChild('downloads')->addChild('downloadurl', $archive); + $download->addAttribute('type', 'full'); + $download->addAttribute('format', 'zip'); + $entry->addChild('tags')->addChild('tag', 'stable'); + $platform = $entry->addChild('targetplatform'); + $platform->addAttribute('name', 'joomla'); + $platform->addAttribute('version', '6\\.[1-9][0-9]*'); + $entry->addChild('php_minimum', '8.3.0'); + $entry->addChild('detailsurl', 'https://github.com/joomengine/mcp_component/tree/v' . $version); + $entry->addChild('changelogurl', 'https://raw.githubusercontent.com/joomengine/mcp_component/main/changelog.xml'); + $writes['joomengine_mcp_update_server.xml'] = $feed->asXML(); } foreach ($writes as $path => $contents) @@ -236,7 +114,7 @@ function mcpRelease(array $arguments, string $root): void try { mcpRelease(array_slice($argv, 1), dirname(__DIR__)); - echo "Release metadata verified.\n"; + echo "Release metadata updated.\n"; } catch (Throwable $error) { From 29deb6dfeaa84c238e13ba4a3463a355d5f8e92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eW=C9=98yn?= <5607939+Llewellynvdm@users.noreply.github.com> Date: Mon, 28 Sep 2026 17:52:00 +0200 Subject: [PATCH 3/3] Use package updates and extract webservices plugin ownership --- .github/workflows/golden-image.yml | 8 + .github/workflows/integration.yml | 10 + .github/workflows/release.yml | 27 +- .octojpack | 17 +- AGENTS.md | 6 +- CHANGELOG.md | 12 +- README.md | 10 +- admin/src/Installer/InstallerScript.php | 62 +- changelog.xml | 12 +- docs/ARCHITECTURE.md | 4 +- docs/IMPLEMENTATION.md | 8 +- docs/RELEASE.md | 50 +- joomengine_mcp_update_server.xml | 23 +- plugins/webservices/joomengine_mcp/LICENSE | 674 ------------------ .../joomengine_mcp/joomengine_mcp.xml | 23 - .../en-GB/plg_webservices_joomengine_mcp.ini | 2 - .../plg_webservices_joomengine_mcp.sys.ini | 2 - .../joomengine_mcp/services/provider.php | 37 - .../src/Extension/JoomEngineMcp.php | 67 -- tests/golden-image/run.sh | 7 + tests/integration/lifecycle.php | 17 +- tests/integration/run.sh | 9 +- tests/package.php | 4 +- tests/release.php | 20 +- tools/release.php | 49 +- 25 files changed, 183 insertions(+), 977 deletions(-) delete mode 100644 plugins/webservices/joomengine_mcp/LICENSE delete mode 100644 plugins/webservices/joomengine_mcp/joomengine_mcp.xml delete mode 100644 plugins/webservices/joomengine_mcp/language/en-GB/plg_webservices_joomengine_mcp.ini delete mode 100644 plugins/webservices/joomengine_mcp/language/en-GB/plg_webservices_joomengine_mcp.sys.ini delete mode 100644 plugins/webservices/joomengine_mcp/services/provider.php delete mode 100644 plugins/webservices/joomengine_mcp/src/Extension/JoomEngineMcp.php diff --git a/.github/workflows/golden-image.yml b/.github/workflows/golden-image.yml index 62fa041..8ab267a 100644 --- a/.github/workflows/golden-image.yml +++ b/.github/workflows/golden-image.yml @@ -50,6 +50,13 @@ jobs: ref: 881b1006b67afc24d35d17b82cd32d16a5593a44 path: build/client-source persist-credentials: false + - name: Check out the independent webservices plugin under test + uses: actions/checkout@v7 + with: + repository: joomengine/mcp_webservices + ref: 7853f864d70ff8aea43c488bc3a93bd6e5724623 + path: build/webservices-source + persist-credentials: false - name: Install the client dependencies for the remote acceptance scenario working-directory: build/client-source run: composer install --no-interaction --prefer-dist --no-progress @@ -57,6 +64,7 @@ jobs: env: COMPOSE_PROJECT_NAME: mcp-${{ github.run_id }}-${{ github.run_attempt }} MCP_PLUGIN_SOURCE: ${{ github.workspace }}/build/plugin-source + MCP_WEBSERVICES_SOURCE: ${{ github.workspace }}/build/webservices-source MCP_CLIENT_SOURCE: ${{ github.workspace }}/build/client-source run: bash tests/golden-image/run.sh - name: Preserve redacted installation and execution evidence diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 2142fb3..6980cb4 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -54,6 +54,13 @@ jobs: ref: fe387b962dab605191ef18efe4d5cb94821165d9 path: build/plugin-source persist-credentials: false + - name: Check out the independent webservices plugin under test + uses: actions/checkout@v7 + with: + repository: joomengine/mcp_webservices + ref: 7853f864d70ff8aea43c488bc3a93bd6e5724623 + path: build/webservices-source + persist-credentials: false - name: Check out the remote client bridge under test uses: actions/checkout@v7 with: @@ -74,6 +81,7 @@ jobs: run: | mkdir -p build/evidence git -C build/plugin-source rev-parse HEAD > build/evidence/console-plugin-source.txt + git -C build/webservices-source rev-parse HEAD > build/evidence/webservices-plugin-source.txt git -C build/client-source rev-parse HEAD > build/evidence/client-source.txt - name: Validate committed runtime files and native manifests run: | @@ -89,6 +97,7 @@ jobs: MCP_TEST_DB_PASS: disposable-test-password MCP_TEST_DB_NAME: mcp_fixture MCP_PLUGIN_SOURCE: ${{ github.workspace }}/build/plugin-source + MCP_WEBSERVICES_SOURCE: ${{ github.workspace }}/build/webservices-source MCP_CLIENT_SOURCE: ${{ github.workspace }}/build/client-source run: bash tests/integration/run.sh - name: Preserve redacted evidence and the tested source ZIPs @@ -100,5 +109,6 @@ jobs: build/evidence/ build/component-source.zip build/console-plugin-source.zip + build/webservices-plugin-source.zip if-no-files-found: error retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33556aa..447ad5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release component with OctoShoom and OctoJPack +name: Release component with OctoJPack and OctoShoom on: workflow_dispatch: @@ -40,7 +40,7 @@ jobs: with: php-version: '8.3' coverage: none - - name: Publish the version and Joomla update entry + - name: Publish the component version env: VERSION: ${{ inputs.version }} run: | @@ -49,24 +49,29 @@ jobs: git remote set-url origin git@github.com:joomengine/mcp_component.git if ! git show-ref --verify --quiet "refs/tags/$tag"; then php tools/release.php prepare "$version" - git add joomengine_mcp.xml CHANGELOG.md changelog.xml plugins/webservices/joomengine_mcp/joomengine_mcp.xml + git add joomengine_mcp.xml CHANGELOG.md changelog.xml git commit -m "Release $tag" git tag -a "$tag" -m "Release $tag" git push --atomic origin HEAD:main "refs/tags/$tag" fi - php tools/release.php feed "$version" + - name: Build and push the package + id: package + uses: octoleo/octojpack@master + with: + config: .octojpack + push: 'true' + - name: Update the package download entry + env: + VERSION: ${{ steps.package.outputs.version }} + run: | + php tools/release.php feed "$VERSION" git add joomengine_mcp_update_server.xml if ! git diff --cached --quiet; then - git commit -m "Add $tag to the Joomla update server" + git commit -m "Publish package $VERSION update metadata" git push origin HEAD:main fi - - name: Update hashes + - name: Hash the published package uses: octoleo/octoshoom@master with: config-json: | {"update_servers":[{"owner":"joomengine","repo":"mcp_component","branch":"main","path":"joomengine_mcp_update_server.xml"}]} - - name: Build and push the package - uses: octoleo/octojpack@master - with: - config: .octojpack - push: 'true' diff --git a/.octojpack b/.octojpack index 8a6c174..ab60efb 100644 --- a/.octojpack +++ b/.octojpack @@ -20,13 +20,13 @@ "author_url": "https://dev.vdm.io/", "description": "JoomEngine MCP component, webservices routing, and local console server.", "version_id": "com_joomengine_mcp", - "update_servers": "[[[PACKAGE_UPDATE_SERVER]]]", - "changelog_servers": "[[[PACKAGE_CHANGELOG_SERVER]]]" + "update_servers": "https://raw.githubusercontent.com/joomengine/mcp_component/main/joomengine_mcp_update_server.xml", + "changelog_servers": "https://raw.githubusercontent.com/joomengine/mcp_component/main/changelog.xml" }, "repository": { - "owner": "[[[PACKAGE_OWNER]]]", - "repo": "[[[PACKAGE_REPOSITORY]]]", - "branch": "[[[PACKAGE_BRANCH]]]" + "owner": "joomengine", + "repo": "mcp_package", + "branch": "main" }, "files": [ { @@ -41,6 +41,13 @@ "id": "joomengine_mcp", "type": "plugin", "group": "console" + }, + { + "owner": "joomengine", + "repo": "mcp_webservices", + "id": "joomengine_mcp", + "type": "plugin", + "group": "webservices" } ], "languages": [ diff --git a/AGENTS.md b/AGENTS.md index 452e9bf..3b5ff2c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -31,11 +31,11 @@ PHP style authority: https://github.com/extension-builder/joomla/blob/main/docs/ ## Source installation and release contract -- This is exclusively the component repository. A GitHub source ZIP of any reviewed branch or tag must install directly in Joomla, with every manifest file, production Composer dependency, licence, routing plugin and seed already tracked. No downstream Composer run, staging, compilation or packaging is allowed. +- This is exclusively the component repository. A GitHub source ZIP of any reviewed branch or tag must install directly in Joomla, with every manifest file, production Composer dependency, licence and seed already tracked. No downstream Composer run, staging, compilation or packaging is allowed. - Keep production dependencies in `admin/vendor` and the installation seed in `admin/data`. When changing dependencies, run Composer as a maintainer, commit the lock and complete resolved runtime, and verify its autoload paths after relocation to Joomla's administrator component directory. Never hand-edit third-party vendor source. - Preserve SQL installation/schema updates and the JSON-driven customization-preserving seed updater. They are approved installation mechanisms; do not replace them merely to change the release process. -- OctoJPack alone combines extensions using `.octojpack` and writes to the separate package repository. Package manifests, package update feeds, assembly scripts and bundled console copies do not belong here. Keep `.octojpack` concrete and usable from any machine: hardcode stable source/destination repositories, branch, raw GitHub update/changelog URLs and the raw licence URL. Use native latest-tag selection and `version_id`; do not render placeholders or rewrite the configuration during releases. Never change the shared Octo engines without an explicit request. -- The manual Release workflow takes the next version, freezes metadata, creates the tag and adds its archive URL to the native component feed. Follow the upstream quick-start examples: call `octoleo/git-user@v2` once, then `octoleo/octoshoom@master`, then `octoleo/octojpack@master` with `.octojpack`. Both actions inherit the same Git setup and environment. A failed hash step stops packaging. Keep credentials in GitHub secrets. Do not duplicate authentication, hashing, archive checks, packaging, configuration rendering or repository preflight logic locally. Local release code only edits this component's version, changelogs and update entry. Never move a released tag. +- OctoJPack alone combines `mcp_component`, `mcp_plugin` (console) and `mcp_webservices` (HTTP routing), then writes to `joomengine/mcp_package` on `main`. Every plugin belongs in its own repository. Component installation, update and uninstall must never install, change or remove either plugin. The generated package manifest and assembly belong in the package repository. The package update feed `joomengine_mcp_update_server.xml` and shared `changelog.xml` deliberately remain in this component repository, as requested by the maintainer. Keep `.octojpack` concrete and usable from any machine: hardcode stable source/destination repositories, branch, raw GitHub update/changelog URLs and the raw licence URL. Use native latest-tag selection and `version_id`; do not render placeholders or rewrite the configuration during releases. Never change the shared Octo engines without an explicit request. +- The manual Release workflow takes the next version and freezes component metadata before creating its tag. Call `octoleo/git-user@v2` once, then `octoleo/octojpack@master` with `.octojpack`, update the package feed with the published version, and call `octoleo/octoshoom@master`. Hashing must follow package publication because the feed downloads the package ZIP. Both actions inherit the same Git setup and environment. The feed contains the current `pkg_joomengine_mcp` / `package` / client `site` entry, downloads only `mcp_package` tag archives, and uses the component version. Clear the previous archive checksum when advancing the feed; OctoShoom supplies the new one. Keep credentials in GitHub secrets. Do not duplicate authentication, hashing, archive checks, packaging, configuration rendering or repository preflight logic locally. Local release code only edits the component version, changelogs and package update entry. Never move a released tag. - Update **both** `CHANGELOG.md` and `changelog.xml` with every meaningful change. Put pending entries under the exact literal `[[[NEXT_VERSION]]]`; create a new pending section after the previous one is released. Do not invent a version or modify historical released entries. The workflow replaces this marker with its input version in both files. - Joomla changelog identity is `com_joomengine_mcp` / `component`. Use native categories `security`, `fix`, `language`, `addition`, `change`, `remove`, and `note`, each containing `item` children. Use matching human headings in Markdown. Record compatibility warnings under Note, errors fixed under Fix, and security fixes under Security. Keep both changelogs consistent and the manifest's `changelogurl` valid. - Check workflow syntax and changed metadata behavior. Source installation checks inspect the tracked source archive. Do not copy upstream action tests or restore package builders to make a test pass. See `docs/RELEASE.md`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dd93cb..bb034e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,24 +11,26 @@ ### Addition -- Add a manual version release workflow that freezes both changelogs, creates an immutable tag, updates the Joomla feed and waits for OctoShoom before invoking OctoJPack. +- Add a manual version release workflow that freezes both changelogs, creates an immutable tag, publishes the package with OctoJPack, updates the package feed and runs OctoShoom against the published package. - Document GitHub secrets and the source-installation contract for future agents. ### Change -- Follow the Octoleo quick starts: set up Git once, run OctoShoom, then let OctoJPack read `.octojpack` directly. +- Follow the Octoleo quick starts: set up Git once, let OctoJPack read `.octojpack` directly, then let OctoShoom hash the package download. -- Delegate combined Joomla package assembly exclusively to OctoJPack and a separate package repository. +- Publish combined Joomla packages to `joomengine/mcp_package`; keep the package feed and shared changelog here, with the package version derived from the component. +- Extract webservices routing into its own `mcp_webservices` repository and include it as a separate OctoJPack extension. - Verify tracked source archives in component and console installation tests. ### Remove -- Remove repository-local ZIP/package builders, distribution locks and package update metadata. +- Remove repository-local ZIP/package builders, distribution locks and generated package manifests. +- Remove component-installer ownership of the webservices plugin. - Remove temporary action checkouts, configuration rendering, custom SSH setup, duplicate hash verification and package repository checks. ### Note -- Release the console plugin first; OctoJPack selects the latest tags using its native configuration. +- Tag the independent console and webservices plugin releases before releasing the component; OctoJPack selects their latest tags. - Configure the secrets documented in docs/RELEASE.md before the first release. ## 0.1.1 — development baseline diff --git a/README.md b/README.md index 1cbc146..34005cd 100644 --- a/README.md +++ b/README.md @@ -9,21 +9,21 @@ An installable PHP MCP server for Joomla 6.1–6.x, with database-defined tools, ## Repository boundary -This repository owns the installable component: catalogue, administrator MVC/forms, HTTP endpoint/routing glue, Joomla token/ACL integration, shared API/native execution, durable state and jobs. Its locked production dependencies are committed under `admin/vendor`; Composer is a maintainer tool, never an installation step. External MCP connection code, remote stdio bridging, client documentation and client releases belong exclusively to `mcp_client`. +This repository owns the installable component: catalogue, administrator MVC/forms, HTTP endpoint controllers, Joomla token/ACL integration, shared API/native execution, durable state and jobs. Its locked production dependencies are committed under `admin/vendor`; Composer is a maintainer tool, never an installation step. External MCP connection code, remote stdio bridging, client documentation and client releases belong exclusively to `mcp_client`. The component's outbound Joomla API transport is implemented in `admin/src/Http`. See [client separation and handoff](docs/CLIENT-HANDOFF.md). ## Download and install -Download this repository using **Code → Download ZIP**, or download a release tag's source ZIP, and upload it in Joomla's extension installer. The source tree already contains its production PHP dependencies, installation data and owned webservices routing plugin. No build, Composer run or repacking is required. The supported host is Joomla 6.1–6.x with PHP 8.3 or later and the extensions listed in `composer.json`. +Download this repository using **Code → Download ZIP**, or download a release tag's source ZIP, and upload it in Joomla's extension installer. The source tree already contains its production PHP dependencies and installation data. No build, Composer run or repacking is required. The supported host is Joomla 6.1–6.x with PHP 8.3 or later and the extensions listed in `composer.json`. -Configure the canonical site API URL and Joomla permissions under **Components → JoomEngine MCP → Options**. The authenticated MCP endpoint is `/api/index.php/v1/joomengine-mcp`, relative to the Joomla installation. For direct local console commands, install the separate [console plugin](https://github.com/joomengine/mcp_plugin), or use the combined Joomla package published by OctoJPack in the configured package repository. +Configure the canonical site API URL and Joomla permissions under **Components → JoomEngine MCP → Options**. The authenticated MCP endpoint is `/api/index.php/v1/joomengine-mcp`, relative to the Joomla installation. HTTP route registration comes from the separate [webservices plugin](https://github.com/joomengine/mcp_webservices); local console commands come from the [console plugin](https://github.com/joomengine/mcp_plugin). Install the [combined package](https://github.com/joomengine/mcp_package) to get all three extensions together. For native JCB background jobs, provide a PHP CLI executable compatible with the installed Joomla version, with `pcntl_fork`, `posix_setsid` and `proc_open` available. Select its absolute path in the component's **PHP CLI binary** setting when it differs from the automatically detected PHP executable. The web-server account must be able to launch it and write the private artifact directory outside the served Joomla tree. Worker prerequisites are checked before a write is claimed. The golden-image Dockerfile demonstrates the required CLI extension setup; ordinary Joomla API operations remain available without that job runtime. Remote AI applications can use the independent client's [Docker Compose launcher](https://github.com/joomengine/mcp_client/blob/feature/standalone-php-client/docs/DOCKER.md). Supply the HTTPS Joomla installation URL and native API token; the client discovers capabilities from this component. The console plugin is required for direct local Joomla MCP commands, while the remote client connects to the component's authenticated HTTP endpoint. -The combined package is built exclusively by [OctoJPack](https://github.com/octoleo/octojpack), using `.octojpack`, and published to a separate package repository. Run the manual **Release** workflow with the next version to freeze both changelogs, create the tag, update the Joomla feed, wait for OctoShoom to commit its checksums, and then invoke OctoJPack. [Release instructions](docs/RELEASE.md) list the repository variables and secrets to configure. +The combined package is built exclusively by [OctoJPack](https://github.com/octoleo/octojpack), using the fixed `.octojpack` configuration, and published to [mcp_package](https://github.com/joomengine/mcp_package). The component version determines the package version. Run the manual **Release** workflow to freeze the changelogs, tag the component, publish the package, update the package feed here, and let OctoShoom hash that package ZIP. [Release instructions](docs/RELEASE.md) list the required secrets. ## Required capabilities @@ -47,7 +47,7 @@ Joomla core remains usable without JCB. Remote HTTP and stdio clients retain the ## Current status -Native administration, installed core tests, JCB synchronization and job/artifact runtime are implemented. [Implementation status](docs/IMPLEMENTATION.md) separates historical installed Joomla/JCB evidence from verification of the current source and release changes. Published tags identify component releases; package publication belongs to the configured package repository. +Native administration, installed core tests, JCB synchronization and job/artifact runtime are implemented. [Implementation status](docs/IMPLEMENTATION.md) separates historical installed Joomla/JCB evidence from verification of the current source and release changes. Published tags identify component releases; package publication belongs to `joomengine/mcp_package`. The original migration source is pinned at `joomengine/joomla-mcp@2cff50f4f6b440da3c684f9995a77efad32e1a36`. It remains unchanged. Joomla 6 native contracts are authoritative; repository/MVC/XML placement follows JCB's extension-root layout. This is hand-authored JCB-aligned source, not an already imported JCB blueprint. diff --git a/admin/src/Installer/InstallerScript.php b/admin/src/Installer/InstallerScript.php index 8093415..2b41a55 100644 --- a/admin/src/Installer/InstallerScript.php +++ b/admin/src/Installer/InstallerScript.php @@ -10,13 +10,10 @@ use Joomla\CMS\Application\CMSApplicationInterface; -use Joomla\CMS\Installer\Installer; use Joomla\CMS\Installer\InstallerAdapter; use Joomla\CMS\Installer\InstallerScriptInterface; -use Joomla\CMS\Table\Extension; use Joomla\CMS\Version; use Joomla\Database\DatabaseInterface; -use Joomla\Registry\Registry; use RuntimeException; use Throwable; use VDM\Component\JoomEngineMcp\Administrator\Database\JoomlaStore; @@ -24,9 +21,9 @@ /** - * Native Joomla installer owning the component's routing glue and catalogue assets. + * Native Joomla installer owning the component's catalogue assets. * - * Update preserves operator settings, plugin enabled state, custom rows and ACL. + * Update preserves operator settings, custom rows and ACL. * The distributed archive already contains its complete PHP dependency tree. * * @since 0.1.0 @@ -72,7 +69,7 @@ public function preflight(string $type, InstallerAdapter $adapter): bool $source = $adapter->getParent()->getPath('source'); - foreach (['admin/autoload.php', 'admin/vendor/autoload.php', 'admin/data/catalogue-seed.json', 'plugins/webservices/joomengine_mcp/joomengine_mcp.xml'] as $file) + foreach (['admin/autoload.php', 'admin/vendor/autoload.php', 'admin/data/catalogue-seed.json'] as $file) { if (!is_file($source . '/' . $file)) { @@ -80,7 +77,7 @@ public function preflight(string $type, InstallerAdapter $adapter): bool } } - $current = $this->extension('component', 'com_joomengine_mcp'); + $current = $this->component(); if ($current !== null) { @@ -134,34 +131,6 @@ public function postflight(string $type, InstallerAdapter $adapter): bool } (new Assets($this->database, $store))->synchronize(); - $previous = $this->extension('plugin', 'joomengine_mcp', 'webservices'); - $installer = new Installer(); - $installer->setDatabase($this->database); - - if (!$installer->install($adapter->getParent()->getPath('source') . '/plugins/webservices/joomengine_mcp')) - { - throw new RuntimeException('The required MCP webservices routing plugin could not be installed.'); - } - - $row = $this->extension('plugin', 'joomengine_mcp', 'webservices'); - - if ($row === null) - { - throw new RuntimeException('The installed MCP webservices plugin is missing.'); - } - - $table = new Extension($this->database); - $table->load((int) $row['extension_id']); - $params = new Registry($table->params); - $params->set('joomengine_mcp_owner', 'com_joomengine_mcp'); - $table->params = (string) $params; - $table->enabled = $previous === null ? 1 : (int) $previous['enabled']; - - if (!$table->store()) - { - throw new RuntimeException('The MCP routing plugin state could not be stored.'); - } - $this->application->enqueueMessage('JoomEngine MCP is installed. Configure its canonical API URL and Joomla permissions in Components → JoomEngine MCP → Options.'); return true; @@ -177,31 +146,16 @@ public function postflight(string $type, InstallerAdapter $adapter): bool /** @inheritDoc */ public function uninstall(InstallerAdapter $adapter): bool { - $row = $this->extension('plugin', 'joomengine_mcp', 'webservices'); - - if ($row !== null && (new Registry($row['params']))->get('joomengine_mcp_owner') === 'com_joomengine_mcp') - { - $installer = new Installer(); - $installer->setDatabase($this->database); - $installer->setPackageUninstall($adapter->getParent()->isPackageUninstall()); - - if (!$installer->uninstall('plugin', (int) $row['extension_id'])) - { - $this->application->enqueueMessage('Remove the owned JoomEngine MCP webservices plugin manually; its automatic uninstall failed.', 'warning'); - } - } - return true; } - /** @param string $type Native extension type. @param string $element Native element. @param string $folder Optional plugin group. @return ?array Native extension record. @since 0.1.0 */ - private function extension(string $type, string $element, string $folder = ''): ?array + /** @return ?array Installed component record. @since 0.1.0 */ + private function component(): ?array { $db = $this->database; $query = $db->createQuery()->select('*')->from($db->quoteName('#__extensions')) - ->where($db->quoteName('type') . ' = :type')->where($db->quoteName('element') . ' = :element') - ->where($db->quoteName('folder') . ' = :folder') - ->bind(':type', $type)->bind(':element', $element)->bind(':folder', $folder); + ->where($db->quoteName('type') . ' = ' . $db->quote('component')) + ->where($db->quoteName('element') . ' = ' . $db->quote('com_joomengine_mcp')); return $db->setQuery($query)->loadAssoc() ?: null; } diff --git a/changelog.xml b/changelog.xml index 5744f87..1963fdc 100644 --- a/changelog.xml +++ b/changelog.xml @@ -10,20 +10,22 @@ Point component update discovery to the maintained native XML feed. - Add manual version releases with changelog freezing, immutable tags, Joomla update entries and synchronous OctoShoom before OctoJPack. + Add manual version releases with changelog freezing, immutable tags, OctoJPack package publication and subsequent OctoShoom package hashing. Document release secrets and source installation requirements for maintainers and agents. - Follow the Octoleo quick starts: set up Git once, run OctoShoom, then let OctoJPack read .octojpack directly. - Delegate combined Joomla package assembly exclusively to OctoJPack and a separate package repository. + Follow the Octoleo quick starts: set up Git once, let OctoJPack read .octojpack directly, then let OctoShoom hash the package download. + Publish packages to joomengine/mcp_package with the component version, keeping the package feed and shared changelog in this component repository. + Extract webservices routing into its own mcp_webservices repository and include it as a separate OctoJPack extension. Verify tracked source archives in component and console installation tests. - Remove local ZIP/package builders, distribution locks and package update metadata. + Remove local ZIP/package builders, distribution locks and generated package manifests. + Remove component-installer ownership of the webservices plugin. Remove temporary action checkouts, configuration rendering, custom SSH setup, duplicate hash verification and package repository checks. - Release the console plugin first; OctoJPack selects the latest tags using its native configuration. + Tag the console and webservices plugin releases first; OctoJPack selects their latest tags. Configure the secrets documented in docs/RELEASE.md before the first release. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index e424325..b687e95 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -12,7 +12,7 @@ Joomla 6 contracts are authoritative. Repository placement follows JCB: root `jo AI/MCP client → Joomla API entry point → Joomla API-token authentication → non-public MCP route → component controller/transport boundary → protocol engine → database catalogue/authorizer → reviewed action binding → Joomla/JCB API or explicitly authorized native service → verification/audit → JSON-RPC response. -Joomla route registration requires a webservices plugin. Minimal `webservices/joomengine_mcp` glue is bundled with the component and is distinct from the console plugin. Install/enable it through the native installer, preserve operator state on updates and remove only owned glue on uninstall. An API directory alone does not register routes. +Joomla route registration belongs to `joomengine/mcp_webservices`, a separately installable plugin. Local console entry belongs to `joomengine/mcp_plugin`. OctoJPack combines both plugins with the component in `joomengine/mcp_package`; the component installer never manages either plugin. The webservices plugin registers routes only while the component is enabled, enables itself on initial installation and preserves operator state on updates. Reuse Joomla token authentication, not a second credential store. Verify both supported Joomla token header forms against the installed API authentication plugin. Static token authentication is not OAuth discovery; do not advertise an OAuth authorization server that is not implemented. @@ -52,7 +52,7 @@ JCB source-code fields remain permitted inert definition data under appropriate ## Distribution and references -This repository is a directly installable component source tree, with routing glue, locked production dependencies and installation data committed in place. MySQL/MariaDB and PostgreSQL schema updates and customization-preserving JSON seed updates remain installer-owned. The console plugin is independently installable. Manual version releases freeze both changelogs, tag source, update the native feed and wait for OctoShoom. Only then does the OctoJPack action use the same standalone `.octojpack` configuration and latest component/console tags to assemble a combined package in a separate repository. No package builder or combined-package manifest belongs here. See RELEASE.md. +This repository is a directly installable component source tree, with production dependencies and installation data committed in place. MySQL/MariaDB and PostgreSQL schema updates and customization-preserving JSON seed updates remain installer-owned. Both plugins have independent repositories and native installers. Manual version releases tag the component, use the standalone `.octojpack` configuration to publish the combined package with the same version, update the package feed in this component repository, then run OctoShoom against the package archive. See RELEASE.md. - Original MCP: https://github.com/joomengine/joomla-mcp/tree/2cff50f4f6b440da3c684f9995a77efad32e1a36 - Joomla/JCB layout: https://github.com/joomengine/Joomla-Component-Builder/tree/6.x diff --git a/docs/IMPLEMENTATION.md b/docs/IMPLEMENTATION.md index d13432b..bf44895 100644 --- a/docs/IMPLEMENTATION.md +++ b/docs/IMPLEMENTATION.md @@ -2,11 +2,11 @@ ## Repository and source baseline -The migration PR #1 is merged; source-installation and release realignment is on `fix/octo-release-workflow`. Original MCP source: `2cff50f4f6b440da3c684f9995a77efad32e1a36`. JCB source: `extension-builder/joomla@5ee658dd07eb749dca43ed4722f6cca7eb8208cf`. The development component version is 0.1.1. Releases select an immutable console tag through GitHub configuration; the package repository is separate. +The migration PR #1 is merged; source-installation and release realignment is on `fix/standalone-octojpack`. Original MCP source: `2cff50f4f6b440da3c684f9995a77efad32e1a36`. JCB source: `extension-builder/joomla@5ee658dd07eb749dca43ed4722f6cca7eb8208cf`. The development component version is 0.1.1. OctoJPack selects the tagged component and independent plugins from its fixed configuration and publishes to `joomengine/mcp_package`. ## Implemented server -Database catalogue/authorization, schema validation, reviewed API/native handlers, durable permission/plan/execution/audit services, PHP SDK tools/resources/prompts/sessions, authenticated HTTP routing and local console composition are present. Native administrator forms, assets, access/configuration, operational inspection, grant revocation and execution reconciliation are implemented. The installer owns its webservices plugin and preserves operator settings and customized catalogue rows on update. +Database catalogue/authorization, schema validation, reviewed API/native handlers, durable permission/plan/execution/audit services, PHP SDK tools/resources/prompts/sessions, authenticated HTTP routing and local console composition are present. Native administrator forms, assets, access/configuration, operational inspection, grant revocation and execution reconciliation are implemented. The component installer preserves operator settings and customized catalogue rows on update. HTTP routing and console plugins are installed and managed independently. All 36 imported production native PHP files follow the JCB style, with explicit dependency properties and class/member contract documentation. The source map retains original hashes and records the target transformations. The five original `sourceOnlyGates` remain deliberate upstream diagnostics; they were rejected by the original implementation and are not missing migrated functionality. See [migration provenance](migration/README.md). @@ -22,9 +22,9 @@ Approval previews show the selected definitions, frozen option layers, repositor The administrator Operations screen includes jobs/artifact metadata and cancellation. The `joomla_job_*` tools expose owned listing, status, cancellation, queued redispatch and bounded artifact reads. An API worker reloads the requesting Joomla user and rechecks authority; it does not become the trusted console owner. -The tracked component source now contains production dependencies, installation data and its administrator licence. Source ZIP installation replaces local archive builders. The manual next-version release freezes changelogs and manifest metadata, creates an immutable tag, updates the native feed, waits for OctoShoom to commit its checksum, and then invokes external OctoJPack. Combined package manifests and publication belong to a separate configured repository. See [RELEASE.md](RELEASE.md). +The tracked component source contains production dependencies, installation data and its administrator licence. Source ZIP installation replaces local archive builders. The manual release freezes metadata and tags the component, then OctoJPack publishes the package with that version. Its current-version update feed and shared changelog stay in this component repository; OctoShoom hashes the published package ZIP. See [RELEASE.md](RELEASE.md). -Release simplification in PR #3 follows the native Octoleo action examples: one `git-user` setup, then OctoShoom and OctoJPack using their shared environment. Local release code now only edits version, changelog and feed metadata. Workflow lint, 22 metadata checks and 34 source-installation checks passed locally. The separate package destination and its raw XML URLs still need to be supplied before `.octojpack` is complete; no release was run. +PR #3 uses the native Octoleo actions with one Git setup and fully concrete `.octojpack` values. The feed is populated with the current 0.1.1 metadata; the first release run replaces it with the published package version and adds the real hash. No package tag has been published by this PR. The webservices plugin is extracted into `joomengine/mcp_webservices`, PR #1. Installed CI checks use its exact source revision to verify independent plugin install, upgrade and uninstall. Local metadata, source-installation, ownership, PHP and workflow syntax checks pass; the latest installed run is recorded in PR #3. ## Historical verified runtime evidence diff --git a/docs/RELEASE.md b/docs/RELEASE.md index cc31b73..d480273 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -1,41 +1,49 @@ -# Source installation and releases +# Installation and releases -This is the component repository. Its source ZIP installs directly in Joomla: production dependencies, installation data, licence and owned webservices plugin are already tracked. No downstream Composer or build step is required. The console plugin has its own installable repository. +This is exclusively the component repository. Its source ZIP installs directly in Joomla with production dependencies and installation data already included. The [console plugin](https://github.com/joomengine/mcp_plugin) and [webservices plugin](https://github.com/joomengine/mcp_webservices) are independent extensions. The component installer does not install, update or remove them. -OctoJPack combines the latest tagged component and console plugin using `.octojpack`. It owns package assembly and publication in the separate package repository. The package manifest and package update/changelog files belong there. +[OctoJPack](https://github.com/octoleo/octojpack#quick-start) combines all three extensions using the concrete `.octojpack` file and publishes to **joomengine/mcp_package**, branch **main**. Native `version_id: com_joomengine_mcp` makes the package version follow the component tag. Default tag selection works both in the workflow and from a standalone OctoJPack installation. + +## Fixed update URLs + +The package files and generated package manifest belong in `mcp_package`. The package update server and shared changelog deliberately remain in this component repository: + +- Update server: https://raw.githubusercontent.com/joomengine/mcp_component/main/joomengine_mcp_update_server.xml +- Changelog: https://raw.githubusercontent.com/joomengine/mcp_component/main/changelog.xml +- Licence: https://raw.githubusercontent.com/joomengine/mcp_component/main/LICENSE + +The feed identifies `pkg_joomengine_mcp`, type `package`, client `site` (Joomla installs packages with client ID 0). Its download is the matching `mcp_package/archive/refs/tags/vVERSION.zip`, never a component-only ZIP. The feed keeps the current supported package version; changelogs retain release history. The initial 0.1.1 entry is prepared metadata. The first release run publishes the selected package version before replacing that entry and adding its real checksum. + +Joomla updates through this feed require the combined package to be installed. Standalone component installation remains available; HTTP routing requires the separately installed webservices plugin. ## GitHub setup -Follow the upstream [git-user](https://github.com/octoleo/git-user#workflows), [OctoShoom](https://github.com/octoleo/octoshoom#quick-start) and [OctoJPack](https://github.com/octoleo/octojpack#quick-start) examples. Configure these repository or organization Actions secrets: +Follow the native [git-user](https://github.com/octoleo/git-user#workflows), OctoJPack and [OctoShoom](https://github.com/octoleo/octoshoom#quick-start) examples. Configure these Actions secrets: | Secret | Value | | --- | --- | | `GIT_USER`, `GIT_EMAIL` | Release Git identity. | | `GPG_KEY`, `GPG_USER` | Signing key and its user ID. | -| `SSH_KEY`, `SSH_PUB` | Matching SSH keypair for that identity, with write access to the component and package repositories. | +| `SSH_KEY`, `SSH_PUB` | Matching SSH keypair with write access to component and package repositories. | | `GIT_TOKEN` | GitHub API token for OctoJPack to read the source repositories. | -`git-user` runs once. OctoShoom and OctoJPack inherit its Git configuration; OctoJPack reads the token from `VDM_GLOBAL_TOKEN`. The workflow supplies each action's configuration input and enables OctoJPack's native `push` option. There are no per-release repository, tool-ref or package-URL variables. - -## Release - -Release the console plugin first, then run **Release component with OctoShoom and OctoJPack** on `main` with the next version, such as `1.2.3` or `v1.2.3`. +`git-user` runs once. Both actions inherit its Git setup; OctoJPack reads `VDM_GLOBAL_TOKEN`. Configuration is passed directly to the actions. No repository placeholders, temporary action checkouts, configuration rendering or local package builders are needed. -1. Freeze the pending changelogs and manifest versions, commit and create `v1.2.3`. -2. Add the tag archive URL to the component's Joomla update feed. -3. OctoShoom adds and commits the SHA-512 hashes. -4. After it succeeds, OctoJPack reads `.octojpack` and builds/pushes the combined package. +## Release sequence -Both shared actions do their own work. There is no local packaging, hash calculation, checksum recheck or configuration rendering. `tools/release.php` only updates this component's release metadata. Existing tags are retained when rerunning an interrupted release; existing feed entries and hashes are preserved. +Tag reviewed releases of both plugins first. Then run **Release component with OctoJPack and OctoShoom** on `main`, entering the next unused version, such as `1.2.3` or `v1.2.3`. -`.octojpack` is also the standalone OctoJPack configuration. Its stable repository identities, raw GitHub feed/changelog URLs and raw licence URL belong in that file. Native latest-tag selection and `version_id` determine the package version. Workflow-only placeholders and generated configuration copies do not belong here. +1. Freeze component/changelog metadata, commit and create its version tag. +2. OctoJPack builds and publishes the three-extension package using the component version. +3. Update this repository's feed with the package version and tagged package URL, clearing the previous archive hash. +4. OctoShoom hashes the published package archive and commits the checksum here. -## Changelogs +The package must exist before its hash can be calculated. A failed packaging step stops feed publication and hashing. Neither shared tool's work is duplicated locally. Rerunning keeps existing tags and preserves a matching feed entry/hash. -Keep `CHANGELOG.md` and `changelog.xml` consistent. Record new changes under one literal `[[[NEXT_VERSION]]]` section in each file. The release replaces that marker with the entered version. Create the next pending section when subsequent changes begin; preserve released history. +## Changelogs and dependencies -Joomla XML uses `changelogs/changelog`, `element` = `com_joomengine_mcp`, `type` = `component`, and `security`, `fix`, `language`, `addition`, `change`, `remove` or `note` categories containing `item` children. Use matching Markdown headings. The manifest points to the raw GitHub changelog and update feed. +Keep `CHANGELOG.md` and `changelog.xml` consistent, with new changes under one literal `[[[NEXT_VERSION]]]` section in each file. The release replaces the marker with its version. Create another pending section when subsequent changes begin; preserve released history. The shared XML keeps component identity and Joomla selects the changelog by version. -## Dependencies and checks +Use Joomla categories `security`, `fix`, `language`, `addition`, `change`, `remove` and `note`, with `item` children and matching Markdown headings. -When dependencies change, maintainers run Composer and commit the lock and complete production runtime under `admin/vendor`, including licences. Do not edit vendor source by hand. CI checks source archives, relocated autoloading and the runtime; `php tests/release.php` checks version/changelog/feed edits without publishing. +Maintainers resolve changed dependencies with Composer and commit the lock and complete production runtime under `admin/vendor`. CI checks source installation, relocated dependencies, native metadata, and separately installed plugins. No downstream Composer run is required. diff --git a/joomengine_mcp_update_server.xml b/joomengine_mcp_update_server.xml index 3adf91c..0290a8b 100644 --- a/joomengine_mcp_update_server.xml +++ b/joomengine_mcp_update_server.xml @@ -1,3 +1,22 @@ - - + + + + JoomEngine MCP Package + JoomEngine MCP component, console plugin and webservices plugin. + pkg_joomengine_mcp + package + site + 0.1.1 + https://github.com/joomengine/mcp_package/tree/v0.1.1 + + https://github.com/joomengine/mcp_package/archive/refs/tags/v0.1.1.zip + + stable + Llewellyn van der Merwe + https://dev.vdm.io + + 8.3.0 + https://raw.githubusercontent.com/joomengine/mcp_component/main/changelog.xml + + diff --git a/plugins/webservices/joomengine_mcp/LICENSE b/plugins/webservices/joomengine_mcp/LICENSE deleted file mode 100644 index f288702..0000000 --- a/plugins/webservices/joomengine_mcp/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/plugins/webservices/joomengine_mcp/joomengine_mcp.xml b/plugins/webservices/joomengine_mcp/joomengine_mcp.xml deleted file mode 100644 index 339f701..0000000 --- a/plugins/webservices/joomengine_mcp/joomengine_mcp.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - PLG_WEBSERVICES_JOOMENGINE_MCP - Vast Development Method - September 2026 - Copyright (C) 2026 Vast Development Method. All rights reserved. - GNU General Public License version 3 or later; see LICENSE - joomla@vdm.io - https://dev.vdm.io - 0.1.1 - PLG_WEBSERVICES_JOOMENGINE_MCP_DESCRIPTION - VDM\Plugin\Webservices\JoomEngineMcp - - services - src - language - LICENSE - - - language/en-GB/plg_webservices_joomengine_mcp.ini - language/en-GB/plg_webservices_joomengine_mcp.sys.ini - - diff --git a/plugins/webservices/joomengine_mcp/language/en-GB/plg_webservices_joomengine_mcp.ini b/plugins/webservices/joomengine_mcp/language/en-GB/plg_webservices_joomengine_mcp.ini deleted file mode 100644 index 8ccb12f..0000000 --- a/plugins/webservices/joomengine_mcp/language/en-GB/plg_webservices_joomengine_mcp.ini +++ /dev/null @@ -1,2 +0,0 @@ -PLG_WEBSERVICES_JOOMENGINE_MCP="Web Services - JoomEngine MCP" -PLG_WEBSERVICES_JOOMENGINE_MCP_DESCRIPTION="Registers the authenticated Joomla MCP API endpoint. Installed and updated with the JoomEngine MCP component." diff --git a/plugins/webservices/joomengine_mcp/language/en-GB/plg_webservices_joomengine_mcp.sys.ini b/plugins/webservices/joomengine_mcp/language/en-GB/plg_webservices_joomengine_mcp.sys.ini deleted file mode 100644 index 8ccb12f..0000000 --- a/plugins/webservices/joomengine_mcp/language/en-GB/plg_webservices_joomengine_mcp.sys.ini +++ /dev/null @@ -1,2 +0,0 @@ -PLG_WEBSERVICES_JOOMENGINE_MCP="Web Services - JoomEngine MCP" -PLG_WEBSERVICES_JOOMENGINE_MCP_DESCRIPTION="Registers the authenticated Joomla MCP API endpoint. Installed and updated with the JoomEngine MCP component." diff --git a/plugins/webservices/joomengine_mcp/services/provider.php b/plugins/webservices/joomengine_mcp/services/provider.php deleted file mode 100644 index 5c1e552..0000000 --- a/plugins/webservices/joomengine_mcp/services/provider.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @copyright Copyright (C) 2026 Vast Development Method. All rights reserved. - * @license GNU General Public License version 3 or later; see LICENSE - */ -use Joomla\CMS\Extension\PluginInterface; -use Joomla\CMS\Factory; -use Joomla\CMS\Plugin\PluginHelper; -use Joomla\DI\Container; -use Joomla\DI\ServiceProviderInterface; -use Joomla\Event\DispatcherInterface; -use VDM\Plugin\Webservices\JoomEngineMcp\Extension\JoomEngineMcp; - -\defined('_JEXEC') or die; - -/** - * Native Joomla provider for routing glue only. - * - * @since 0.1.0 - */ -return new class implements ServiceProviderInterface -{ - /** @inheritDoc */ - public function register(Container $container): void - { - $container->set(PluginInterface::class, static function (Container $container): PluginInterface - { - $plugin = new JoomEngineMcp($container->get(DispatcherInterface::class), (array) PluginHelper::getPlugin('webservices', 'joomengine_mcp')); - $plugin->setApplication(Factory::getApplication()); - - return $plugin; - }); - } -}; diff --git a/plugins/webservices/joomengine_mcp/src/Extension/JoomEngineMcp.php b/plugins/webservices/joomengine_mcp/src/Extension/JoomEngineMcp.php deleted file mode 100644 index 01c2aad..0000000 --- a/plugins/webservices/joomengine_mcp/src/Extension/JoomEngineMcp.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @copyright Copyright (C) 2026 Vast Development Method. All rights reserved. - * @license GNU General Public License version 3 or later; see LICENSE - */ -namespace VDM\Plugin\Webservices\JoomEngineMcp\Extension; - - -use Joomla\CMS\Event\Application\AfterApiRouteEvent; -use Joomla\CMS\Event\Application\BeforeApiRouteEvent; -use Joomla\CMS\Plugin\CMSPlugin; -use Joomla\Event\SubscriberInterface; -use Joomla\Router\Route; - - -/** - * Minimal native webservices registration for the installed MCP component. - * - * All protocol requests are non-public Joomla API routes. The sole public route - * is a CORS OPTIONS preflight which returns no definitions, data or execution. - * - * @since 0.1.0 - */ -final class JoomEngineMcp extends CMSPlugin implements SubscriberInterface -{ - /** @inheritDoc */ - public static function getSubscribedEvents(): array - { - return ['onBeforeApiRoute' => 'onBeforeApiRoute', 'onAfterApiRoute' => 'onAfterApiRoute']; - } - - /** @param BeforeApiRouteEvent $event Joomla native routing event. @return void @since 0.1.0 */ - public function onBeforeApiRoute(BeforeApiRouteEvent $event): void - { - $defaults = ['component' => 'com_joomengine_mcp', 'public' => false, 'format' => ['application/json', 'text/event-stream']]; - $event->getRouter()->addRoutes([ - new Route(['POST', 'GET', 'DELETE', 'HEAD'], 'v1/joomengine-mcp', 'mcp.handle', [], $defaults), - new Route(['OPTIONS'], 'v1/joomengine-mcp', 'mcp.options', [], array_replace($defaults, ['public' => true])), - ]); - } - - /** - * Preserve Joomla's native API authentication error-to-status mapping. - * - * Negotiation still accepts the MCP media types. Before authentication Joomla - * needs its JSON:API error renderer to map AuthenticationFailed to HTTP 401; - * the generic JSON renderer instead turns that code-less exception into 500. - * Successful MCP requests emit their protocol response in the controller and - * do not use this native error document. Authentication itself is unchanged. - * - * @param AfterApiRouteEvent $event Native route event before authentication. - * @return void - * @since 0.1.0 - */ - public function onAfterApiRoute(AfterApiRouteEvent $event): void - { - $input = $event->getApplication()->getInput(); - - if ($input->getCmd('option') === 'com_joomengine_mcp' && $input->getCmd('controller') === 'mcp') - { - $input->set('format', 'jsonapi'); - } - } -} diff --git a/tests/golden-image/run.sh b/tests/golden-image/run.sh index 2fe18a7..2d43d13 100755 --- a/tests/golden-image/run.sh +++ b/tests/golden-image/run.sh @@ -3,7 +3,9 @@ set -euo pipefail root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$root" : "${MCP_PLUGIN_SOURCE:?Set the reviewed console plugin checkout}" +: "${MCP_WEBSERVICES_SOURCE:?Set the independent webservices plugin checkout}" MCP_PLUGIN_SOURCE="$(realpath -- "$MCP_PLUGIN_SOURCE")" +MCP_WEBSERVICES_SOURCE="$(realpath -- "$MCP_WEBSERVICES_SOURCE")" [[ -f "$MCP_PLUGIN_SOURCE/joomengine_mcp.xml" && -f "$MCP_PLUGIN_SOURCE/tests/installed.php" ]] out="$root/build/evidence/golden" mkdir -p "$out" @@ -56,6 +58,10 @@ actual="$(compose exec -T joomla sha256sum /var/www/html/libraries/vendor_jcb/VD [[ "$actual" == "$expected" ]] || { echo 'The native JCB install did not deploy the tested source.' >&2; exit 1; } printf '%s\n' "$actual" > "$out/installed-jcb-compiler.sha256" compose exec -T joomla php /var/www/html/cli/joomla.php extension:install --path=/tmp/mcp-component.zip --no-interaction --no-ansi > "$out/install-mcp.log" 2>&1 +git -C "$MCP_WEBSERVICES_SOURCE" archive --format=zip --prefix=webservices-source/ --output="$root/build/webservices-plugin-source.zip" HEAD +git -C "$MCP_WEBSERVICES_SOURCE" rev-parse HEAD > "$out/webservices-plugin-source.txt" +compose cp "$root/build/webservices-plugin-source.zip" joomla:/tmp/mcp-webservices-plugin.zip +compose exec -T joomla php /var/www/html/cli/joomla.php extension:install --path=/tmp/mcp-webservices-plugin.zip --no-interaction --no-ansi > "$out/install-webservices-plugin.log" 2>&1 git -C "$MCP_PLUGIN_SOURCE" archive --format=zip --prefix=plugin-source/ --output="$root/build/console-plugin-source.zip" HEAD git -C "$MCP_PLUGIN_SOURCE" rev-parse HEAD > "$out/console-plugin-source.txt" compose exec -T joomla mkdir -p /tmp/mcp-plugin/tests @@ -126,6 +132,7 @@ fixture /tmp/mcp-component/tests/golden-image/registry.php > "$out/jcb-command-r php -r '$v=json_decode(file_get_contents($argv[1]),true,512,JSON_THROW_ON_ERROR); $c=array_filter($v["commands"]??[],static fn($c)=>str_starts_with($c["name"],"componentbuilder:")); if(count($c)<2)throw new RuntimeException("The installed JCB command registry is empty."); echo "Verified ",count($c)," native JCB command definitions\n";' "$out/jcb-command-registry.json" > "$out/registry.log" fixture /tmp/mcp-component/tests/integration/lifecycle.php prepare > "$out/upgrade-prepare.log" 2>&1 compose exec -T joomla php /var/www/html/cli/joomla.php extension:install --path=/tmp/mcp-component.zip --no-interaction --no-ansi > "$out/upgrade-mcp.log" 2>&1 +compose exec -T joomla php /var/www/html/cli/joomla.php extension:install --path=/tmp/mcp-webservices-plugin.zip --no-interaction --no-ansi > "$out/upgrade-webservices-plugin.log" 2>&1 fixture /tmp/mcp-component/tests/integration/lifecycle.php verify > "$out/upgrade-verify.log" 2>&1 fixture /tmp/mcp-component/tests/integration/installation.php > "$out/upgraded-installation.log" 2>&1 fixture /tmp/mcp-component/tests/integration/lifecycle.php uninstall > "$out/uninstall.log" 2>&1 diff --git a/tests/integration/lifecycle.php b/tests/integration/lifecycle.php index e2e17df..f51978a 100644 --- a/tests/integration/lifecycle.php +++ b/tests/integration/lifecycle.php @@ -44,7 +44,7 @@ $provider = $store->one('provider', ['name' => 'joomla.core']); $editor = $factory->createModel('Provider', 'Administrator', ['ignore_request' => true]); $editor->setCurrentUser($admin); - $check($editor->save(['id' => (int) $provider['id'], 'version' => (int) $provider['version'], 'description' => 'Operator customization must survive package upgrade.']), 'Customize a shipped definition through native administration'); + $check($editor->save(['id' => (int) $provider['id'], 'version' => (int) $provider['version'], 'description' => 'Operator customization must survive component upgrade.']), 'Customize a shipped definition through native administration'); $external = $provider; unset($external['id']); $external['name'] = 'fixture.external.provider'; @@ -62,8 +62,9 @@ $component->params = (string) $params; $check($component->store(), 'Store operator-owned component configuration'); $plugin = new Extension($db); - $check($plugin->load(['type' => 'plugin', 'folder' => 'webservices', 'element' => 'joomengine_mcp']), 'Owned routing plugin exists'); + $check($plugin->load(['type' => 'plugin', 'folder' => 'webservices', 'element' => 'joomengine_mcp']), 'Independently installed routing plugin exists'); $enabled = (int) $plugin->enabled; + $check($enabled === 1, 'The standalone routing plugin enables itself on first installation'); $plugin->enabled = 0; $check($plugin->store(), 'Operator disables the routing plugin before upgrade'); $asset = new Asset($db); @@ -83,8 +84,8 @@ { $expected = json_decode(file_get_contents($file), true, 64, JSON_THROW_ON_ERROR); $provider = $store->one('provider', ['id' => (int) $expected['provider']['id']]); - $check($provider['description'] === 'Operator customization must survive package upgrade.' && (int) $provider['customized'] === 1, 'Real package upgrade preserves modified shipped rows'); - $check((int) $store->one('provider', ['id' => (int) $expected['externalId']])['published'] === 1, 'Real package upgrade does not retire another extension provider'); + $check($provider['description'] === 'Operator customization must survive component upgrade.' && (int) $provider['customized'] === 1, 'Real component upgrade preserves modified shipped rows'); + $check((int) $store->one('provider', ['id' => (int) $expected['externalId']])['published'] === 1, 'Real component upgrade does not retire another extension provider'); $component = new Extension($db); $component->load(['type' => 'component', 'element' => 'com_joomengine_mcp']); $check((int) (new Registry($component->params))->get('timeout') === 31, 'Real upgrade preserves component options'); @@ -115,6 +116,8 @@ $check($component->load(['type' => 'component', 'element' => 'com_joomengine_mcp']), 'Resolve exact installed component for removal'); $console = new Extension($db); $hasConsole = $console->load(['type' => 'plugin', 'folder' => 'console', 'element' => 'joomengine_mcp']); + $routing = new Extension($db); + $check($routing->load(['type' => 'plugin', 'folder' => 'webservices', 'element' => 'joomengine_mcp']), 'Resolve the independent routing plugin before component removal'); $coreArticles = (int) $db->setQuery('SELECT COUNT(*) FROM ' . $db->quoteName('#__content'))->loadResult(); $ownedEntities = array_merge(array_keys(Structure::definitions()), array_keys(Structure::state())); $ownedTables = []; @@ -131,9 +134,13 @@ $check(!in_array($table, $tables, true), 'Uninstall removes owned ' . $entity . ' table'); } $check(!(bool) $db->setQuery('SELECT id FROM ' . $db->quoteName('#__assets') . ' WHERE name LIKE ' . $db->quote('com_joomengine_mcp%'))->loadResult(), 'Uninstall removes native component and row assets'); - $check(!(bool) $db->setQuery('SELECT extension_id FROM ' . $db->quoteName('#__extensions') . ' WHERE element = ' . $db->quote('joomengine_mcp') . ' AND folder = ' . $db->quote('webservices'))->loadResult(), 'Uninstall removes only the owned routing extension'); + $check($routing->load((int) $routing->extension_id) && is_dir(JPATH_PLUGINS . '/webservices/joomengine_mcp'), 'Component removal preserves the independently installed routing plugin'); $check(!is_dir(JPATH_ADMINISTRATOR . '/components/com_joomengine_mcp') && !is_dir(JPATH_API . '/components/com_joomengine_mcp'), 'Uninstall removes administrator and API runtime'); $check((int) $db->setQuery('SELECT COUNT(*) FROM ' . $db->quoteName('#__content'))->loadResult() === $coreArticles, 'Removing MCP does not delete Joomla content'); + $installer = new Installer(); + $installer->setDatabase($db); + $check($installer->uninstall('plugin', (int) $routing->extension_id), 'The independent routing plugin can be uninstalled separately'); + $check(!is_dir(JPATH_PLUGINS . '/webservices/joomengine_mcp'), 'Routing plugin uninstall removes its own runtime directory'); if ($hasConsole) { diff --git a/tests/integration/run.sh b/tests/integration/run.sh index fece1b9..b93db48 100644 --- a/tests/integration/run.sh +++ b/tests/integration/run.sh @@ -7,6 +7,7 @@ root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)" : "${MCP_TEST_DB_HOST:?Set the test database host and port}" : "${MCP_TEST_DB_USER:?Set the isolated test database user}" : "${MCP_TEST_DB_NAME:?Set the disposable database name}" +: "${MCP_WEBSERVICES_SOURCE:?Set the independent webservices plugin checkout}" [[ "$MCP_TEST_ALLOW_DESTRUCTIVE" == 1 ]] [[ "$MCP_TEST_DB_TYPE" == mysqli || "$MCP_TEST_DB_TYPE" == pgsql ]] export JOOMLA_ROOT="$(realpath -m -- "$JOOMLA_ROOT")" @@ -51,6 +52,10 @@ git -C "$root" archive --format=zip --prefix=component-source/ --output="$root/b php "$root/tests/package.php" "$root/build/component-source.zip" php "$JOOMLA_ROOT/cli/joomla.php" extension:install --path="$root/build/component-source.zip" --no-interaction --no-ansi \ | tee "$root/build/evidence/install-component.log" +MCP_WEBSERVICES_SOURCE="$(realpath -- "$MCP_WEBSERVICES_SOURCE")" +git -C "$MCP_WEBSERVICES_SOURCE" archive --format=zip --prefix=webservices-source/ --output="$root/build/webservices-plugin-source.zip" HEAD +php "$JOOMLA_ROOT/cli/joomla.php" extension:install --path="$root/build/webservices-plugin-source.zip" --no-interaction --no-ansi \ + | tee "$root/build/evidence/install-webservices-plugin.log" if [[ -n "${MCP_PLUGIN_SOURCE:-}" ]]; then export MCP_PLUGIN_SOURCE="$(realpath -- "$MCP_PLUGIN_SOURCE")" export MCP_COMPONENT_SOURCE="$root" @@ -94,9 +99,11 @@ if [[ -n "${MCP_CLIENT_SOURCE:-}" ]]; then fi export MCP_TEST_LIFECYCLE_FILE="$work/lifecycle.json" php "$root/tests/integration/lifecycle.php" prepare | tee "$root/build/evidence/live-upgrade-prepare.log" -# Upgrading the same package must retain definitions and operator configuration. +# Upgrading each extension must retain definitions and operator configuration. php "$JOOMLA_ROOT/cli/joomla.php" extension:install --path="$root/build/component-source.zip" --no-interaction --no-ansi \ | tee "$root/build/evidence/upgrade-component.log" +php "$JOOMLA_ROOT/cli/joomla.php" extension:install --path="$root/build/webservices-plugin-source.zip" --no-interaction --no-ansi \ + | tee "$root/build/evidence/upgrade-webservices-plugin.log" php "$root/tests/integration/lifecycle.php" verify | tee "$root/build/evidence/live-upgrade.log" php "$root/tests/integration/installation.php" | tee "$root/build/evidence/live-upgrade-seed.log" php "$root/tests/integration/lifecycle.php" uninstall | tee "$root/build/evidence/live-uninstall.log" diff --git a/tests/package.php b/tests/package.php index ee7aae6..c127dfd 100644 --- a/tests/package.php +++ b/tests/package.php @@ -105,11 +105,11 @@ } } - foreach (['admin/autoload.php', 'admin/vendor/autoload.php', 'admin/data/catalogue-seed.json', 'admin/LICENSE', - 'plugins/webservices/joomengine_mcp/joomengine_mcp.xml'] as $file) + foreach (['admin/autoload.php', 'admin/vendor/autoload.php', 'admin/data/catalogue-seed.json', 'admin/LICENSE'] as $file) { $check(is_file($source . '/' . $file), 'Required runtime source is missing: ' . $file); } + $check(!is_dir($source . '/plugins'), 'Plugins belong in their own repositories, not the component source ZIP.'); $check(file_get_contents($source . '/LICENSE') === file_get_contents($source . '/admin/LICENSE'), 'The installed license differs from the repository license.'); $seed = json_decode(file_get_contents($source . '/admin/data/catalogue-seed.json'), true, 512, JSON_THROW_ON_ERROR); diff --git a/tests/release.php b/tests/release.php index 90e62a0..7a98842 100644 --- a/tests/release.php +++ b/tests/release.php @@ -9,7 +9,7 @@ /** Exercise component release metadata without publishing or building packages. */ require dirname(__DIR__) . '/tools/release.php'; $root = sys_get_temp_dir() . '/mcp-release-' . bin2hex(random_bytes(8)); -mkdir($root . '/plugins/webservices/joomengine_mcp', 0700, true); +mkdir($root, 0700); $checks = 0; $check = static function (bool $condition, string $message) use (&$checks): void { @@ -27,12 +27,10 @@ . '[[[NEXT_VERSION]]]Preserve existing releases.'; $metadata = [ 'joomengine_mcp.xml' => '1.0.0January 2026', - 'plugins/webservices/joomengine_mcp/joomengine_mcp.xml' => '' - . '1.0.0January 2026', '.octojpack' => '{"package":{"version_id":"com_joomengine_mcp"}}', 'changelog.xml' => '' . $pending . '', 'CHANGELOG.md' => "# Changelog\n\n## [[[NEXT_VERSION]]]\n\n### Fix\n\n- Preserve updates.\n", - 'joomengine_mcp_update_server.xml' => '', + 'joomengine_mcp_update_server.xml' => file_get_contents(dirname(__DIR__) . '/joomengine_mcp_update_server.xml'), ]; foreach ($metadata as $path => $contents) @@ -63,8 +61,7 @@ mcpRelease(['prepare', 'v1.1.0'], $root); $manifest = mcpReleaseXml($root . '/joomengine_mcp.xml'); - $routing = mcpReleaseXml($root . '/plugins/webservices/joomengine_mcp/joomengine_mcp.xml'); - $check((string) $manifest->version === '1.1.0' && (string) $routing->version === '1.1.0', 'Component and routing versions agree.'); + $check((string) $manifest->version === '1.1.0', 'Component receives the selected version.'); $check((string) $manifest->creationDate === gmdate('F Y'), 'Release refreshes the manifest date.'); $check((string) mcpReleaseXml($root . '/changelog.xml')->changelog->version === '1.1.0' && str_contains(file_get_contents($root . '/CHANGELOG.md'), '## 1.1.0'), 'Both changelogs freeze the pending version.'); @@ -73,9 +70,9 @@ 'Preparing a tag does not advertise its download before the tag exists.'); mcpRelease(['feed', '1.1.0'], $root); $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml'); - $check((string) $feed->update->downloads->downloadurl === 'https://github.com/joomengine/mcp_component/archive/refs/tags/v1.1.0.zip', - 'Update uses the immutable tag ZIP.'); - $check((string) $feed->update->client === '1' && (string) $feed->update->php_minimum === '8.3.0' + $check((string) $feed->update->downloads->downloadurl === 'https://github.com/joomengine/mcp_package/archive/refs/tags/v1.1.0.zip', + 'Update uses the immutable package tag ZIP.'); + $check((string) $feed->update->client === 'site' && (string) $feed->update->element === 'pkg_joomengine_mcp' && (string) $feed->update->type === 'package' && (string) $feed->update->php_minimum === '8.3.0' && (string) $feed->update->targetplatform['version'] === '6\\.[1-9][0-9]*', 'Update carries supported Joomla/PHP versions.'); $check(!isset($feed->update->sha512), 'OctoShoom supplies the checksum.'); $feed->update->addChild('sha512', str_repeat('a', 128)); @@ -90,8 +87,9 @@ mcpRelease(['prepare', '1.2.0'], $root); mcpRelease(['feed', '1.2.0'], $root); $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml'); - $check(count($feed->update) === 2 && (string) $feed->update[0]->sha512 === str_repeat('a', 128), - 'Next release retains the previous update and checksum.'); + $check(count($feed->update) === 1 && (string) $feed->update->version === '1.2.0' && !isset($feed->update->sha512), + 'Next package release replaces the current feed entry and clears the previous archive checksum.'); + $check((string) $feed->update->downloads->downloadurl === 'https://github.com/joomengine/mcp_package/archive/refs/tags/v1.2.0.zip', 'The next download stays in the package repository.'); $check((string) mcpReleaseXml($root . '/changelog.xml')->changelog[1]->version === '1.1.0', 'Next release retains the previous changelog.'); echo json_encode(['checks' => $checks, 'metadataTransitions' => 'passed'], JSON_THROW_ON_ERROR) . "\n"; diff --git a/tools/release.php b/tools/release.php index f0e1a48..397b0ea 100644 --- a/tools/release.php +++ b/tools/release.php @@ -19,7 +19,7 @@ function mcpReleaseXml(string $path): SimpleXMLElement return $xml; } -/** Freeze the pending version or add its tag archive to the component update feed. */ +/** Freeze the pending version or add its tag archive to the package update feed. */ function mcpRelease(array $arguments, string $root): void { [$command, $version] = array_pad($arguments, 2, ''); @@ -47,56 +47,33 @@ function mcpRelease(array $arguments, string $root): void throw new RuntimeException('Choose an unreleased version at least as new as the manifest, with one pending section in both changelogs.'); } - $routingPath = 'plugins/webservices/joomengine_mcp/joomengine_mcp.xml'; - $routing = mcpReleaseXml($root . '/' . $routingPath); - $manifest->version = $routing->version = $version; - $manifest->creationDate = $routing->creationDate = gmdate('F Y'); + $manifest->version = $version; + $manifest->creationDate = gmdate('F Y'); $writes['joomengine_mcp.xml'] = $manifest->asXML(); - $writes[$routingPath] = $routing->asXML(); $writes['changelog.xml'] = str_replace('[[[NEXT_VERSION]]]', $version, file_get_contents($root . '/changelog.xml')); $writes['CHANGELOG.md'] = str_replace('[[[NEXT_VERSION]]]', $version, $markdown); } else { $feed = mcpReleaseXml($root . '/joomengine_mcp_update_server.xml'); - $existing = $feed->xpath('update[version="' . $version . '"]'); - $archive = 'https://github.com/joomengine/mcp_component/archive/refs/tags/v' . $version . '.zip'; + $entry = $feed->update; + $archive = 'https://github.com/joomengine/mcp_package/archive/refs/tags/v' . $version . '.zip'; - if (count($existing) > 1 || version_compare($version, (string) $manifest->version, '>')) + if (count($feed->update) !== 1 || (string) $entry->element !== 'pkg_joomengine_mcp' + || (string) $entry->type !== 'package' || version_compare($version, (string) $manifest->version, '>')) { - throw new RuntimeException('Duplicate update versions or update newer than the prepared manifest.'); + throw new RuntimeException('Expected the current package update entry and a prepared component version.'); } - if ($existing) + if ((string) $entry->version === $version && (string) $entry->downloads->downloadurl === $archive) { - if ((string) $existing[0]->element !== 'com_joomengine_mcp' - || (string) $existing[0]->type !== 'component' - || (string) $existing[0]->downloads->downloadurl !== $archive) - { - throw new RuntimeException('Existing update identity or tag URL differs; refusing to overwrite it.'); - } - return; } - $entry = $feed->addChild('update'); - - foreach (['name' => 'JoomEngine MCP', 'description' => 'JoomEngine MCP component.', - 'element' => 'com_joomengine_mcp', 'type' => 'component', 'version' => $version, 'client' => '1'] as $name => $value) - { - $entry->addChild($name, $value); - } - - $download = $entry->addChild('downloads')->addChild('downloadurl', $archive); - $download->addAttribute('type', 'full'); - $download->addAttribute('format', 'zip'); - $entry->addChild('tags')->addChild('tag', 'stable'); - $platform = $entry->addChild('targetplatform'); - $platform->addAttribute('name', 'joomla'); - $platform->addAttribute('version', '6\\.[1-9][0-9]*'); - $entry->addChild('php_minimum', '8.3.0'); - $entry->addChild('detailsurl', 'https://github.com/joomengine/mcp_component/tree/v' . $version); - $entry->addChild('changelogurl', 'https://raw.githubusercontent.com/joomengine/mcp_component/main/changelog.xml'); + $entry->version = $version; + $entry->downloads->downloadurl = $archive; + $entry->infourl = 'https://github.com/joomengine/mcp_package/tree/v' . $version; + unset($entry->md5, $entry->sha256, $entry->sha384, $entry->sha512); $writes['joomengine_mcp_update_server.xml'] = $feed->asXML(); }