Skip to content

Discover contrib plugins via Composer metadata; custom from .polymer/plugins (PWT-115)#77

Merged
lpeabody merged 3 commits into
0.xfrom
feature/PWT-115-remappable-install-paths
Jun 2, 2026
Merged

Discover contrib plugins via Composer metadata; custom from .polymer/plugins (PWT-115)#77
lpeabody merged 3 commits into
0.xfrom
feature/PWT-115-remappable-install-paths

Conversation

@lpeabody

@lpeabody lpeabody commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes plugin discovery independent of where plugins are installed, so contrib plugins can live in the normal vendor/ location and project-local custom plugins live under .polymer/plugins — no per-project installer-path configuration required.

Refs PWT-115.

What changed

ExtensionDiscovery::findExtensions() now merges two sources:

  • Contrib plugins — located via Composer\InstalledVersions::getInstalledPackagesByType('polymer-plugin') + getInstallPath(), then reading each package's *.poly_info.yml. They're discovered wherever Composer installs them (vendor/ by default), so no installer-paths/extender machinery is needed.
  • Custom plugins — the existing fixed-depth glob scan of <repo>/.polymer/plugins for project-local, committed plugins.

Local (custom) entries take precedence by extension id. Guarded when the Composer runtime API (getInstalledPackagesByType) is unavailable.

Context

PWT-115 originally aimed at remappable installer paths. While implementing, two heavier approaches were explored and rejected after verification:

  • Auto-injecting installer-paths from the Composer plugin's activate()doesn't work (composer/installers-extender reads installer-types at its own activation; plugin ordering means the injection is too late and the package falls back to vendor/).
  • A configurable extension_paths discovery key — dropped, since managing install locations turned out not to be desired.

The accepted design above is simpler and removes the need to manage install locations at all.

Testing

  • PHPUnit: 14/14; PHPStan (level 6) and phpcs clean.
  • End-to-end in the consuming project: with the polymer installer-paths removed from the project composer.json, composer install places contrib plugins in vendor/digitalpolygon/*, and polymer plugin:list discovers them from there; all extension commands register; plugin:enable/disable gating still works (0 ↔ 7 commands).

🤖 Generated with Claude Code

…plugins

findExtensions() now merges two sources so plugins are found regardless of where
they are installed:

- Contrib plugins: located via Composer\InstalledVersions::getInstalledPackagesByType(
  "polymer-plugin") + getInstallPath(), so they are discovered from the normal
  vendor/ install location with no installer-path configuration or extender.
- Custom plugins: the existing fixed-depth glob scan of <repo>/.polymer/plugins,
  for project-local, committed plugins.

Local (custom) entries take precedence by extension id. Guards when
InstalledVersions / getInstalledPackagesByType is unavailable.

Refs PWT-115.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors extension discovery in ExtensionDiscovery.php by separating the logic into two methods: findComposerInstalledExtensions(), which leverages Composer's InstalledVersions metadata to locate plugins, and findLocalExtensions(), which scans local directories. Feedback suggests using the union operator (+) instead of array_merge to prevent key reindexing and enforce precedence, checking for the existence of getInstallPath to ensure compatibility with older Composer versions, and using basename() with a suffix parameter to safely extract extension names.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/Robo/Discovery/ExtensionDiscovery.php Outdated
Comment thread src/Robo/Discovery/ExtensionDiscovery.php
Comment thread src/Robo/Discovery/ExtensionDiscovery.php Outdated
Comment thread src/Robo/Discovery/ExtensionDiscovery.php Outdated
lpeabody and others added 2 commits June 2, 2026 08:43
With contrib plugins discovered by type from their normal vendor install
location, Polymer no longer places packages at custom install paths, so the
installer machinery is unnecessary. Remove oomphinc/composer-installers-extender
(archived upstream) and mnsami/composer-custom-directory-installer from require
and allow-plugins.

Refs PWT-115.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Combine discovery sources with the union operator instead of array_merge, so
  local entries take precedence and numeric-looking extension ids are not reindexed.
- Also guard for InstalledVersions::getInstallPath() (added in Composer 2.1).
- Strip the .poly_info.yml suffix with basename($file, ...) rather than str_replace.

Refs PWT-115.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lpeabody
lpeabody merged commit 5164148 into 0.x Jun 2, 2026
6 checks passed
@lpeabody
lpeabody deleted the feature/PWT-115-remappable-install-paths branch June 2, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant