WordPress / WordPress/php-ai-client
cli.php: missing provider registration and .env loading causes "Provider not registered" error
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 308
- Forks
- 84
- Avg merge
- 7d 21h
- Merged PRs (30d)
- 2
Description
Description:
Bug Report
Summary
On running cli.php with any provider (e.g. --providerId=google) always fails with:
[ERROR] Invalid arguments while trying to set up prompt builder: Provider not registered: google
Cause
This happens even when the correct API key is set in .env and the provider packages (wordpress/google-ai-provider, wordpress/openai-ai-provider, wordpress/anthropic-ai-provider) are installed as dev dependencies.
cli.php is missing two bootstrapping steps that the integration test suite handles in tests/integration/bootstrap.php:
- Loading
.envAPI keys in.envare never read into the environment, sogetenv()calls inside providers return nothing. - Registering providers — Provider classes (e.g.
GoogleProvider) are never registered with theProviderRegistry, so the registry has no providers to resolve by ID.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare cli.php with tests/integration/bootstrap.php, starting with the two bootstrapping steps identified in the issue: loading .env values and registering provider classes with ProviderRegistry. Run cli.php with a provider such as google and verify that the provider resolves and API-key loading no longer fails.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100