Reference metadata-provider plugin for Phlix: one final PHP class exercising the plugin lifecycle contract. PHP >=8.3, PHPUnit ^10, depends on detain/phlix-shared ^0.6 (VCS repo in composer.json).
composer install # install deps incl. detain/phlix-shared
vendor/bin/phpunit # run the suite defined by phpunit.xml
vendor/bin/phpunit --filter test_subscribed_events_is_emptycomposer phpstan # vendor/bin/phpstan analyse src --level=9 (phpstan.neon)
composer phpcs # vendor/bin/phpcs src --standard=PSR12 (phpcs.xml)- Entry:
src/HelloMetadataProvider.php— implementsPhlix\Shared\Plugin\LifecycleInterface;lookup()returns['title' => $greeting]forFIXTURE_PATH, else[]. - Manifest:
plugin.json—entry,settings.greeting(default"Hello, World"),events: []. - Package:
composer.json— PSR-4Phlix\PluginExample\→src/, tests →tests/. - Tests:
tests/HelloMetadataProviderTest.php(8 tests:lookup(),subscribedEvents(), and theonEnable()/onDisable()no-ops), bootstraptests/bootstrap.php; configphpunit.xml. - Stub:
dev-stubs/LifecycleInterface.php— fallback only whendetain/phlix-sharedis absent. - Lint config:
phpstan.neon(level 9 oversrc),phpcs.xml(PSR-12 declared as<rule ref="PSR12"/>— PHPCS 4.x usesref, notname). - CI:
.github/workflows/test.ymlruns install + phpunit + PHPStan + PHPCS on push tomaster/mainand on PRs, and uploads the phpunit cobertura coverage report to Codacy from the8.3matrix leg only.
declare(strict_types=1);everywhere;finalclasses; constructor injection (__construct(string $greeting)).- Namespace
Phlix\PluginExample\; lifecycleonEnable(ContainerInterface)/onDisable()/subscribedEvents(): array— keeponEnable()cheap. - Use
HelloMetadataProvider::FIXTURE_PATHin tests; assert withassertSame(); mock the container withcreateMock(ContainerInterface::class)foronEnable(). - Plugin
namemust start withphlix-plugin-.
dev-stubs/LifecycleInterface.php+tests/bootstrap.php+README.mdreference the legacyPhlix\Plugins\Contract\LifecycleInterface; the live class usesPhlix\Shared\Plugin\LifecycleInterface. Keep the stub aligned when editing the contract.
- Branch off
main; one concern per PR. Remote:https://github.com/detain/phlix-plugin-example.git.
IMPORTANT: Before every git commit, you MUST ensure Caliber syncs agent configs with the latest code changes.
First, check if the pre-commit hook is already installed:
grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "hook-active" || echo "no-hook"- If hook-active: the hook handles sync automatically — just commit normally. Tell the user: "Caliber will sync your agent configs automatically via the pre-commit hook."
- If no-hook: run Caliber manually before committing:
- Tell the user: "Caliber: Syncing agent configs with your latest changes..."
- Run:
caliber refresh && git add CLAUDE.md .claude/ AGENTS.md .agents/ 2>/dev/null - After it completes, briefly tell the user what Caliber updated. Then proceed with the commit.
Valid caliber refresh options: --quiet (suppress output) and --dry-run (preview without writing). Do not pass any other flags — options like --auto-approve, --debug, or --force do not exist and will cause errors.
caliber config takes no flags — it runs an interactive provider setup. Do not pass --provider, --api-key, or --endpoint.
If caliber is not found, read .agents/skills/setup-caliber/SKILL.md and follow its instructions to install Caliber.
Read project learnings for patterns and anti-patterns learned from previous sessions. These are auto-extracted from real tool usage — treat them as project-specific rules.
Recommended default: claude-sonnet-4-6 with high effort (stronger reasoning; higher cost and latency than smaller models).
Smaller/faster models trade quality for speed and cost — pick what fits the task.
Pin your choice (/model in Claude Code, or CALIBER_MODEL when using Caliber with an API provider) so upstream default changes do not silently change behavior.
This project uses Caliber to keep AI agent configs in sync across Claude Code, Cursor, Copilot, and Codex.
Configs update automatically before each commit via caliber refresh.
If the pre-commit hook is not set up, read .agents/skills/setup-caliber/SKILL.md and follow the setup instructions.